From 97576ac1ee97159e14606ab6445633e2406b951b Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Sun, 9 Jun 2024 18:18:57 -0500 Subject: [PATCH] Revert "Rename to ScheduleClient" This reverts commit aa1a1f698c503925a57ac58e881b19922ecb80b3. --- CHANGELOG.md | 2 +- examples/schedule.js | 10 +++++----- lib/clients/index.js | 2 +- lib/clients/{schedule.doc.js => scheduler.doc.js} | 14 +++++++------- lib/clients/{schedule.js => scheduler.js} | 12 ++++++------ .../{schedule.spec.js => scheduler.spec.js} | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) rename lib/clients/{schedule.doc.js => scheduler.doc.js} (88%) rename lib/clients/{schedule.js => scheduler.js} (92%) rename lib/clients/{schedule.spec.js => scheduler.spec.js} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e01f14..652ef22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ### Added -- `ScheduleClient`. +- `SchedulerClient`. ## 1.7.1 / 2022-10-09 diff --git a/examples/schedule.js b/examples/schedule.js index e3a1c62..a9d7293 100644 --- a/examples/schedule.js +++ b/examples/schedule.js @@ -1,9 +1,9 @@ -import { ScheduleClient } from '../index.js' +import { SchedulerClient } from '../index.js' export const createSchedule = ({ log }) => async (scheduleName, groupName, arn, roleArn) => { - const client = new ScheduleClient({ + const client = new SchedulerClient({ log }) return client.createSchedule(scheduleName, { @@ -25,7 +25,7 @@ export const createSchedule = export const deleteSchedule = ({ log }) => async (scheduleName, groupName) => { - const client = new ScheduleClient({ + const client = new SchedulerClient({ log }) return client.deleteSchedule(scheduleName, { groupName }) @@ -34,7 +34,7 @@ export const deleteSchedule = export const updateSchedule = ({ log }) => async (scheduleName, groupName, arn, roleArn) => { - const client = new ScheduleClient({ + const client = new SchedulerClient({ log }) return client.updateSchedule(scheduleName, { @@ -56,7 +56,7 @@ export const updateSchedule = export const getSchedule = ({ log }) => async (scheduleName, groupName) => { - const client = new ScheduleClient({ + const client = new SchedulerClient({ log }) return client.getSchedule(scheduleName, { groupName }) diff --git a/lib/clients/index.js b/lib/clients/index.js index c6c6a8d..1274a32 100644 --- a/lib/clients/index.js +++ b/lib/clients/index.js @@ -2,5 +2,5 @@ export * from './dynamodb-document.js' export * from './eventbridge.js' export * from './lambda.js' export * from './s3.js' -export * from './schedule.js' +export * from './scheduler.js' export * from './sqs.js' diff --git a/lib/clients/schedule.doc.js b/lib/clients/scheduler.doc.js similarity index 88% rename from lib/clients/schedule.doc.js rename to lib/clients/scheduler.doc.js index 9610453..c2cc820 100644 --- a/lib/clients/schedule.doc.js +++ b/lib/clients/scheduler.doc.js @@ -1,9 +1,9 @@ /** - * AWS ScheduleClient client. - * @class ScheduleClient + * AWS SchedulerClient client. + * @class SchedulerClient * @see {@link https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-eventbridge/index.html|@aws-sdk/client-scheduler} * @param {Object} parameters - * @param {string} [parameters.name=schedule] Client name. + * @param {string} [parameters.name=scheduler] Client name. * @param {string} [parameters.reqId=] Request id. * @param {Object} [parameters.log=] Pino compatible logger. * @param {Constructor} [parameters.AwsSdkSchedulerClient=SchedulerClient] @@ -16,7 +16,7 @@ * Get a schedule. * @async * @function getSchedule - * @memberof ScheduleClient + * @memberof SchedulerClient * @instance * @param {Object[]} [name] Name of the schedule to get. * @param {Object} [params=[]] Additional params to pass to the GetScheduleCommand. @@ -27,7 +27,7 @@ * Create a schedule. * @async * @function createSchedule - * @memberof ScheduleClient + * @memberof SchedulerClient * @instance * @param {Object[]} [name] Name of the schedule to create. * @param {Object} [params=[]] Additional params to pass to the CreateScheduleCommand. @@ -38,7 +38,7 @@ * Delete a schedule. * @async * @function deleteSchedule - * @memberof ScheduleClient + * @memberof SchedulerClient * @instance * @param {Object[]} [name] Name of the schedule to delete. * @param {Object} [params=[]] Additional params to pass to the DeleteScheduleCommand. @@ -51,7 +51,7 @@ * AWS schedules * @async * @function deleteSchedule - * @memberof ScheduleClient + * @memberof SchedulerClient * @instance * @param {Object[]} [name] Name of the schedule to update. * @param {Object} [params=[]] Additional params to pass to the UpdateScheduleCommand. diff --git a/lib/clients/schedule.js b/lib/clients/scheduler.js similarity index 92% rename from lib/clients/schedule.js rename to lib/clients/scheduler.js index 8003b89..9ede284 100644 --- a/lib/clients/schedule.js +++ b/lib/clients/scheduler.js @@ -22,7 +22,7 @@ import { keysToCamelCase, keysToPascalCase } from '../case.js' const createClient = createCache() -export class ScheduleClient { +export class SchedulerClient { #client #reqId #log @@ -39,7 +39,7 @@ export class ScheduleClient { this.#log = log.child({ params, client: name, - class: ScheduleClient.name, + class: SchedulerClient.name, reqId }) } @@ -48,7 +48,7 @@ export class ScheduleClient { const log = this.#log.child({ scheduleName, meta: params, - method: ScheduleClient.prototype.getSchedule.name + method: SchedulerClient.prototype.getSchedule.name }) try { log.info('start') @@ -72,7 +72,7 @@ export class ScheduleClient { const log = this.#log.child({ scheduleName, meta: params, - method: ScheduleClient.prototype.createSchedule.name + method: SchedulerClient.prototype.createSchedule.name }) try { log.info('start') @@ -96,7 +96,7 @@ export class ScheduleClient { const log = this.#log.child({ scheduleName, meta: params, - method: ScheduleClient.prototype.deleteSchedule.name + method: SchedulerClient.prototype.deleteSchedule.name }) try { log.info('start') @@ -120,7 +120,7 @@ export class ScheduleClient { const log = this.#log.child({ scheduleName, meta: params, - method: ScheduleClient.prototype.updateSchedule.name + method: SchedulerClient.prototype.updateSchedule.name }) try { log.info('start') diff --git a/lib/clients/schedule.spec.js b/lib/clients/scheduler.spec.js similarity index 97% rename from lib/clients/schedule.spec.js rename to lib/clients/scheduler.spec.js index cb7eee8..95c838b 100644 --- a/lib/clients/schedule.spec.js +++ b/lib/clients/scheduler.spec.js @@ -11,7 +11,7 @@ import { import { registerTestdoubleMatchers } from '../../testdouble-matchers.js' -import { ScheduleClient } from './schedule.js' +import { SchedulerClient } from './scheduler.js' test.before(() => { registerTestdoubleMatchers(td) @@ -21,7 +21,7 @@ test.beforeEach((t) => { t.context.AwsSchedulerClient = td.constructor(['send']) t.context.createClient = (t, options) => { - const client = new ScheduleClient({ + const client = new SchedulerClient({ name: uuidv4(), AwsSchedulerClient: t.context.AwsSchedulerClient, reqId, @@ -33,10 +33,10 @@ test.beforeEach((t) => { } }) -test('constructor: passes params to AWS ScheduleClient', (t) => { +test('constructor: passes params to AWS SchedulerClient', (t) => { const { AwsSchedulerClient } = t.context const params = { foo: 'bar' } - const client = new ScheduleClient({ + const client = new SchedulerClient({ name: uuidv4(), AwsSchedulerClient, params,