@aligent/aws-wrappers 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
5
  "main": "./cjs/index.cjs",
6
6
  "module": "./index.esm.js",
@@ -33,6 +33,7 @@
33
33
  "@aws-lambda-powertools/logger": "^2.33.1",
34
34
  "@aws-sdk/client-dynamodb": "^3.1068.0",
35
35
  "@aws-sdk/client-s3": "^3.1068.0",
36
+ "@aws-sdk/client-scheduler": "^3.1077.0",
36
37
  "@aws-sdk/client-secrets-manager": "^3.1068.0",
37
38
  "@aws-sdk/client-sfn": "^3.1068.0",
38
39
  "@aws-sdk/client-sns": "^3.1068.0",
@@ -11,6 +11,10 @@ type WithTypedKey<TInput, K extends Record<string, unknown>> = Omit<TInput, 'Key
11
11
  * Wrapper around the AWS DynamoDB Document client providing structured
12
12
  * Powertools logging and X-Ray tracing by default.
13
13
  *
14
+ * Where a method's input carries payloads, secret material or PII, the INFO
15
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
16
+ * `TRACE`) log full SDK inputs.
17
+ *
14
18
  * Items are automatically marshalled / unmarshalled via the document client —
15
19
  * callers work with plain TypeScript objects in both directions.
16
20
  */
@@ -1,5 +1,6 @@
1
1
  export { DynamoDBService } from './dynamodb/dynamodb.js';
2
2
  export { S3Service } from './s3/s3.js';
3
+ export { SchedulerService } from './scheduler/scheduler.js';
3
4
  export { SecretsManagerService } from './secrets-manager/secrets-manager.js';
4
5
  export { StepFunctionsService } from './sfn/sfn.js';
5
6
  export { SNSService } from './sns/sns.js';
@@ -13,6 +13,10 @@ type PutJsonObjectInput<T> = {
13
13
  * Wrapper around the AWS S3 client providing structured Powertools logging
14
14
  * and X-Ray tracing by default.
15
15
  *
16
+ * Where a method's input carries payloads, secret material or PII, the INFO
17
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
18
+ * `TRACE`) log full SDK inputs.
19
+ *
16
20
  * Input shapes are intentionally tight (Bucket/Key/Body only). Callers
17
21
  * needing SDK-level options not exposed here (server-side encryption,
18
22
  * tagging, version IDs) should use `S3Client` directly.
@@ -0,0 +1,85 @@
1
+ import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
2
+ import { CreateScheduleCommandInput, CreateScheduleCommandOutput, CreateScheduleGroupCommandInput, CreateScheduleGroupCommandOutput, DeleteScheduleCommandInput, DeleteScheduleCommandOutput, DeleteScheduleGroupCommandInput, DeleteScheduleGroupCommandOutput, GetScheduleCommandInput, GetScheduleCommandOutput, GetScheduleGroupCommandInput, GetScheduleGroupCommandOutput, ListScheduleGroupsCommandInput, ListSchedulesCommandInput, ScheduleGroupSummary, SchedulerClient, ScheduleSummary, UpdateScheduleCommandInput, UpdateScheduleCommandOutput } from '@aws-sdk/client-scheduler';
3
+ /**
4
+ * Wrapper around the AWS EventBridge Scheduler client providing structured
5
+ * Powertools logging and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
10
+ *
11
+ * Covers CRUD on schedules and their groups. Named `SchedulerService` (not
12
+ * `EventBridgeSchedulerService`) so it doesn't collide with a future wrapper
13
+ * over the separate EventBridge bus/rules API (`@aws-sdk/client-eventbridge`).
14
+ *
15
+ * `FlexibleTimeWindow` is required by `CreateSchedule` and is passed through
16
+ * untouched — the wrapper bakes in no default, so the caller must state their
17
+ * intent (`{ Mode: 'OFF' }` for a fixed-time schedule).
18
+ */
19
+ export declare class SchedulerService {
20
+ private readonly client;
21
+ private readonly logger;
22
+ /**
23
+ * @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
24
+ * which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
25
+ * @param opts.client - Optional pre-configured `SchedulerClient`. When
26
+ * supplied, the wrapper does not apply X-Ray instrumentation.
27
+ */
28
+ constructor(opts?: {
29
+ logger?: LoggerInterface;
30
+ client?: SchedulerClient;
31
+ });
32
+ /**
33
+ * Create a new schedule. At INFO the log line omits `Target.Input` (the
34
+ * target payload, a PII carrier).
35
+ */
36
+ createSchedule(input: CreateScheduleCommandInput): Promise<CreateScheduleCommandOutput>;
37
+ /**
38
+ * Fetch a schedule's full configuration.
39
+ */
40
+ getSchedule(input: GetScheduleCommandInput): Promise<GetScheduleCommandOutput>;
41
+ /**
42
+ * Update an existing schedule.
43
+ *
44
+ * **`UpdateSchedule` has PUT (full-replacement) semantics.** Any field you
45
+ * omit is reset to its default — this is not a partial patch. To change one
46
+ * attribute, `getSchedule` first and resend the complete configuration with
47
+ * that attribute modified, or you will silently erase `ScheduleExpression`,
48
+ * `Target`, `Description`, `StartDate`, etc. The wrapper does not merge on
49
+ * your behalf: deep-merging a `Target` (with its mutually-exclusive
50
+ * target-type params) has no single correct semantics.
51
+ *
52
+ * At INFO the log line omits `Target.Input`.
53
+ */
54
+ updateSchedule(input: UpdateScheduleCommandInput): Promise<UpdateScheduleCommandOutput>;
55
+ /**
56
+ * Delete a schedule.
57
+ */
58
+ deleteSchedule(input: DeleteScheduleCommandInput): Promise<DeleteScheduleCommandOutput>;
59
+ /**
60
+ * List schedules, auto-paginating across all pages. Bounded in practice by
61
+ * the account's schedule count and the `GroupName` / `NamePrefix` / `State`
62
+ * filters, so the flat-array shape is safe.
63
+ */
64
+ listSchedules(input?: ListSchedulesCommandInput): Promise<ScheduleSummary[]>;
65
+ /**
66
+ * Create a new schedule group. Groups are containers for schedules and are
67
+ * typically IaC-managed; use this for dynamically-provisioned groups only.
68
+ */
69
+ createScheduleGroup(input: CreateScheduleGroupCommandInput): Promise<CreateScheduleGroupCommandOutput>;
70
+ /**
71
+ * Fetch a schedule group's configuration.
72
+ */
73
+ getScheduleGroup(input: GetScheduleGroupCommandInput): Promise<GetScheduleGroupCommandOutput>;
74
+ /**
75
+ * Delete a schedule group. Deleting a group also deletes every schedule it
76
+ * contains, asynchronously — the API has no `UpdateScheduleGroup`, so this
77
+ * is the only mutating group operation besides create.
78
+ */
79
+ deleteScheduleGroup(input: DeleteScheduleGroupCommandInput): Promise<DeleteScheduleGroupCommandOutput>;
80
+ /**
81
+ * List schedule groups, auto-paginating across all pages. Bounded in
82
+ * practice by the account's group count and the `NamePrefix` filter.
83
+ */
84
+ listScheduleGroups(input?: ListScheduleGroupsCommandInput): Promise<ScheduleGroupSummary[]>;
85
+ }
@@ -4,6 +4,10 @@ import { CreateSecretCommandInput, CreateSecretCommandOutput, DeleteSecretComman
4
4
  * Wrapper around the AWS Secrets Manager client providing structured
5
5
  * Powertools logging and X-Ray tracing by default.
6
6
  *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
10
+ *
7
11
  * Write operations (`createSecret`, `updateSecret`, `putSecretValue`,
8
12
  * `deleteSecret`) are exposed for convenience but should be used with care:
9
13
  * secret lifecycle is usually managed by IaC (CDK / Terraform). Prefer IaC
@@ -43,8 +47,7 @@ export declare class SecretsManagerService {
43
47
  getJsonSecret<T>(secretId: string): Promise<T>;
44
48
  /**
45
49
  * Create a new secret. At INFO level the log line includes only identity
46
- * and non-secret metadata; `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the full
47
- * input (including `SecretString` / `SecretBinary`).
50
+ * and non-secret metadata.
48
51
  *
49
52
  * Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
50
53
  * dynamically-issued credentials only.
@@ -52,8 +55,7 @@ export declare class SecretsManagerService {
52
55
  createSecret(input: CreateSecretCommandInput): Promise<CreateSecretCommandOutput>;
53
56
  /**
54
57
  * Update an existing secret's metadata or value. At INFO level the log
55
- * line omits `SecretString` / `SecretBinary`; `POWERTOOLS_LOG_LEVEL=DEBUG`
56
- * unlocks the full input.
58
+ * line omits `SecretString` / `SecretBinary`.
57
59
  *
58
60
  * Prefer IaC (CDK / Terraform) for secret lifecycle — use this for
59
61
  * runtime metadata updates only.
@@ -61,8 +63,7 @@ export declare class SecretsManagerService {
61
63
  updateSecret(input: UpdateSecretCommandInput): Promise<UpdateSecretCommandOutput>;
62
64
  /**
63
65
  * Store a new version of a secret's value. At INFO level the log line
64
- * omits `SecretString` / `SecretBinary`; `POWERTOOLS_LOG_LEVEL=DEBUG`
65
- * unlocks the full input.
66
+ * omits `SecretString` / `SecretBinary`.
66
67
  *
67
68
  * Typically used by rotation flows.
68
69
  */
@@ -3,6 +3,10 @@ import { DescribeExecutionCommandInput, DescribeExecutionCommandOutput, Executio
3
3
  /**
4
4
  * Wrapper around the AWS Step Functions client providing structured
5
5
  * Powertools logging and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
6
10
  */
7
11
  export declare class StepFunctionsService {
8
12
  private readonly client;
@@ -3,6 +3,10 @@ import { PublishBatchCommandInput, PublishBatchCommandOutput, PublishCommandInpu
3
3
  /**
4
4
  * Wrapper around the AWS SNS client providing structured Powertools logging
5
5
  * and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
6
10
  */
7
11
  export declare class SNSService {
8
12
  private readonly client;
@@ -28,8 +32,7 @@ export declare class SNSService {
28
32
  * Publish a single message to an SNS topic.
29
33
  *
30
34
  * At INFO level the log line includes only routing / dedup metadata; see
31
- * `PUBLISH_SAFE_FIELDS` for the list. Setting `POWERTOOLS_LOG_LEVEL=DEBUG`
32
- * unlocks the full input.
35
+ * `PUBLISH_SAFE_FIELDS` for the list.
33
36
  *
34
37
  * @param input - PublishCommandInput including TopicArn and Message.
35
38
  */
@@ -3,6 +3,10 @@ import { DeleteMessageBatchCommandInput, DeleteMessageBatchCommandOutput, Delete
3
3
  /**
4
4
  * Wrapper around the AWS SQS client providing structured Powertools logging
5
5
  * and X-Ray tracing by default.
6
+ *
7
+ * Where a method's input carries payloads, secret material or PII, the INFO
8
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
9
+ * `TRACE`) log full SDK inputs.
6
10
  */
7
11
  export declare class SQSService {
8
12
  private readonly client;
@@ -27,8 +31,7 @@ export declare class SQSService {
27
31
  * Send a single message to an SQS queue.
28
32
  *
29
33
  * At INFO level the log line includes only queue routing / FIFO metadata;
30
- * see `SEND_MESSAGE_SAFE_FIELDS`. `POWERTOOLS_LOG_LEVEL=DEBUG` unlocks the
31
- * full input.
34
+ * see `SEND_MESSAGE_SAFE_FIELDS`.
32
35
  */
33
36
  sendMessage(input: SendMessageCommandInput, opts?: {
34
37
  truncate?: boolean;
@@ -6,6 +6,10 @@ import { Parameter, PutParameterCommandInput, PutParameterCommandOutput, SSMClie
6
6
  * `WithDecryption` — callers needing plaintext should use `SSMClient`
7
7
  * directly.
8
8
  *
9
+ * Where a method's input carries payloads, secret material or PII, the INFO
10
+ * log line omits them; the verbose levels (`POWERTOOLS_LOG_LEVEL=DEBUG` or
11
+ * `TRACE`) log full SDK inputs.
12
+ *
9
13
  * Write operations (`putParameter`, `deleteParameter`) are exposed for
10
14
  * convenience but should be used with care: parameter lifecycle is usually
11
15
  * managed by IaC (CDK / Terraform). Prefer IaC for anything that exists at
@@ -1,11 +1,21 @@
1
1
  import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
2
+ /**
3
+ * Whether the logger is verbose enough that full SDK inputs — payloads, secret
4
+ * material and PII — may be written to the log.
5
+ *
6
+ * **This is the only place in the package that reads the log level.** Never
7
+ * compare `logger.getLevelName()` yourself: Powertools orders `TRACE` as *more*
8
+ * verbose than `DEBUG` (thresholds 6 and 8), so the obvious
9
+ * `getLevelName() === 'DEBUG'` check silently redacts at the most verbose level
10
+ * available. Route every disclosure decision through this predicate instead.
11
+ */
12
+ export declare function shouldLogFullInput(logger: LoggerInterface): boolean;
2
13
  /**
3
14
  * Return a log-safe projection of `input` based on the logger's configured level.
4
15
  *
5
- * At `DEBUG`, the full input is returned unchanged — operators who set
6
- * `POWERTOOLS_LOG_LEVEL=DEBUG` (or call `logger.setLogLevel('DEBUG')`) have
7
- * explicitly opted into seeing everything, including payloads, secret material
8
- * and PII.
16
+ * At the verbose levels — see {@link shouldLogFullInput} — the full input is
17
+ * returned unchanged: operators who asked for that verbosity have explicitly
18
+ * opted into seeing everything, including payloads, secret material and PII.
9
19
  *
10
20
  * At any other level, only the fields listed in `safeFields` are included.
11
21
  * Missing fields are silently skipped — the result type narrows to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aligent/aws-wrappers",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
5
5
  "main": "./cjs/index.cjs",
6
6
  "module": "./esm/index.mjs",
@@ -33,6 +33,7 @@
33
33
  "@aws-lambda-powertools/logger": "^2.33.1",
34
34
  "@aws-sdk/client-dynamodb": "^3.1068.0",
35
35
  "@aws-sdk/client-s3": "^3.1068.0",
36
+ "@aws-sdk/client-scheduler": "^3.1077.0",
36
37
  "@aws-sdk/client-secrets-manager": "^3.1068.0",
37
38
  "@aws-sdk/client-sfn": "^3.1068.0",
38
39
  "@aws-sdk/client-sns": "^3.1068.0",