@webiny/aws-sdk 6.0.0-beta.0 → 6.0.0-rc.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.
Files changed (52) hide show
  1. package/README.md +11 -0
  2. package/client-apigatewaymanagementapi/index.d.ts +2 -1
  3. package/client-apigatewaymanagementapi/index.js +1 -120
  4. package/client-apigatewaymanagementapi/index.js.map +1 -1
  5. package/client-cloudfront/index.js +1 -12
  6. package/client-cloudfront/index.js.map +1 -1
  7. package/client-cloudwatch/index.d.ts +3 -2
  8. package/client-cloudwatch/index.js +2 -55
  9. package/client-cloudwatch/index.js.map +1 -1
  10. package/client-cognito-identity-provider/index.d.ts +5 -1
  11. package/client-cognito-identity-provider/index.js +19 -29
  12. package/client-cognito-identity-provider/index.js.map +1 -1
  13. package/client-dynamodb/getDocumentClient.d.ts +6 -1
  14. package/client-dynamodb/getDocumentClient.js +40 -27
  15. package/client-dynamodb/getDocumentClient.js.map +1 -1
  16. package/client-dynamodb/index.d.ts +5 -4
  17. package/client-dynamodb/index.js +4 -93
  18. package/client-dynamodb/index.js.map +1 -1
  19. package/client-eventbridge/index.d.ts +5 -1
  20. package/client-eventbridge/index.js +7 -36
  21. package/client-eventbridge/index.js.map +1 -1
  22. package/client-iam/index.js +1 -12
  23. package/client-iam/index.js.map +1 -1
  24. package/client-iot/index.d.ts +1 -0
  25. package/client-iot/index.js +3 -0
  26. package/client-iot/index.js.map +1 -0
  27. package/client-lambda/index.d.ts +5 -1
  28. package/client-lambda/index.js +19 -17
  29. package/client-lambda/index.js.map +1 -1
  30. package/client-s3/index.d.ts +10 -4
  31. package/client-s3/index.js +45 -179
  32. package/client-s3/index.js.map +1 -1
  33. package/client-scheduler/index.d.ts +8 -0
  34. package/client-scheduler/index.js +24 -0
  35. package/client-scheduler/index.js.map +1 -0
  36. package/client-sfn/index.d.ts +12 -7
  37. package/client-sfn/index.js +46 -37
  38. package/client-sfn/index.js.map +1 -1
  39. package/client-sqs/index.d.ts +2 -1
  40. package/client-sqs/index.js +1 -24
  41. package/client-sqs/index.js.map +1 -1
  42. package/client-sts/index.js +1 -12
  43. package/client-sts/index.js.map +1 -1
  44. package/credential-providers/index.js +1 -12
  45. package/credential-providers/index.js.map +1 -1
  46. package/lib-storage/index.d.ts +2 -1
  47. package/lib-storage/index.js +1 -42
  48. package/lib-storage/index.js.map +1 -1
  49. package/package.json +39 -32
  50. package/types/index.d.ts +1 -0
  51. package/types/index.js +3 -0
  52. package/types/index.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_clientIam","require"],"sources":["index.ts"],"sourcesContent":["export { IAM } from \"@aws-sdk/client-iam\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["IAM"],"sources":["index.ts"],"sourcesContent":["export { IAM } from \"@aws-sdk/client-iam\";\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,qBAAqB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
@@ -0,0 +1,3 @@
1
+ export { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IoTClient","DescribeEndpointCommand"],"sources":["index.ts"],"sourcesContent":["export { IoTClient, DescribeEndpointCommand } from \"@aws-sdk/client-iot\";\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,uBAAuB,QAAQ,qBAAqB","ignoreList":[]}
@@ -1 +1,5 @@
1
- export { LambdaClient, InvokeCommand } from "@aws-sdk/client-lambda";
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;
@@ -1,20 +1,22 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "InvokeCommand", {
7
- enumerable: true,
8
- get: function get() {
9
- return _clientLambda.InvokeCommand;
10
- }
11
- });
12
- Object.defineProperty(exports, "LambdaClient", {
13
- enumerable: true,
14
- get: function get() {
15
- return _clientLambda.LambdaClient;
1
+ import { createCacheKey } from "@webiny/utils";
2
+ import { LambdaClient } from "@aws-sdk/client-lambda";
3
+ export { LambdaClient, InvokeCommand, GetFunctionConfigurationCommand, UpdateFunctionConfigurationCommand, UpdateFunctionCodeCommand, InvocationType } from "@aws-sdk/client-lambda";
4
+ const DEFAULT_CONFIG = {
5
+ region: process.env.AWS_REGION
6
+ };
7
+ const lambdaClients = {};
8
+ export const createLambdaClient = input => {
9
+ const config = {
10
+ ...DEFAULT_CONFIG,
11
+ ...input
12
+ };
13
+ const key = createCacheKey(config);
14
+ if (lambdaClients[key]) {
15
+ return lambdaClients[key];
16
16
  }
17
- });
18
- var _clientLambda = require("@aws-sdk/client-lambda");
17
+ const client = new LambdaClient(config);
18
+ lambdaClients[key] = client;
19
+ return client;
20
+ };
19
21
 
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientLambda","require"],"sources":["index.ts"],"sourcesContent":["export { LambdaClient, InvokeCommand } from \"@aws-sdk/client-lambda\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["createCacheKey","LambdaClient","InvokeCommand","GetFunctionConfigurationCommand","UpdateFunctionConfigurationCommand","UpdateFunctionCodeCommand","InvocationType","DEFAULT_CONFIG","region","process","env","AWS_REGION","lambdaClients","createLambdaClient","input","config","key","client"],"sources":["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"],"mappings":"AAAA,SAASA,cAAc,QAAQ,eAAe;AAE9C,SAASC,YAAY,QAAQ,wBAAwB;AAErD,SACIA,YAAY,EACZC,aAAa,EACbC,+BAA+B,EAC/BC,kCAAkC,EAClCC,yBAAyB,EACzBC,cAAc,QACX,wBAAwB;AAY/B,MAAMC,cAAkC,GAAG;EACvCC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;AACxB,CAAC;AAED,MAAMC,aAA2C,GAAG,CAAC,CAAC;AAEtD,OAAO,MAAMC,kBAAkB,GAAIC,KAAmC,IAAmB;EACrF,MAAMC,MAA0B,GAAG;IAC/B,GAAGR,cAAc;IACjB,GAAGO;EACP,CAAC;EACD,MAAME,GAAG,GAAGhB,cAAc,CAACe,MAAM,CAAC;EAElC,IAAIH,aAAa,CAACI,GAAG,CAAC,EAAE;IACpB,OAAOJ,aAAa,CAACI,GAAG,CAAC;EAC7B;EAEA,MAAMC,MAAM,GAAG,IAAIhB,YAAY,CAACc,MAAM,CAAC;EAEvCH,aAAa,CAACI,GAAG,CAAC,GAAGC,MAAM;EAE3B,OAAOA,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -1,6 +1,12 @@
1
- import { S3, S3ClientConfig } from "@aws-sdk/client-s3";
2
- export { CompleteMultipartUploadCommand, CompleteMultipartUploadCommandOutput, AbortMultipartUploadCommandOutput, CompleteMultipartUploadOutput, DeleteObjectOutput, GetObjectCommand, GetObjectOutput, HeadObjectCommand, HeadObjectOutput, ListObjectsOutput, ListPartsCommand, ListPartsCommandOutput, ListPartsOutput, ObjectCannedACL, Part, PutObjectCommand, PutObjectCommandInput, PutObjectCommandOutput, PutObjectRequest, S3, S3Client, UploadPartCommand } from "@aws-sdk/client-s3";
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";
3
5
  export { createPresignedPost } from "@aws-sdk/s3-presigned-post";
4
- export { PresignedPost, PresignedPostOptions } from "@aws-sdk/s3-presigned-post";
6
+ export type { PresignedPost, PresignedPostOptions } from "@aws-sdk/s3-presigned-post";
5
7
  export { getSignedUrl } from "@aws-sdk/s3-request-presigner";
6
- export declare const createS3Client: (initial?: S3ClientConfig) => S3;
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;
@@ -1,182 +1,48 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "AbortMultipartUploadCommandOutput", {
8
- enumerable: true,
9
- get: function get() {
10
- return _clientS.AbortMultipartUploadCommandOutput;
11
- }
12
- });
13
- Object.defineProperty(exports, "CompleteMultipartUploadCommand", {
14
- enumerable: true,
15
- get: function get() {
16
- return _clientS.CompleteMultipartUploadCommand;
17
- }
18
- });
19
- Object.defineProperty(exports, "CompleteMultipartUploadCommandOutput", {
20
- enumerable: true,
21
- get: function get() {
22
- return _clientS.CompleteMultipartUploadCommandOutput;
23
- }
24
- });
25
- Object.defineProperty(exports, "CompleteMultipartUploadOutput", {
26
- enumerable: true,
27
- get: function get() {
28
- return _clientS.CompleteMultipartUploadOutput;
29
- }
30
- });
31
- Object.defineProperty(exports, "DeleteObjectOutput", {
32
- enumerable: true,
33
- get: function get() {
34
- return _clientS.DeleteObjectOutput;
35
- }
36
- });
37
- Object.defineProperty(exports, "GetObjectCommand", {
38
- enumerable: true,
39
- get: function get() {
40
- return _clientS.GetObjectCommand;
41
- }
42
- });
43
- Object.defineProperty(exports, "GetObjectOutput", {
44
- enumerable: true,
45
- get: function get() {
46
- return _clientS.GetObjectOutput;
47
- }
48
- });
49
- Object.defineProperty(exports, "HeadObjectCommand", {
50
- enumerable: true,
51
- get: function get() {
52
- return _clientS.HeadObjectCommand;
53
- }
54
- });
55
- Object.defineProperty(exports, "HeadObjectOutput", {
56
- enumerable: true,
57
- get: function get() {
58
- return _clientS.HeadObjectOutput;
59
- }
60
- });
61
- Object.defineProperty(exports, "ListObjectsOutput", {
62
- enumerable: true,
63
- get: function get() {
64
- return _clientS.ListObjectsOutput;
65
- }
66
- });
67
- Object.defineProperty(exports, "ListPartsCommand", {
68
- enumerable: true,
69
- get: function get() {
70
- return _clientS.ListPartsCommand;
71
- }
72
- });
73
- Object.defineProperty(exports, "ListPartsCommandOutput", {
74
- enumerable: true,
75
- get: function get() {
76
- return _clientS.ListPartsCommandOutput;
77
- }
78
- });
79
- Object.defineProperty(exports, "ListPartsOutput", {
80
- enumerable: true,
81
- get: function get() {
82
- return _clientS.ListPartsOutput;
83
- }
84
- });
85
- Object.defineProperty(exports, "ObjectCannedACL", {
86
- enumerable: true,
87
- get: function get() {
88
- return _clientS.ObjectCannedACL;
89
- }
90
- });
91
- Object.defineProperty(exports, "Part", {
92
- enumerable: true,
93
- get: function get() {
94
- return _clientS.Part;
95
- }
96
- });
97
- Object.defineProperty(exports, "PresignedPost", {
98
- enumerable: true,
99
- get: function get() {
100
- return _s3PresignedPost.PresignedPost;
101
- }
102
- });
103
- Object.defineProperty(exports, "PresignedPostOptions", {
104
- enumerable: true,
105
- get: function get() {
106
- return _s3PresignedPost.PresignedPostOptions;
107
- }
108
- });
109
- Object.defineProperty(exports, "PutObjectCommand", {
110
- enumerable: true,
111
- get: function get() {
112
- return _clientS.PutObjectCommand;
113
- }
114
- });
115
- Object.defineProperty(exports, "PutObjectCommandInput", {
116
- enumerable: true,
117
- get: function get() {
118
- return _clientS.PutObjectCommandInput;
119
- }
120
- });
121
- Object.defineProperty(exports, "PutObjectCommandOutput", {
122
- enumerable: true,
123
- get: function get() {
124
- return _clientS.PutObjectCommandOutput;
125
- }
126
- });
127
- Object.defineProperty(exports, "PutObjectRequest", {
128
- enumerable: true,
129
- get: function get() {
130
- return _clientS.PutObjectRequest;
131
- }
132
- });
133
- Object.defineProperty(exports, "S3", {
134
- enumerable: true,
135
- get: function get() {
136
- return _clientS.S3;
137
- }
138
- });
139
- Object.defineProperty(exports, "S3Client", {
140
- enumerable: true,
141
- get: function get() {
142
- return _clientS.S3Client;
143
- }
144
- });
145
- Object.defineProperty(exports, "UploadPartCommand", {
146
- enumerable: true,
147
- get: function get() {
148
- return _clientS.UploadPartCommand;
149
- }
150
- });
151
- Object.defineProperty(exports, "createPresignedPost", {
152
- enumerable: true,
153
- get: function get() {
154
- return _s3PresignedPost.createPresignedPost;
155
- }
156
- });
157
- exports.createS3Client = void 0;
158
- Object.defineProperty(exports, "getSignedUrl", {
159
- enumerable: true,
160
- get: function get() {
161
- return _s3RequestPresigner.getSignedUrl;
162
- }
163
- });
164
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
165
- var _clientS = require("@aws-sdk/client-s3");
166
- var _utils = require("@webiny/utils");
167
- var _s3PresignedPost = require("@aws-sdk/s3-presigned-post");
168
- var _s3RequestPresigner = require("@aws-sdk/s3-request-presigner");
169
- var clients = new Map();
170
- var createS3Client = exports.createS3Client = function createS3Client(initial) {
171
- var options = (0, _objectSpread2.default)({
172
- region: process.env.AWS_REGION
173
- }, initial);
174
- var key = (0, _utils.createCacheKey)(options);
175
- if (clients.has(key)) {
176
- return clients.get(key);
177
- }
178
- var instance = new _clientS.S3(options);
179
- clients.set(key, instance);
1
+ import { S3, S3Client } from "@aws-sdk/client-s3";
2
+ import { createCacheKey } from "@webiny/utils";
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 { createPresignedPost } from "@aws-sdk/s3-presigned-post";
5
+ export { getSignedUrl } from "@aws-sdk/s3-request-presigner";
6
+ const s3ClientsCache = new Map();
7
+ export const createS3Client = initial => {
8
+ const options = {
9
+ region: process.env.AWS_REGION,
10
+ ...initial
11
+ };
12
+ const skipCache = options.cache === false;
13
+ delete options.cache;
14
+ if (skipCache) {
15
+ return new S3Client({
16
+ ...options
17
+ });
18
+ }
19
+ const key = createCacheKey(options);
20
+ if (s3ClientsCache.has(key)) {
21
+ return s3ClientsCache.get(key);
22
+ }
23
+ const instance = new S3Client({
24
+ ...options
25
+ });
26
+ s3ClientsCache.set(key, instance);
27
+ return instance;
28
+ };
29
+ const s3Cache = new Map();
30
+ export const createS3 = initial => {
31
+ const options = {
32
+ region: process.env.AWS_REGION,
33
+ ...initial
34
+ };
35
+ const skipCache = options.cache === false;
36
+ delete options.cache;
37
+ if (skipCache) {
38
+ return new S3(options);
39
+ }
40
+ const key = createCacheKey(options);
41
+ if (s3Cache.has(key)) {
42
+ return s3Cache.get(key);
43
+ }
44
+ const instance = new S3(options);
45
+ s3Cache.set(key, instance);
180
46
  return instance;
181
47
  };
182
48
 
@@ -1 +1 @@
1
- {"version":3,"names":["_clientS","require","_utils","_s3PresignedPost","_s3RequestPresigner","clients","Map","createS3Client","exports","initial","options","_objectSpread2","default","region","process","env","AWS_REGION","key","createCacheKey","has","get","instance","S3","set"],"sources":["index.ts"],"sourcesContent":["import { S3, S3ClientConfig } from \"@aws-sdk/client-s3\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport {\n CompleteMultipartUploadCommand,\n CompleteMultipartUploadCommandOutput,\n AbortMultipartUploadCommandOutput,\n CompleteMultipartUploadOutput,\n DeleteObjectOutput,\n GetObjectCommand,\n GetObjectOutput,\n HeadObjectCommand,\n HeadObjectOutput,\n ListObjectsOutput,\n ListPartsCommand,\n ListPartsCommandOutput,\n ListPartsOutput,\n ObjectCannedACL,\n Part,\n PutObjectCommand,\n PutObjectCommandInput,\n PutObjectCommandOutput,\n PutObjectRequest,\n S3,\n S3Client,\n UploadPartCommand\n} from \"@aws-sdk/client-s3\";\n\nexport { createPresignedPost } from \"@aws-sdk/s3-presigned-post\";\nexport { PresignedPost, PresignedPostOptions } from \"@aws-sdk/s3-presigned-post\";\n\nexport { getSignedUrl } from \"@aws-sdk/s3-request-presigner\";\n\nconst clients = new Map<string, S3>();\n\nexport const createS3Client = (initial?: S3ClientConfig): S3 => {\n const options = {\n region: process.env.AWS_REGION,\n ...initial\n };\n const key = createCacheKey(options);\n if (clients.has(key)) {\n return clients.get(key) as S3;\n }\n\n const instance = new S3(options);\n clients.set(key, instance);\n return instance;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AA2BA,IAAAE,gBAAA,GAAAF,OAAA;AAGA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAMI,OAAO,GAAG,IAAIC,GAAG,CAAa,CAAC;AAE9B,IAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAIE,OAAwB,EAAS;EAC5D,IAAMC,OAAO,OAAAC,cAAA,CAAAC,OAAA;IACTC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;EAAU,GAC3BP,OAAO,CACb;EACD,IAAMQ,GAAG,GAAG,IAAAC,qBAAc,EAACR,OAAO,CAAC;EACnC,IAAIL,OAAO,CAACc,GAAG,CAACF,GAAG,CAAC,EAAE;IAClB,OAAOZ,OAAO,CAACe,GAAG,CAACH,GAAG,CAAC;EAC3B;EAEA,IAAMI,QAAQ,GAAG,IAAIC,WAAE,CAACZ,OAAO,CAAC;EAChCL,OAAO,CAACkB,GAAG,CAACN,GAAG,EAAEI,QAAQ,CAAC;EAC1B,OAAOA,QAAQ;AACnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["S3","S3Client","createCacheKey","CopyObjectCommand","GetObjectCommand","HeadObjectCommand","ListObjectsCommand","UploadPartCopyCommand","ListObjectsV2Command","ListPartsCommand","ObjectCannedACL","DeleteObjectCommand","PutObjectCommand","UploadPartCommand","AbortMultipartUploadCommand","CompleteMultipartUploadCommand","CreateMultipartUploadCommand","createPresignedPost","getSignedUrl","s3ClientsCache","Map","createS3Client","initial","options","region","process","env","AWS_REGION","skipCache","cache","key","has","get","instance","set","s3Cache","createS3"],"sources":["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"],"mappings":"AACA,SAASA,EAAE,EAAEC,QAAQ,QAAQ,oBAAoB;AACjD,SAASC,cAAc,QAAQ,eAAe;AAE9C,SACIC,iBAAiB,EACjBC,gBAAgB,EAChBC,iBAAiB,EACjBC,kBAAkB,EAClBC,qBAAqB,EACrBC,oBAAoB,EACpBC,gBAAgB,EAChBC,eAAe,EACfC,mBAAmB,EACnBC,gBAAgB,EAChBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,4BAA4B,EAC5BhB,EAAE,EACFC,QAAQ,QACL,oBAAoB;AAiC3B,SAASgB,mBAAmB,QAAQ,4BAA4B;AAGhE,SAASC,YAAY,QAAQ,+BAA+B;AAE5D,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAAmB,CAAC;AAMlD,OAAO,MAAMC,cAAc,GAAIC,OAAwB,IAAe;EAClE,MAAMC,OAAuB,GAAG;IAC5BC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC,UAAU;IAC9B,GAAGL;EACP,CAAC;EACD,MAAMM,SAAS,GAAGL,OAAO,CAACM,KAAK,KAAK,KAAK;EACzC,OAAON,OAAO,CAACM,KAAK;EACpB,IAAID,SAAS,EAAE;IACX,OAAO,IAAI3B,QAAQ,CAAC;MAChB,GAAGsB;IACP,CAAC,CAAC;EACN;EAEA,MAAMO,GAAG,GAAG5B,cAAc,CAACqB,OAAO,CAAC;EACnC,IAAIJ,cAAc,CAACY,GAAG,CAACD,GAAG,CAAC,EAAE;IACzB,OAAOX,cAAc,CAACa,GAAG,CAACF,GAAG,CAAC;EAClC;EAEA,MAAMG,QAAQ,GAAG,IAAIhC,QAAQ,CAAC;IAC1B,GAAGsB;EACP,CAAC,CAAC;EACFJ,cAAc,CAACe,GAAG,CAACJ,GAAG,EAAEG,QAAQ,CAAC;EAEjC,OAAOA,QAAQ;AACnB,CAAC;AAED,MAAME,OAAO,GAAG,IAAIf,GAAG,CAAa,CAAC;AAErC,OAAO,MAAMgB,QAAQ,GAAId,OAAwB,IAAS;EACtD,MAAMC,OAAuB,GAAG;IAC5BC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC,UAAU;IAC9B,GAAGL;EACP,CAAC;EACD,MAAMM,SAAS,GAAGL,OAAO,CAACM,KAAK,KAAK,KAAK;EACzC,OAAON,OAAO,CAACM,KAAK;EACpB,IAAID,SAAS,EAAE;IACX,OAAO,IAAI5B,EAAE,CAACuB,OAAO,CAAC;EAC1B;EACA,MAAMO,GAAG,GAAG5B,cAAc,CAACqB,OAAO,CAAC;EACnC,IAAIY,OAAO,CAACJ,GAAG,CAACD,GAAG,CAAC,EAAE;IAClB,OAAOK,OAAO,CAACH,GAAG,CAACF,GAAG,CAAC;EAC3B;EAEA,MAAMG,QAAQ,GAAG,IAAIjC,EAAE,CAACuB,OAAO,CAAC;EAEhCY,OAAO,CAACD,GAAG,CAACJ,GAAG,EAAEG,QAAQ,CAAC;EAC1B,OAAOA,QAAQ;AACnB,CAAC","ignoreList":[]}
@@ -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,24 @@
1
+ import { createCacheKey } from "@webiny/utils";
2
+ import { SchedulerClient } from "@aws-sdk/client-scheduler";
3
+ export { SchedulerClient, GetScheduleCommand, CreateScheduleCommand, UpdateScheduleCommand, DeleteScheduleCommand } from "@aws-sdk/client-scheduler";
4
+ const clients = {};
5
+ export const createSchedulerClient = (input = {}) => {
6
+ const options = {
7
+ region: process.env.AWS_REGION,
8
+ ...input
9
+ };
10
+ const skipCache = options.cache === false;
11
+ delete options.cache;
12
+ if (skipCache) {
13
+ return new SchedulerClient(options);
14
+ }
15
+ const key = createCacheKey(options);
16
+ if (clients[key]) {
17
+ return clients[key];
18
+ }
19
+ const client = new SchedulerClient(options);
20
+ clients[key] = client;
21
+ return client;
22
+ };
23
+
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCacheKey","SchedulerClient","GetScheduleCommand","CreateScheduleCommand","UpdateScheduleCommand","DeleteScheduleCommand","clients","createSchedulerClient","input","options","region","process","env","AWS_REGION","skipCache","cache","key","client"],"sources":["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"],"mappings":"AAAA,SAASA,cAAc,QAAQ,eAAe;AAE9C,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,SACIA,eAAe,EACfC,kBAAkB,EAClBC,qBAAqB,EACrBC,qBAAqB,EACrBC,qBAAqB,QAClB,2BAA2B;AAalC,MAAMC,OAAwC,GAAG,CAAC,CAAC;AAMnD,OAAO,MAAMC,qBAAqB,GAAGA,CACjCC,KAAqC,GAAG,CAAC,CAAC,KACxB;EAClB,MAAMC,OAA8B,GAAG;IACnCC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC,UAAU;IAC9B,GAAGL;EACP,CAAC;EAED,MAAMM,SAAS,GAAGL,OAAO,CAACM,KAAK,KAAK,KAAK;EACzC,OAAON,OAAO,CAACM,KAAK;EACpB,IAAID,SAAS,EAAE;IACX,OAAO,IAAIb,eAAe,CAACQ,OAAO,CAAC;EACvC;EAEA,MAAMO,GAAG,GAAGhB,cAAc,CAACS,OAAO,CAAC;EAEnC,IAAIH,OAAO,CAACU,GAAG,CAAC,EAAE;IACd,OAAOV,OAAO,CAACU,GAAG,CAAC;EACvB;EAEA,MAAMC,MAAM,GAAG,IAAIhB,eAAe,CAACQ,OAAO,CAAC;EAE3CH,OAAO,CAACU,GAAG,CAAC,GAAGC,MAAM;EAErB,OAAOA,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -1,10 +1,15 @@
1
- import { SFNClient, SFNClientConfig, StartExecutionCommandInput } from "@aws-sdk/client-sfn";
2
- export { SFNClient, StartExecutionCommand, SFNServiceException } from "@aws-sdk/client-sfn";
3
- export declare type GenericData = string | number | boolean | null | undefined;
4
- export interface GenericStepFunctionData {
5
- [key: string]: GenericData | GenericData[];
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;
6
8
  }
7
- export interface TriggerStepFunctionParams<T extends GenericStepFunctionData = GenericStepFunctionData> extends Partial<Omit<StartExecutionCommandInput, "input">> {
9
+ export interface TriggerStepFunctionParams<T extends GenericRecord = GenericRecord> extends Partial<Omit<StartExecutionCommandInput, "input">> {
8
10
  input: T;
9
11
  }
10
- export declare const triggerStepFunctionFactory: (config: SFNClient | SFNClientConfig) => <T extends GenericStepFunctionData = GenericStepFunctionData>(params: TriggerStepFunctionParams<T>) => Promise<import("@aws-sdk/client-sfn").StartExecutionCommandOutput>;
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>;
@@ -1,46 +1,55 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "SFNClient", {
8
- enumerable: true,
9
- get: function get() {
10
- return _clientSfn.SFNClient;
11
- }
12
- });
13
- Object.defineProperty(exports, "SFNServiceException", {
14
- enumerable: true,
15
- get: function get() {
16
- return _clientSfn.SFNServiceException;
17
- }
18
- });
19
- Object.defineProperty(exports, "StartExecutionCommand", {
20
- enumerable: true,
21
- get: function get() {
22
- return _clientSfn.StartExecutionCommand;
1
+ import { DescribeExecutionCommand, ListExecutionsCommand, SFNClient, SFNServiceException, StartExecutionCommand } from "@aws-sdk/client-sfn";
2
+ import { createCacheKey } from "@webiny/utils";
3
+ export { SFNClient, DescribeExecutionCommand, SFNServiceException, StartExecutionCommand, ListExecutionsCommand };
4
+ const stepFunctionClientsCache = new Map();
5
+ export const createStepFunctionClient = initial => {
6
+ const config = {
7
+ region: process.env.AWS_REGION,
8
+ ...initial
9
+ };
10
+ const skipCache = config.cache === false;
11
+ delete config.cache;
12
+ if (skipCache) {
13
+ return new SFNClient({
14
+ ...config
15
+ });
23
16
  }
24
- });
25
- exports.triggerStepFunctionFactory = void 0;
26
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
27
- var _clientSfn = require("@aws-sdk/client-sfn");
28
- var getClient = function getClient(config) {
29
- if (config instanceof _clientSfn.SFNClient) {
30
- return config;
17
+ const key = createCacheKey(config);
18
+ if (stepFunctionClientsCache.has(key)) {
19
+ return stepFunctionClientsCache.get(key);
31
20
  }
32
- return new _clientSfn.SFNClient((0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
33
- region: config.region || process.env.AWS_REGION
34
- }));
21
+ return new SFNClient({
22
+ ...config
23
+ });
35
24
  };
36
- var triggerStepFunctionFactory = exports.triggerStepFunctionFactory = function triggerStepFunctionFactory(config) {
37
- var client = getClient(config);
38
- return async function (params) {
39
- var cmd = new _clientSfn.StartExecutionCommand((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
25
+ export const triggerStepFunctionFactory = input => {
26
+ const client = input instanceof SFNClient ? input : createStepFunctionClient(input);
27
+ return async params => {
28
+ const cmd = new StartExecutionCommand({
29
+ ...params,
40
30
  stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN,
41
31
  name: params.name,
42
32
  input: JSON.stringify(params.input)
43
- }));
33
+ });
34
+ return await client.send(cmd);
35
+ };
36
+ };
37
+ export const listExecutionsFactory = input => {
38
+ const client = input instanceof SFNClient ? input : createStepFunctionClient(input);
39
+ return async params => {
40
+ const cmd = new ListExecutionsCommand({
41
+ ...params,
42
+ stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN
43
+ });
44
+ return await client.send(cmd);
45
+ };
46
+ };
47
+ export const describeExecutionFactory = input => {
48
+ const client = input instanceof SFNClient ? input : createStepFunctionClient(input);
49
+ return async params => {
50
+ const cmd = new DescribeExecutionCommand({
51
+ ...params
52
+ });
44
53
  return await client.send(cmd);
45
54
  };
46
55
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_clientSfn","require","getClient","config","SFNClient","_objectSpread2","default","region","process","env","AWS_REGION","triggerStepFunctionFactory","exports","client","params","cmd","StartExecutionCommand","stateMachineArn","BG_TASK_SFN_ARN","name","input","JSON","stringify","send"],"sources":["index.ts"],"sourcesContent":["import {\n SFNClient,\n SFNClientConfig,\n StartExecutionCommand,\n StartExecutionCommandInput\n} from \"@aws-sdk/client-sfn\";\n\nexport { SFNClient, StartExecutionCommand, SFNServiceException } from \"@aws-sdk/client-sfn\";\n\nexport type GenericData = string | number | boolean | null | undefined;\n\nexport interface GenericStepFunctionData {\n [key: string]: GenericData | GenericData[];\n}\n\nexport interface TriggerStepFunctionParams<\n T extends GenericStepFunctionData = GenericStepFunctionData\n> extends Partial<Omit<StartExecutionCommandInput, \"input\">> {\n input: T;\n}\n\nconst getClient = (config: SFNClient | SFNClientConfig): SFNClient => {\n if (config instanceof SFNClient) {\n return config;\n }\n return new SFNClient({\n ...config,\n region: config.region || process.env.AWS_REGION\n });\n};\n\nexport const triggerStepFunctionFactory = (config: SFNClient | SFNClientConfig) => {\n const client = getClient(config);\n return async <T extends GenericStepFunctionData = GenericStepFunctionData>(\n params: TriggerStepFunctionParams<T>\n ) => {\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAqBA,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAIC,MAAmC,EAAgB;EAClE,IAAIA,MAAM,YAAYC,oBAAS,EAAE;IAC7B,OAAOD,MAAM;EACjB;EACA,OAAO,IAAIC,oBAAS,KAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACbH,MAAM;IACTI,MAAM,EAAEJ,MAAM,CAACI,MAAM,IAAIC,OAAO,CAACC,GAAG,CAACC;EAAU,EAClD,CAAC;AACN,CAAC;AAEM,IAAMC,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG,SAA7BA,0BAA0BA,CAAIR,MAAmC,EAAK;EAC/E,IAAMU,MAAM,GAAGX,SAAS,CAACC,MAAM,CAAC;EAChC,OAAO,gBACHW,MAAoC,EACnC;IACD,IAAMC,GAAG,GAAG,IAAIC,gCAAqB,KAAAX,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MAC9BQ,MAAM;MACTG,eAAe,EAAEH,MAAM,CAACG,eAAe,IAAIT,OAAO,CAACC,GAAG,CAACS,eAAe;MACtEC,IAAI,EAAEL,MAAM,CAACK,IAAI;MACjBC,KAAK,EAAEC,IAAI,CAACC,SAAS,CAACR,MAAM,CAACM,KAAK;IAAC,EACtC,CAAC;IACF,OAAO,MAAMP,MAAM,CAACU,IAAI,CAACR,GAAG,CAAC;EACjC,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["DescribeExecutionCommand","ListExecutionsCommand","SFNClient","SFNServiceException","StartExecutionCommand","createCacheKey","stepFunctionClientsCache","Map","createStepFunctionClient","initial","config","region","process","env","AWS_REGION","skipCache","cache","key","has","get","triggerStepFunctionFactory","input","client","params","cmd","stateMachineArn","BG_TASK_SFN_ARN","name","JSON","stringify","send","listExecutionsFactory","describeExecutionFactory"],"sources":["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>\n extends Partial<Omit<StartExecutionCommandInput, \"input\">> {\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"],"mappings":"AASA,SACIA,wBAAwB,EACxBC,qBAAqB,EACrBC,SAAS,EACTC,mBAAmB,EACnBC,qBAAqB,QAClB,qBAAqB;AAC5B,SAASC,cAAc,QAA4B,eAAe;AAElE,SACIH,SAAS,EACTF,wBAAwB,EACxBG,mBAAmB,EACnBC,qBAAqB,EACrBH,qBAAqB;AAqBzB,MAAMK,wBAAwB,GAAG,IAAIC,GAAG,CAAoB,CAAC;AAE7D,OAAO,MAAMC,wBAAwB,GAAIC,OAAyB,IAAgB;EAC9E,MAAMC,MAAuB,GAAG;IAC5BC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC,UAAU;IAC9B,GAAGL;EACP,CAAC;EACD,MAAMM,SAAS,GAAGL,MAAM,CAACM,KAAK,KAAK,KAAK;EACxC,OAAON,MAAM,CAACM,KAAK;EACnB,IAAID,SAAS,EAAE;IACX,OAAO,IAAIb,SAAS,CAAC;MACjB,GAAGQ;IACP,CAAC,CAAC;EACN;EAEA,MAAMO,GAAG,GAAGZ,cAAc,CAACK,MAAM,CAAC;EAClC,IAAIJ,wBAAwB,CAACY,GAAG,CAACD,GAAG,CAAC,EAAE;IACnC,OAAOX,wBAAwB,CAACa,GAAG,CAACF,GAAG,CAAC;EAC5C;EAEA,OAAO,IAAIf,SAAS,CAAC;IACjB,GAAGQ;EACP,CAAC,CAAC;AACN,CAAC;AAED,OAAO,MAAMU,0BAA0B,GAAIC,KAAmC,IAAK;EAC/E,MAAMC,MAAM,GAAGD,KAAK,YAAYnB,SAAS,GAAGmB,KAAK,GAAGb,wBAAwB,CAACa,KAAK,CAAC;EACnF,OAAO,MACHE,MAAoC,IACG;IACvC,MAAMC,GAAG,GAAG,IAAIpB,qBAAqB,CAAC;MAClC,GAAGmB,MAAM;MACTE,eAAe,EAAEF,MAAM,CAACE,eAAe,IAAIb,OAAO,CAACC,GAAG,CAACa,eAAe;MACtEC,IAAI,EAAEJ,MAAM,CAACI,IAAI;MACjBN,KAAK,EAAEO,IAAI,CAACC,SAAS,CAACN,MAAM,CAACF,KAAK;IACtC,CAAC,CAAC;IACF,OAAO,MAAMC,MAAM,CAACQ,IAAI,CAACN,GAAG,CAAC;EACjC,CAAC;AACL,CAAC;AAED,OAAO,MAAMO,qBAAqB,GAAIV,KAAmC,IAAK;EAC1E,MAAMC,MAAM,GAAGD,KAAK,YAAYnB,SAAS,GAAGmB,KAAK,GAAGb,wBAAwB,CAACa,KAAK,CAAC;EACnF,OAAO,MAAOE,MAAkC,IAA2C;IACvF,MAAMC,GAAG,GAAG,IAAIvB,qBAAqB,CAAC;MAClC,GAAGsB,MAAM;MACTE,eAAe,EAAEF,MAAM,CAACE,eAAe,IAAIb,OAAO,CAACC,GAAG,CAACa;IAC3D,CAAC,CAAC;IACF,OAAO,MAAMJ,MAAM,CAACQ,IAAI,CAACN,GAAG,CAAC;EACjC,CAAC;AACL,CAAC;AAED,OAAO,MAAMQ,wBAAwB,GAAIX,KAAmC,IAAK;EAC7E,MAAMC,MAAM,GAAGD,KAAK,YAAYnB,SAAS,GAAGmB,KAAK,GAAGb,wBAAwB,CAACa,KAAK,CAAC;EACnF,OAAO,MACHE,MAAqC,IACK;IAC1C,MAAMC,GAAG,GAAG,IAAIxB,wBAAwB,CAAC;MACrC,GAAGuB;IACP,CAAC,CAAC;IACF,OAAO,MAAMD,MAAM,CAACQ,IAAI,CAACN,GAAG,CAAC;EACjC,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1 +1,2 @@
1
- export { SQSClient, SendMessageBatchRequestEntry, SendMessageBatchCommand } from "@aws-sdk/client-sqs";
1
+ export { SQSClient, SendMessageBatchCommand } from "@aws-sdk/client-sqs";
2
+ export type { SendMessageBatchRequestEntry } from "@aws-sdk/client-sqs";
@@ -1,26 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "SQSClient", {
7
- enumerable: true,
8
- get: function get() {
9
- return _clientSqs.SQSClient;
10
- }
11
- });
12
- Object.defineProperty(exports, "SendMessageBatchCommand", {
13
- enumerable: true,
14
- get: function get() {
15
- return _clientSqs.SendMessageBatchCommand;
16
- }
17
- });
18
- Object.defineProperty(exports, "SendMessageBatchRequestEntry", {
19
- enumerable: true,
20
- get: function get() {
21
- return _clientSqs.SendMessageBatchRequestEntry;
22
- }
23
- });
24
- var _clientSqs = require("@aws-sdk/client-sqs");
1
+ export { SQSClient, SendMessageBatchCommand } from "@aws-sdk/client-sqs";
25
2
 
26
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientSqs","require"],"sources":["index.ts"],"sourcesContent":["export {\n SQSClient,\n SendMessageBatchRequestEntry,\n SendMessageBatchCommand\n} from \"@aws-sdk/client-sqs\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["SQSClient","SendMessageBatchCommand"],"sources":["index.ts"],"sourcesContent":["export { SQSClient, SendMessageBatchCommand } from \"@aws-sdk/client-sqs\";\nexport type { SendMessageBatchRequestEntry } from \"@aws-sdk/client-sqs\";\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,uBAAuB,QAAQ,qBAAqB","ignoreList":[]}
@@ -1,14 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "STS", {
7
- enumerable: true,
8
- get: function get() {
9
- return _clientSts.STS;
10
- }
11
- });
12
- var _clientSts = require("@aws-sdk/client-sts");
1
+ export { STS } from "@aws-sdk/client-sts";
13
2
 
14
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientSts","require"],"sources":["index.ts"],"sourcesContent":["export { STS } from \"@aws-sdk/client-sts\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["STS"],"sources":["index.ts"],"sourcesContent":["export { STS } from \"@aws-sdk/client-sts\";\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,qBAAqB","ignoreList":[]}
@@ -1,14 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "fromTemporaryCredentials", {
7
- enumerable: true,
8
- get: function get() {
9
- return _credentialProviders.fromTemporaryCredentials;
10
- }
11
- });
12
- var _credentialProviders = require("@aws-sdk/credential-providers");
1
+ export { fromTemporaryCredentials } from "@aws-sdk/credential-providers";
13
2
 
14
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_credentialProviders","require"],"sources":["index.ts"],"sourcesContent":["export { fromTemporaryCredentials } from \"@aws-sdk/credential-providers\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["fromTemporaryCredentials"],"sources":["index.ts"],"sourcesContent":["export { fromTemporaryCredentials } from \"@aws-sdk/credential-providers\";\n"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,+BAA+B","ignoreList":[]}
@@ -1 +1,2 @@
1
- export { Upload, Options, Progress, BodyDataTypes, RawDataPart, Configuration } from "@aws-sdk/lib-storage";
1
+ export { Upload } from "@aws-sdk/lib-storage";
2
+ export type { Options, Progress, BodyDataTypes, RawDataPart, Configuration } from "@aws-sdk/lib-storage";