@webiny/aws-sdk 6.0.0-alpha.0 → 6.0.0-alpha.2

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.
@@ -1 +1,5 @@
1
- export { AdminCreateUserRequest, CognitoIdentityProvider, ListUsersResponse, UserType } from "@aws-sdk/client-cognito-identity-provider";
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, AdminCreateUserRequest, AdminGetUserRequest, CognitoIdentityProvider, CognitoIdentityProviderClient } from "@aws-sdk/client-cognito-identity-provider";
4
+ export type { AttributeType, ListUsersResponse, 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;
@@ -3,30 +3,74 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "AdminCreateUserCommand", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _clientCognitoIdentityProvider.AdminCreateUserCommand;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "AdminCreateUserRequest", {
7
13
  enumerable: true,
8
14
  get: function () {
9
15
  return _clientCognitoIdentityProvider.AdminCreateUserRequest;
10
16
  }
11
17
  });
12
- Object.defineProperty(exports, "CognitoIdentityProvider", {
18
+ Object.defineProperty(exports, "AdminDeleteUserCommand", {
13
19
  enumerable: true,
14
20
  get: function () {
15
- return _clientCognitoIdentityProvider.CognitoIdentityProvider;
21
+ return _clientCognitoIdentityProvider.AdminDeleteUserCommand;
16
22
  }
17
23
  });
18
- Object.defineProperty(exports, "ListUsersResponse", {
24
+ Object.defineProperty(exports, "AdminGetUserCommand", {
19
25
  enumerable: true,
20
26
  get: function () {
21
- return _clientCognitoIdentityProvider.ListUsersResponse;
27
+ return _clientCognitoIdentityProvider.AdminGetUserCommand;
22
28
  }
23
29
  });
24
- Object.defineProperty(exports, "UserType", {
30
+ Object.defineProperty(exports, "AdminGetUserRequest", {
25
31
  enumerable: true,
26
32
  get: function () {
27
- return _clientCognitoIdentityProvider.UserType;
33
+ return _clientCognitoIdentityProvider.AdminGetUserRequest;
28
34
  }
29
35
  });
36
+ Object.defineProperty(exports, "AdminUpdateUserAttributesCommand", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _clientCognitoIdentityProvider.AdminUpdateUserAttributesCommand;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "CognitoIdentityProvider", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _clientCognitoIdentityProvider.CognitoIdentityProvider;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "CognitoIdentityProviderClient", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _clientCognitoIdentityProvider.CognitoIdentityProviderClient;
52
+ }
53
+ });
54
+ exports.createCognitoIdentityProviderClient = void 0;
30
55
  var _clientCognitoIdentityProvider = require("@aws-sdk/client-cognito-identity-provider");
56
+ var _utils = require("@webiny/utils");
57
+ const DEFAULT_CONFIG = {
58
+ region: process.env.AWS_REGION
59
+ };
60
+ const cache = {};
61
+ const createCognitoIdentityProviderClient = input => {
62
+ const config = {
63
+ ...DEFAULT_CONFIG,
64
+ ...input
65
+ };
66
+ const key = (0, _utils.createCacheKey)(config);
67
+ if (cache[key]) {
68
+ return cache[key];
69
+ }
70
+ const client = new _clientCognitoIdentityProvider.CognitoIdentityProvider(config);
71
+ cache[key] = client;
72
+ return client;
73
+ };
74
+ exports.createCognitoIdentityProviderClient = createCognitoIdentityProviderClient;
31
75
 
32
76
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientCognitoIdentityProvider","require"],"sources":["index.ts"],"sourcesContent":["export {\n AdminCreateUserRequest,\n CognitoIdentityProvider,\n ListUsersResponse,\n UserType\n} from \"@aws-sdk/client-cognito-identity-provider\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_clientCognitoIdentityProvider","require","_utils","DEFAULT_CONFIG","region","process","env","AWS_REGION","cache","createCognitoIdentityProviderClient","input","config","key","createCacheKey","client","CognitoIdentityProvider","exports"],"sources":["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 AdminCreateUserRequest,\n AdminGetUserRequest,\n CognitoIdentityProvider,\n CognitoIdentityProviderClient\n} from \"@aws-sdk/client-cognito-identity-provider\";\n\nexport type {\n AttributeType,\n ListUsersResponse,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,8BAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AA4BA,MAAME,cAAc,GAAG;EACnBC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;AACxB,CAAC;AAED,MAAMC,KAAqD,GAAG,CAAC,CAAC;AAEzD,MAAMC,mCAAmC,GAC5CC,KAAoD,IACnD;EACD,MAAMC,MAA2C,GAAG;IAChD,GAAGR,cAAc;IACjB,GAAGO;EACP,CAAC;EACD,MAAME,GAAG,GAAG,IAAAC,qBAAc,EAACF,MAAM,CAAC;EAClC,IAAIH,KAAK,CAACI,GAAG,CAAC,EAAE;IACZ,OAAOJ,KAAK,CAACI,GAAG,CAAC;EACrB;EACA,MAAME,MAAM,GAAG,IAAIC,sDAAuB,CAACJ,MAAM,CAAC;EAClDH,KAAK,CAACI,GAAG,CAAC,GAAGE,MAAM;EACnB,OAAOA,MAAM;AACjB,CAAC;AAACE,OAAA,CAAAP,mCAAA,GAAAA,mCAAA","ignoreList":[]}
@@ -1,3 +1,8 @@
1
- import { DynamoDBClientConfig } from "@aws-sdk/client-dynamodb";
1
+ import type { DynamoDBClientConfig } from "@aws-sdk/client-dynamodb";
2
2
  import { DynamoDBDocument } from "@aws-sdk/lib-dynamodb";
3
+ export interface IDecorateDocumentClientCallable {
4
+ (client: DynamoDBDocument): DynamoDBDocument;
5
+ }
6
+ export { getDocumentClient as createDocumentClient };
3
7
  export declare const getDocumentClient: (input?: DynamoDBClientConfig) => DynamoDBDocument;
8
+ export declare const decorateDocumentClient: (cb: IDecorateDocumentClientCallable) => void;
@@ -1,23 +1,18 @@
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
- exports.getDocumentClient = void 0;
6
+ exports.getDocumentClient = exports.decorateDocumentClient = exports.createDocumentClient = void 0;
8
7
  var _clientDynamodb = require("@aws-sdk/client-dynamodb");
9
8
  var _libDynamodb = require("@aws-sdk/lib-dynamodb");
10
- var _crypto = _interopRequireDefault(require("crypto"));
9
+ var _utils = require("@webiny/utils");
10
+ let decorateDocumentClientCallable = undefined;
11
11
  const DEFAULT_CONFIG = {
12
12
  region: process.env.AWS_REGION
13
13
  };
14
- const createKey = config => {
15
- const key = JSON.stringify(config);
16
- const hash = _crypto.default.createHash("sha1");
17
- hash.update(key);
18
- return hash.digest("hex");
19
- };
20
14
  const documentClients = {};
15
+
21
16
  /**
22
17
  * We do not want users to be able to change these options, so we are not exposing them.
23
18
  */
@@ -29,16 +24,40 @@ const documentClientConfig = {
29
24
  }
30
25
  };
31
26
  const getDocumentClient = input => {
32
- const config = input || DEFAULT_CONFIG;
33
- const key = createKey(config);
27
+ const config = {
28
+ ...DEFAULT_CONFIG,
29
+ ...input
30
+ };
31
+ const key = (0, _utils.createCacheKey)(config);
34
32
  if (documentClients[key]) {
35
- return documentClients[key];
33
+ return applyDecoration(documentClients[key]);
36
34
  }
37
35
  const client = new _clientDynamodb.DynamoDBClient(config);
38
36
  const documentClient = _libDynamodb.DynamoDBDocument.from(client, documentClientConfig);
39
- documentClients[key] = documentClient;
40
- return documentClient;
37
+ return documentClients[key] = applyDecoration(documentClient);
38
+ };
39
+ /**
40
+ * Client will not be decorated more than once.
41
+ */
42
+ exports.getDocumentClient = exports.createDocumentClient = getDocumentClient;
43
+ const applyDecoration = client => {
44
+ if (!decorateDocumentClientCallable) {
45
+ return client;
46
+ }
47
+
48
+ // @ts-expect-error
49
+ client.__decoratedByWebiny = true;
50
+ return decorateDocumentClientCallable(client);
51
+ };
52
+ const decorateDocumentClient = cb => {
53
+ decorateDocumentClientCallable = cb;
54
+ /**
55
+ * Decorate already existing clients.
56
+ */
57
+ for (const key in documentClients) {
58
+ cb(documentClients[key]);
59
+ }
41
60
  };
42
- exports.getDocumentClient = getDocumentClient;
61
+ exports.decorateDocumentClient = decorateDocumentClient;
43
62
 
44
63
  //# sourceMappingURL=getDocumentClient.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientDynamodb","require","_libDynamodb","_crypto","_interopRequireDefault","DEFAULT_CONFIG","region","process","env","AWS_REGION","createKey","config","key","JSON","stringify","hash","crypto","createHash","update","digest","documentClients","documentClientConfig","marshallOptions","convertEmptyValues","removeUndefinedValues","convertClassInstanceToMap","getDocumentClient","input","client","DynamoDBClient","documentClient","DynamoDBDocument","from","exports"],"sources":["getDocumentClient.ts"],"sourcesContent":["import { DynamoDBClient, DynamoDBClientConfig } from \"@aws-sdk/client-dynamodb\";\nimport { DynamoDBDocument, TranslateConfig } from \"@aws-sdk/lib-dynamodb\";\nimport crypto from \"crypto\";\n\nconst DEFAULT_CONFIG = {\n region: process.env.AWS_REGION\n};\n\nconst createKey = (config: DynamoDBClientConfig): string => {\n const key = JSON.stringify(config);\n const hash = crypto.createHash(\"sha1\");\n hash.update(key);\n return hash.digest(\"hex\");\n};\n\nconst documentClients: Record<string, DynamoDBDocument> = {};\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 const getDocumentClient = (input?: DynamoDBClientConfig): DynamoDBDocument => {\n const config = input || DEFAULT_CONFIG;\n const key = createKey(config);\n if (documentClients[key]) {\n return documentClients[key];\n }\n const client = new DynamoDBClient(config);\n\n const documentClient = DynamoDBDocument.from(client, documentClientConfig);\n\n documentClients[key] = documentClient;\n return documentClient;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,MAAMI,cAAc,GAAG;EACnBC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;AACxB,CAAC;AAED,MAAMC,SAAS,GAAIC,MAA4B,IAAa;EACxD,MAAMC,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACH,MAAM,CAAC;EAClC,MAAMI,IAAI,GAAGC,eAAM,CAACC,UAAU,CAAC,MAAM,CAAC;EACtCF,IAAI,CAACG,MAAM,CAACN,GAAG,CAAC;EAChB,OAAOG,IAAI,CAACI,MAAM,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,MAAMC,eAAiD,GAAG,CAAC,CAAC;AAC5D;AACA;AACA;AACA,MAAMC,oBAAqC,GAAG;EAC1CC,eAAe,EAAE;IACbC,kBAAkB,EAAE,IAAI;IACxBC,qBAAqB,EAAE,IAAI;IAC3BC,yBAAyB,EAAE;EAC/B;AACJ,CAAC;AAEM,MAAMC,iBAAiB,GAAIC,KAA4B,IAAuB;EACjF,MAAMhB,MAAM,GAAGgB,KAAK,IAAItB,cAAc;EACtC,MAAMO,GAAG,GAAGF,SAAS,CAACC,MAAM,CAAC;EAC7B,IAAIS,eAAe,CAACR,GAAG,CAAC,EAAE;IACtB,OAAOQ,eAAe,CAACR,GAAG,CAAC;EAC/B;EACA,MAAMgB,MAAM,GAAG,IAAIC,8BAAc,CAAClB,MAAM,CAAC;EAEzC,MAAMmB,cAAc,GAAGC,6BAAgB,CAACC,IAAI,CAACJ,MAAM,EAAEP,oBAAoB,CAAC;EAE1ED,eAAe,CAACR,GAAG,CAAC,GAAGkB,cAAc;EACrC,OAAOA,cAAc;AACzB,CAAC;AAACG,OAAA,CAAAP,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_clientDynamodb","require","_libDynamodb","_utils","decorateDocumentClientCallable","undefined","DEFAULT_CONFIG","region","process","env","AWS_REGION","documentClients","documentClientConfig","marshallOptions","convertEmptyValues","removeUndefinedValues","convertClassInstanceToMap","getDocumentClient","input","config","key","createCacheKey","applyDecoration","client","DynamoDBClient","documentClient","DynamoDBDocument","from","exports","createDocumentClient","__decoratedByWebiny","decorateDocumentClient","cb"],"sources":["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"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAMA,IAAIG,8BAA2E,GAAGC,SAAS;AAE3F,MAAMC,cAAc,GAAG;EACnBC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAACC;AACxB,CAAC;AAED,MAAMC,eAAiD,GAAG,CAAC,CAAC;;AAE5D;AACA;AACA;AACA,MAAMC,oBAAqC,GAAG;EAC1CC,eAAe,EAAE;IACbC,kBAAkB,EAAE,IAAI;IACxBC,qBAAqB,EAAE,IAAI;IAC3BC,yBAAyB,EAAE;EAC/B;AACJ,CAAC;AAIM,MAAMC,iBAAiB,GAAIC,KAA4B,IAAuB;EACjF,MAAMC,MAA4B,GAAG;IACjC,GAAGb,cAAc;IACjB,GAAGY;EACP,CAAC;EACD,MAAME,GAAG,GAAG,IAAAC,qBAAc,EAACF,MAAM,CAAC;EAClC,IAAIR,eAAe,CAACS,GAAG,CAAC,EAAE;IACtB,OAAOE,eAAe,CAACX,eAAe,CAACS,GAAG,CAAC,CAAC;EAChD;EACA,MAAMG,MAAM,GAAG,IAAIC,8BAAc,CAACL,MAAM,CAAC;EACzC,MAAMM,cAAc,GAAGC,6BAAgB,CAACC,IAAI,CAACJ,MAAM,EAAEX,oBAAoB,CAAC;EAC1E,OAAQD,eAAe,CAACS,GAAG,CAAC,GAAGE,eAAe,CAACG,cAAc,CAAC;AAClE,CAAC;AACD;AACA;AACA;AAFAG,OAAA,CAAAX,iBAAA,GAAAW,OAAA,CAAAC,oBAAA,GAAAZ,iBAAA;AAGA,MAAMK,eAAe,GAAIC,MAAwB,IAAuB;EACpE,IAAI,CAACnB,8BAA8B,EAAE;IACjC,OAAOmB,MAAM;EACjB;;EAEA;EACAA,MAAM,CAACO,mBAAmB,GAAG,IAAI;EACjC,OAAO1B,8BAA8B,CAACmB,MAAM,CAAC;AACjD,CAAC;AAEM,MAAMQ,sBAAsB,GAAIC,EAAmC,IAAW;EACjF5B,8BAA8B,GAAG4B,EAAE;EACnC;AACJ;AACA;EACI,KAAK,MAAMZ,GAAG,IAAIT,eAAe,EAAE;IAC/BqB,EAAE,CAACrB,eAAe,CAACS,GAAG,CAAC,CAAC;EAC5B;AACJ,CAAC;AAACQ,OAAA,CAAAG,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  export { QueryCommand, ScanInput, ScanOutput, WriteRequest } from "@aws-sdk/client-dynamodb";
2
2
  export type { DynamoDBClient, DynamoDBClientConfig, AttributeValue } from "@aws-sdk/client-dynamodb";
3
3
  export type { StreamRecord } from "@aws-sdk/client-dynamodb-streams";
4
- export { GetCommandOutput, BatchWriteCommand, PutCommand, GetCommand, UpdateCommand, DeleteCommand, DynamoDBDocument } from "@aws-sdk/lib-dynamodb";
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";
5
6
  export { unmarshall, marshall } from "@aws-sdk/util-dynamodb";
6
7
  export { getDocumentClient } from "./getDocumentClient";
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "BatchGetCommand", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _libDynamodb.BatchGetCommand;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "BatchWriteCommand", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -27,12 +33,6 @@ Object.defineProperty(exports, "GetCommand", {
27
33
  return _libDynamodb.GetCommand;
28
34
  }
29
35
  });
30
- Object.defineProperty(exports, "GetCommandOutput", {
31
- enumerable: true,
32
- get: function () {
33
- return _libDynamodb.GetCommandOutput;
34
- }
35
- });
36
36
  Object.defineProperty(exports, "PutCommand", {
37
37
  enumerable: true,
38
38
  get: function () {
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "QueryCommand", {
45
45
  return _clientDynamodb.QueryCommand;
46
46
  }
47
47
  });
48
+ Object.defineProperty(exports, "ScanCommand", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _libDynamodb.ScanCommand;
52
+ }
53
+ });
48
54
  Object.defineProperty(exports, "ScanInput", {
49
55
  enumerable: true,
50
56
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_clientDynamodb","require","_libDynamodb","_utilDynamodb","_getDocumentClient"],"sources":["index.ts"],"sourcesContent":["export { QueryCommand, ScanInput, ScanOutput, WriteRequest } from \"@aws-sdk/client-dynamodb\";\nexport type {\n DynamoDBClient,\n DynamoDBClientConfig,\n AttributeValue\n} from \"@aws-sdk/client-dynamodb\";\n\nexport type { StreamRecord } from \"@aws-sdk/client-dynamodb-streams\";\n\nexport {\n GetCommandOutput,\n BatchWriteCommand,\n PutCommand,\n GetCommand,\n UpdateCommand,\n DeleteCommand,\n DynamoDBDocument\n} from \"@aws-sdk/lib-dynamodb\";\n\nexport { unmarshall, marshall } from \"@aws-sdk/util-dynamodb\";\n\nexport { getDocumentClient } from \"./getDocumentClient\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AAUA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_clientDynamodb","require","_libDynamodb","_utilDynamodb","_getDocumentClient"],"sources":["index.ts"],"sourcesContent":["export { QueryCommand, ScanInput, ScanOutput, WriteRequest } from \"@aws-sdk/client-dynamodb\";\nexport type {\n DynamoDBClient,\n DynamoDBClientConfig,\n AttributeValue\n} from \"@aws-sdk/client-dynamodb\";\n\nexport type { StreamRecord } from \"@aws-sdk/client-dynamodb-streams\";\n\nexport {\n BatchWriteCommand,\n BatchGetCommand,\n PutCommand,\n ScanCommand,\n GetCommand,\n UpdateCommand,\n DeleteCommand,\n DynamoDBDocument\n} from \"@aws-sdk/lib-dynamodb\";\n\nexport type {\n BatchWriteCommandInput,\n BatchWriteCommandOutput,\n BatchGetCommandInput,\n BatchGetCommandOutput,\n PutCommandInput,\n PutCommandOutput,\n UpdateCommandInput,\n GetCommandInput,\n GetCommandOutput,\n DeleteCommandInput,\n DeleteCommandOutput,\n ScanCommandInput,\n ScanCommandOutput,\n QueryCommandOutput\n} from \"@aws-sdk/lib-dynamodb\";\n\nexport { unmarshall, marshall } from \"@aws-sdk/util-dynamodb\";\n\nexport { getDocumentClient } from \"./getDocumentClient\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AA4BA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA","ignoreList":[]}
@@ -1 +1,5 @@
1
- export { EventBridgeClient, PutEventsRequestEntry, PutEventsCommand, PutEventsCommandInput, PutEventsCommandOutput } from "@aws-sdk/client-eventbridge";
1
+ import type { EventBridgeClientConfig } from "@aws-sdk/client-eventbridge";
2
+ import { EventBridgeClient } from "@aws-sdk/client-eventbridge";
3
+ export { EventBridgeClient, PutEventsRequestEntry, PutEventsCommand } from "@aws-sdk/client-eventbridge";
4
+ export type { EventBridgeClientConfig, PutEventsCommandInput, PutEventsCommandOutput } from "@aws-sdk/client-eventbridge";
5
+ export declare const createEventBridgeClient: (config?: Partial<EventBridgeClientConfig>) => EventBridgeClient;
@@ -15,24 +15,19 @@ Object.defineProperty(exports, "PutEventsCommand", {
15
15
  return _clientEventbridge.PutEventsCommand;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "PutEventsCommandInput", {
19
- enumerable: true,
20
- get: function () {
21
- return _clientEventbridge.PutEventsCommandInput;
22
- }
23
- });
24
- Object.defineProperty(exports, "PutEventsCommandOutput", {
25
- enumerable: true,
26
- get: function () {
27
- return _clientEventbridge.PutEventsCommandOutput;
28
- }
29
- });
30
18
  Object.defineProperty(exports, "PutEventsRequestEntry", {
31
19
  enumerable: true,
32
20
  get: function () {
33
21
  return _clientEventbridge.PutEventsRequestEntry;
34
22
  }
35
23
  });
24
+ exports.createEventBridgeClient = void 0;
36
25
  var _clientEventbridge = require("@aws-sdk/client-eventbridge");
26
+ const createEventBridgeClient = config => {
27
+ return new _clientEventbridge.EventBridgeClient({
28
+ ...config
29
+ });
30
+ };
31
+ exports.createEventBridgeClient = createEventBridgeClient;
37
32
 
38
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientEventbridge","require"],"sources":["index.ts"],"sourcesContent":["export {\n EventBridgeClient,\n PutEventsRequestEntry,\n PutEventsCommand,\n PutEventsCommandInput,\n PutEventsCommandOutput\n} from \"@aws-sdk/client-eventbridge\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_clientEventbridge","require","createEventBridgeClient","config","EventBridgeClient","exports"],"sources":["index.ts"],"sourcesContent":["import type { EventBridgeClientConfig } from \"@aws-sdk/client-eventbridge\";\nimport { EventBridgeClient } from \"@aws-sdk/client-eventbridge\";\n\nexport {\n EventBridgeClient,\n PutEventsRequestEntry,\n PutEventsCommand\n} from \"@aws-sdk/client-eventbridge\";\n\nexport type {\n EventBridgeClientConfig,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,kBAAA,GAAAC,OAAA;AAcO,MAAMC,uBAAuB,GAAIC,MAAyC,IAAK;EAClF,OAAO,IAAIC,oCAAiB,CAAC;IACzB,GAAGD;EACP,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAH,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1,5 @@
1
+ import type { LambdaClientConfig } from "@aws-sdk/client-lambda";
2
+ import { LambdaClient } from "@aws-sdk/client-lambda";
1
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;
@@ -33,6 +33,26 @@ Object.defineProperty(exports, "UpdateFunctionConfigurationCommand", {
33
33
  return _clientLambda.UpdateFunctionConfigurationCommand;
34
34
  }
35
35
  });
36
+ exports.createLambdaClient = void 0;
37
+ var _utils = require("@webiny/utils");
36
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;
37
57
 
38
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clientLambda","require"],"sources":["index.ts"],"sourcesContent":["export {\n LambdaClient,\n InvokeCommand,\n GetFunctionConfigurationCommand,\n UpdateFunctionConfigurationCommand,\n UpdateFunctionCodeCommand\n} from \"@aws-sdk/client-lambda\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA","ignoreList":[]}
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,7 @@
1
- import { S3, S3Client, S3ClientConfig as BaseS3ClientConfig } from "@aws-sdk/client-s3";
2
- export { GetObjectCommand, HeadObjectCommand, ListObjectsCommand, ListObjectsV2Command, ListPartsCommand, ObjectCannedACL, Part, DeleteObjectCommand, PutObjectCommand, PutObjectCommandInput, PutObjectRequest, UploadPartCommand, AbortMultipartUploadCommand, CompleteMultipartUploadCommand, CreateMultipartUploadCommand, S3, S3Client } from "@aws-sdk/client-s3";
3
- export type { CompleteMultipartUploadCommandOutput, AbortMultipartUploadCommandOutput, CompleteMultipartUploadOutput, DeleteObjectOutput, GetObjectOutput, GetObjectCommandOutput, HeadObjectOutput, HeadObjectCommandOutput, DeleteObjectCommandOutput, ListObjectsOutput, ListPartsCommandOutput, ListPartsOutput, PutObjectCommandOutput, UploadPartCommandOutput } 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";
4
5
  export { createPresignedPost } from "@aws-sdk/s3-presigned-post";
5
6
  export { PresignedPost, PresignedPostOptions } from "@aws-sdk/s3-presigned-post";
6
7
  export { getSignedUrl } from "@aws-sdk/s3-request-presigner";
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "CompleteMultipartUploadCommand", {
15
15
  return _clientS.CompleteMultipartUploadCommand;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "CopyObjectCommand", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _clientS.CopyObjectCommand;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "CreateMultipartUploadCommand", {
19
25
  enumerable: true,
20
26
  get: function () {
@@ -117,6 +123,12 @@ Object.defineProperty(exports, "UploadPartCommand", {
117
123
  return _clientS.UploadPartCommand;
118
124
  }
119
125
  });
126
+ Object.defineProperty(exports, "UploadPartCopyCommand", {
127
+ enumerable: true,
128
+ get: function () {
129
+ return _clientS.UploadPartCopyCommand;
130
+ }
131
+ });
120
132
  Object.defineProperty(exports, "createPresignedPost", {
121
133
  enumerable: true,
122
134
  get: function () {
@@ -1 +1 @@
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 { S3, S3Client, S3ClientConfig as BaseS3ClientConfig } from \"@aws-sdk/client-s3\";\nimport { createCacheKey } from \"@webiny/utils\";\n\nexport {\n GetObjectCommand,\n HeadObjectCommand,\n ListObjectsCommand,\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 CompleteMultipartUploadCommandOutput,\n AbortMultipartUploadCommandOutput,\n CompleteMultipartUploadOutput,\n DeleteObjectOutput,\n GetObjectOutput,\n GetObjectCommandOutput,\n HeadObjectOutput,\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAuCA,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":[]}
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":[]}
package/package.json CHANGED
@@ -1,37 +1,38 @@
1
1
  {
2
2
  "name": "@webiny/aws-sdk",
3
- "version": "6.0.0-alpha.0",
3
+ "version": "6.0.0-alpha.2",
4
4
  "description": "Wrapper for AWS SDK",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "author": "Webiny Ltd.",
8
8
  "dependencies": {
9
- "@aws-sdk/client-apigatewaymanagementapi": "3.734.0",
10
- "@aws-sdk/client-cloudfront": "3.734.0",
11
- "@aws-sdk/client-cloudwatch-events": "3.734.0",
12
- "@aws-sdk/client-cloudwatch-logs": "3.734.0",
13
- "@aws-sdk/client-cognito-identity-provider": "3.734.0",
14
- "@aws-sdk/client-dynamodb": "3.734.0",
15
- "@aws-sdk/client-dynamodb-streams": "3.734.0",
16
- "@aws-sdk/client-eventbridge": "3.734.0",
17
- "@aws-sdk/client-iam": "3.734.0",
18
- "@aws-sdk/client-iot": "3.734.0",
19
- "@aws-sdk/client-lambda": "3.734.0",
20
- "@aws-sdk/client-s3": "3.735.0",
21
- "@aws-sdk/client-sfn": "3.734.0",
22
- "@aws-sdk/client-sqs": "3.734.0",
23
- "@aws-sdk/client-sts": "3.734.0",
24
- "@aws-sdk/credential-providers": "3.734.0",
25
- "@aws-sdk/lib-dynamodb": "3.734.0",
26
- "@aws-sdk/lib-storage": "3.735.0",
27
- "@aws-sdk/s3-presigned-post": "3.735.0",
28
- "@aws-sdk/s3-request-presigner": "3.735.0",
29
- "@aws-sdk/util-dynamodb": "3.734.0",
9
+ "@aws-sdk/client-apigatewaymanagementapi": "3.821.0",
10
+ "@aws-sdk/client-cloudfront": "3.821.0",
11
+ "@aws-sdk/client-cloudwatch-events": "3.821.0",
12
+ "@aws-sdk/client-cloudwatch-logs": "3.821.0",
13
+ "@aws-sdk/client-cognito-identity-provider": "3.821.0",
14
+ "@aws-sdk/client-dynamodb": "3.821.0",
15
+ "@aws-sdk/client-dynamodb-streams": "3.821.0",
16
+ "@aws-sdk/client-eventbridge": "3.821.0",
17
+ "@aws-sdk/client-iam": "3.821.0",
18
+ "@aws-sdk/client-iot": "3.821.0",
19
+ "@aws-sdk/client-lambda": "3.821.0",
20
+ "@aws-sdk/client-s3": "3.821.0",
21
+ "@aws-sdk/client-scheduler": "3.821.0",
22
+ "@aws-sdk/client-sfn": "3.821.0",
23
+ "@aws-sdk/client-sqs": "3.821.0",
24
+ "@aws-sdk/client-sts": "3.821.0",
25
+ "@aws-sdk/credential-providers": "3.821.0",
26
+ "@aws-sdk/lib-dynamodb": "3.821.0",
27
+ "@aws-sdk/lib-storage": "3.821.0",
28
+ "@aws-sdk/s3-presigned-post": "3.821.0",
29
+ "@aws-sdk/s3-request-presigner": "3.821.0",
30
+ "@aws-sdk/util-dynamodb": "3.821.0",
30
31
  "@types/aws-lambda": "8.10.145",
31
- "@webiny/utils": "6.0.0-alpha.0"
32
+ "@webiny/utils": "6.0.0-alpha.2"
32
33
  },
33
34
  "devDependencies": {
34
- "@webiny/project-utils": "6.0.0-alpha.0",
35
+ "@webiny/project-utils": "6.0.0-alpha.2",
35
36
  "rimraf": "6.0.1",
36
37
  "typescript": "5.3.3"
37
38
  },
@@ -53,5 +54,5 @@
53
54
  ]
54
55
  }
55
56
  },
56
- "gitHead": "a5b28fed7a242d8f56712197a8ea83aa6d2ed101"
57
+ "gitHead": "7c9e8fbfd62a57ece5f880dbad6c864636b0355e"
57
58
  }