@webiny/aws-sdk 0.0.0-unstable.a9593f74dd → 0.0.0-unstable.e53eceafb5

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/client-apigatewaymanagementapi/index.d.ts +1 -0
  2. package/client-apigatewaymanagementapi/index.js +122 -0
  3. package/client-apigatewaymanagementapi/index.js.map +1 -0
  4. package/client-cloudfront/index.js +1 -1
  5. package/client-cloudfront/index.js.map +1 -1
  6. package/client-cloudwatch/index.js +8 -8
  7. package/client-cloudwatch/index.js.map +1 -1
  8. package/client-cognito-identity-provider/index.d.ts +5 -1
  9. package/client-cognito-identity-provider/index.js +54 -10
  10. package/client-cognito-identity-provider/index.js.map +1 -1
  11. package/client-dynamodb/getDocumentClient.d.ts +6 -1
  12. package/client-dynamodb/getDocumentClient.js +48 -24
  13. package/client-dynamodb/getDocumentClient.js.map +1 -1
  14. package/client-dynamodb/index.d.ts +2 -1
  15. package/client-dynamodb/index.js +25 -19
  16. package/client-dynamodb/index.js.map +1 -1
  17. package/client-eventbridge/index.d.ts +5 -2
  18. package/client-eventbridge/index.js +9 -33
  19. package/client-eventbridge/index.js.map +1 -1
  20. package/client-iam/index.js +1 -1
  21. package/client-iam/index.js.map +1 -1
  22. package/client-iot/index.d.ts +1 -0
  23. package/client-iot/index.js +20 -0
  24. package/client-iot/index.js.map +1 -0
  25. package/client-lambda/index.d.ts +5 -1
  26. package/client-lambda/index.js +40 -2
  27. package/client-lambda/index.js.map +1 -1
  28. package/client-s3/index.d.ts +9 -3
  29. package/client-s3/index.js +89 -67
  30. package/client-s3/index.js.map +1 -1
  31. package/client-scheduler/index.d.ts +8 -0
  32. package/client-scheduler/index.js +60 -0
  33. package/client-scheduler/index.js.map +1 -0
  34. package/client-sfn/index.d.ts +12 -7
  35. package/client-sfn/index.js +64 -17
  36. package/client-sfn/index.js.map +1 -1
  37. package/client-sqs/index.js +3 -3
  38. package/client-sqs/index.js.map +1 -1
  39. package/client-sts/index.js +1 -1
  40. package/client-sts/index.js.map +1 -1
  41. package/credential-providers/index.js +1 -1
  42. package/credential-providers/index.js.map +1 -1
  43. package/lib-storage/index.d.ts +1 -1
  44. package/lib-storage/index.js +31 -1
  45. package/lib-storage/index.js.map +1 -1
  46. package/package.json +41 -30
  47. package/types/index.d.ts +1 -0
  48. package/types/index.js +18 -0
  49. package/types/index.js.map +1 -0
  50. package/client-eventbridge/types.d.ts +0 -29
  51. package/client-eventbridge/types.js +0 -7
  52. package/client-eventbridge/types.js.map +0 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "IAM", {
7
7
  enumerable: true,
8
- get: function get() {
8
+ get: function () {
9
9
  return _clientIam.IAM;
10
10
  }
11
11
  });
@@ -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"}
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":[]}
@@ -0,0 +1 @@
1
+ export { IoTClient, DescribeEndpointCommand } from "@aws-sdk/client-iot";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "DescribeEndpointCommand", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _clientIot.DescribeEndpointCommand;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "IoTClient", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _clientIot.IoTClient;
16
+ }
17
+ });
18
+ var _clientIot = require("@aws-sdk/client-iot");
19
+
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_clientIot","require"],"sources":["index.ts"],"sourcesContent":["export { IoTClient, DescribeEndpointCommand } from \"@aws-sdk/client-iot\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA","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 } from "@aws-sdk/client-lambda";
4
+ export type { InvocationType, InvokeCommandInput, LambdaClientConfig, InvokeCommandOutput, UpdateFunctionConfigurationCommandInput, UpdateFunctionConfigurationCommandOutput, UpdateFunctionCodeCommandInput, UpdateFunctionCodeCommandOutput } from "@aws-sdk/client-lambda";
5
+ export declare const createLambdaClient: (input?: Partial<LambdaClientConfig>) => LambdaClient;
@@ -3,18 +3,56 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "GetFunctionConfigurationCommand", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _clientLambda.GetFunctionConfigurationCommand;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "InvokeCommand", {
7
13
  enumerable: true,
8
- get: function get() {
14
+ get: function () {
9
15
  return _clientLambda.InvokeCommand;
10
16
  }
11
17
  });
12
18
  Object.defineProperty(exports, "LambdaClient", {
13
19
  enumerable: true,
14
- get: function get() {
20
+ get: function () {
15
21
  return _clientLambda.LambdaClient;
16
22
  }
17
23
  });
24
+ Object.defineProperty(exports, "UpdateFunctionCodeCommand", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _clientLambda.UpdateFunctionCodeCommand;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "UpdateFunctionConfigurationCommand", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _clientLambda.UpdateFunctionConfigurationCommand;
34
+ }
35
+ });
36
+ exports.createLambdaClient = void 0;
37
+ var _utils = require("@webiny/utils");
18
38
  var _clientLambda = require("@aws-sdk/client-lambda");
39
+ const DEFAULT_CONFIG = {
40
+ region: process.env.AWS_REGION
41
+ };
42
+ const lambdaClients = {};
43
+ const createLambdaClient = input => {
44
+ const config = {
45
+ ...DEFAULT_CONFIG,
46
+ ...input
47
+ };
48
+ const key = (0, _utils.createCacheKey)(config);
49
+ if (lambdaClients[key]) {
50
+ return lambdaClients[key];
51
+ }
52
+ const client = new _clientLambda.LambdaClient(config);
53
+ lambdaClients[key] = client;
54
+ return client;
55
+ };
56
+ exports.createLambdaClient = createLambdaClient;
19
57
 
20
58
  //# 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"}
1
+ {"version":3,"names":["_utils","require","_clientLambda","DEFAULT_CONFIG","region","process","env","AWS_REGION","lambdaClients","createLambdaClient","input","config","key","createCacheKey","client","LambdaClient","exports"],"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} from \"@aws-sdk/client-lambda\";\n\nexport type {\n InvocationType,\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,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAqBA,MAAME,cAAkC,GAAG;EACvCC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;AACxB,CAAC;AAED,MAAMC,aAA2C,GAAG,CAAC,CAAC;AAE/C,MAAMC,kBAAkB,GAAIC,KAAmC,IAAmB;EACrF,MAAMC,MAA0B,GAAG;IAC/B,GAAGR,cAAc;IACjB,GAAGO;EACP,CAAC;EACD,MAAME,GAAG,GAAG,IAAAC,qBAAc,EAACF,MAAM,CAAC;EAElC,IAAIH,aAAa,CAACI,GAAG,CAAC,EAAE;IACpB,OAAOJ,aAAa,CAACI,GAAG,CAAC;EAC7B;EAEA,MAAME,MAAM,GAAG,IAAIC,0BAAY,CAACJ,MAAM,CAAC;EAEvCH,aAAa,CAACI,GAAG,CAAC,GAAGE,MAAM;EAE3B,OAAOA,MAAM;AACjB,CAAC;AAACE,OAAA,CAAAP,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,6 +1,12 @@
1
- import { S3, S3ClientConfig } from "@aws-sdk/client-s3";
2
- export { CompleteMultipartUploadCommandOutput, 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, Part, DeleteObjectCommand, PutObjectCommand, PutObjectCommandInput, PutObjectRequest, UploadPartCommand, AbortMultipartUploadCommand, CompleteMultipartUploadCommand, CreateMultipartUploadCommand, S3, S3Client } from "@aws-sdk/client-s3";
4
+ export type { 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
6
  export { 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,172 +1,194 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- Object.defineProperty(exports, "CompleteMultipartUploadCommandOutput", {
6
+ Object.defineProperty(exports, "AbortMultipartUploadCommand", {
8
7
  enumerable: true,
9
- get: function get() {
10
- return _clientS.CompleteMultipartUploadCommandOutput;
8
+ get: function () {
9
+ return _clientS.AbortMultipartUploadCommand;
11
10
  }
12
11
  });
13
- Object.defineProperty(exports, "CompleteMultipartUploadOutput", {
12
+ Object.defineProperty(exports, "CompleteMultipartUploadCommand", {
14
13
  enumerable: true,
15
- get: function get() {
16
- return _clientS.CompleteMultipartUploadOutput;
14
+ get: function () {
15
+ return _clientS.CompleteMultipartUploadCommand;
17
16
  }
18
17
  });
19
- Object.defineProperty(exports, "DeleteObjectOutput", {
18
+ Object.defineProperty(exports, "CopyObjectCommand", {
20
19
  enumerable: true,
21
- get: function get() {
22
- return _clientS.DeleteObjectOutput;
20
+ get: function () {
21
+ return _clientS.CopyObjectCommand;
23
22
  }
24
23
  });
25
- Object.defineProperty(exports, "GetObjectCommand", {
24
+ Object.defineProperty(exports, "CreateMultipartUploadCommand", {
26
25
  enumerable: true,
27
- get: function get() {
28
- return _clientS.GetObjectCommand;
26
+ get: function () {
27
+ return _clientS.CreateMultipartUploadCommand;
29
28
  }
30
29
  });
31
- Object.defineProperty(exports, "GetObjectOutput", {
30
+ Object.defineProperty(exports, "DeleteObjectCommand", {
32
31
  enumerable: true,
33
- get: function get() {
34
- return _clientS.GetObjectOutput;
32
+ get: function () {
33
+ return _clientS.DeleteObjectCommand;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "GetObjectCommand", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _clientS.GetObjectCommand;
35
40
  }
36
41
  });
37
42
  Object.defineProperty(exports, "HeadObjectCommand", {
38
43
  enumerable: true,
39
- get: function get() {
44
+ get: function () {
40
45
  return _clientS.HeadObjectCommand;
41
46
  }
42
47
  });
43
- Object.defineProperty(exports, "HeadObjectOutput", {
48
+ Object.defineProperty(exports, "ListObjectsCommand", {
44
49
  enumerable: true,
45
- get: function get() {
46
- return _clientS.HeadObjectOutput;
50
+ get: function () {
51
+ return _clientS.ListObjectsCommand;
47
52
  }
48
53
  });
49
- Object.defineProperty(exports, "ListObjectsOutput", {
54
+ Object.defineProperty(exports, "ListObjectsV2Command", {
50
55
  enumerable: true,
51
- get: function get() {
52
- return _clientS.ListObjectsOutput;
56
+ get: function () {
57
+ return _clientS.ListObjectsV2Command;
53
58
  }
54
59
  });
55
60
  Object.defineProperty(exports, "ListPartsCommand", {
56
61
  enumerable: true,
57
- get: function get() {
62
+ get: function () {
58
63
  return _clientS.ListPartsCommand;
59
64
  }
60
65
  });
61
- Object.defineProperty(exports, "ListPartsCommandOutput", {
62
- enumerable: true,
63
- get: function get() {
64
- return _clientS.ListPartsCommandOutput;
65
- }
66
- });
67
- Object.defineProperty(exports, "ListPartsOutput", {
68
- enumerable: true,
69
- get: function get() {
70
- return _clientS.ListPartsOutput;
71
- }
72
- });
73
66
  Object.defineProperty(exports, "ObjectCannedACL", {
74
67
  enumerable: true,
75
- get: function get() {
68
+ get: function () {
76
69
  return _clientS.ObjectCannedACL;
77
70
  }
78
71
  });
79
72
  Object.defineProperty(exports, "Part", {
80
73
  enumerable: true,
81
- get: function get() {
74
+ get: function () {
82
75
  return _clientS.Part;
83
76
  }
84
77
  });
85
78
  Object.defineProperty(exports, "PresignedPost", {
86
79
  enumerable: true,
87
- get: function get() {
80
+ get: function () {
88
81
  return _s3PresignedPost.PresignedPost;
89
82
  }
90
83
  });
91
84
  Object.defineProperty(exports, "PresignedPostOptions", {
92
85
  enumerable: true,
93
- get: function get() {
86
+ get: function () {
94
87
  return _s3PresignedPost.PresignedPostOptions;
95
88
  }
96
89
  });
97
90
  Object.defineProperty(exports, "PutObjectCommand", {
98
91
  enumerable: true,
99
- get: function get() {
92
+ get: function () {
100
93
  return _clientS.PutObjectCommand;
101
94
  }
102
95
  });
103
96
  Object.defineProperty(exports, "PutObjectCommandInput", {
104
97
  enumerable: true,
105
- get: function get() {
98
+ get: function () {
106
99
  return _clientS.PutObjectCommandInput;
107
100
  }
108
101
  });
109
- Object.defineProperty(exports, "PutObjectCommandOutput", {
110
- enumerable: true,
111
- get: function get() {
112
- return _clientS.PutObjectCommandOutput;
113
- }
114
- });
115
102
  Object.defineProperty(exports, "PutObjectRequest", {
116
103
  enumerable: true,
117
- get: function get() {
104
+ get: function () {
118
105
  return _clientS.PutObjectRequest;
119
106
  }
120
107
  });
121
108
  Object.defineProperty(exports, "S3", {
122
109
  enumerable: true,
123
- get: function get() {
110
+ get: function () {
124
111
  return _clientS.S3;
125
112
  }
126
113
  });
127
114
  Object.defineProperty(exports, "S3Client", {
128
115
  enumerable: true,
129
- get: function get() {
116
+ get: function () {
130
117
  return _clientS.S3Client;
131
118
  }
132
119
  });
133
120
  Object.defineProperty(exports, "UploadPartCommand", {
134
121
  enumerable: true,
135
- get: function get() {
122
+ get: function () {
136
123
  return _clientS.UploadPartCommand;
137
124
  }
138
125
  });
126
+ Object.defineProperty(exports, "UploadPartCopyCommand", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _clientS.UploadPartCopyCommand;
130
+ }
131
+ });
139
132
  Object.defineProperty(exports, "createPresignedPost", {
140
133
  enumerable: true,
141
- get: function get() {
134
+ get: function () {
142
135
  return _s3PresignedPost.createPresignedPost;
143
136
  }
144
137
  });
145
- exports.createS3Client = void 0;
138
+ exports.createS3Client = exports.createS3 = void 0;
146
139
  Object.defineProperty(exports, "getSignedUrl", {
147
140
  enumerable: true,
148
- get: function get() {
141
+ get: function () {
149
142
  return _s3RequestPresigner.getSignedUrl;
150
143
  }
151
144
  });
152
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
153
145
  var _clientS = require("@aws-sdk/client-s3");
154
146
  var _utils = require("@webiny/utils");
155
147
  var _s3PresignedPost = require("@aws-sdk/s3-presigned-post");
156
148
  var _s3RequestPresigner = require("@aws-sdk/s3-request-presigner");
157
- var clients = new Map();
158
- var createS3Client = function createS3Client(initial) {
159
- var options = (0, _objectSpread2.default)({
160
- region: process.env.AWS_REGION
161
- }, initial);
162
- var key = (0, _utils.createCacheKey)(options);
163
- if (clients.has(key)) {
164
- return clients.get(key);
165
- }
166
- var instance = new _clientS.S3(options);
167
- clients.set(key, instance);
149
+ const s3ClientsCache = new Map();
150
+ const createS3Client = initial => {
151
+ const options = {
152
+ region: process.env.AWS_REGION,
153
+ ...initial
154
+ };
155
+ const skipCache = options.cache === false;
156
+ delete options.cache;
157
+ if (skipCache) {
158
+ return new _clientS.S3Client({
159
+ ...options
160
+ });
161
+ }
162
+ const key = (0, _utils.createCacheKey)(options);
163
+ if (s3ClientsCache.has(key)) {
164
+ return s3ClientsCache.get(key);
165
+ }
166
+ const instance = new _clientS.S3Client({
167
+ ...options
168
+ });
169
+ s3ClientsCache.set(key, instance);
168
170
  return instance;
169
171
  };
170
172
  exports.createS3Client = createS3Client;
173
+ const s3Cache = new Map();
174
+ const createS3 = initial => {
175
+ const options = {
176
+ region: process.env.AWS_REGION,
177
+ ...initial
178
+ };
179
+ const skipCache = options.cache === false;
180
+ delete options.cache;
181
+ if (skipCache) {
182
+ return new _clientS.S3(options);
183
+ }
184
+ const key = (0, _utils.createCacheKey)(options);
185
+ if (s3Cache.has(key)) {
186
+ return s3Cache.get(key);
187
+ }
188
+ const instance = new _clientS.S3(options);
189
+ s3Cache.set(key, instance);
190
+ return instance;
191
+ };
192
+ exports.createS3 = createS3;
171
193
 
172
194
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientS","require","_utils","_s3PresignedPost","_s3RequestPresigner","clients","Map","createS3Client","initial","options","_objectSpread2","default","region","process","env","AWS_REGION","key","createCacheKey","has","get","instance","S3","set","exports"],"sources":["index.ts"],"sourcesContent":["import { S3, S3ClientConfig } from \"@aws-sdk/client-s3\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport {\n CompleteMultipartUploadCommandOutput,\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;AAyBA,IAAAE,gBAAA,GAAAF,OAAA;AAGA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAMI,OAAO,GAAG,IAAIC,GAAG,CAAa,CAAC;AAE9B,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,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,IAAIJ,OAAO,CAACa,GAAG,CAACF,GAAG,CAAC,EAAE;IAClB,OAAOX,OAAO,CAACc,GAAG,CAACH,GAAG,CAAC;EAC3B;EAEA,IAAMI,QAAQ,GAAG,IAAIC,WAAE,CAACZ,OAAO,CAAC;EAChCJ,OAAO,CAACiB,GAAG,CAACN,GAAG,EAAEI,QAAQ,CAAC;EAC1B,OAAOA,QAAQ;AACnB,CAAC;AAACG,OAAA,CAAAhB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_clientS","require","_utils","_s3PresignedPost","_s3RequestPresigner","s3ClientsCache","Map","createS3Client","initial","options","region","process","env","AWS_REGION","skipCache","cache","S3Client","key","createCacheKey","has","get","instance","set","exports","s3Cache","createS3","S3"],"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 Part,\n DeleteObjectCommand,\n PutObjectCommand,\n PutObjectCommandInput,\n PutObjectRequest,\n UploadPartCommand,\n AbortMultipartUploadCommand,\n CompleteMultipartUploadCommand,\n CreateMultipartUploadCommand,\n S3,\n S3Client\n} from \"@aws-sdk/client-s3\";\n\nexport type {\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 { 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,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAoDA,IAAAE,gBAAA,GAAAF,OAAA;AAGA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,MAAMI,cAAc,GAAG,IAAIC,GAAG,CAAmB,CAAC;AAM3C,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,IAAIE,iBAAQ,CAAC;MAChB,GAAGP;IACP,CAAC,CAAC;EACN;EAEA,MAAMQ,GAAG,GAAG,IAAAC,qBAAc,EAACT,OAAO,CAAC;EACnC,IAAIJ,cAAc,CAACc,GAAG,CAACF,GAAG,CAAC,EAAE;IACzB,OAAOZ,cAAc,CAACe,GAAG,CAACH,GAAG,CAAC;EAClC;EAEA,MAAMI,QAAQ,GAAG,IAAIL,iBAAQ,CAAC;IAC1B,GAAGP;EACP,CAAC,CAAC;EACFJ,cAAc,CAACiB,GAAG,CAACL,GAAG,EAAEI,QAAQ,CAAC;EAEjC,OAAOA,QAAQ;AACnB,CAAC;AAACE,OAAA,CAAAhB,cAAA,GAAAA,cAAA;AAEF,MAAMiB,OAAO,GAAG,IAAIlB,GAAG,CAAa,CAAC;AAE9B,MAAMmB,QAAQ,GAAIjB,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,IAAIY,WAAE,CAACjB,OAAO,CAAC;EAC1B;EACA,MAAMQ,GAAG,GAAG,IAAAC,qBAAc,EAACT,OAAO,CAAC;EACnC,IAAIe,OAAO,CAACL,GAAG,CAACF,GAAG,CAAC,EAAE;IAClB,OAAOO,OAAO,CAACJ,GAAG,CAACH,GAAG,CAAC;EAC3B;EAEA,MAAMI,QAAQ,GAAG,IAAIK,WAAE,CAACjB,OAAO,CAAC;EAEhCe,OAAO,CAACF,GAAG,CAACL,GAAG,EAAEI,QAAQ,CAAC;EAC1B,OAAOA,QAAQ;AACnB,CAAC;AAACE,OAAA,CAAAE,QAAA,GAAAA,QAAA","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,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "CreateScheduleCommand", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _clientScheduler.CreateScheduleCommand;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "DeleteScheduleCommand", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _clientScheduler.DeleteScheduleCommand;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "GetScheduleCommand", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _clientScheduler.GetScheduleCommand;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "SchedulerClient", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _clientScheduler.SchedulerClient;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "UpdateScheduleCommand", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _clientScheduler.UpdateScheduleCommand;
34
+ }
35
+ });
36
+ exports.createSchedulerClient = void 0;
37
+ var _utils = require("@webiny/utils");
38
+ var _clientScheduler = require("@aws-sdk/client-scheduler");
39
+ const clients = {};
40
+ const createSchedulerClient = (input = {}) => {
41
+ const options = {
42
+ region: process.env.AWS_REGION,
43
+ ...input
44
+ };
45
+ const skipCache = options.cache === false;
46
+ delete options.cache;
47
+ if (skipCache) {
48
+ return new _clientScheduler.SchedulerClient(options);
49
+ }
50
+ const key = (0, _utils.createCacheKey)(options);
51
+ if (clients[key]) {
52
+ return clients[key];
53
+ }
54
+ const client = new _clientScheduler.SchedulerClient(options);
55
+ clients[key] = client;
56
+ return client;
57
+ };
58
+ exports.createSchedulerClient = createSchedulerClient;
59
+
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","_clientScheduler","clients","createSchedulerClient","input","options","region","process","env","AWS_REGION","skipCache","cache","SchedulerClient","key","createCacheKey","client","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAqBA,MAAME,OAAwC,GAAG,CAAC,CAAC;AAM5C,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,IAAIE,gCAAe,CAACP,OAAO,CAAC;EACvC;EAEA,MAAMQ,GAAG,GAAG,IAAAC,qBAAc,EAACT,OAAO,CAAC;EAEnC,IAAIH,OAAO,CAACW,GAAG,CAAC,EAAE;IACd,OAAOX,OAAO,CAACW,GAAG,CAAC;EACvB;EAEA,MAAME,MAAM,GAAG,IAAIH,gCAAe,CAACP,OAAO,CAAC;EAE3CH,OAAO,CAACW,GAAG,CAAC,GAAGE,MAAM;EAErB,OAAOA,MAAM;AACjB,CAAC;AAACC,OAAA,CAAAb,qBAAA,GAAAA,qBAAA","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,49 +1,96 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
6
+ Object.defineProperty(exports, "DescribeExecutionCommand", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _clientSfn.DescribeExecutionCommand;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ListExecutionsCommand", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _clientSfn.ListExecutionsCommand;
16
+ }
17
+ });
7
18
  Object.defineProperty(exports, "SFNClient", {
8
19
  enumerable: true,
9
- get: function get() {
20
+ get: function () {
10
21
  return _clientSfn.SFNClient;
11
22
  }
12
23
  });
13
24
  Object.defineProperty(exports, "SFNServiceException", {
14
25
  enumerable: true,
15
- get: function get() {
26
+ get: function () {
16
27
  return _clientSfn.SFNServiceException;
17
28
  }
18
29
  });
19
30
  Object.defineProperty(exports, "StartExecutionCommand", {
20
31
  enumerable: true,
21
- get: function get() {
32
+ get: function () {
22
33
  return _clientSfn.StartExecutionCommand;
23
34
  }
24
35
  });
25
- exports.triggerStepFunctionFactory = void 0;
26
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
36
+ exports.triggerStepFunctionFactory = exports.listExecutionsFactory = exports.describeExecutionFactory = exports.createStepFunctionClient = void 0;
27
37
  var _clientSfn = require("@aws-sdk/client-sfn");
28
- var getClient = function getClient(config) {
29
- if (config instanceof _clientSfn.SFNClient) {
30
- return config;
38
+ var _utils = require("@webiny/utils");
39
+ const stepFunctionClientsCache = new Map();
40
+ const createStepFunctionClient = initial => {
41
+ const config = {
42
+ region: process.env.AWS_REGION,
43
+ ...initial
44
+ };
45
+ const skipCache = config.cache === false;
46
+ delete config.cache;
47
+ if (skipCache) {
48
+ return new _clientSfn.SFNClient({
49
+ ...config
50
+ });
31
51
  }
32
- return new _clientSfn.SFNClient((0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
33
- region: config.region || process.env.AWS_REGION
34
- }));
52
+ const key = (0, _utils.createCacheKey)(config);
53
+ if (stepFunctionClientsCache.has(key)) {
54
+ return stepFunctionClientsCache.get(key);
55
+ }
56
+ return new _clientSfn.SFNClient({
57
+ ...config
58
+ });
35
59
  };
36
- var 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), {}, {
60
+ exports.createStepFunctionClient = createStepFunctionClient;
61
+ const triggerStepFunctionFactory = input => {
62
+ const client = input instanceof _clientSfn.SFNClient ? input : createStepFunctionClient(input);
63
+ return async params => {
64
+ const cmd = new _clientSfn.StartExecutionCommand({
65
+ ...params,
40
66
  stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN,
41
67
  name: params.name,
42
68
  input: JSON.stringify(params.input)
43
- }));
69
+ });
44
70
  return await client.send(cmd);
45
71
  };
46
72
  };
47
73
  exports.triggerStepFunctionFactory = triggerStepFunctionFactory;
74
+ const listExecutionsFactory = input => {
75
+ const client = input instanceof _clientSfn.SFNClient ? input : createStepFunctionClient(input);
76
+ return async params => {
77
+ const cmd = new _clientSfn.ListExecutionsCommand({
78
+ ...params,
79
+ stateMachineArn: params.stateMachineArn || process.env.BG_TASK_SFN_ARN
80
+ });
81
+ return await client.send(cmd);
82
+ };
83
+ };
84
+ exports.listExecutionsFactory = listExecutionsFactory;
85
+ const describeExecutionFactory = input => {
86
+ const client = input instanceof _clientSfn.SFNClient ? input : createStepFunctionClient(input);
87
+ return async params => {
88
+ const cmd = new _clientSfn.DescribeExecutionCommand({
89
+ ...params
90
+ });
91
+ return await client.send(cmd);
92
+ };
93
+ };
94
+ exports.describeExecutionFactory = describeExecutionFactory;
48
95
 
49
96
  //# sourceMappingURL=index.js.map