@aligent/aws-wrappers 0.5.3 → 0.5.5
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/README.md +27 -1
- package/cjs/index.cjs +133 -1
- package/cjs/package.json +3 -1
- package/cjs/src/api-gateway/api-gateway.d.ts +45 -0
- package/cjs/src/api-gateway/api-gateway.d.ts.map +1 -0
- package/cjs/src/api-gateway-v2/api-gateway-v2.d.ts +39 -0
- package/cjs/src/api-gateway-v2/api-gateway-v2.d.ts.map +1 -0
- package/cjs/src/index.d.ts +2 -0
- package/cjs/src/index.d.ts.map +1 -1
- package/cjs/src/util/pagination.d.ts +12 -0
- package/cjs/src/util/pagination.d.ts.map +1 -0
- package/docs/index/classes/APIGatewayService.md +143 -0
- package/docs/index/classes/APIGatewayV2Service.md +119 -0
- package/docs/index/classes/DynamoDBService.md +12 -12
- package/docs/index/classes/S3Service.md +15 -15
- package/docs/index/classes/SNSService.md +4 -4
- package/docs/index/classes/SQSService.md +7 -7
- package/docs/index/classes/SSMService.md +7 -7
- package/docs/index/classes/SchedulerService.md +11 -11
- package/docs/index/classes/SecretsManagerService.md +8 -8
- package/docs/index/classes/StepFunctionsService.md +6 -6
- package/docs/index/modules.md +2 -0
- package/docs/testing/testing/functions/createMockService.md +1 -1
- package/esm/index.mjs +133 -3
- package/esm/package.json +3 -1
- package/esm/src/api-gateway/api-gateway.d.ts +45 -0
- package/esm/src/api-gateway/api-gateway.d.ts.map +1 -0
- package/esm/src/api-gateway-v2/api-gateway-v2.d.ts +39 -0
- package/esm/src/api-gateway-v2/api-gateway-v2.d.ts.map +1 -0
- package/esm/src/index.d.ts +2 -0
- package/esm/src/index.d.ts.map +1 -1
- package/esm/src/util/pagination.d.ts +12 -0
- package/esm/src/util/pagination.d.ts.map +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -353,6 +353,32 @@ await truncSns.publish({ TopicArn, Message: huge, Subject: long });
|
|
|
353
353
|
await truncSns.publish({ TopicArn, Message: huge }, { truncate: false });
|
|
354
354
|
```
|
|
355
355
|
|
|
356
|
+
## API Gateway
|
|
357
|
+
|
|
358
|
+
Read-only lookups against the control plane. `APIGatewayService` wraps REST APIs (v1); `APIGatewayV2Service` wraps HTTP and WebSocket APIs (v2). List methods are auto-paginated and return flat arrays.
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
import { APIGatewayService, APIGatewayV2Service } from '@aligent/aws-wrappers';
|
|
362
|
+
|
|
363
|
+
const apiGateway = new APIGatewayService();
|
|
364
|
+
|
|
365
|
+
const restApis = await apiGateway.getRestApis();
|
|
366
|
+
// REST APIs expose their routes as resources; embed methods to see the verbs.
|
|
367
|
+
const resources = await apiGateway.getResources({ restApiId, embed: ['methods'] });
|
|
368
|
+
|
|
369
|
+
// API key values are always returned (includeValue(s) is baked in, no opt-out).
|
|
370
|
+
const keys = await apiGateway.getApiKeys({ nameQuery: 'partner' });
|
|
371
|
+
const key = await apiGateway.getApiKey({ apiKey: keyId }); // throws NotFoundException if missing
|
|
372
|
+
|
|
373
|
+
const apiGatewayV2 = new APIGatewayV2Service();
|
|
374
|
+
|
|
375
|
+
const apis = await apiGatewayV2.getApis();
|
|
376
|
+
const routes = await apiGatewayV2.getRoutes({ ApiId });
|
|
377
|
+
const route = await apiGatewayV2.getRoute({ ApiId, RouteId }); // throws NotFoundException if missing
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
API key values only ever appear in method output, which the wrappers never log.
|
|
381
|
+
|
|
356
382
|
## Testing
|
|
357
383
|
|
|
358
384
|
When you unit-test code that takes a wrapper as a dependency, you usually want to assert that *your* code called the right method with the right arguments — not to exercise the wrapper's chunking, pagination or JSON round-tripping, which this package already covers with its own tests against a mocked SDK client.
|
|
@@ -413,7 +439,7 @@ const getJsonObject = async <T>() => ({ total: 42 }) as T;
|
|
|
413
439
|
|
|
414
440
|
Note that the typed-spy form does **not** work here: `vi.fn<S3Service['getJsonObject']>()` produces a `Mock` that erases the type parameter and is no longer assignable to the generic signature. Reach for a typed spy on non-generic methods only.
|
|
415
441
|
|
|
416
|
-
The helper is generic over any class, so it works for all
|
|
442
|
+
The helper is generic over any class, so it works for all wrappers and for your own service classes too.
|
|
417
443
|
|
|
418
444
|
## Build / test
|
|
419
445
|
|
package/cjs/index.cjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var logger = require('@aws-lambda-powertools/logger');
|
|
4
|
+
var clientApigatewayv2 = require('@aws-sdk/client-apigatewayv2');
|
|
5
|
+
var xray = require('aws-xray-sdk-core');
|
|
6
|
+
var clientApiGateway = require('@aws-sdk/client-api-gateway');
|
|
4
7
|
var clientDynamodb = require('@aws-sdk/client-dynamodb');
|
|
5
8
|
var libDynamodb = require('@aws-sdk/lib-dynamodb');
|
|
6
|
-
var xray = require('aws-xray-sdk-core');
|
|
7
9
|
var clientS3 = require('@aws-sdk/client-s3');
|
|
8
10
|
var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
|
|
9
11
|
var clientScheduler = require('@aws-sdk/client-scheduler');
|
|
@@ -13,6 +15,134 @@ var clientSns = require('@aws-sdk/client-sns');
|
|
|
13
15
|
var clientSqs = require('@aws-sdk/client-sqs');
|
|
14
16
|
var clientSsm = require('@aws-sdk/client-ssm');
|
|
15
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Flatten the items of every page of an SDK paginator (`paginateXxx`).
|
|
20
|
+
* `getItems` picks the data-bearing field, which differs per operation.
|
|
21
|
+
*/
|
|
22
|
+
async function collectItems(pages, getItems) {
|
|
23
|
+
const items = [];
|
|
24
|
+
for await (const page of pages) {
|
|
25
|
+
items.push(...(getItems(page) ?? []));
|
|
26
|
+
}
|
|
27
|
+
return items;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Flatten the items of every page of an operation the SDK ships no paginator
|
|
31
|
+
* for, following its continuation token until the response stops returning one.
|
|
32
|
+
* `fetchPage` receives `undefined` on the first call.
|
|
33
|
+
*/
|
|
34
|
+
async function collectPages(fetchPage, getItems, getNextToken) {
|
|
35
|
+
const items = [];
|
|
36
|
+
let token;
|
|
37
|
+
do {
|
|
38
|
+
const page = await fetchPage(token);
|
|
39
|
+
items.push(...(getItems(page) ?? []));
|
|
40
|
+
token = getNextToken(page);
|
|
41
|
+
} while (token);
|
|
42
|
+
return items;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Read-only wrapper around the API Gateway v2 (HTTP and WebSocket APIs)
|
|
47
|
+
* control-plane client providing structured Powertools logging and X-Ray
|
|
48
|
+
* tracing by default.
|
|
49
|
+
*
|
|
50
|
+
* The v2 SDK ships no paginators for `GetApis` or `GetRoutes`, so list methods
|
|
51
|
+
* follow `NextToken` manually.
|
|
52
|
+
*/
|
|
53
|
+
class APIGatewayV2Service {
|
|
54
|
+
client;
|
|
55
|
+
logger;
|
|
56
|
+
/**
|
|
57
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
58
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
59
|
+
* @param opts.client - Optional pre-configured `ApiGatewayV2Client`. When
|
|
60
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
61
|
+
*/
|
|
62
|
+
constructor(opts) {
|
|
63
|
+
this.client = opts?.client ?? xray.captureAWSv3Client(new clientApigatewayv2.ApiGatewayV2Client());
|
|
64
|
+
this.logger = opts?.logger ?? new logger.Logger();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* List every HTTP and WebSocket API in the account and region.
|
|
68
|
+
* Auto-paginated.
|
|
69
|
+
*/
|
|
70
|
+
async getApis(input = {}) {
|
|
71
|
+
this.logger.info('Fetching APIs', { input });
|
|
72
|
+
return collectPages(NextToken => this.client.send(new clientApigatewayv2.GetApisCommand({ ...input, NextToken })), page => page.Items, page => page.NextToken);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Fetch a single route of an HTTP or WebSocket API.
|
|
76
|
+
* @throws NotFoundException when the route does not exist.
|
|
77
|
+
*/
|
|
78
|
+
async getRoute(input) {
|
|
79
|
+
this.logger.info('Fetching API route', { input });
|
|
80
|
+
return this.client.send(new clientApigatewayv2.GetRouteCommand(input));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* List every route of an HTTP or WebSocket API. Auto-paginated.
|
|
84
|
+
*/
|
|
85
|
+
async getRoutes(input) {
|
|
86
|
+
this.logger.info('Fetching API routes', { input });
|
|
87
|
+
return collectPages(NextToken => this.client.send(new clientApigatewayv2.GetRoutesCommand({ ...input, NextToken })), page => page.Items, page => page.NextToken);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Read-only wrapper around the API Gateway (REST API, v1) control-plane client
|
|
93
|
+
* providing structured Powertools logging and X-Ray tracing by default.
|
|
94
|
+
*
|
|
95
|
+
* `getApiKeys` and `getApiKey` always request key values (`includeValues` /
|
|
96
|
+
* `includeValue` is `true`, with no opt-out) — callers needing metadata only
|
|
97
|
+
* should use `APIGatewayClient` directly. Key values appear only in method
|
|
98
|
+
* output; the wrapper never logs output, and no input carries secrets.
|
|
99
|
+
*/
|
|
100
|
+
class APIGatewayService {
|
|
101
|
+
client;
|
|
102
|
+
logger;
|
|
103
|
+
/**
|
|
104
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
105
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
106
|
+
* @param opts.client - Optional pre-configured `APIGatewayClient`. When
|
|
107
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
108
|
+
*/
|
|
109
|
+
constructor(opts) {
|
|
110
|
+
this.client = opts?.client ?? xray.captureAWSv3Client(new clientApiGateway.APIGatewayClient());
|
|
111
|
+
this.logger = opts?.logger ?? new logger.Logger();
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* List every REST API in the account and region. Auto-paginated.
|
|
115
|
+
*/
|
|
116
|
+
async getRestApis(input = {}) {
|
|
117
|
+
this.logger.info('Fetching REST APIs', { input });
|
|
118
|
+
return collectItems(clientApiGateway.paginateGetRestApis({ client: this.client }, input), page => page.items);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* List API keys, including their secret values. Auto-paginated.
|
|
122
|
+
*/
|
|
123
|
+
async getApiKeys(input = {}) {
|
|
124
|
+
this.logger.info('Fetching API keys', { input });
|
|
125
|
+
return collectItems(clientApiGateway.paginateGetApiKeys({ client: this.client }, { ...input, includeValues: true }), page => page.items);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Fetch a single API key, including its secret value.
|
|
129
|
+
* @throws NotFoundException when the key does not exist.
|
|
130
|
+
*/
|
|
131
|
+
async getApiKey(input) {
|
|
132
|
+
this.logger.info('Fetching API key', { input });
|
|
133
|
+
return this.client.send(new clientApiGateway.GetApiKeyCommand({ ...input, includeValue: true }));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* List every resource (path) of a REST API, which is how REST APIs expose
|
|
137
|
+
* their routes. Pass `embed: ['methods']` to include each resource's
|
|
138
|
+
* methods. Auto-paginated.
|
|
139
|
+
*/
|
|
140
|
+
async getResources(input) {
|
|
141
|
+
this.logger.info('Fetching REST API resources', { input });
|
|
142
|
+
return collectItems(clientApiGateway.paginateGetResources({ client: this.client }, input), page => page.items);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
16
146
|
/**
|
|
17
147
|
* Whether the logger is verbose enough that full SDK inputs — payloads, secret
|
|
18
148
|
* material and PII — may be written to the log.
|
|
@@ -1452,6 +1582,8 @@ class SSMService {
|
|
|
1452
1582
|
}
|
|
1453
1583
|
}
|
|
1454
1584
|
|
|
1585
|
+
exports.APIGatewayService = APIGatewayService;
|
|
1586
|
+
exports.APIGatewayV2Service = APIGatewayV2Service;
|
|
1455
1587
|
exports.DynamoDBService = DynamoDBService;
|
|
1456
1588
|
exports.S3Service = S3Service;
|
|
1457
1589
|
exports.SNSService = SNSService;
|
package/cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aligent/aws-wrappers",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Opinionated AWS SDK wrappers with Powertools logging and X-Ray tracing",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@aws-lambda-powertools/logger": "^2.33.1",
|
|
47
|
+
"@aws-sdk/client-api-gateway": "^3.1127.0",
|
|
48
|
+
"@aws-sdk/client-apigatewayv2": "^3.1127.0",
|
|
47
49
|
"@aws-sdk/client-dynamodb": "^3.1127.0",
|
|
48
50
|
"@aws-sdk/client-s3": "^3.1127.0",
|
|
49
51
|
"@aws-sdk/client-scheduler": "^3.1127.0",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
2
|
+
import { APIGatewayClient, ApiKey, GetApiKeyCommandInput, GetApiKeyCommandOutput, GetApiKeysCommandInput, GetResourcesCommandInput, GetRestApisCommandInput, Resource, RestApi } from '@aws-sdk/client-api-gateway';
|
|
3
|
+
/**
|
|
4
|
+
* Read-only wrapper around the API Gateway (REST API, v1) control-plane client
|
|
5
|
+
* providing structured Powertools logging and X-Ray tracing by default.
|
|
6
|
+
*
|
|
7
|
+
* `getApiKeys` and `getApiKey` always request key values (`includeValues` /
|
|
8
|
+
* `includeValue` is `true`, with no opt-out) — callers needing metadata only
|
|
9
|
+
* should use `APIGatewayClient` directly. Key values appear only in method
|
|
10
|
+
* output; the wrapper never logs output, and no input carries secrets.
|
|
11
|
+
*/
|
|
12
|
+
export declare class APIGatewayService {
|
|
13
|
+
private readonly client;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
/**
|
|
16
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
17
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
18
|
+
* @param opts.client - Optional pre-configured `APIGatewayClient`. When
|
|
19
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
20
|
+
*/
|
|
21
|
+
constructor(opts?: {
|
|
22
|
+
logger?: LoggerInterface;
|
|
23
|
+
client?: APIGatewayClient;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* List every REST API in the account and region. Auto-paginated.
|
|
27
|
+
*/
|
|
28
|
+
getRestApis(input?: GetRestApisCommandInput): Promise<RestApi[]>;
|
|
29
|
+
/**
|
|
30
|
+
* List API keys, including their secret values. Auto-paginated.
|
|
31
|
+
*/
|
|
32
|
+
getApiKeys(input?: Omit<GetApiKeysCommandInput, 'includeValues'>): Promise<ApiKey[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Fetch a single API key, including its secret value.
|
|
35
|
+
* @throws NotFoundException when the key does not exist.
|
|
36
|
+
*/
|
|
37
|
+
getApiKey(input: Omit<GetApiKeyCommandInput, 'includeValue'>): Promise<GetApiKeyCommandOutput>;
|
|
38
|
+
/**
|
|
39
|
+
* List every resource (path) of a REST API, which is how REST APIs expose
|
|
40
|
+
* their routes. Pass `embed: ['methods']` to include each resource's
|
|
41
|
+
* methods. Auto-paginated.
|
|
42
|
+
*/
|
|
43
|
+
getResources(input: GetResourcesCommandInput): Promise<Resource[]>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=api-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-gateway.d.ts","sourceRoot":"","sources":["../../../../src/api-gateway/api-gateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACH,gBAAgB,EAChB,MAAM,EAEN,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EAIvB,QAAQ,EACR,OAAO,EACV,MAAM,6BAA6B,CAAC;AAIrC;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAAE;IAK1E;;OAEG;IACG,WAAW,CAAC,KAAK,GAAE,uBAA4B,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAQ1E;;OAEG;IACG,UAAU,CAAC,KAAK,GAAE,IAAI,CAAC,sBAAsB,EAAE,eAAe,CAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ9F;;;OAGG;IACG,SAAS,CACX,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,cAAc,CAAC,GACnD,OAAO,CAAC,sBAAsB,CAAC;IAKlC;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAO3E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { LoggerInterface } from '@aws-lambda-powertools/logger/types';
|
|
2
|
+
import { Api, ApiGatewayV2Client, GetApisCommandInput, GetRouteCommandInput, GetRouteCommandOutput, GetRoutesCommandInput, Route } from '@aws-sdk/client-apigatewayv2';
|
|
3
|
+
/**
|
|
4
|
+
* Read-only wrapper around the API Gateway v2 (HTTP and WebSocket APIs)
|
|
5
|
+
* control-plane client providing structured Powertools logging and X-Ray
|
|
6
|
+
* tracing by default.
|
|
7
|
+
*
|
|
8
|
+
* The v2 SDK ships no paginators for `GetApis` or `GetRoutes`, so list methods
|
|
9
|
+
* follow `NextToken` manually.
|
|
10
|
+
*/
|
|
11
|
+
export declare class APIGatewayV2Service {
|
|
12
|
+
private readonly client;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
/**
|
|
15
|
+
* @param opts.logger - Optional Powertools logger. Defaults to `new Logger()`,
|
|
16
|
+
* which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
17
|
+
* @param opts.client - Optional pre-configured `ApiGatewayV2Client`. When
|
|
18
|
+
* supplied, the wrapper does not apply X-Ray instrumentation.
|
|
19
|
+
*/
|
|
20
|
+
constructor(opts?: {
|
|
21
|
+
logger?: LoggerInterface;
|
|
22
|
+
client?: ApiGatewayV2Client;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* List every HTTP and WebSocket API in the account and region.
|
|
26
|
+
* Auto-paginated.
|
|
27
|
+
*/
|
|
28
|
+
getApis(input?: Omit<GetApisCommandInput, 'NextToken'>): Promise<Api[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Fetch a single route of an HTTP or WebSocket API.
|
|
31
|
+
* @throws NotFoundException when the route does not exist.
|
|
32
|
+
*/
|
|
33
|
+
getRoute(input: GetRouteCommandInput): Promise<GetRouteCommandOutput>;
|
|
34
|
+
/**
|
|
35
|
+
* List every route of an HTTP or WebSocket API. Auto-paginated.
|
|
36
|
+
*/
|
|
37
|
+
getRoutes(input: Omit<GetRoutesCommandInput, 'NextToken'>): Promise<Route[]>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=api-gateway-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-gateway-v2.d.ts","sourceRoot":"","sources":["../../../../src/api-gateway-v2/api-gateway-v2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACH,GAAG,EACH,kBAAkB,EAElB,mBAAmB,EAEnB,oBAAoB,EACpB,qBAAqB,EAErB,qBAAqB,EACrB,KAAK,EACR,MAAM,8BAA8B,CAAC;AAItC;;;;;;;GAOG;AACH,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IAEzC;;;;;OAKG;gBACS,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,MAAM,CAAC,EAAE,kBAAkB,CAAA;KAAE;IAK5E;;;OAGG;IACG,OAAO,CAAC,KAAK,GAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IASjF;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK3E;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAQrF"}
|
package/cjs/src/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { APIGatewayV2Service } from './api-gateway-v2/api-gateway-v2.js';
|
|
2
|
+
export { APIGatewayService } from './api-gateway/api-gateway.js';
|
|
1
3
|
export { DynamoDBService } from './dynamodb/dynamodb.js';
|
|
2
4
|
export { S3Service } from './s3/s3.js';
|
|
3
5
|
export { SchedulerService } from './scheduler/scheduler.js';
|
package/cjs/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flatten the items of every page of an SDK paginator (`paginateXxx`).
|
|
3
|
+
* `getItems` picks the data-bearing field, which differs per operation.
|
|
4
|
+
*/
|
|
5
|
+
export declare function collectItems<TPage, TItem>(pages: AsyncIterable<TPage>, getItems: (page: TPage) => TItem[] | undefined): Promise<TItem[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Flatten the items of every page of an operation the SDK ships no paginator
|
|
8
|
+
* for, following its continuation token until the response stops returning one.
|
|
9
|
+
* `fetchPage` receives `undefined` on the first call.
|
|
10
|
+
*/
|
|
11
|
+
export declare function collectPages<TPage, TItem>(fetchPage: (token: string | undefined) => Promise<TPage>, getItems: (page: TPage) => TItem[] | undefined, getNextToken: (page: TPage) => string | undefined): Promise<TItem[]>;
|
|
12
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../src/util/pagination.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,KAAK,EAC3C,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,EAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,KAAK,EAAE,GAAG,SAAS,GAC/C,OAAO,CAAC,KAAK,EAAE,CAAC,CAMlB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,KAAK,EAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,EACxD,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,KAAK,EAAE,GAAG,SAAS,EAC9C,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,GAAG,SAAS,GAClD,OAAO,CAAC,KAAK,EAAE,CAAC,CASlB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
[**@aligent/aws-wrappers**](../../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/aws-wrappers](../../modules.md) / [index](../modules.md) / APIGatewayService
|
|
6
|
+
|
|
7
|
+
# Class: APIGatewayService
|
|
8
|
+
|
|
9
|
+
Defined in: [api-gateway/api-gateway.ts:30](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L30)
|
|
10
|
+
|
|
11
|
+
Read-only wrapper around the API Gateway (REST API, v1) control-plane client
|
|
12
|
+
providing structured Powertools logging and X-Ray tracing by default.
|
|
13
|
+
|
|
14
|
+
`getApiKeys` and `getApiKey` always request key values (`includeValues` /
|
|
15
|
+
`includeValue` is `true`, with no opt-out) — callers needing metadata only
|
|
16
|
+
should use `APIGatewayClient` directly. Key values appear only in method
|
|
17
|
+
output; the wrapper never logs output, and no input carries secrets.
|
|
18
|
+
|
|
19
|
+
## Constructors
|
|
20
|
+
|
|
21
|
+
<a id="constructor"></a>
|
|
22
|
+
|
|
23
|
+
### Constructor
|
|
24
|
+
|
|
25
|
+
> **new APIGatewayService**(`opts?`): `APIGatewayService`
|
|
26
|
+
|
|
27
|
+
Defined in: [api-gateway/api-gateway.ts:40](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L40)
|
|
28
|
+
|
|
29
|
+
#### Parameters
|
|
30
|
+
|
|
31
|
+
##### opts?
|
|
32
|
+
|
|
33
|
+
###### client?
|
|
34
|
+
|
|
35
|
+
`APIGatewayClient`
|
|
36
|
+
|
|
37
|
+
Optional pre-configured `APIGatewayClient`. When
|
|
38
|
+
supplied, the wrapper does not apply X-Ray instrumentation.
|
|
39
|
+
|
|
40
|
+
###### logger?
|
|
41
|
+
|
|
42
|
+
`LoggerInterface`
|
|
43
|
+
|
|
44
|
+
Optional Powertools logger. Defaults to `new Logger()`,
|
|
45
|
+
which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
46
|
+
|
|
47
|
+
#### Returns
|
|
48
|
+
|
|
49
|
+
`APIGatewayService`
|
|
50
|
+
|
|
51
|
+
## Methods
|
|
52
|
+
|
|
53
|
+
<a id="getapikey"></a>
|
|
54
|
+
|
|
55
|
+
### getApiKey()
|
|
56
|
+
|
|
57
|
+
> **getApiKey**(`input`): `Promise`\<`GetApiKeyCommandOutput`\>
|
|
58
|
+
|
|
59
|
+
Defined in: [api-gateway/api-gateway.ts:71](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L71)
|
|
60
|
+
|
|
61
|
+
Fetch a single API key, including its secret value.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### input
|
|
66
|
+
|
|
67
|
+
`Omit`\<`GetApiKeyCommandInput`, `"includeValue"`\>
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`Promise`\<`GetApiKeyCommandOutput`\>
|
|
72
|
+
|
|
73
|
+
#### Throws
|
|
74
|
+
|
|
75
|
+
NotFoundException when the key does not exist.
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
<a id="getapikeys"></a>
|
|
80
|
+
|
|
81
|
+
### getApiKeys()
|
|
82
|
+
|
|
83
|
+
> **getApiKeys**(`input?`): `Promise`\<`ApiKey`[]\>
|
|
84
|
+
|
|
85
|
+
Defined in: [api-gateway/api-gateway.ts:59](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L59)
|
|
86
|
+
|
|
87
|
+
List API keys, including their secret values. Auto-paginated.
|
|
88
|
+
|
|
89
|
+
#### Parameters
|
|
90
|
+
|
|
91
|
+
##### input?
|
|
92
|
+
|
|
93
|
+
`Omit`\<`GetApiKeysCommandInput`, `"includeValues"`\> = `{}`
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`Promise`\<`ApiKey`[]\>
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
<a id="getresources"></a>
|
|
102
|
+
|
|
103
|
+
### getResources()
|
|
104
|
+
|
|
105
|
+
> **getResources**(`input`): `Promise`\<`Resource`[]\>
|
|
106
|
+
|
|
107
|
+
Defined in: [api-gateway/api-gateway.ts:83](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L83)
|
|
108
|
+
|
|
109
|
+
List every resource (path) of a REST API, which is how REST APIs expose
|
|
110
|
+
their routes. Pass `embed: ['methods']` to include each resource's
|
|
111
|
+
methods. Auto-paginated.
|
|
112
|
+
|
|
113
|
+
#### Parameters
|
|
114
|
+
|
|
115
|
+
##### input
|
|
116
|
+
|
|
117
|
+
`GetResourcesCommandInput`
|
|
118
|
+
|
|
119
|
+
#### Returns
|
|
120
|
+
|
|
121
|
+
`Promise`\<`Resource`[]\>
|
|
122
|
+
|
|
123
|
+
***
|
|
124
|
+
|
|
125
|
+
<a id="getrestapis"></a>
|
|
126
|
+
|
|
127
|
+
### getRestApis()
|
|
128
|
+
|
|
129
|
+
> **getRestApis**(`input?`): `Promise`\<`RestApi`[]\>
|
|
130
|
+
|
|
131
|
+
Defined in: [api-gateway/api-gateway.ts:48](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway/api-gateway.ts#L48)
|
|
132
|
+
|
|
133
|
+
List every REST API in the account and region. Auto-paginated.
|
|
134
|
+
|
|
135
|
+
#### Parameters
|
|
136
|
+
|
|
137
|
+
##### input?
|
|
138
|
+
|
|
139
|
+
`GetRestApisCommandInput` = `{}`
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
`Promise`\<`RestApi`[]\>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
[**@aligent/aws-wrappers**](../../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/aws-wrappers](../../modules.md) / [index](../modules.md) / APIGatewayV2Service
|
|
6
|
+
|
|
7
|
+
# Class: APIGatewayV2Service
|
|
8
|
+
|
|
9
|
+
Defined in: [api-gateway-v2/api-gateway-v2.ts:26](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L26)
|
|
10
|
+
|
|
11
|
+
Read-only wrapper around the API Gateway v2 (HTTP and WebSocket APIs)
|
|
12
|
+
control-plane client providing structured Powertools logging and X-Ray
|
|
13
|
+
tracing by default.
|
|
14
|
+
|
|
15
|
+
The v2 SDK ships no paginators for `GetApis` or `GetRoutes`, so list methods
|
|
16
|
+
follow `NextToken` manually.
|
|
17
|
+
|
|
18
|
+
## Constructors
|
|
19
|
+
|
|
20
|
+
<a id="constructor"></a>
|
|
21
|
+
|
|
22
|
+
### Constructor
|
|
23
|
+
|
|
24
|
+
> **new APIGatewayV2Service**(`opts?`): `APIGatewayV2Service`
|
|
25
|
+
|
|
26
|
+
Defined in: [api-gateway-v2/api-gateway-v2.ts:36](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L36)
|
|
27
|
+
|
|
28
|
+
#### Parameters
|
|
29
|
+
|
|
30
|
+
##### opts?
|
|
31
|
+
|
|
32
|
+
###### client?
|
|
33
|
+
|
|
34
|
+
`ApiGatewayV2Client`
|
|
35
|
+
|
|
36
|
+
Optional pre-configured `ApiGatewayV2Client`. When
|
|
37
|
+
supplied, the wrapper does not apply X-Ray instrumentation.
|
|
38
|
+
|
|
39
|
+
###### logger?
|
|
40
|
+
|
|
41
|
+
`LoggerInterface`
|
|
42
|
+
|
|
43
|
+
Optional Powertools logger. Defaults to `new Logger()`,
|
|
44
|
+
which picks up `POWERTOOLS_SERVICE_NAME` from the environment.
|
|
45
|
+
|
|
46
|
+
#### Returns
|
|
47
|
+
|
|
48
|
+
`APIGatewayV2Service`
|
|
49
|
+
|
|
50
|
+
## Methods
|
|
51
|
+
|
|
52
|
+
<a id="getapis"></a>
|
|
53
|
+
|
|
54
|
+
### getApis()
|
|
55
|
+
|
|
56
|
+
> **getApis**(`input?`): `Promise`\<`Api`[]\>
|
|
57
|
+
|
|
58
|
+
Defined in: [api-gateway-v2/api-gateway-v2.ts:45](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L45)
|
|
59
|
+
|
|
60
|
+
List every HTTP and WebSocket API in the account and region.
|
|
61
|
+
Auto-paginated.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### input?
|
|
66
|
+
|
|
67
|
+
`Omit`\<`GetApisCommandInput`, `"NextToken"`\> = `{}`
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`Promise`\<`Api`[]\>
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
<a id="getroute"></a>
|
|
76
|
+
|
|
77
|
+
### getRoute()
|
|
78
|
+
|
|
79
|
+
> **getRoute**(`input`): `Promise`\<`GetRouteCommandOutput`\>
|
|
80
|
+
|
|
81
|
+
Defined in: [api-gateway-v2/api-gateway-v2.ts:58](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L58)
|
|
82
|
+
|
|
83
|
+
Fetch a single route of an HTTP or WebSocket API.
|
|
84
|
+
|
|
85
|
+
#### Parameters
|
|
86
|
+
|
|
87
|
+
##### input
|
|
88
|
+
|
|
89
|
+
`GetRouteCommandInput`
|
|
90
|
+
|
|
91
|
+
#### Returns
|
|
92
|
+
|
|
93
|
+
`Promise`\<`GetRouteCommandOutput`\>
|
|
94
|
+
|
|
95
|
+
#### Throws
|
|
96
|
+
|
|
97
|
+
NotFoundException when the route does not exist.
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
<a id="getroutes"></a>
|
|
102
|
+
|
|
103
|
+
### getRoutes()
|
|
104
|
+
|
|
105
|
+
> **getRoutes**(`input`): `Promise`\<`Route`[]\>
|
|
106
|
+
|
|
107
|
+
Defined in: [api-gateway-v2/api-gateway-v2.ts:66](https://github.com/aligent/microservice-development-utilities/blob/4b7a8331206e0f1a082391738f45ac3fcf87a1b3/packages/aws-wrappers/src/api-gateway-v2/api-gateway-v2.ts#L66)
|
|
108
|
+
|
|
109
|
+
List every route of an HTTP or WebSocket API. Auto-paginated.
|
|
110
|
+
|
|
111
|
+
#### Parameters
|
|
112
|
+
|
|
113
|
+
##### input
|
|
114
|
+
|
|
115
|
+
`Omit`\<`GetRoutesCommandInput`, `"NextToken"`\>
|
|
116
|
+
|
|
117
|
+
#### Returns
|
|
118
|
+
|
|
119
|
+
`Promise`\<`Route`[]\>
|