@webiny/aws-sdk 0.0.0-unstable.0156a4c312
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/LICENSE +21 -0
- package/README.md +11 -0
- package/client-apigatewaymanagementapi/index.d.ts +2 -0
- package/client-apigatewaymanagementapi/index.js +1 -0
- package/client-cloudfront/index.d.ts +1 -0
- package/client-cloudfront/index.js +1 -0
- package/client-cloudwatch/index.d.ts +3 -0
- package/client-cloudwatch/index.js +2 -0
- package/client-cognito-identity-provider/index.d.ts +5 -0
- package/client-cognito-identity-provider/index.js +20 -0
- package/client-cognito-identity-provider/index.js.map +1 -0
- package/client-dynamodb/getDocumentClient.d.ts +8 -0
- package/client-dynamodb/getDocumentClient.js +38 -0
- package/client-dynamodb/getDocumentClient.js.map +1 -0
- package/client-dynamodb/index.d.ts +7 -0
- package/client-dynamodb/index.js +4 -0
- package/client-eventbridge/index.d.ts +5 -0
- package/client-eventbridge/index.js +7 -0
- package/client-eventbridge/index.js.map +1 -0
- package/client-iam/index.d.ts +1 -0
- package/client-iam/index.js +1 -0
- package/client-iot/index.d.ts +1 -0
- package/client-iot/index.js +1 -0
- package/client-lambda/index.d.ts +5 -0
- package/client-lambda/index.js +20 -0
- package/client-lambda/index.js.map +1 -0
- package/client-s3/index.d.ts +12 -0
- package/client-s3/index.js +41 -0
- package/client-s3/index.js.map +1 -0
- package/client-scheduler/index.d.ts +8 -0
- package/client-scheduler/index.js +20 -0
- package/client-scheduler/index.js.map +1 -0
- package/client-sfn/index.d.ts +15 -0
- package/client-sfn/index.js +53 -0
- package/client-sfn/index.js.map +1 -0
- package/client-sqs/index.d.ts +2 -0
- package/client-sqs/index.js +1 -0
- package/client-sts/index.d.ts +1 -0
- package/client-sts/index.js +1 -0
- package/credential-providers/index.d.ts +1 -0
- package/credential-providers/index.js +1 -0
- package/lib-storage/index.d.ts +2 -0
- package/lib-storage/index.js +1 -0
- package/package.json +58 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @webiny/aws-sdk
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { ApiGatewayManagementApiClient, PostToConnectionCommand, DeleteConnectionCommand, GetConnectionCommand, GoneException, ForbiddenException, LimitExceededException, PayloadTooLargeException } from "@aws-sdk/client-apigatewaymanagementapi";
|
|
2
|
+
export type { PostToConnectionCommandInput, PostToConnectionRequest, PostToConnectionCommandOutput, PostToConnectionCommandInputType, DeleteConnectionCommandInput, DeleteConnectionRequest, DeleteConnectionCommandOutput, GetConnectionCommandInput, GetConnectionCommandOutput, GetConnectionRequest, GetConnectionResponse } from "@aws-sdk/client-apigatewaymanagementapi";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ApiGatewayManagementApiClient, DeleteConnectionCommand, ForbiddenException, GetConnectionCommand, GoneException, LimitExceededException, PayloadTooLargeException, PostToConnectionCommand } from "@aws-sdk/client-apigatewaymanagementapi";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CloudFront } from "@aws-sdk/client-cloudfront";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CloudFront } from "@aws-sdk/client-cloudfront";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CloudWatchEventsClient, DeleteRuleCommand, RemoveTargetsCommand, PutRuleCommand, PutTargetsCommand } from "@aws-sdk/client-cloudwatch-events";
|
|
2
|
+
export type { PutRuleCommandInput } from "@aws-sdk/client-cloudwatch-events";
|
|
3
|
+
export { CloudWatchLogs, type GetLogEventsRequest } from "@aws-sdk/client-cloudwatch-logs";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CognitoIdentityProviderClientConfig } from "@aws-sdk/client-cognito-identity-provider";
|
|
2
|
+
import { CognitoIdentityProvider } from "@aws-sdk/client-cognito-identity-provider";
|
|
3
|
+
export { AdminGetUserCommand, AdminCreateUserCommand, AdminDeleteUserCommand, AdminUpdateUserAttributesCommand, CognitoIdentityProvider, CognitoIdentityProviderClient } from "@aws-sdk/client-cognito-identity-provider";
|
|
4
|
+
export type { AttributeType, ListUsersResponse, AdminCreateUserRequest, AdminGetUserRequest, UserType, CognitoIdentityProviderClientConfig, AdminGetUserCommandInput, AdminGetUserCommandOutput, AdminCreateUserCommandInput, AdminCreateUserCommandOutput, AdminDeleteUserCommandInput, AdminDeleteUserCommandOutput, AdminUpdateUserAttributesCommandInput, AdminUpdateUserAttributesCommandOutput } from "@aws-sdk/client-cognito-identity-provider";
|
|
5
|
+
export declare const createCognitoIdentityProviderClient: (input?: Partial<CognitoIdentityProviderClientConfig>) => CognitoIdentityProvider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AdminCreateUserCommand, AdminDeleteUserCommand, AdminGetUserCommand, AdminUpdateUserAttributesCommand, CognitoIdentityProvider, CognitoIdentityProviderClient } from "@aws-sdk/client-cognito-identity-provider";
|
|
2
|
+
import { createCacheKey } from "@webiny/utils";
|
|
3
|
+
const DEFAULT_CONFIG = {
|
|
4
|
+
region: process.env.AWS_REGION
|
|
5
|
+
};
|
|
6
|
+
const cache = {};
|
|
7
|
+
const createCognitoIdentityProviderClient = (input)=>{
|
|
8
|
+
const config = {
|
|
9
|
+
...DEFAULT_CONFIG,
|
|
10
|
+
...input
|
|
11
|
+
};
|
|
12
|
+
const key = createCacheKey(config);
|
|
13
|
+
if (cache[key]) return cache[key];
|
|
14
|
+
const client = new CognitoIdentityProvider(config);
|
|
15
|
+
cache[key] = client;
|
|
16
|
+
return client;
|
|
17
|
+
};
|
|
18
|
+
export { AdminCreateUserCommand, AdminDeleteUserCommand, AdminGetUserCommand, AdminUpdateUserAttributesCommand, CognitoIdentityProvider, CognitoIdentityProviderClient, createCognitoIdentityProviderClient };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-cognito-identity-provider/index.js","sources":["../../src/client-cognito-identity-provider/index.ts"],"sourcesContent":["import type { CognitoIdentityProviderClientConfig } from \"@aws-sdk/client-cognito-identity-provider\";\nimport { CognitoIdentityProvider } from \"@aws-sdk/client-cognito-identity-provider\";\nimport type { GenericRecord } from \"@webiny/utils\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport {\n AdminGetUserCommand,\n AdminCreateUserCommand,\n AdminDeleteUserCommand,\n AdminUpdateUserAttributesCommand,\n CognitoIdentityProvider,\n CognitoIdentityProviderClient\n} from \"@aws-sdk/client-cognito-identity-provider\";\n\nexport type {\n AttributeType,\n ListUsersResponse,\n AdminCreateUserRequest,\n AdminGetUserRequest,\n UserType,\n CognitoIdentityProviderClientConfig,\n AdminGetUserCommandInput,\n AdminGetUserCommandOutput,\n AdminCreateUserCommandInput,\n AdminCreateUserCommandOutput,\n AdminDeleteUserCommandInput,\n AdminDeleteUserCommandOutput,\n AdminUpdateUserAttributesCommandInput,\n AdminUpdateUserAttributesCommandOutput\n} from \"@aws-sdk/client-cognito-identity-provider\";\n\nconst DEFAULT_CONFIG = {\n region: process.env.AWS_REGION\n};\n\nconst cache: GenericRecord<string, CognitoIdentityProvider> = {};\n\nexport const createCognitoIdentityProviderClient = (\n input?: Partial<CognitoIdentityProviderClientConfig>\n) => {\n const config: CognitoIdentityProviderClientConfig = {\n ...DEFAULT_CONFIG,\n ...input\n };\n const key = createCacheKey(config);\n if (cache[key]) {\n return cache[key];\n }\n const client = new CognitoIdentityProvider(config);\n cache[key] = client;\n return client;\n};\n"],"names":["DEFAULT_CONFIG","process","cache","createCognitoIdentityProviderClient","input","config","key","createCacheKey","client","CognitoIdentityProvider"],"mappings":";;AA+BA,MAAMA,iBAAiB;IACnB,QAAQC,QAAQ,GAAG,CAAC,UAAU;AAClC;AAEA,MAAMC,QAAwD,CAAC;AAExD,MAAMC,sCAAsC,CAC/CC;IAEA,MAAMC,SAA8C;QAChD,GAAGL,cAAc;QACjB,GAAGI,KAAK;IACZ;IACA,MAAME,MAAMC,eAAeF;IAC3B,IAAIH,KAAK,CAACI,IAAI,EACV,OAAOJ,KAAK,CAACI,IAAI;IAErB,MAAME,SAAS,IAAIC,wBAAwBJ;IAC3CH,KAAK,CAACI,IAAI,GAAGE;IACb,OAAOA;AACX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DynamoDBClientConfig } from "@aws-sdk/client-dynamodb";
|
|
2
|
+
import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb";
|
|
3
|
+
export interface IDecorateDocumentClientCallable {
|
|
4
|
+
(client: DynamoDBDocument): DynamoDBDocument;
|
|
5
|
+
}
|
|
6
|
+
export { getDocumentClient as createDocumentClient };
|
|
7
|
+
export declare const getDocumentClient: (input?: DynamoDBClientConfig) => DynamoDBDocument;
|
|
8
|
+
export declare const decorateDocumentClient: (cb: IDecorateDocumentClientCallable) => void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
|
|
2
|
+
import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb";
|
|
3
|
+
import { createCacheKey } from "@webiny/utils";
|
|
4
|
+
let decorateDocumentClientCallable;
|
|
5
|
+
const DEFAULT_CONFIG = {
|
|
6
|
+
region: process.env.AWS_REGION
|
|
7
|
+
};
|
|
8
|
+
const documentClients = {};
|
|
9
|
+
const documentClientConfig = {
|
|
10
|
+
marshallOptions: {
|
|
11
|
+
convertEmptyValues: true,
|
|
12
|
+
removeUndefinedValues: true,
|
|
13
|
+
convertClassInstanceToMap: true
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const getDocumentClient = (input)=>{
|
|
17
|
+
const config = {
|
|
18
|
+
...DEFAULT_CONFIG,
|
|
19
|
+
...input
|
|
20
|
+
};
|
|
21
|
+
const key = createCacheKey(config);
|
|
22
|
+
if (documentClients[key]) return applyDecoration(documentClients[key]);
|
|
23
|
+
const client = new DynamoDBClient(config);
|
|
24
|
+
const documentClient = DynamoDBDocument.from(client, documentClientConfig);
|
|
25
|
+
return documentClients[key] = applyDecoration(documentClient);
|
|
26
|
+
};
|
|
27
|
+
const applyDecoration = (client)=>{
|
|
28
|
+
if (!decorateDocumentClientCallable) return client;
|
|
29
|
+
client.__decoratedByWebiny = true;
|
|
30
|
+
return decorateDocumentClientCallable(client);
|
|
31
|
+
};
|
|
32
|
+
const decorateDocumentClient = (cb)=>{
|
|
33
|
+
decorateDocumentClientCallable = cb;
|
|
34
|
+
for(const key in documentClients)cb(documentClients[key]);
|
|
35
|
+
};
|
|
36
|
+
export { decorateDocumentClient, getDocumentClient as createDocumentClient, getDocumentClient };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=getDocumentClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-dynamodb/getDocumentClient.js","sources":["../../src/client-dynamodb/getDocumentClient.ts"],"sourcesContent":["import type { DynamoDBClientConfig } from \"@aws-sdk/client-dynamodb\";\nimport { DynamoDBClient } from \"@aws-sdk/client-dynamodb\";\nimport type { TranslateConfig } from \"@aws-sdk/lib-dynamodb\";\nimport { DynamoDBDocument } from \"@aws-sdk/lib-dynamodb\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport interface IDecorateDocumentClientCallable {\n (client: DynamoDBDocument): DynamoDBDocument;\n}\n\nlet decorateDocumentClientCallable: IDecorateDocumentClientCallable | undefined = undefined;\n\nconst DEFAULT_CONFIG = {\n region: process.env.AWS_REGION\n};\n\nconst documentClients: Record<string, DynamoDBDocument> = {};\n\n/**\n * We do not want users to be able to change these options, so we are not exposing them.\n */\nconst documentClientConfig: TranslateConfig = {\n marshallOptions: {\n convertEmptyValues: true,\n removeUndefinedValues: true,\n convertClassInstanceToMap: true\n }\n};\n\nexport { getDocumentClient as createDocumentClient };\n\nexport const getDocumentClient = (input?: DynamoDBClientConfig): DynamoDBDocument => {\n const config: DynamoDBClientConfig = {\n ...DEFAULT_CONFIG,\n ...input\n };\n const key = createCacheKey(config);\n if (documentClients[key]) {\n return applyDecoration(documentClients[key]);\n }\n const client = new DynamoDBClient(config);\n const documentClient = DynamoDBDocument.from(client, documentClientConfig);\n return (documentClients[key] = applyDecoration(documentClient));\n};\n/**\n * Client will not be decorated more than once.\n */\nconst applyDecoration = (client: DynamoDBDocument): DynamoDBDocument => {\n if (!decorateDocumentClientCallable) {\n return client;\n }\n\n // @ts-expect-error\n client.__decoratedByWebiny = true;\n return decorateDocumentClientCallable(client);\n};\n\nexport const decorateDocumentClient = (cb: IDecorateDocumentClientCallable): void => {\n decorateDocumentClientCallable = cb;\n /**\n * Decorate already existing clients.\n */\n for (const key in documentClients) {\n cb(documentClients[key]);\n }\n};\n"],"names":["decorateDocumentClientCallable","DEFAULT_CONFIG","process","documentClients","documentClientConfig","getDocumentClient","input","config","key","createCacheKey","applyDecoration","client","DynamoDBClient","documentClient","DynamoDBDocument","decorateDocumentClient","cb"],"mappings":";;;AAUA,IAAIA;AAEJ,MAAMC,iBAAiB;IACnB,QAAQC,QAAQ,GAAG,CAAC,UAAU;AAClC;AAEA,MAAMC,kBAAoD,CAAC;AAK3D,MAAMC,uBAAwC;IAC1C,iBAAiB;QACb,oBAAoB;QACpB,uBAAuB;QACvB,2BAA2B;IAC/B;AACJ;AAIO,MAAMC,oBAAoB,CAACC;IAC9B,MAAMC,SAA+B;QACjC,GAAGN,cAAc;QACjB,GAAGK,KAAK;IACZ;IACA,MAAME,MAAMC,eAAeF;IAC3B,IAAIJ,eAAe,CAACK,IAAI,EACpB,OAAOE,gBAAgBP,eAAe,CAACK,IAAI;IAE/C,MAAMG,SAAS,IAAIC,eAAeL;IAClC,MAAMM,iBAAiBC,iBAAiB,IAAI,CAACH,QAAQP;IACrD,OAAQD,eAAe,CAACK,IAAI,GAAGE,gBAAgBG;AACnD;AAIA,MAAMH,kBAAkB,CAACC;IACrB,IAAI,CAACX,gCACD,OAAOW;IAIXA,OAAO,mBAAmB,GAAG;IAC7B,OAAOX,+BAA+BW;AAC1C;AAEO,MAAMI,yBAAyB,CAACC;IACnChB,iCAAiCgB;IAIjC,IAAK,MAAMR,OAAOL,gBACda,GAAGb,eAAe,CAACK,IAAI;AAE/B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { QueryCommand } from "@aws-sdk/client-dynamodb";
|
|
2
|
+
export type { ScanInput, ScanOutput, WriteRequest, DynamoDBClient, DynamoDBClientConfig, AttributeValue } from "@aws-sdk/client-dynamodb";
|
|
3
|
+
export type { StreamRecord } from "@aws-sdk/client-dynamodb-streams";
|
|
4
|
+
export { BatchWriteCommand, BatchGetCommand, PutCommand, ScanCommand, GetCommand, UpdateCommand, DeleteCommand, DynamoDBDocument } from "@aws-sdk/lib-dynamodb";
|
|
5
|
+
export type { BatchWriteCommandInput, BatchWriteCommandOutput, BatchGetCommandInput, BatchGetCommandOutput, PutCommandInput, PutCommandOutput, UpdateCommandInput, GetCommandInput, GetCommandOutput, DeleteCommandInput, DeleteCommandOutput, ScanCommandInput, ScanCommandOutput, QueryCommandOutput } from "@aws-sdk/lib-dynamodb";
|
|
6
|
+
export { unmarshall, marshall } from "@aws-sdk/util-dynamodb";
|
|
7
|
+
export { getDocumentClient } from "./getDocumentClient.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { QueryCommand } from "@aws-sdk/client-dynamodb";
|
|
2
|
+
export { BatchGetCommand, BatchWriteCommand, DeleteCommand, DynamoDBDocument, GetCommand, PutCommand, ScanCommand, UpdateCommand } from "@aws-sdk/lib-dynamodb";
|
|
3
|
+
export { marshall, unmarshall } from "@aws-sdk/util-dynamodb";
|
|
4
|
+
export { getDocumentClient } from "./getDocumentClient.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EventBridgeClientConfig } from "@aws-sdk/client-eventbridge";
|
|
2
|
+
import { EventBridgeClient } from "@aws-sdk/client-eventbridge";
|
|
3
|
+
export { EventBridgeClient, PutEventsCommand } from "@aws-sdk/client-eventbridge";
|
|
4
|
+
export type { EventBridgeClientConfig, PutEventsRequestEntry, PutEventsCommandInput, PutEventsCommandOutput } from "@aws-sdk/client-eventbridge";
|
|
5
|
+
export declare const createEventBridgeClient: (config?: Partial<EventBridgeClientConfig>) => EventBridgeClient;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EventBridgeClient, PutEventsCommand } from "@aws-sdk/client-eventbridge";
|
|
2
|
+
const createEventBridgeClient = (config)=>new EventBridgeClient({
|
|
3
|
+
...config
|
|
4
|
+
});
|
|
5
|
+
export { EventBridgeClient, PutEventsCommand, createEventBridgeClient };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-eventbridge/index.js","sources":["../../src/client-eventbridge/index.ts"],"sourcesContent":["import type { EventBridgeClientConfig } from \"@aws-sdk/client-eventbridge\";\nimport { EventBridgeClient } from \"@aws-sdk/client-eventbridge\";\n\nexport { EventBridgeClient, PutEventsCommand } from \"@aws-sdk/client-eventbridge\";\n\nexport type {\n EventBridgeClientConfig,\n PutEventsRequestEntry,\n PutEventsCommandInput,\n PutEventsCommandOutput\n} from \"@aws-sdk/client-eventbridge\";\n\nexport const createEventBridgeClient = (config?: Partial<EventBridgeClientConfig>) => {\n return new EventBridgeClient({\n ...config\n });\n};\n"],"names":["createEventBridgeClient","config","EventBridgeClient"],"mappings":";AAYO,MAAMA,0BAA0B,CAACC,SAC7B,IAAIC,kBAAkB;QACzB,GAAGD,MAAM;IACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IAM } from "@aws-sdk/client-iam";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IAM } from "@aws-sdk/client-iam";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DescribeEndpointCommand, IoTClient } from "@aws-sdk/client-iot";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LambdaClientConfig } from "@aws-sdk/client-lambda";
|
|
2
|
+
import { LambdaClient } from "@aws-sdk/client-lambda";
|
|
3
|
+
export { LambdaClient, InvokeCommand, GetFunctionConfigurationCommand, UpdateFunctionConfigurationCommand, UpdateFunctionCodeCommand, InvocationType } from "@aws-sdk/client-lambda";
|
|
4
|
+
export type { InvokeCommandInput, LambdaClientConfig, InvokeCommandOutput, UpdateFunctionConfigurationCommandInput, UpdateFunctionConfigurationCommandOutput, UpdateFunctionCodeCommandInput, UpdateFunctionCodeCommandOutput } from "@aws-sdk/client-lambda";
|
|
5
|
+
export declare const createLambdaClient: (input?: Partial<LambdaClientConfig>) => LambdaClient;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createCacheKey } from "@webiny/utils";
|
|
2
|
+
import { GetFunctionConfigurationCommand, InvocationType, InvokeCommand, LambdaClient, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand } from "@aws-sdk/client-lambda";
|
|
3
|
+
const DEFAULT_CONFIG = {
|
|
4
|
+
region: process.env.AWS_REGION
|
|
5
|
+
};
|
|
6
|
+
const lambdaClients = {};
|
|
7
|
+
const createLambdaClient = (input)=>{
|
|
8
|
+
const config = {
|
|
9
|
+
...DEFAULT_CONFIG,
|
|
10
|
+
...input
|
|
11
|
+
};
|
|
12
|
+
const key = createCacheKey(config);
|
|
13
|
+
if (lambdaClients[key]) return lambdaClients[key];
|
|
14
|
+
const client = new LambdaClient(config);
|
|
15
|
+
lambdaClients[key] = client;
|
|
16
|
+
return client;
|
|
17
|
+
};
|
|
18
|
+
export { GetFunctionConfigurationCommand, InvocationType, InvokeCommand, LambdaClient, UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand, createLambdaClient };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-lambda/index.js","sources":["../../src/client-lambda/index.ts"],"sourcesContent":["import { createCacheKey } from \"@webiny/utils\";\nimport type { LambdaClientConfig } from \"@aws-sdk/client-lambda\";\nimport { LambdaClient } from \"@aws-sdk/client-lambda\";\n\nexport {\n LambdaClient,\n InvokeCommand,\n GetFunctionConfigurationCommand,\n UpdateFunctionConfigurationCommand,\n UpdateFunctionCodeCommand,\n InvocationType\n} from \"@aws-sdk/client-lambda\";\n\nexport type {\n InvokeCommandInput,\n LambdaClientConfig,\n InvokeCommandOutput,\n UpdateFunctionConfigurationCommandInput,\n UpdateFunctionConfigurationCommandOutput,\n UpdateFunctionCodeCommandInput,\n UpdateFunctionCodeCommandOutput\n} from \"@aws-sdk/client-lambda\";\n\nconst DEFAULT_CONFIG: LambdaClientConfig = {\n region: process.env.AWS_REGION\n};\n\nconst lambdaClients: Record<string, LambdaClient> = {};\n\nexport const createLambdaClient = (input?: Partial<LambdaClientConfig>): LambdaClient => {\n const config: LambdaClientConfig = {\n ...DEFAULT_CONFIG,\n ...input\n };\n const key = createCacheKey(config);\n\n if (lambdaClients[key]) {\n return lambdaClients[key];\n }\n\n const client = new LambdaClient(config);\n\n lambdaClients[key] = client;\n\n return client;\n};\n"],"names":["DEFAULT_CONFIG","process","lambdaClients","createLambdaClient","input","config","key","createCacheKey","client","LambdaClient"],"mappings":";;AAuBA,MAAMA,iBAAqC;IACvC,QAAQC,QAAQ,GAAG,CAAC,UAAU;AAClC;AAEA,MAAMC,gBAA8C,CAAC;AAE9C,MAAMC,qBAAqB,CAACC;IAC/B,MAAMC,SAA6B;QAC/B,GAAGL,cAAc;QACjB,GAAGI,KAAK;IACZ;IACA,MAAME,MAAMC,eAAeF;IAE3B,IAAIH,aAAa,CAACI,IAAI,EAClB,OAAOJ,aAAa,CAACI,IAAI;IAG7B,MAAME,SAAS,IAAIC,aAAaJ;IAEhCH,aAAa,CAACI,IAAI,GAAGE;IAErB,OAAOA;AACX"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { S3ClientConfig as BaseS3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
|
+
import { S3, S3Client } from "@aws-sdk/client-s3";
|
|
3
|
+
export { CopyObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsCommand, UploadPartCopyCommand, ListObjectsV2Command, ListPartsCommand, ObjectCannedACL, DeleteObjectCommand, PutObjectCommand, UploadPartCommand, AbortMultipartUploadCommand, CompleteMultipartUploadCommand, CreateMultipartUploadCommand, S3, S3Client } from "@aws-sdk/client-s3";
|
|
4
|
+
export type { PutObjectRequest, PutObjectCommandInput, Part, CopyObjectCommandInput, CopyObjectCommandOutput, DeleteObjectCommandInput, DeleteObjectsCommandInput, DeleteObjectsCommandOutput, AbortMultipartUploadCommandInput, CompleteMultipartUploadCommandInput, UploadPartCopyCommandInput, CreateMultipartUploadCommandInput, CompleteMultipartUploadCommandOutput, AbortMultipartUploadCommandOutput, CompleteMultipartUploadOutput, DeleteObjectOutput, GetObjectOutput, CompletedPart, GetObjectCommandOutput, HeadObjectOutput, HeadObjectCommandInput, HeadObjectCommandOutput, DeleteObjectCommandOutput, ListObjectsOutput, ListPartsCommandOutput, ListPartsOutput, PutObjectCommandOutput, UploadPartCommandOutput } from "@aws-sdk/client-s3";
|
|
5
|
+
export { createPresignedPost } from "@aws-sdk/s3-presigned-post";
|
|
6
|
+
export type { PresignedPost, PresignedPostOptions } from "@aws-sdk/s3-presigned-post";
|
|
7
|
+
export { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
8
|
+
export interface S3ClientConfig extends BaseS3ClientConfig {
|
|
9
|
+
cache?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const createS3Client: (initial?: S3ClientConfig) => S3Client;
|
|
12
|
+
export declare const createS3: (initial?: S3ClientConfig) => S3;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AbortMultipartUploadCommand, CompleteMultipartUploadCommand, CopyObjectCommand, CreateMultipartUploadCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsCommand, ListObjectsV2Command, ListPartsCommand, ObjectCannedACL, PutObjectCommand, S3, S3Client, UploadPartCommand, UploadPartCopyCommand } from "@aws-sdk/client-s3";
|
|
2
|
+
import { createCacheKey } from "@webiny/utils";
|
|
3
|
+
const s3ClientsCache = new Map();
|
|
4
|
+
const createS3Client = (initial)=>{
|
|
5
|
+
const options = {
|
|
6
|
+
region: process.env.AWS_REGION,
|
|
7
|
+
...initial
|
|
8
|
+
};
|
|
9
|
+
const skipCache = false === options.cache;
|
|
10
|
+
delete options.cache;
|
|
11
|
+
if (skipCache) return new S3Client({
|
|
12
|
+
...options
|
|
13
|
+
});
|
|
14
|
+
const key = createCacheKey(options);
|
|
15
|
+
if (s3ClientsCache.has(key)) return s3ClientsCache.get(key);
|
|
16
|
+
const instance = new S3Client({
|
|
17
|
+
...options
|
|
18
|
+
});
|
|
19
|
+
s3ClientsCache.set(key, instance);
|
|
20
|
+
return instance;
|
|
21
|
+
};
|
|
22
|
+
const s3Cache = new Map();
|
|
23
|
+
const createS3 = (initial)=>{
|
|
24
|
+
const options = {
|
|
25
|
+
region: process.env.AWS_REGION,
|
|
26
|
+
...initial
|
|
27
|
+
};
|
|
28
|
+
const skipCache = false === options.cache;
|
|
29
|
+
delete options.cache;
|
|
30
|
+
if (skipCache) return new S3(options);
|
|
31
|
+
const key = createCacheKey(options);
|
|
32
|
+
if (s3Cache.has(key)) return s3Cache.get(key);
|
|
33
|
+
const instance = new S3(options);
|
|
34
|
+
s3Cache.set(key, instance);
|
|
35
|
+
return instance;
|
|
36
|
+
};
|
|
37
|
+
export { createPresignedPost } from "@aws-sdk/s3-presigned-post";
|
|
38
|
+
export { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
39
|
+
export { AbortMultipartUploadCommand, CompleteMultipartUploadCommand, CopyObjectCommand, CreateMultipartUploadCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsCommand, ListObjectsV2Command, ListPartsCommand, ObjectCannedACL, PutObjectCommand, S3, S3Client, UploadPartCommand, UploadPartCopyCommand, createS3, createS3Client };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-s3/index.js","sources":["../../src/client-s3/index.ts"],"sourcesContent":["import type { S3ClientConfig as BaseS3ClientConfig } from \"@aws-sdk/client-s3\";\nimport { S3, S3Client } from \"@aws-sdk/client-s3\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport {\n CopyObjectCommand,\n GetObjectCommand,\n HeadObjectCommand,\n ListObjectsCommand,\n UploadPartCopyCommand,\n ListObjectsV2Command,\n ListPartsCommand,\n ObjectCannedACL,\n DeleteObjectCommand,\n PutObjectCommand,\n UploadPartCommand,\n AbortMultipartUploadCommand,\n CompleteMultipartUploadCommand,\n CreateMultipartUploadCommand,\n S3,\n S3Client\n} from \"@aws-sdk/client-s3\";\n\nexport type {\n PutObjectRequest,\n PutObjectCommandInput,\n Part,\n CopyObjectCommandInput,\n CopyObjectCommandOutput,\n DeleteObjectCommandInput,\n DeleteObjectsCommandInput,\n DeleteObjectsCommandOutput,\n AbortMultipartUploadCommandInput,\n CompleteMultipartUploadCommandInput,\n UploadPartCopyCommandInput,\n CreateMultipartUploadCommandInput,\n CompleteMultipartUploadCommandOutput,\n AbortMultipartUploadCommandOutput,\n CompleteMultipartUploadOutput,\n DeleteObjectOutput,\n GetObjectOutput,\n CompletedPart,\n GetObjectCommandOutput,\n HeadObjectOutput,\n HeadObjectCommandInput,\n HeadObjectCommandOutput,\n DeleteObjectCommandOutput,\n ListObjectsOutput,\n ListPartsCommandOutput,\n ListPartsOutput,\n PutObjectCommandOutput,\n UploadPartCommandOutput\n} from \"@aws-sdk/client-s3\";\n\nexport { createPresignedPost } from \"@aws-sdk/s3-presigned-post\";\nexport type { PresignedPost, PresignedPostOptions } from \"@aws-sdk/s3-presigned-post\";\n\nexport { getSignedUrl } from \"@aws-sdk/s3-request-presigner\";\n\nconst s3ClientsCache = new Map<string, S3Client>();\n\nexport interface S3ClientConfig extends BaseS3ClientConfig {\n cache?: boolean;\n}\n\nexport const createS3Client = (initial?: S3ClientConfig): S3Client => {\n const options: S3ClientConfig = {\n region: process.env.AWS_REGION,\n ...initial\n };\n const skipCache = options.cache === false;\n delete options.cache;\n if (skipCache) {\n return new S3Client({\n ...options\n });\n }\n\n const key = createCacheKey(options);\n if (s3ClientsCache.has(key)) {\n return s3ClientsCache.get(key) as S3Client;\n }\n\n const instance = new S3Client({\n ...options\n });\n s3ClientsCache.set(key, instance);\n\n return instance;\n};\n\nconst s3Cache = new Map<string, S3>();\n\nexport const createS3 = (initial?: S3ClientConfig): S3 => {\n const options: S3ClientConfig = {\n region: process.env.AWS_REGION,\n ...initial\n };\n const skipCache = options.cache === false;\n delete options.cache;\n if (skipCache) {\n return new S3(options);\n }\n const key = createCacheKey(options);\n if (s3Cache.has(key)) {\n return s3Cache.get(key) as S3;\n }\n\n const instance = new S3(options);\n\n s3Cache.set(key, instance);\n return instance;\n};\n"],"names":["s3ClientsCache","Map","createS3Client","initial","options","process","skipCache","S3Client","key","createCacheKey","instance","s3Cache","createS3","S3"],"mappings":";;AA2DA,MAAMA,iBAAiB,IAAIC;AAMpB,MAAMC,iBAAiB,CAACC;IAC3B,MAAMC,UAA0B;QAC5B,QAAQC,QAAQ,GAAG,CAAC,UAAU;QAC9B,GAAGF,OAAO;IACd;IACA,MAAMG,YAAYF,AAAkB,UAAlBA,QAAQ,KAAK;IAC/B,OAAOA,QAAQ,KAAK;IACpB,IAAIE,WACA,OAAO,IAAIC,SAAS;QAChB,GAAGH,OAAO;IACd;IAGJ,MAAMI,MAAMC,eAAeL;IAC3B,IAAIJ,eAAe,GAAG,CAACQ,MACnB,OAAOR,eAAe,GAAG,CAACQ;IAG9B,MAAME,WAAW,IAAIH,SAAS;QAC1B,GAAGH,OAAO;IACd;IACAJ,eAAe,GAAG,CAACQ,KAAKE;IAExB,OAAOA;AACX;AAEA,MAAMC,UAAU,IAAIV;AAEb,MAAMW,WAAW,CAACT;IACrB,MAAMC,UAA0B;QAC5B,QAAQC,QAAQ,GAAG,CAAC,UAAU;QAC9B,GAAGF,OAAO;IACd;IACA,MAAMG,YAAYF,AAAkB,UAAlBA,QAAQ,KAAK;IAC/B,OAAOA,QAAQ,KAAK;IACpB,IAAIE,WACA,OAAO,IAAIO,GAAGT;IAElB,MAAMI,MAAMC,eAAeL;IAC3B,IAAIO,QAAQ,GAAG,CAACH,MACZ,OAAOG,QAAQ,GAAG,CAACH;IAGvB,MAAME,WAAW,IAAIG,GAAGT;IAExBO,QAAQ,GAAG,CAACH,KAAKE;IACjB,OAAOA;AACX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SchedulerClientConfig as BaseSchedulerClientConfig } from "@aws-sdk/client-scheduler";
|
|
2
|
+
import { SchedulerClient } from "@aws-sdk/client-scheduler";
|
|
3
|
+
export { SchedulerClient, GetScheduleCommand, CreateScheduleCommand, UpdateScheduleCommand, DeleteScheduleCommand } from "@aws-sdk/client-scheduler";
|
|
4
|
+
export type { GetScheduleCommandInput, GetScheduleCommandOutput, CreateScheduleCommandInput, CreateScheduleCommandOutput, UpdateScheduleCommandInput, UpdateScheduleCommandOutput, DeleteScheduleCommandInput, DeleteScheduleCommandOutput } from "@aws-sdk/client-scheduler";
|
|
5
|
+
export interface SchedulerClientConfig extends BaseSchedulerClientConfig {
|
|
6
|
+
cache?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const createSchedulerClient: (input?: Partial<SchedulerClientConfig>) => SchedulerClient;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createCacheKey } from "@webiny/utils";
|
|
2
|
+
import { CreateScheduleCommand, DeleteScheduleCommand, GetScheduleCommand, SchedulerClient, UpdateScheduleCommand } from "@aws-sdk/client-scheduler";
|
|
3
|
+
const clients = {};
|
|
4
|
+
const createSchedulerClient = (input = {})=>{
|
|
5
|
+
const options = {
|
|
6
|
+
region: process.env.AWS_REGION,
|
|
7
|
+
...input
|
|
8
|
+
};
|
|
9
|
+
const skipCache = false === options.cache;
|
|
10
|
+
delete options.cache;
|
|
11
|
+
if (skipCache) return new SchedulerClient(options);
|
|
12
|
+
const key = createCacheKey(options);
|
|
13
|
+
if (clients[key]) return clients[key];
|
|
14
|
+
const client = new SchedulerClient(options);
|
|
15
|
+
clients[key] = client;
|
|
16
|
+
return client;
|
|
17
|
+
};
|
|
18
|
+
export { CreateScheduleCommand, DeleteScheduleCommand, GetScheduleCommand, SchedulerClient, UpdateScheduleCommand, createSchedulerClient };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-scheduler/index.js","sources":["../../src/client-scheduler/index.ts"],"sourcesContent":["import { createCacheKey } from \"@webiny/utils\";\nimport type { SchedulerClientConfig as BaseSchedulerClientConfig } from \"@aws-sdk/client-scheduler\";\nimport { SchedulerClient } from \"@aws-sdk/client-scheduler\";\n\nexport {\n SchedulerClient,\n GetScheduleCommand,\n CreateScheduleCommand,\n UpdateScheduleCommand,\n DeleteScheduleCommand\n} from \"@aws-sdk/client-scheduler\";\n\nexport type {\n GetScheduleCommandInput,\n GetScheduleCommandOutput,\n CreateScheduleCommandInput,\n CreateScheduleCommandOutput,\n UpdateScheduleCommandInput,\n UpdateScheduleCommandOutput,\n DeleteScheduleCommandInput,\n DeleteScheduleCommandOutput\n} from \"@aws-sdk/client-scheduler\";\n\nconst clients: Record<string, SchedulerClient> = {};\n\nexport interface SchedulerClientConfig extends BaseSchedulerClientConfig {\n cache?: boolean;\n}\n\nexport const createSchedulerClient = (\n input: Partial<SchedulerClientConfig> = {}\n): SchedulerClient => {\n const options: SchedulerClientConfig = {\n region: process.env.AWS_REGION,\n ...input\n };\n\n const skipCache = options.cache === false;\n delete options.cache;\n if (skipCache) {\n return new SchedulerClient(options);\n }\n\n const key = createCacheKey(options);\n\n if (clients[key]) {\n return clients[key];\n }\n\n const client = new SchedulerClient(options);\n\n clients[key] = client;\n\n return client;\n};\n"],"names":["clients","createSchedulerClient","input","options","process","skipCache","SchedulerClient","key","createCacheKey","client"],"mappings":";;AAuBA,MAAMA,UAA2C,CAAC;AAM3C,MAAMC,wBAAwB,CACjCC,QAAwC,CAAC,CAAC;IAE1C,MAAMC,UAAiC;QACnC,QAAQC,QAAQ,GAAG,CAAC,UAAU;QAC9B,GAAGF,KAAK;IACZ;IAEA,MAAMG,YAAYF,AAAkB,UAAlBA,QAAQ,KAAK;IAC/B,OAAOA,QAAQ,KAAK;IACpB,IAAIE,WACA,OAAO,IAAIC,gBAAgBH;IAG/B,MAAMI,MAAMC,eAAeL;IAE3B,IAAIH,OAAO,CAACO,IAAI,EACZ,OAAOP,OAAO,CAACO,IAAI;IAGvB,MAAME,SAAS,IAAIH,gBAAgBH;IAEnCH,OAAO,CAACO,IAAI,GAAGE;IAEf,OAAOA;AACX"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DescribeExecutionCommandInput, DescribeExecutionCommandOutput, ListExecutionsCommandInput, ListExecutionsCommandOutput, SFNClientConfig as BaseSFNClientConfig, StartExecutionCommandInput, StartExecutionCommandOutput } from "@aws-sdk/client-sfn";
|
|
2
|
+
import { DescribeExecutionCommand, ListExecutionsCommand, SFNClient, SFNServiceException, StartExecutionCommand } from "@aws-sdk/client-sfn";
|
|
3
|
+
import { type GenericRecord } from "@webiny/utils";
|
|
4
|
+
export { SFNClient, DescribeExecutionCommand, SFNServiceException, StartExecutionCommand, ListExecutionsCommand };
|
|
5
|
+
export type { DescribeExecutionCommandInput, DescribeExecutionCommandOutput, StartExecutionCommandInput, StartExecutionCommandOutput, ListExecutionsCommandInput, ListExecutionsCommandOutput };
|
|
6
|
+
export interface SFNClientConfig extends BaseSFNClientConfig {
|
|
7
|
+
cache?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface TriggerStepFunctionParams<T extends GenericRecord = GenericRecord> extends Partial<Omit<StartExecutionCommandInput, "input">> {
|
|
10
|
+
input: T;
|
|
11
|
+
}
|
|
12
|
+
export declare const createStepFunctionClient: (initial?: SFNClientConfig) => SFNClient;
|
|
13
|
+
export declare const triggerStepFunctionFactory: (input?: SFNClient | SFNClientConfig) => <T extends GenericRecord = GenericRecord>(params: TriggerStepFunctionParams<T>) => Promise<StartExecutionCommandOutput>;
|
|
14
|
+
export declare const listExecutionsFactory: (input?: SFNClient | SFNClientConfig) => (params: ListExecutionsCommandInput) => Promise<ListExecutionsCommandOutput>;
|
|
15
|
+
export declare const describeExecutionFactory: (input?: SFNClient | SFNClientConfig) => (params: DescribeExecutionCommandInput) => Promise<DescribeExecutionCommandOutput>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DescribeExecutionCommand, ListExecutionsCommand, SFNClient, SFNServiceException, StartExecutionCommand } from "@aws-sdk/client-sfn";
|
|
2
|
+
import { createCacheKey } from "@webiny/utils";
|
|
3
|
+
const stepFunctionClientsCache = new Map();
|
|
4
|
+
const createStepFunctionClient = (initial)=>{
|
|
5
|
+
const config = {
|
|
6
|
+
region: process.env.AWS_REGION,
|
|
7
|
+
...initial
|
|
8
|
+
};
|
|
9
|
+
const skipCache = false === config.cache;
|
|
10
|
+
delete config.cache;
|
|
11
|
+
if (skipCache) return new SFNClient({
|
|
12
|
+
...config
|
|
13
|
+
});
|
|
14
|
+
const key = createCacheKey(config);
|
|
15
|
+
if (stepFunctionClientsCache.has(key)) return stepFunctionClientsCache.get(key);
|
|
16
|
+
return new SFNClient({
|
|
17
|
+
...config
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const triggerStepFunctionFactory = (input)=>{
|
|
21
|
+
const client = input instanceof SFNClient ? input : createStepFunctionClient(input);
|
|
22
|
+
return async (params)=>{
|
|
23
|
+
const cmd = new StartExecutionCommand({
|
|
24
|
+
...params,
|
|
25
|
+
stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN,
|
|
26
|
+
name: params.name,
|
|
27
|
+
input: JSON.stringify(params.input)
|
|
28
|
+
});
|
|
29
|
+
return await client.send(cmd);
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const listExecutionsFactory = (input)=>{
|
|
33
|
+
const client = input instanceof SFNClient ? input : createStepFunctionClient(input);
|
|
34
|
+
return async (params)=>{
|
|
35
|
+
const cmd = new ListExecutionsCommand({
|
|
36
|
+
...params,
|
|
37
|
+
stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN
|
|
38
|
+
});
|
|
39
|
+
return await client.send(cmd);
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const describeExecutionFactory = (input)=>{
|
|
43
|
+
const client = input instanceof SFNClient ? input : createStepFunctionClient(input);
|
|
44
|
+
return async (params)=>{
|
|
45
|
+
const cmd = new DescribeExecutionCommand({
|
|
46
|
+
...params
|
|
47
|
+
});
|
|
48
|
+
return await client.send(cmd);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export { DescribeExecutionCommand, ListExecutionsCommand, SFNClient, SFNServiceException, StartExecutionCommand, createStepFunctionClient, describeExecutionFactory, listExecutionsFactory, triggerStepFunctionFactory };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-sfn/index.js","sources":["../../src/client-sfn/index.ts"],"sourcesContent":["import type {\n DescribeExecutionCommandInput,\n DescribeExecutionCommandOutput,\n ListExecutionsCommandInput,\n ListExecutionsCommandOutput,\n SFNClientConfig as BaseSFNClientConfig,\n StartExecutionCommandInput,\n StartExecutionCommandOutput\n} from \"@aws-sdk/client-sfn\";\nimport {\n DescribeExecutionCommand,\n ListExecutionsCommand,\n SFNClient,\n SFNServiceException,\n StartExecutionCommand\n} from \"@aws-sdk/client-sfn\";\nimport { createCacheKey, type GenericRecord } from \"@webiny/utils\";\n\nexport {\n SFNClient,\n DescribeExecutionCommand,\n SFNServiceException,\n StartExecutionCommand,\n ListExecutionsCommand\n};\n\nexport type {\n DescribeExecutionCommandInput,\n DescribeExecutionCommandOutput,\n StartExecutionCommandInput,\n StartExecutionCommandOutput,\n ListExecutionsCommandInput,\n ListExecutionsCommandOutput\n};\n\nexport interface SFNClientConfig extends BaseSFNClientConfig {\n cache?: boolean;\n}\n\nexport interface TriggerStepFunctionParams<T extends GenericRecord = GenericRecord> extends Partial<\n Omit<StartExecutionCommandInput, \"input\">\n> {\n input: T;\n}\n\nconst stepFunctionClientsCache = new Map<string, SFNClient>();\n\nexport const createStepFunctionClient = (initial?: SFNClientConfig): SFNClient => {\n const config: SFNClientConfig = {\n region: process.env.AWS_REGION,\n ...initial\n };\n const skipCache = config.cache === false;\n delete config.cache;\n if (skipCache) {\n return new SFNClient({\n ...config\n });\n }\n\n const key = createCacheKey(config);\n if (stepFunctionClientsCache.has(key)) {\n return stepFunctionClientsCache.get(key) as SFNClient;\n }\n\n return new SFNClient({\n ...config\n });\n};\n\nexport const triggerStepFunctionFactory = (input?: SFNClient | SFNClientConfig) => {\n const client = input instanceof SFNClient ? input : createStepFunctionClient(input);\n return async <T extends GenericRecord = GenericRecord>(\n params: TriggerStepFunctionParams<T>\n ): Promise<StartExecutionCommandOutput> => {\n const cmd = new StartExecutionCommand({\n ...params,\n stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN,\n name: params.name,\n input: JSON.stringify(params.input)\n });\n return await client.send(cmd);\n };\n};\n\nexport const listExecutionsFactory = (input?: SFNClient | SFNClientConfig) => {\n const client = input instanceof SFNClient ? input : createStepFunctionClient(input);\n return async (params: ListExecutionsCommandInput): Promise<ListExecutionsCommandOutput> => {\n const cmd = new ListExecutionsCommand({\n ...params,\n stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN\n });\n return await client.send(cmd);\n };\n};\n\nexport const describeExecutionFactory = (input?: SFNClient | SFNClientConfig) => {\n const client = input instanceof SFNClient ? input : createStepFunctionClient(input);\n return async (\n params: DescribeExecutionCommandInput\n ): Promise<DescribeExecutionCommandOutput> => {\n const cmd = new DescribeExecutionCommand({\n ...params\n });\n return await client.send(cmd);\n };\n};\n"],"names":["stepFunctionClientsCache","Map","createStepFunctionClient","initial","config","process","skipCache","SFNClient","key","createCacheKey","triggerStepFunctionFactory","input","client","params","cmd","StartExecutionCommand","JSON","listExecutionsFactory","ListExecutionsCommand","describeExecutionFactory","DescribeExecutionCommand"],"mappings":";;AA6CA,MAAMA,2BAA2B,IAAIC;AAE9B,MAAMC,2BAA2B,CAACC;IACrC,MAAMC,SAA0B;QAC5B,QAAQC,QAAQ,GAAG,CAAC,UAAU;QAC9B,GAAGF,OAAO;IACd;IACA,MAAMG,YAAYF,AAAiB,UAAjBA,OAAO,KAAK;IAC9B,OAAOA,OAAO,KAAK;IACnB,IAAIE,WACA,OAAO,IAAIC,UAAU;QACjB,GAAGH,MAAM;IACb;IAGJ,MAAMI,MAAMC,eAAeL;IAC3B,IAAIJ,yBAAyB,GAAG,CAACQ,MAC7B,OAAOR,yBAAyB,GAAG,CAACQ;IAGxC,OAAO,IAAID,UAAU;QACjB,GAAGH,MAAM;IACb;AACJ;AAEO,MAAMM,6BAA6B,CAACC;IACvC,MAAMC,SAASD,iBAAiBJ,YAAYI,QAAQT,yBAAyBS;IAC7E,OAAO,OACHE;QAEA,MAAMC,MAAM,IAAIC,sBAAsB;YAClC,GAAGF,MAAM;YACT,iBAAiBA,OAAO,eAAe,IAAIR,QAAQ,GAAG,CAAC,eAAe;YACtE,MAAMQ,OAAO,IAAI;YACjB,OAAOG,KAAK,SAAS,CAACH,OAAO,KAAK;QACtC;QACA,OAAO,MAAMD,OAAO,IAAI,CAACE;IAC7B;AACJ;AAEO,MAAMG,wBAAwB,CAACN;IAClC,MAAMC,SAASD,iBAAiBJ,YAAYI,QAAQT,yBAAyBS;IAC7E,OAAO,OAAOE;QACV,MAAMC,MAAM,IAAII,sBAAsB;YAClC,GAAGL,MAAM;YACT,iBAAiBA,OAAO,eAAe,IAAIR,QAAQ,GAAG,CAAC,eAAe;QAC1E;QACA,OAAO,MAAMO,OAAO,IAAI,CAACE;IAC7B;AACJ;AAEO,MAAMK,2BAA2B,CAACR;IACrC,MAAMC,SAASD,iBAAiBJ,YAAYI,QAAQT,yBAAyBS;IAC7E,OAAO,OACHE;QAEA,MAAMC,MAAM,IAAIM,yBAAyB;YACrC,GAAGP,MAAM;QACb;QACA,OAAO,MAAMD,OAAO,IAAI,CAACE;IAC7B;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SQSClient, SendMessageBatchCommand } from "@aws-sdk/client-sqs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STS } from "@aws-sdk/client-sts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STS } from "@aws-sdk/client-sts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fromTemporaryCredentials } from "@aws-sdk/credential-providers";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fromTemporaryCredentials } from "@aws-sdk/credential-providers";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Upload } from "@aws-sdk/lib-storage";
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/aws-sdk",
|
|
3
|
+
"version": "0.0.0-unstable.0156a4c312",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Wrapper for AWS SDK",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Webiny Ltd.",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@aws-sdk/client-apigatewaymanagementapi": "3.1161.0",
|
|
13
|
+
"@aws-sdk/client-cloudfront": "3.1161.0",
|
|
14
|
+
"@aws-sdk/client-cloudwatch-events": "3.1161.0",
|
|
15
|
+
"@aws-sdk/client-cloudwatch-logs": "3.1161.0",
|
|
16
|
+
"@aws-sdk/client-cognito-identity-provider": "3.1161.0",
|
|
17
|
+
"@aws-sdk/client-dynamodb": "3.1161.0",
|
|
18
|
+
"@aws-sdk/client-dynamodb-streams": "3.1161.0",
|
|
19
|
+
"@aws-sdk/client-eventbridge": "3.1161.0",
|
|
20
|
+
"@aws-sdk/client-iam": "3.1161.0",
|
|
21
|
+
"@aws-sdk/client-iot": "3.1161.0",
|
|
22
|
+
"@aws-sdk/client-lambda": "3.1161.0",
|
|
23
|
+
"@aws-sdk/client-s3": "3.1161.0",
|
|
24
|
+
"@aws-sdk/client-scheduler": "3.1161.0",
|
|
25
|
+
"@aws-sdk/client-sfn": "3.1161.0",
|
|
26
|
+
"@aws-sdk/client-sqs": "3.1161.0",
|
|
27
|
+
"@aws-sdk/client-sts": "3.1161.0",
|
|
28
|
+
"@aws-sdk/credential-providers": "3.1161.0",
|
|
29
|
+
"@aws-sdk/lib-dynamodb": "3.1161.0",
|
|
30
|
+
"@aws-sdk/lib-storage": "3.1161.0",
|
|
31
|
+
"@aws-sdk/s3-presigned-post": "3.1161.0",
|
|
32
|
+
"@aws-sdk/s3-request-presigner": "3.1161.0",
|
|
33
|
+
"@aws-sdk/util-dynamodb": "3.996.9",
|
|
34
|
+
"@types/aws-lambda": "8.10.164",
|
|
35
|
+
"@webiny/utils": "0.0.0-unstable.0156a4c312"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@webiny/build-tools": "0.0.0-unstable.0156a4c312",
|
|
39
|
+
"rimraf": "6.1.3",
|
|
40
|
+
"typescript": "7.0.2"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"aws-lambda": "^1.0.7"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"adio": {
|
|
49
|
+
"ignore": {
|
|
50
|
+
"dependencies": [
|
|
51
|
+
"@types/aws-lambda"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"webiny": {
|
|
56
|
+
"publishFrom": "dist"
|
|
57
|
+
}
|
|
58
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "aws-lambda";
|
package/types/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "aws-lambda";
|