Skip to content

Commit

Permalink
Revert "Rename to ScheduleClient"
Browse files Browse the repository at this point in the history
This reverts commit aa1a1f6.
  • Loading branch information
razor-x committed Jun 9, 2024
1 parent aa1a1f6 commit 97576ac
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

### Added

- `ScheduleClient`.
- `SchedulerClient`.

## 1.7.1 / 2022-10-09

Expand Down
10 changes: 5 additions & 5 deletions examples/schedule.js
Original file line number Diff line number Diff line change
@@ -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, {
Expand All @@ -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 })
Expand All @@ -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, {
Expand All @@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion lib/clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
14 changes: 7 additions & 7 deletions lib/clients/schedule.doc.js → lib/clients/scheduler.doc.js
Original file line number Diff line number Diff line change
@@ -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=<uuid>] Request id.
* @param {Object} [parameters.log=<logger>] Pino compatible logger.
* @param {Constructor} [parameters.AwsSdkSchedulerClient=SchedulerClient]
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions lib/clients/schedule.js → lib/clients/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { keysToCamelCase, keysToPascalCase } from '../case.js'

const createClient = createCache()

export class ScheduleClient {
export class SchedulerClient {
#client
#reqId
#log
Expand All @@ -39,7 +39,7 @@ export class ScheduleClient {
this.#log = log.child({
params,
client: name,
class: ScheduleClient.name,
class: SchedulerClient.name,
reqId
})
}
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 97576ac

Please sign in to comment.