@aws-amplify/core 6.0.1-mjs-test.20ead30.0 → 6.0.1-mjs-test.237504c.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 (38) hide show
  1. package/dist/cjs/Platform/version.js +1 -1
  2. package/dist/cjs/Platform/version.js.map +1 -1
  3. package/dist/cjs/Reachability/Reachability.js +2 -2
  4. package/dist/cjs/Reachability/Reachability.js.map +1 -1
  5. package/dist/cjs/providers/pinpoint/apis/updateEndpoint.js +4 -3
  6. package/dist/cjs/providers/pinpoint/apis/updateEndpoint.js.map +1 -1
  7. package/dist/cjs/providers/pinpoint/utils/cacheEndpointId.js +2 -2
  8. package/dist/cjs/providers/pinpoint/utils/cacheEndpointId.js.map +1 -1
  9. package/dist/cjs/providers/pinpoint/utils/getEndpointId.js +2 -2
  10. package/dist/cjs/providers/pinpoint/utils/getEndpointId.js.map +1 -1
  11. package/dist/cjs/providers/pinpoint/utils/resolveEndpointId.js +2 -2
  12. package/dist/cjs/providers/pinpoint/utils/resolveEndpointId.js.map +1 -1
  13. package/dist/esm/Platform/version.d.ts +1 -1
  14. package/dist/esm/Platform/version.mjs +1 -1
  15. package/dist/esm/Platform/version.mjs.map +1 -1
  16. package/dist/esm/Reachability/Reachability.mjs +0 -12
  17. package/dist/esm/Reachability/Reachability.mjs.map +1 -1
  18. package/dist/esm/ServiceWorker/ServiceWorker.mjs +2 -6
  19. package/dist/esm/ServiceWorker/ServiceWorker.mjs.map +1 -1
  20. package/dist/esm/providers/pinpoint/apis/record.mjs +2 -18
  21. package/dist/esm/providers/pinpoint/apis/record.mjs.map +1 -1
  22. package/dist/esm/providers/pinpoint/apis/updateEndpoint.mjs +0 -4
  23. package/dist/esm/providers/pinpoint/apis/updateEndpoint.mjs.map +1 -1
  24. package/dist/esm/providers/pinpoint/index.mjs +0 -13
  25. package/dist/esm/providers/pinpoint/index.mjs.map +1 -1
  26. package/dist/esm/providers/pinpoint/utils/cacheEndpointId.mjs +0 -19
  27. package/dist/esm/providers/pinpoint/utils/cacheEndpointId.mjs.map +1 -1
  28. package/dist/esm/providers/pinpoint/utils/getEndpointId.mjs +0 -19
  29. package/dist/esm/providers/pinpoint/utils/getEndpointId.mjs.map +1 -1
  30. package/dist/esm/providers/pinpoint/utils/resolveEndpointId.mjs +0 -16
  31. package/dist/esm/providers/pinpoint/utils/resolveEndpointId.mjs.map +1 -1
  32. package/package.json +3 -3
  33. package/src/Platform/version.ts +1 -1
  34. package/src/Reachability/Reachability.ts +1 -1
  35. package/src/providers/pinpoint/apis/updateEndpoint.ts +2 -1
  36. package/src/providers/pinpoint/utils/cacheEndpointId.ts +1 -1
  37. package/src/providers/pinpoint/utils/getEndpointId.ts +1 -1
  38. package/src/providers/pinpoint/utils/resolveEndpointId.ts +1 -1
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.version = void 0;
5
5
  // generated by genversion
6
- exports.version = '6.0.1-mjs-test.20ead30.0+20ead30';
6
+ exports.version = '6.0.1-mjs-test.237504c.0+237504c';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.0.1-mjs-test.20ead30.0+20ead30';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
1
+ {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.0.1-mjs-test.237504c.0+237504c';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
@@ -5,10 +5,10 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Reachability = void 0;
7
7
  const rxjs_1 = require("rxjs");
8
- const libraryUtils_1 = require("../libraryUtils");
8
+ const utils_1 = require("../utils");
9
9
  class Reachability {
10
10
  networkMonitor(_) {
11
- const globalObj = (0, libraryUtils_1.isWebWorker)()
11
+ const globalObj = (0, utils_1.isWebWorker)()
12
12
  ? self
13
13
  : typeof window !== 'undefined' && window;
14
14
  if (!globalObj) {
@@ -1 +1 @@
1
- {"version":3,"file":"Reachability.js","sources":["../../../src/Reachability/Reachability.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Reachability = void 0;\nconst rxjs_1 = require(\"rxjs\");\nconst libraryUtils_1 = require(\"../libraryUtils\");\nclass Reachability {\n networkMonitor(_) {\n const globalObj = (0, libraryUtils_1.isWebWorker)()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return (0, rxjs_1.from)([{ online: true }]);\n }\n return new rxjs_1.Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => observer.next({ online: true });\n const notifyOffline = () => observer.next({ online: false });\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\nexports.Reachability = Reachability;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,YAAY,CAAC;AACnB,IAAI,cAAc,CAAC,CAAC,EAAE;AACtB,QAAQ,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,WAAW,GAAG;AAC3D,cAAc,IAAI;AAClB,cAAc,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC;AACtD,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxD,SAAS;AACT,QAAQ,OAAO,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,IAAI;AACjD,YAAY,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AAClE,YAAY,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,YAAY,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACzE,YAAY,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC/D,YAAY,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACjE,YAAY,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnD,YAAY,OAAO,MAAM;AACzB,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACtE,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACxE,gBAAgB,YAAY,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,CAAC;AAC9G,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA,IAAI,OAAO,iBAAiB,CAAC,MAAM,EAAE;AACrC,QAAQ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;AAChD,YAAY,IAAI,QAAQ,CAAC,MAAM,EAAE;AACjC,gBAAgB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,CAAC;AAC9F,gBAAgB,SAAS;AACzB,aAAa;AACb,YAAY,QAAQ,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpD,SAAS;AACT,KAAK;AACL,CAAC;AACD,YAAY,CAAC,UAAU,GAAG,EAAE,CAAC;AAC7B,OAAO,CAAC,YAAY,GAAG,YAAY;;"}
1
+ {"version":3,"file":"Reachability.js","sources":["../../../src/Reachability/Reachability.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Reachability = void 0;\nconst rxjs_1 = require(\"rxjs\");\nconst utils_1 = require(\"../utils\");\nclass Reachability {\n networkMonitor(_) {\n const globalObj = (0, utils_1.isWebWorker)()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return (0, rxjs_1.from)([{ online: true }]);\n }\n return new rxjs_1.Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => observer.next({ online: true });\n const notifyOffline = () => observer.next({ online: false });\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\nexports.Reachability = Reachability;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC;AAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC,MAAM,YAAY,CAAC;AACnB,IAAI,cAAc,CAAC,CAAC,EAAE;AACtB,QAAQ,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,WAAW,GAAG;AACpD,cAAc,IAAI;AAClB,cAAc,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC;AACtD,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxD,SAAS;AACT,QAAQ,OAAO,IAAI,MAAM,C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,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpD,SAAS;AACT,KAAK;AACL,CAAC;AACD,YAAY,CAAC,UAAU,GAAG,EAAE,CAAC;AAC7B,OAAO,CAAC,YAAY,GAAG,YAAY;;"}
@@ -7,12 +7,13 @@ exports.updateEndpoint = void 0;
7
7
  const amplifyUuid_1 = require("../../../utils/amplifyUuid");
8
8
  const getClientInfo_1 = require("../../../utils/getClientInfo");
9
9
  const pinpoint_1 = require("../../../awsClients/pinpoint");
10
- const utils_1 = require("../utils");
10
+ const cacheEndpointId_1 = require("../utils/cacheEndpointId");
11
+ const getEndpointId_1 = require("../utils/getEndpointId");
11
12
  /**
12
13
  * @internal
13
14
  */
14
15
  const updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {
15
- const endpointId = await (0, utils_1.getEndpointId)(appId, category);
16
+ const endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);
16
17
  // only generate a new endpoint id if one was not found in cache
17
18
  const createdEndpointId = !endpointId ? (0, amplifyUuid_1.amplifyUuid)() : undefined;
18
19
  const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};
@@ -70,7 +71,7 @@ const updateEndpoint = async ({ address, appId, category, channelType, credentia
70
71
  await (0, pinpoint_1.updateEndpoint)({ credentials, region, userAgentValue }, input);
71
72
  // if we had to create an endpoint id, we need to now cache it
72
73
  if (!!createdEndpointId) {
73
- return (0, utils_1.cacheEndpointId)(appId, category, createdEndpointId);
74
+ return (0, cacheEndpointId_1.cacheEndpointId)(appId, category, createdEndpointId);
74
75
  }
75
76
  };
76
77
  exports.updateEndpoint = updateEndpoint;
@@ -1 +1 @@
1
- {"version":3,"file":"updateEndpoint.js","sources":["../../../../../src/providers/pinpoint/apis/updateEndpoint.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateEndpoint = void 0;\nconst amplifyUuid_1 = require(\"../../../utils/amplifyUuid\");\nconst getClientInfo_1 = require(\"../../../utils/getClientInfo\");\nconst pinpoint_1 = require(\"../../../awsClients/pinpoint\");\nconst utils_1 = require(\"../utils\");\n/**\n * @internal\n */\nconst updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {\n const endpointId = await (0, utils_1.getEndpointId)(appId, category);\n // only generate a new endpoint id if one was not found in cache\n const createdEndpointId = !endpointId ? (0, amplifyUuid_1.amplifyUuid)() : undefined;\n const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};\n const clientInfo = (0, getClientInfo_1.getClientInfo)();\n const mergedDemographic = {\n appVersion: clientInfo.appVersion,\n make: clientInfo.make,\n model: clientInfo.model,\n modelVersion: clientInfo.version,\n platform: clientInfo.platform,\n ...demographic,\n };\n const shouldAddAttributes = email || customProperties || name || plan;\n const attributes = {\n ...(email && { email: [email] }),\n ...(name && { name: [name] }),\n ...(plan && { plan: [plan] }),\n ...customProperties,\n };\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId ?? createdEndpointId,\n EndpointRequest: {\n RequestId: (0, amplifyUuid_1.amplifyUuid)(),\n EffectiveDate: new Date().toISOString(),\n ChannelType: channelType,\n Address: address,\n Attributes: shouldAddAttributes ? attributes : undefined,\n Demographic: {\n AppVersion: mergedDemographic.appVersion,\n Locale: mergedDemographic.locale,\n Make: mergedDemographic.make,\n Model: mergedDemographic.model,\n ModelVersion: mergedDemographic.modelVersion,\n Platform: mergedDemographic.platform,\n PlatformVersion: mergedDemographic.platformVersion,\n Timezone: mergedDemographic.timezone,\n },\n Location: {\n City: location?.city,\n Country: location?.country,\n Latitude: location?.latitude,\n Longitude: location?.longitude,\n PostalCode: location?.postalCode,\n Region: location?.region,\n },\n Metrics: metrics,\n OptOut: optOut,\n User: {\n UserId: userId ?? identityId,\n UserAttributes: userAttributes,\n },\n },\n };\n await (0, pinpoint_1.updateEndpoint)({ credentials, region, userAgentValue }, input);\n // if we had to create an endpoint id, we need to now cache it\n if (!!createdEndpointId) {\n return (0, utils_1.cacheEndpointId)(appId, category, createdEndpointId);\n }\n};\nexports.updateEndpoint = updateEndpoint;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC,MAAM,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpC;AACA;AACA;AACA,MAAM,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,KAAK;AAC3K,IAAI,MAAM,UAAU,GAAG,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACzE;AACA,IAAI,MAAM,iBAAiB,GAAG,CAAC,UAAU,GAAG,IAAI,aAAa,CAAC,WAAW,GAAG,GAAG,SAAS,CAAC;AACzF,IAAI,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvG,IAAI,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC,aAAa,GAAG,CAAC;AAC5D,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAA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AC9C,gBAAgB,YAAY,EAAE,iBAAiB,CAAC,YAAY;AAC5D,gBAAgB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;AACpD,gBAAgB,eAAe,EAAE,iBAAiB,CAAC,eAAe;AAClE,gBAAgB,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;AACpD,aAAa;AACb,YAAY,QAAQ,EAAE;AACtB,gBAAgB,IAAI,EAAE,QAAQ,EAAE,IAAI;AACpC,gBAAgB,OAAO,EAAE,QAAQ,EAAE,OAAO;AAC1C,gBAAgB,QAAQ,EAAE,QAAQ,EAAE,QAAQ;AAC5C,gBAAgB,SAAS,EAAE,QAAQ,EAAE,SAAS;AAC9C,gBAAgB,UAAU,EAAE,QAAQ,EAAE,UAAU;AAChD,gBAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM;AACxC,aAAa;AACb,YAAY,OAAO,EAAE,OAAO;AAC5B,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,IAAI,EAAE;AAClB,gBAAgB,MAAM,EAAE,MAAM,IAAI,UAAU;AAC5C,gBAAgB,cAAc,EAAE,cAAc;AAC9C,aAAa;AACb,SAAS;AACT,KAAK,CAAC;AACN,IAAI,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,KAAK,CAAC,CAAC;AACzF;AACA,IAAI,IAAI,CAAC,CAAC,iBAAiB,EAAE;AAC7B,QAAQ,OAAO,IAAI,OAAO,CAAC,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AAChF,KAAK;AACL,CAAC,CAAC;AACF,OAAO,CAAC,cAAc,GAAG,cAAc;;"}
1
+ {"version":3,"file":"updateEndpoint.js","sources":["../../../../../src/providers/pinpoint/apis/updateEndpoint.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.updateEndpoint = void 0;\nconst amplifyUuid_1 = require(\"../../../utils/amplifyUuid\");\nconst getClientInfo_1 = require(\"../../../utils/getClientInfo\");\nconst pinpoint_1 = require(\"../../../awsClients/pinpoint\");\nconst cacheEndpointId_1 = require(\"../utils/cacheEndpointId\");\nconst getEndpointId_1 = require(\"../utils/getEndpointId\");\n/**\n * @internal\n */\nconst updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {\n const endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);\n // only generate a new endpoint id if one was not found in cache\n const createdEndpointId = !endpointId ? (0, amplifyUuid_1.amplifyUuid)() : undefined;\n const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};\n const clientInfo = (0, getClientInfo_1.getClientInfo)();\n const mergedDemographic = {\n appVersion: clientInfo.appVersion,\n make: clientInfo.make,\n model: clientInfo.model,\n modelVersion: clientInfo.version,\n platform: clientInfo.platform,\n ...demographic,\n };\n const shouldAddAttributes = email || customProperties || name || plan;\n const attributes = {\n ...(email && { email: [email] }),\n ...(name && { name: [name] }),\n ...(plan && { plan: [plan] }),\n ...customProperties,\n };\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId ?? createdEndpointId,\n EndpointRequest: {\n RequestId: (0, amplifyUuid_1.amplifyUuid)(),\n EffectiveDate: new Date().toISOString(),\n ChannelType: channelType,\n Address: address,\n Attributes: shouldAddAttributes ? attributes : undefined,\n Demographic: {\n AppVersion: mergedDemographic.appVersion,\n Locale: mergedDemographic.locale,\n Make: mergedDemographic.make,\n Model: mergedDemographic.model,\n ModelVersion: mergedDemographic.modelVersion,\n Platform: mergedDemographic.platform,\n PlatformVersion: mergedDemographic.platformVersion,\n Timezone: mergedDemographic.timezone,\n },\n Location: {\n City: location?.city,\n Country: location?.country,\n Latitude: location?.latitude,\n Longitude: location?.longitude,\n PostalCode: location?.postalCode,\n Region: location?.region,\n },\n Metrics: metrics,\n OptOut: optOut,\n User: {\n UserId: userId ?? identityId,\n UserAttributes: userAttributes,\n },\n },\n };\n await (0, pinpoint_1.updateEndpoint)({ credentials, region, userAgentValue }, input);\n // if we had to create an endpoint id, we need to now cache it\n if (!!createdEndpointId) {\n return (0, cacheEndpointId_1.cacheEndpointId)(appId, category, createdEndpointId);\n }\n};\nexports.updateEndpoint = updateEndpoint;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC,MAAM,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAChE,MAAM,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC3D,MAAM,iBAAiB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC9D,MAAM,eAAe,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAC1D;AACA;AACA;AACA,MAAM,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,KAAK;AAC3K,IAAI,MAAM,UAAU,GAAG,MAAM,IAAI,eAAe,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACjF;AACA,IAAI,MAAM,iBAAiB,GAAG,CAAC,UAAU,GAAG,IAAI,aAAa,CAAC,WAAW,GAAG,GAAG,SAAS,CAAC;AACzF,IAAI,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,WAAW,I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.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.cacheEndpointId = void 0;
7
- const __1 = require("../../..");
7
+ const Cache_1 = require("../../../Cache");
8
8
  const getCacheKey_1 = require("./getCacheKey");
9
9
  /**
10
10
  * Writes an endpoint id to a long-lived cache.
@@ -17,7 +17,7 @@ const cacheEndpointId = async (appId, category, endpointId) => {
17
17
  // Also set its priority to the highest to reduce its chance of being deleted when cache is full
18
18
  const ttl = 1000 * 60 * 60 * 24 * 365 * 100; // 100 years
19
19
  const expiration = new Date().getTime() + ttl;
20
- return __1.Cache.setItem(cacheKey, endpointId, {
20
+ return Cache_1.Cache.setItem(cacheKey, endpointId, {
21
21
  expires: expiration,
22
22
  priority: 1,
23
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cacheEndpointId.js","sources":["../../../../../src/providers/pinpoint/utils/cacheEndpointId.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cacheEndpointId = void 0;\nconst __1 = require(\"../../..\");\nconst getCacheKey_1 = require(\"./getCacheKey\");\n/**\n * Writes an endpoint id to a long-lived cache.\n *\n * @internal\n */\nconst cacheEndpointId = async (appId, category, endpointId) => {\n const cacheKey = (0, getCacheKey_1.getCacheKey)(appId, category);\n // Set a longer TTL to avoid endpoint id being deleted after the default TTL (3 days)\n // Also set its priority to the highest to reduce its chance of being deleted when cache is full\n const ttl = 1000 * 60 * 60 * 24 * 365 * 100; // 100 years\n const expiration = new Date().getTime() + ttl;\n return __1.Cache.setItem(cacheKey, endpointId, {\n expires: expiration,\n priority: 1,\n });\n};\nexports.cacheEndpointId = cacheEndpointId;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,KAAK;AAC/D,IAAI,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACrE;AACA;AACA,IAAI,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAChD,IAAI,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAClD,IAAI,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;AACnD,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,QAAQ,EAAE,CAAC;AACnB,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
1
+ {"version":3,"file":"cacheEndpointId.js","sources":["../../../../../src/providers/pinpoint/utils/cacheEndpointId.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.cacheEndpointId = void 0;\nconst Cache_1 = require(\"../../../Cache\");\nconst getCacheKey_1 = require(\"./getCacheKey\");\n/**\n * Writes an endpoint id to a long-lived cache.\n *\n * @internal\n */\nconst cacheEndpointId = async (appId, category, endpointId) => {\n const cacheKey = (0, getCacheKey_1.getCacheKey)(appId, category);\n // Set a longer TTL to avoid endpoint id being deleted after the default TTL (3 days)\n // Also set its priority to the highest to reduce its chance of being deleted when cache is full\n const ttl = 1000 * 60 * 60 * 24 * 365 * 100; // 100 years\n const expiration = new Date().getTime() + ttl;\n return Cache_1.Cache.setItem(cacheKey, endpointId, {\n expires: expiration,\n priority: 1,\n });\n};\nexports.cacheEndpointId = cacheEndpointId;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,CAAC;AACjC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe,GAAG,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,KAAK;AAC/D,IAAI,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACrE;AACA;AACA,IAAI,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAChD,IAAI,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAClD,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;AACvD,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,QAAQ,EAAE,CAAC;AACnB,KAAK,CAAC,CAAC;AACP,CAAC,CAAC;AACF,OAAO,CAAC,eAAe,GAAG,eAAe;;"}
@@ -4,7 +4,7 @@
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getEndpointId = void 0;
7
- const __1 = require("../../..");
7
+ const Cache_1 = require("../../../Cache");
8
8
  const getCacheKey_1 = require("./getCacheKey");
9
9
  /**
10
10
  * Returns an endpoint id from cache or `undefined` if not found.
@@ -13,7 +13,7 @@ const getCacheKey_1 = require("./getCacheKey");
13
13
  */
14
14
  const getEndpointId = async (appId, category) => {
15
15
  const cacheKey = (0, getCacheKey_1.getCacheKey)(appId, category);
16
- const cachedEndpointId = await __1.Cache.getItem(cacheKey);
16
+ const cachedEndpointId = await Cache_1.Cache.getItem(cacheKey);
17
17
  return cachedEndpointId ?? undefined;
18
18
  };
19
19
  exports.getEndpointId = getEndpointId;
@@ -1 +1 @@
1
- {"version":3,"file":"getEndpointId.js","sources":["../../../../../src/providers/pinpoint/utils/getEndpointId.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getEndpointId = void 0;\nconst __1 = require(\"../../..\");\nconst getCacheKey_1 = require(\"./getCacheKey\");\n/**\n * Returns an endpoint id from cache or `undefined` if not found.\n *\n * @internal\n */\nconst getEndpointId = async (appId, category) => {\n const cacheKey = (0, getCacheKey_1.getCacheKey)(appId, category);\n const cachedEndpointId = await __1.Cache.getItem(cacheKey);\n return cachedEndpointId ?? undefined;\n};\nexports.getEndpointId = getEndpointId;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAChC,MAAM,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACjD,IAAI,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACrE,IAAI,MAAM,gBAAgB,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/D,IAAI,OAAO,gBAAgB,IAAI,SAAS,CAAC;AACzC,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
1
+ {"version":3,"file":"getEndpointId.js","sources":["../../../../../src/providers/pinpoint/utils/getEndpointId.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getEndpointId = void 0;\nconst Cache_1 = require(\"../../../Cache\");\nconst getCacheKey_1 = require(\"./getCacheKey\");\n/**\n * Returns an endpoint id from cache or `undefined` if not found.\n *\n * @internal\n */\nconst getEndpointId = async (appId, category) => {\n const cacheKey = (0, getCacheKey_1.getCacheKey)(appId, category);\n const cachedEndpointId = await Cache_1.Cache.getItem(cacheKey);\n return cachedEndpointId ?? undefined;\n};\nexports.getEndpointId = getEndpointId;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAAC;AAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC/C;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACjD,IAAI,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AACrE,IAAI,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnE,IAAI,OAAO,gBAAgB,IAAI,SAAS,CAAC;AACzC,CAAC,CAAC;AACF,OAAO,CAAC,aAAa,GAAG,aAAa;;"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resolveEndpointId = void 0;
7
7
  const errors_1 = require("../../../errors");
8
8
  const types_1 = require("../../../types");
9
- const apis_1 = require("../apis");
9
+ const updateEndpoint_1 = require("../apis/updateEndpoint");
10
10
  const getEndpointId_1 = require("./getEndpointId");
11
11
  /**
12
12
  * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
@@ -17,7 +17,7 @@ const getEndpointId_1 = require("./getEndpointId");
17
17
  const resolveEndpointId = async ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }) => {
18
18
  let endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);
19
19
  if (!endpointId) {
20
- await (0, apis_1.updateEndpoint)({
20
+ await (0, updateEndpoint_1.updateEndpoint)({
21
21
  address,
22
22
  appId,
23
23
  category,
@@ -1 +1 @@
1
- {"version":3,"file":"resolveEndpointId.js","sources":["../../../../../src/providers/pinpoint/utils/resolveEndpointId.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveEndpointId = void 0;\nconst errors_1 = require(\"../../../errors\");\nconst types_1 = require(\"../../../types\");\nconst apis_1 = require(\"../apis\");\nconst getEndpointId_1 = require(\"./getEndpointId\");\n/**\n * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,\n * which will generate and cache an endpoint id between calls.\n *\n * @internal\n */\nconst resolveEndpointId = async ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }) => {\n let endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);\n if (!endpointId) {\n await (0, apis_1.updateEndpoint)({\n address,\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);\n }\n (0, errors_1.assert)(!!endpointId, types_1.AmplifyErrorCode.NoEndpointId);\n return endpointId;\n};\nexports.resolveEndpointId = resolveEndpointId;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AACjI,IAAI,IAAI,UAAU,GAAG,MAAM,IAAI,eAAe,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC/E,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,MAAM,IAAI,MAAM,CAAC,cAAc,EAAE;AACzC,YAAY,OAAO;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ;AACpB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,SAAS,CAAC,CAAC;AACX,QAAQ,UAAU,GAAG,MAAM,IAAI,eAAe,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC/E,KAAK;AACL,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC9E,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AACF,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;;"}
1
+ {"version":3,"file":"resolveEndpointId.js","sources":["../../../../../src/providers/pinpoint/utils/resolveEndpointId.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.resolveEndpointId = void 0;\nconst errors_1 = require(\"../../../errors\");\nconst types_1 = require(\"../../../types\");\nconst updateEndpoint_1 = require(\"../apis/updateEndpoint\");\nconst getEndpointId_1 = require(\"./getEndpointId\");\n/**\n * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,\n * which will generate and cache an endpoint id between calls.\n *\n * @internal\n */\nconst resolveEndpointId = async ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }) => {\n let endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);\n if (!endpointId) {\n await (0, updateEndpoint_1.updateEndpoint)({\n address,\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n endpointId = await (0, getEndpointId_1.getEndpointId)(appId, category);\n }\n (0, errors_1.assert)(!!endpointId, types_1.AmplifyErrorCode.NoEndpointId);\n return endpointId;\n};\nexports.resolveEndpointId = resolveEndpointId;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C,MAAM,gBAAgB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAC3D,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AACjI,IAAI,IAAI,UAAU,GAAG,MAAM,IAAI,eAAe,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC/E,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,MAAM,IAAI,gBAAgB,CAAC,cAAc,EAAE;AACnD,YAAY,OAAO;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ;AACpB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,SAAS,CAAC,CAAC;AACX,QAAQ,UAAU,GAAG,MAAM,IAAI,eAAe,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC/E,KAAK;AACL,IAAI,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AAC9E,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AACF,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;;"}
@@ -1 +1 @@
1
- export declare const version = "6.0.1-mjs-test.20ead30.0+20ead30";
1
+ export declare const version = "6.0.1-mjs-test.237504c.0+237504c";
@@ -1,5 +1,5 @@
1
1
  // generated by genversion
2
- const version = '6.0.1-mjs-test.20ead30.0+20ead30';
2
+ const version = '6.0.1-mjs-test.237504c.0+237504c';
3
3
 
4
4
  export { version };
5
5
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.1-mjs-test.20ead30.0+20ead30';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.0.1-mjs-test.237504c.0+237504c';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
@@ -1,19 +1,7 @@
1
1
  import { from, Observable } from 'rxjs';
2
- import '../types/errors.mjs';
3
- import '../errors/errorHelpers.mjs';
4
2
  import '../utils/getClientInfo/getClientInfo.mjs';
5
3
  import { isWebWorker } from '../utils/isWebWorker.mjs';
6
4
  import '../utils/retry/retry.mjs';
7
- import '../parseAWSExports.mjs';
8
- import 'uuid';
9
- import '../singleton/Auth/utils/errorHelpers.mjs';
10
- import '@aws-crypto/sha256-js';
11
- import '@smithy/util-hex-encoding';
12
- import '../Platform/types.mjs';
13
- import '../Platform/detection/index.mjs';
14
- import '../BackgroundProcessManager/types.mjs';
15
- import '../Hub/index.mjs';
16
- import '../utils/sessionListener/index.mjs';
17
5
 
18
6
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
7
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"Reachability.mjs","sources":["../../../src/Reachability/Reachability.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable, from } from 'rxjs';\nimport { isWebWorker } from '../libraryUtils';\nclass Reachability {\n networkMonitor(_) {\n const globalObj = isWebWorker()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return from([{ online: true }]);\n }\n return new Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => observer.next({ online: true });\n const notifyOffline = () => observer.next({ online: false });\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\nexport { Reachability };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AAGA,MAAM,YAAY,CAAC;AACnB,IAAI,cAAc,CAAC,CAAC,EAAE;AACtB,QAAQ,MAAM,SAAS,GAAG,WAAW,EAAE;AACvC,cAAc,IAAI;AAClB,cAAc,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC;AACtD,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,SAAS;AACT,QAAQ,OAAO,IAAI,UAAU,CAAC,QAAQ,IAAI;AAC1C,YAAY,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AAClE,YAAY,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,YAAY,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACzE,YAAY,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC/D,YAAY,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACjE,YAAY,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnD,YAAY,OAAO,MAAM;AACzB,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACtE,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACxE,gBAAgB,YAAY,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,CAAC;AAC9G,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA,IAAI,OAAO,iBAAiB,CAAC,MAAM,EAAE;AACrC,QAAQ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;AAChD,YAAY,IAAI,QAAQ,CAAC,MAAM,EAAE;AACjC,gBAAgB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,CAAC;AAC9F,gBAAgB,SAAS;AACzB,aAAa;AACb,YAAY,QAAQ,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpD,SAAS;AACT,KAAK;AACL,CAAC;AACD,YAAY,CAAC,UAAU,GAAG,EAAE;;;;"}
1
+ {"version":3,"file":"Reachability.mjs","sources":["../../../src/Reachability/Reachability.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Observable, from } from 'rxjs';\nimport { isWebWorker } from '../utils';\nclass Reachability {\n networkMonitor(_) {\n const globalObj = isWebWorker()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return from([{ online: true }]);\n }\n return new Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => observer.next({ online: true });\n const notifyOffline = () => observer.next({ online: false });\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\nexport { Reachability };\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGA,MAAM,YAAY,CAAC;AACnB,IAAI,cAAc,CAAC,CAAC,EAAE;AACtB,QAAQ,MAAM,SAAS,GAAG,WAAW,EAAE;AACvC,cAAc,IAAI;AAClB,cAAc,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC;AACtD,QAAQ,IAAI,CAAC,SAAS,EAAE;AACxB,YAAY,OAAO,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,SAAS;AACT,QAAQ,OAAO,IAAI,UAAU,CAAC,QAAQ,IAAI;AAC1C,YAAY,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AAClE,YAAY,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACvE,YAAY,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACzE,YAAY,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAC/D,YAAY,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACjE,YAAY,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACnD,YAAY,OAAO,MAAM;AACzB,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACtE,gBAAgB,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACxE,gBAAgB,YAAY,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,CAAC;AAC9G,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA,IAAI,OAAO,iBAAiB,CAAC,MAAM,EAAE;AACrC,QAAQ,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;AAChD,YAAY,IAAI,QAAQ,CAAC,MAAM,EAAE;AACjC,gBAAgB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,QAAQ,CAAC,CAAC;AAC9F,gBAAgB,SAAS;AACzB,aAAa;AACb,YAAY,QAAQ,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACpD,SAAS;AACT,KAAK;AACL,CAAC;AACD,YAAY,CAAC,UAAU,GAAG,EAAE;;;;"}
@@ -11,16 +11,12 @@ import '@aws-crypto/sha256-js';
11
11
  import '@smithy/util-hex-encoding';
12
12
  import '../awsClients/pinpoint/base.mjs';
13
13
  import '../awsClients/pinpoint/errorHelpers.mjs';
14
- import '../Hub/index.mjs';
15
- import { Amplify } from '../singleton/Amplify.mjs';
16
- import { fetchAuthSession } from '../singleton/apis/fetchAuthSession.mjs';
17
- import '../awsClients/cognitoIdentity/base.mjs';
18
- import '../storage/index.mjs';
19
14
  import '../Cache/index.mjs';
20
- import '../I18n/index.mjs';
21
15
  import { record } from '../providers/pinpoint/apis/record.mjs';
22
16
  import '../providers/pinpoint/utils/PinpointEventBuffer.mjs';
23
17
  import '../providers/pinpoint/types/errors.mjs';
18
+ import { Amplify } from '../singleton/Amplify.mjs';
19
+ import { fetchAuthSession } from '../singleton/apis/fetchAuthSession.mjs';
24
20
 
25
21
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
26
22
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceWorker.mjs","sources":["../../../src/ServiceWorker/ServiceWorker.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { isBrowser } from '../utils';\nimport { AmplifyError } from '../errors';\nimport { assert, ServiceWorkerErrorCode } from './errorHelpers';\nimport { record } from '../providers/pinpoint';\nimport { Amplify, fetchAuthSession } from '../singleton';\n/**\n * Provides a means to registering a service worker in the browser\n * and communicating with it via postMessage events.\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/\n *\n * postMessage events are currently not supported in all browsers. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\n *\n * At the minmum this class will register the service worker and listen\n * and attempt to dispatch messages on state change and record analytics\n * events based on the service worker lifecycle.\n */\nexport class ServiceWorkerClass {\n constructor() {\n // The AWS Amplify logger\n this._logger = new Logger('ServiceWorker');\n }\n /**\n * Get the currently active service worker\n */\n get serviceWorker() {\n assert(this._serviceWorker !== undefined, ServiceWorkerErrorCode.UndefinedInstance);\n return this._serviceWorker;\n }\n /**\n * Register the service-worker.js file in the browser\n * Make sure the service-worker.js is part of the build\n * for example with Angular, modify the angular-cli.json file\n * and add to \"assets\" array \"service-worker.js\"\n * @param {string} - (optional) Service worker file. Defaults to \"/service-worker.js\"\n * @param {string} - (optional) The service worker scope. Defaults to \"/\"\n * - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n * @returns {Promise}\n *\t- resolve(ServiceWorkerRegistration)\n *\t- reject(Error)\n **/\n register(filePath = '/service-worker.js', scope = '/') {\n this._logger.debug(`registering ${filePath}`);\n this._logger.debug(`registering service worker with scope ${scope}`);\n return new Promise((resolve, reject) => {\n if (navigator && 'serviceWorker' in navigator) {\n navigator.serviceWorker\n .register(filePath, {\n scope,\n })\n .then(registration => {\n if (registration.installing) {\n this._serviceWorker = registration.installing;\n }\n else if (registration.waiting) {\n this._serviceWorker = registration.waiting;\n }\n else if (registration.active) {\n this._serviceWorker = registration.active;\n }\n this._registration = registration;\n this._setupListeners();\n this._logger.debug(`Service Worker Registration Success: ${registration}`);\n return resolve(registration);\n })\n .catch(error => {\n this._logger.debug(`Service Worker Registration Failed ${error}`);\n return reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n underlyingError: error,\n }));\n });\n }\n else {\n return reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Enable web push notifications. If not subscribed, a new subscription will\n * be created and registered.\n * \tTest Push Server: https://web-push-codelab.glitch.me/\n * \tPush Server Libraries: https://github.com/web-push-libs/\n * \tAPI Doc: https://developers.google.com/web/fundamentals/codelabs/push-notifications/\n * @param publicKey\n * @returns {Promise}\n * \t- resolve(PushSubscription)\n * - reject(Error)\n */\n enablePush(publicKey) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._publicKey = publicKey;\n return new Promise((resolve, reject) => {\n if (isBrowser()) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._registration.pushManager.getSubscription().then(subscription => {\n if (subscription) {\n this._subscription = subscription;\n this._logger.debug(`User is subscribed to push: ${JSON.stringify(subscription)}`);\n resolve(subscription);\n }\n else {\n this._logger.debug(`User is NOT subscribed to push`);\n return this._registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: this._urlB64ToUint8Array(publicKey),\n })\n .then(subscription => {\n this._subscription = subscription;\n this._logger.debug(`User subscribed: ${JSON.stringify(subscription)}`);\n resolve(subscription);\n })\n .catch(error => {\n this._logger.error(error);\n });\n }\n });\n }\n else {\n return reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Convert a base64 encoded string to a Uint8 array for the push server key\n * @param base64String\n */\n _urlB64ToUint8Array(base64String) {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n }\n /**\n * Send a message to the service worker. The service worker needs\n * to implement `self.addEventListener('message') to handle the\n * message. This ***currently*** does not work in Safari or IE.\n * @param {object | string} - An arbitrary JSON object or string message to send to the service worker\n *\t- see: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n * @returns {Promise}\n **/\n send(message) {\n if (this._serviceWorker) {\n this._serviceWorker.postMessage(typeof message === 'object' ? JSON.stringify(message) : message);\n }\n }\n /**\n * Listen for service worker state change and message events\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state\n **/\n _setupListeners() {\n this.serviceWorker.addEventListener('statechange', async (event) => {\n const currentState = this.serviceWorker.state;\n this._logger.debug(`ServiceWorker statechange: ${currentState}`);\n const { appId, region } = Amplify.getConfig().Analytics?.Pinpoint ?? {};\n const { credentials } = await fetchAuthSession();\n if (appId && region && credentials) {\n // Pinpoint is configured, record an event\n record({\n appId,\n region,\n category: 'Core',\n credentials,\n event: {\n name: 'ServiceWorker',\n attributes: {\n state: currentState,\n },\n },\n });\n }\n });\n this.serviceWorker.addEventListener('message', event => {\n this._logger.debug(`ServiceWorker message event: ${event}`);\n });\n }\n}\n"],"names":["Logger"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,CAAC;AAChC,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Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger as Logger } from '../Logger';\nimport { isBrowser } from '../utils';\nimport { AmplifyError } from '../errors';\nimport { assert, ServiceWorkerErrorCode } from './errorHelpers';\nimport { record } from '../providers/pinpoint';\nimport { Amplify, fetchAuthSession } from '../singleton';\n/**\n * Provides a means to registering a service worker in the browser\n * and communicating with it via postMessage events.\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/\n *\n * postMessage events are currently not supported in all browsers. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API\n *\n * At the minmum this class will register the service worker and listen\n * and attempt to dispatch messages on state change and record analytics\n * events based on the service worker lifecycle.\n */\nexport class ServiceWorkerClass {\n constructor() {\n // The AWS Amplify logger\n this._logger = new Logger('ServiceWorker');\n }\n /**\n * Get the currently active service worker\n */\n get serviceWorker() {\n assert(this._serviceWorker !== undefined, ServiceWorkerErrorCode.UndefinedInstance);\n return this._serviceWorker;\n }\n /**\n * Register the service-worker.js file in the browser\n * Make sure the service-worker.js is part of the build\n * for example with Angular, modify the angular-cli.json file\n * and add to \"assets\" array \"service-worker.js\"\n * @param {string} - (optional) Service worker file. Defaults to \"/service-worker.js\"\n * @param {string} - (optional) The service worker scope. Defaults to \"/\"\n * - API Doc: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register\n * @returns {Promise}\n *\t- resolve(ServiceWorkerRegistration)\n *\t- reject(Error)\n **/\n register(filePath = '/service-worker.js', scope = '/') {\n this._logger.debug(`registering ${filePath}`);\n this._logger.debug(`registering service worker with scope ${scope}`);\n return new Promise((resolve, reject) => {\n if (navigator && 'serviceWorker' in navigator) {\n navigator.serviceWorker\n .register(filePath, {\n scope,\n })\n .then(registration => {\n if (registration.installing) {\n this._serviceWorker = registration.installing;\n }\n else if (registration.waiting) {\n this._serviceWorker = registration.waiting;\n }\n else if (registration.active) {\n this._serviceWorker = registration.active;\n }\n this._registration = registration;\n this._setupListeners();\n this._logger.debug(`Service Worker Registration Success: ${registration}`);\n return resolve(registration);\n })\n .catch(error => {\n this._logger.debug(`Service Worker Registration Failed ${error}`);\n return reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n underlyingError: error,\n }));\n });\n }\n else {\n return reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Enable web push notifications. If not subscribed, a new subscription will\n * be created and registered.\n * \tTest Push Server: https://web-push-codelab.glitch.me/\n * \tPush Server Libraries: https://github.com/web-push-libs/\n * \tAPI Doc: https://developers.google.com/web/fundamentals/codelabs/push-notifications/\n * @param publicKey\n * @returns {Promise}\n * \t- resolve(PushSubscription)\n * - reject(Error)\n */\n enablePush(publicKey) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._publicKey = publicKey;\n return new Promise((resolve, reject) => {\n if (isBrowser()) {\n assert(this._registration !== undefined, ServiceWorkerErrorCode.UndefinedRegistration);\n this._registration.pushManager.getSubscription().then(subscription => {\n if (subscription) {\n this._subscription = subscription;\n this._logger.debug(`User is subscribed to push: ${JSON.stringify(subscription)}`);\n resolve(subscription);\n }\n else {\n this._logger.debug(`User is NOT subscribed to push`);\n return this._registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: this._urlB64ToUint8Array(publicKey),\n })\n .then(subscription => {\n this._subscription = subscription;\n this._logger.debug(`User subscribed: ${JSON.stringify(subscription)}`);\n resolve(subscription);\n })\n .catch(error => {\n this._logger.error(error);\n });\n }\n });\n }\n else {\n return reject(new AmplifyError({\n name: ServiceWorkerErrorCode.Unavailable,\n message: 'Service Worker not available',\n }));\n }\n });\n }\n /**\n * Convert a base64 encoded string to a Uint8 array for the push server key\n * @param base64String\n */\n _urlB64ToUint8Array(base64String) {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n }\n /**\n * Send a message to the service worker. The service worker needs\n * to implement `self.addEventListener('message') to handle the\n * message. This ***currently*** does not work in Safari or IE.\n * @param {object | string} - An arbitrary JSON object or string message to send to the service worker\n *\t- see: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n * @returns {Promise}\n **/\n send(message) {\n if (this._serviceWorker) {\n this._serviceWorker.postMessage(typeof message === 'object' ? JSON.stringify(message) : message);\n }\n }\n /**\n * Listen for service worker state change and message events\n * https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker/state\n **/\n _setupListeners() {\n this.serviceWorker.addEventListener('statechange', async (event) => {\n const currentState = this.serviceWorker.state;\n this._logger.debug(`ServiceWorker statechange: ${currentState}`);\n const { appId, region } = Amplify.getConfig().Analytics?.Pinpoint ?? {};\n const { credentials } = await fetchAuthSession();\n if (appId && region && credentials) {\n // Pinpoint is configured, record an event\n record({\n appId,\n region,\n category: 'Core',\n credentials,\n event: {\n name: 'ServiceWorker',\n attributes: {\n state: currentState,\n },\n },\n });\n }\n });\n this.serviceWorker.addEventListener('message', event => {\n this._logger.debug(`ServiceWorker message event: ${event}`);\n });\n }\n}\n"],"names":["Logger"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAkB,CAAC;AAChC,IAAI,WAAW,GAAG;AAClB;AACA,QAAQ,IAAI,CAAC,OAAO,GAAG,IAAIA,aAAM,CAAC,eAAe,CAAC,CAAC;AACnD,KAAK;AACL;AACA;AACA;AACA,IAAI,IAAI,aAAa,GAAG;AACxB,QAAQ,MAAM,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,sBAAsB,CAAC,iBAAiB,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AK,CAAC;AAC1D,YAAY,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,2BAA2B,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;AAC7E,YAAY,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,QAAQ,IAAI,EAAE,CAAC;AACpF,YAAY,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,gBAAgB,EAAE,CAAC;AAC7D,YAAY,IAAI,KAAK,IAAI,MAAM,IAAI,WAAW,EAAE;AAChD;AACA,gBAAgB,MAAM,CAAC;AACvB,oBAAoB,KAAK;AACzB,oBAAoB,MAAM;AAC1B,oBAAoB,QAAQ,EAAE,MAAM;AACpC,oBAAoB,WAAW;AAC/B,oBAAoB,KAAK,EAAE;AAC3B,wBAAwB,IAAI,EAAE,eAAe;AAC7C,wBAAwB,UAAU,EAAE;AACpC,4BAA4B,KAAK,EAAE,YAAY;AAC/C,yBAAyB;AACzB,qBAAqB;AACrB,iBAAiB,CAAC,CAAC;AACnB,aAAa;AACb,SAAS,CAAC,CAAC;AACX,QAAQ,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,IAAI;AAChE,YAAY,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AACxE,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;"}
@@ -1,25 +1,9 @@
1
1
  import { amplifyUuid } from '../../../utils/amplifyUuid/index.mjs';
2
- import '../../../Hub/index.mjs';
3
- import '../../../parseAWSExports.mjs';
4
- import '../../../utils/getClientInfo/getClientInfo.mjs';
5
- import '../../../utils/retry/retry.mjs';
6
- import '../../../awsClients/cognitoIdentity/base.mjs';
7
- import '@aws-crypto/sha256-js';
8
- import '@smithy/util-hex-encoding';
9
- import '../../../storage/index.mjs';
10
2
  import '../../../Cache/index.mjs';
11
- import '../../../I18n/index.mjs';
12
- import '../../../Logger/ConsoleLogger.mjs';
13
- import '../../../types/errors.mjs';
14
- import '../../../errors/errorHelpers.mjs';
15
- import '../../../ServiceWorker/errorHelpers.mjs';
16
- import '../../../awsClients/pinpoint/base.mjs';
17
- import '../../../awsClients/pinpoint/errorHelpers.mjs';
18
- import { getEventBuffer } from '../utils/getEventBuffer.mjs';
19
- import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT } from '../utils/constants.mjs';
20
- import '../types/errors.mjs';
21
3
  import { resolveEndpointId } from '../utils/resolveEndpointId.mjs';
22
4
  import '../../../utils/sessionListener/index.mjs';
5
+ import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT } from '../utils/constants.mjs';
6
+ import { getEventBuffer } from '../utils/getEventBuffer.mjs';
23
7
  import { SESSION_STOP_EVENT, SESSION_START_EVENT } from '../../../utils/sessionListener/constants.mjs';
24
8
 
25
9
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -1 +1 @@
1
- {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { resolveEndpointId } from '../utils';\nimport { SESSION_START_EVENT, SESSION_STOP_EVENT, } from '../../../utils/sessionListener';\nimport { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';\nimport { getEventBuffer } from '../utils/getEventBuffer';\nlet session;\n/**\n * @internal\n */\nexport const record = async ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, }) => {\n let eventSession = session;\n const currentTime = new Date();\n const timestampISOString = currentTime.toISOString();\n const eventId = amplifyUuid();\n // Prepare event buffer if required\n const buffer = getEventBuffer({\n appId,\n bufferSize: BUFFER_SIZE,\n credentials,\n flushInterval: FLUSH_INTERVAL,\n flushSize: FLUSH_SIZE,\n identityId,\n region,\n resendLimit: RESEND_LIMIT,\n userAgentValue,\n });\n const endpointId = await resolveEndpointId({\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n // Generate session if required\n if (!eventSession || event.name === SESSION_START_EVENT) {\n const sessionId = amplifyUuid();\n session = {\n Id: sessionId,\n StartTimestamp: timestampISOString,\n };\n eventSession = session;\n }\n // Terminate session when required\n if (session && event.name === SESSION_STOP_EVENT) {\n eventSession = {\n ...session,\n StopTimestamp: timestampISOString,\n Duration: currentTime.getTime() - new Date(session.StartTimestamp).getTime(),\n };\n session = undefined;\n }\n // Push event to buffer\n buffer.push({\n eventId,\n endpointId,\n event,\n session: eventSession,\n timestamp: timestampISOString,\n resendLimit: RESEND_LIMIT,\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA,IAAI,OAAO,CAAC;AACZ;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AAC3H,IAAI,IAAI,YAAY,GAAG,OAAO,CAAC;AAC/B,IAAI,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;AACnC,IAAI,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;AACzD,IAAI,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;AAClC;AACA,IAAI,MAAM,MAAM,GAAG,cAAc,CAAC;AAClC,QAAQ,KAAK;AACb,QAAQ,UAAU,EAAE,WAAW;AAC/B,QAAQ,WAAW;AACnB,QAAQ,aAAa,EAAE,cAAc;AACrC,QAAQ,SAAS,EAAE,UAAU;AAC7B,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,WAAW,EAAE,YAAY;AACjC,QAAQ,cAAc;AACtB,KAAK,CAAC,CAAC;AACP,IAAI,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC;AAC/C,QAAQ,KAAK;AACb,QAAQ,QAAQ;AAChB,QAAQ,WAAW;AACnB,QAAQ,WAAW;AACnB,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,cAAc;AACtB,KAAK,CAAC,CAAC;AACP;AACA,IAAI,IAAI,CAAC,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE;AAC7D,QAAQ,MAAM,SAAS,GAAG,WAAW,EAAE,CAAC;AACxC,QAAQ,OAAO,GAAG;AAClB,YAAY,EAAE,EAAE,SAAS;AACzB,YAAY,cAAc,EAAE,kBAAkB;AAC9C,SAAS,CAAC;AACV,QAAQ,YAAY,GAAG,OAAO,CAAC;AAC/B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE;AACtD,QAAQ,YAAY,GAAG;AACvB,YAAY,GAAG,OAAO;AACtB,YAAY,aAAa,EAAE,kBAAkB;AAC7C,YAAY,QAAQ,EAAE,WAAW,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;AACxF,SAAS,CAAC;AACV,QAAQ,OAAO,GAAG,SAAS,CAAC;AAC5B,KAAK;AACL;AACA,IAAI,MAAM,CAAC,IAAI,CAAC;AAChB,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,KAAK;AACb,QAAQ,OAAO,EAAE,YAAY;AAC7B,QAAQ,SAAS,EAAE,kBAAkB;AACrC,QAAQ,WAAW,EAAE,YAAY;AACjC,KAAK,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"record.mjs","sources":["../../../../../src/providers/pinpoint/apis/record.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { resolveEndpointId } from '../utils';\nimport { SESSION_START_EVENT, SESSION_STOP_EVENT, } from '../../../utils/sessionListener';\nimport { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';\nimport { getEventBuffer } from '../utils/getEventBuffer';\nlet session;\n/**\n * @internal\n */\nexport const record = async ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, }) => {\n let eventSession = session;\n const currentTime = new Date();\n const timestampISOString = currentTime.toISOString();\n const eventId = amplifyUuid();\n // Prepare event buffer if required\n const buffer = getEventBuffer({\n appId,\n bufferSize: BUFFER_SIZE,\n credentials,\n flushInterval: FLUSH_INTERVAL,\n flushSize: FLUSH_SIZE,\n identityId,\n region,\n resendLimit: RESEND_LIMIT,\n userAgentValue,\n });\n const endpointId = await resolveEndpointId({\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n // Generate session if required\n if (!eventSession || event.name === SESSION_START_EVENT) {\n const sessionId = amplifyUuid();\n session = {\n Id: sessionId,\n StartTimestamp: timestampISOString,\n };\n eventSession = session;\n }\n // Terminate session when required\n if (session && event.name === SESSION_STOP_EVENT) {\n eventSession = {\n ...session,\n StopTimestamp: timestampISOString,\n Duration: currentTime.getTime() - new Date(session.StartTimestamp).getTime(),\n };\n session = undefined;\n }\n // Push event to buffer\n buffer.push({\n eventId,\n endpointId,\n event,\n session: eventSession,\n timestamp: timestampISOString,\n resendLimit: RESEND_LIMIT,\n });\n};\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAMA,IAAI,OAAO,CAAC;AACZ;AACA;AACA;AACY,MAAC,MAAM,GAAG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AAC3H,IAAI,IAAI,YAAY,GAAG,OAAO,CAAC;AAC/B,IAAI,MAAM,WAAW,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,GAAG,SAAS,CAAC;AAC5B,KAAK;AACL;AACA,IAAI,MAAM,CAAC,IAAI,CAAC;AAChB,QAAQ,OAAO;AACf,QAAQ,UAAU;AAClB,QAAQ,KAAK;AACb,QAAQ,OAAO,EAAE,YAAY;AAC7B,QAAQ,SAAS,EAAE,kBAAkB;AACrC,QAAQ,WAAW,EAAE,YAAY;AACjC,KAAK,CAAC,CAAC;AACP;;;;"}
@@ -8,10 +8,6 @@ import '../../../awsClients/pinpoint/errorHelpers.mjs';
8
8
  import { updateEndpoint as updateEndpoint$1 } from '../../../awsClients/pinpoint/updateEndpoint.mjs';
9
9
  import { cacheEndpointId } from '../utils/cacheEndpointId.mjs';
10
10
  import { getEndpointId } from '../utils/getEndpointId.mjs';
11
- import '../../../types/errors.mjs';
12
- import '../../../errors/errorHelpers.mjs';
13
- import '../../../utils/sessionListener/index.mjs';
14
- import '../utils/PinpointEventBuffer.mjs';
15
11
 
16
12
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
17
13
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"updateEndpoint.mjs","sources":["../../../../../src/providers/pinpoint/apis/updateEndpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getClientInfo } from '../../../utils/getClientInfo';\nimport { updateEndpoint as clientUpdateEndpoint, } from '../../../awsClients/pinpoint';\nimport { cacheEndpointId, getEndpointId } from '../utils';\n/**\n * @internal\n */\nexport const updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {\n const endpointId = await getEndpointId(appId, category);\n // only generate a new endpoint id if one was not found in cache\n const createdEndpointId = !endpointId ? amplifyUuid() : undefined;\n const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};\n const clientInfo = getClientInfo();\n const mergedDemographic = {\n appVersion: clientInfo.appVersion,\n make: clientInfo.make,\n model: clientInfo.model,\n modelVersion: clientInfo.version,\n platform: clientInfo.platform,\n ...demographic,\n };\n const shouldAddAttributes = email || customProperties || name || plan;\n const attributes = {\n ...(email && { email: [email] }),\n ...(name && { name: [name] }),\n ...(plan && { plan: [plan] }),\n ...customProperties,\n };\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId ?? createdEndpointId,\n EndpointRequest: {\n RequestId: amplifyUuid(),\n EffectiveDate: new Date().toISOString(),\n ChannelType: channelType,\n Address: address,\n Attributes: shouldAddAttributes ? attributes : undefined,\n Demographic: {\n AppVersion: mergedDemographic.appVersion,\n Locale: mergedDemographic.locale,\n Make: mergedDemographic.make,\n Model: mergedDemographic.model,\n ModelVersion: mergedDemographic.modelVersion,\n Platform: mergedDemographic.platform,\n PlatformVersion: mergedDemographic.platformVersion,\n Timezone: mergedDemographic.timezone,\n },\n Location: {\n City: location?.city,\n Country: location?.country,\n Latitude: location?.latitude,\n Longitude: location?.longitude,\n PostalCode: location?.postalCode,\n Region: location?.region,\n },\n Metrics: metrics,\n OptOut: optOut,\n User: {\n UserId: userId ?? identityId,\n UserAttributes: userAttributes,\n },\n },\n };\n await clientUpdateEndpoint({ credentials, region, userAgentValue }, input);\n // if we had to create an endpoint id, we need to now cache it\n if (!!createdEndpointId) {\n return cacheEndpointId(appId, category, createdEndpointId);\n }\n};\n"],"names":["clientUpdateEndpoint"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AAKA;AACA;AACA;AACY,MAAC,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,KAAK;AAClL,IAAI,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC5D;AACA,IAAI,MAAM,iBA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E,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"updateEndpoint.mjs","sources":["../../../../../src/providers/pinpoint/apis/updateEndpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { amplifyUuid } from '../../../utils/amplifyUuid';\nimport { getClientInfo } from '../../../utils/getClientInfo';\nimport { updateEndpoint as clientUpdateEndpoint, } from '../../../awsClients/pinpoint';\nimport { cacheEndpointId } from '../utils/cacheEndpointId';\nimport { getEndpointId } from '../utils/getEndpointId';\n/**\n * @internal\n */\nexport const updateEndpoint = async ({ address, appId, category, channelType, credentials, identityId, optOut, region, userAttributes, userId, userProfile, userAgentValue, }) => {\n const endpointId = await getEndpointId(appId, category);\n // only generate a new endpoint id if one was not found in cache\n const createdEndpointId = !endpointId ? amplifyUuid() : undefined;\n const { customProperties, demographic, email, location, metrics, name, plan, } = userProfile ?? {};\n const clientInfo = getClientInfo();\n const mergedDemographic = {\n appVersion: clientInfo.appVersion,\n make: clientInfo.make,\n model: clientInfo.model,\n modelVersion: clientInfo.version,\n platform: clientInfo.platform,\n ...demographic,\n };\n const shouldAddAttributes = email || customProperties || name || plan;\n const attributes = {\n ...(email && { email: [email] }),\n ...(name && { name: [name] }),\n ...(plan && { plan: [plan] }),\n ...customProperties,\n };\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId ?? createdEndpointId,\n EndpointRequest: {\n RequestId: amplifyUuid(),\n EffectiveDate: new Date().toISOString(),\n ChannelType: channelType,\n Address: address,\n Attributes: shouldAddAttributes ? attributes : undefined,\n Demographic: {\n AppVersion: mergedDemographic.appVersion,\n Locale: mergedDemographic.locale,\n Make: mergedDemographic.make,\n Model: mergedDemographic.model,\n ModelVersion: mergedDemographic.modelVersion,\n Platform: mergedDemographic.platform,\n PlatformVersion: mergedDemographic.platformVersion,\n Timezone: mergedDemographic.timezone,\n },\n Location: {\n City: location?.city,\n Country: location?.country,\n Latitude: location?.latitude,\n Longitude: location?.longitude,\n PostalCode: location?.postalCode,\n Region: location?.region,\n },\n Metrics: metrics,\n OptOut: optOut,\n User: {\n UserId: userId ?? identityId,\n UserAttributes: userAttributes,\n },\n },\n };\n await clientUpdateEndpoint({ credentials, region, userAgentValue }, input);\n // if we had to create an endpoint id, we need to now cache it\n if (!!createdEndpointId) {\n return cacheEndpointId(appId, category, createdEndpointId);\n }\n};\n"],"names":["clientUpdateEndpoint"],"mappings":";;;;;;;;;;;AAAA;AACA;AAMA;AACA;AACA;AACY,MAAC,cAAc,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,GAAG,KAAK;AAClL,IAAI,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC5D;AACA,IAAI,MAAM,iBAAiB,GAAG,CAAC,UAAU,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;AACtE,IAAI,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,GAAG,WAAW,IAAI,EAAE,CAAC;AACvG,IAAI,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;AACvC,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,UAAU,EAAE,UAAU,CAAC,UAAU;AACzC,QAAQ,IAAI,EAAE,UAAU,CAAC,IAAI;AAC7B,QAAQ,KAAK,EAAE,UAAU,CAAC,KAAK;AAC/B,QAAQ,YAAY,EAAE,UAAU,CAAC,OAAO;AACxC,QAAQ,QAAQ,EAAE,UAAU,CAAC,QAAQ;AACrC,QAAQ,GAAG,WAAW;AACtB,KAAK,CAAC;AACN,IAAI,MAAM,mBAAmB,GAAG,KAAK,IAAI,gBAAgB,IAAI,IAAI,IAAI,IA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AAE,QAAQ,EAAE,QAAQ;AAC5C,gBAAgB,SAAS,EAAE,QAAQ,EAAE,SAAS;AAC9C,gBAAgB,UAAU,EAAE,QAAQ,EAAE,UAAU;AAChD,gBAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM;AACxC,aAAa;AACb,YAAY,OAAO,EAAE,OAAO;AAC5B,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,IAAI,EAAE;AAClB,gBAAgB,MAAM,EAAE,MAAM,IAAI,UAAU;AAC5C,gBAAgB,cAAc,EAAE,cAAc;AAC9C,aAAa;AACb,SAAS;AACT,KAAK,CAAC;AACN,IAAI,MAAMA,gBAAoB,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,KAAK,CAAC,CAAC;AAC/E;AACA,IAAI,IAAI,CAAC,CAAC,iBAAiB,EAAE;AAC7B,QAAQ,OAAO,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;AACnE,KAAK;AACL;;;;"}
@@ -2,19 +2,6 @@ export { updateEndpoint } from './apis/updateEndpoint.mjs';
2
2
  export { record } from './apis/record.mjs';
3
3
  export { flushEvents } from './apis/flushEvents.mjs';
4
4
  export { UpdateEndpointException } from './types/errors.mjs';
5
- import '../../Hub/index.mjs';
6
- import '../../parseAWSExports.mjs';
7
- import '../../utils/getClientInfo/getClientInfo.mjs';
8
- import '../../utils/retry/retry.mjs';
9
- import '../../awsClients/cognitoIdentity/base.mjs';
10
- import '@aws-crypto/sha256-js';
11
- import '@smithy/util-hex-encoding';
12
- import '../../storage/index.mjs';
13
5
  import '../../Cache/index.mjs';
14
- import '../../I18n/index.mjs';
15
- import '../../Logger/ConsoleLogger.mjs';
16
- import '../../types/errors.mjs';
17
- import '../../errors/errorHelpers.mjs';
18
- import '../../ServiceWorker/errorHelpers.mjs';
19
6
  export { resolveEndpointId } from './utils/resolveEndpointId.mjs';
20
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1,24 +1,5 @@
1
- import '../../../Hub/index.mjs';
2
- import '../../../parseAWSExports.mjs';
3
- import '../../../utils/getClientInfo/getClientInfo.mjs';
4
- import '../../../utils/retry/retry.mjs';
5
- import '../../../awsClients/cognitoIdentity/base.mjs';
6
- import '@aws-crypto/sha256-js';
7
- import '@smithy/util-hex-encoding';
8
- import '../../../storage/index.mjs';
9
1
  import { Cache } from '../../../Cache/index.mjs';
10
- import '../../../I18n/index.mjs';
11
- import '../../../Logger/ConsoleLogger.mjs';
12
- import '../../../types/errors.mjs';
13
- import '../../../errors/errorHelpers.mjs';
14
- import '../../../ServiceWorker/errorHelpers.mjs';
15
- import 'uuid';
16
- import '../../../awsClients/pinpoint/base.mjs';
17
- import '../../../awsClients/pinpoint/errorHelpers.mjs';
18
2
  import { getCacheKey } from './getCacheKey.mjs';
19
- import '../../../utils/sessionListener/index.mjs';
20
- import './PinpointEventBuffer.mjs';
21
- import '../types/errors.mjs';
22
3
 
23
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
24
5
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"cacheEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/cacheEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Cache } from '../../..';\nimport { getCacheKey } from './getCacheKey';\n/**\n * Writes an endpoint id to a long-lived cache.\n *\n * @internal\n */\nexport const cacheEndpointId = async (appId, category, endpointId) => {\n const cacheKey = getCacheKey(appId, category);\n // Set a longer TTL to avoid endpoint id being deleted after the default TTL (3 days)\n // Also set its priority to the highest to reduce its chance of being deleted when cache is full\n const ttl = 1000 * 60 * 60 * 24 * 365 * 100; // 100 years\n const expiration = new Date().getTime() + ttl;\n return Cache.setItem(cacheKey, endpointId, {\n expires: expiration,\n priority: 1,\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,KAAK;AACtE,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD;AACA;AACA,IAAI,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAChD,IAAI,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAClD,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;AAC/C,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,QAAQ,EAAE,CAAC;AACnB,KAAK,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"cacheEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/cacheEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Cache } from '../../../Cache';\nimport { getCacheKey } from './getCacheKey';\n/**\n * Writes an endpoint id to a long-lived cache.\n *\n * @internal\n */\nexport const cacheEndpointId = async (appId, category, endpointId) => {\n const cacheKey = getCacheKey(appId, category);\n // Set a longer TTL to avoid endpoint id being deleted after the default TTL (3 days)\n // Also set its priority to the highest to reduce its chance of being deleted when cache is full\n const ttl = 1000 * 60 * 60 * 24 * 365 * 100; // 100 years\n const expiration = new Date().getTime() + ttl;\n return Cache.setItem(cacheKey, endpointId, {\n expires: expiration,\n priority: 1,\n });\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACY,MAAC,eAAe,GAAG,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,KAAK;AACtE,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD;AACA;AACA,IAAI,MAAM,GAAG,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC;AAChD,IAAI,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAClD,IAAI,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE;AAC/C,QAAQ,OAAO,EAAE,UAAU;AAC3B,QAAQ,QAAQ,EAAE,CAAC;AACnB,KAAK,CAAC,CAAC;AACP;;;;"}
@@ -1,24 +1,5 @@
1
- import '../../../Hub/index.mjs';
2
- import '../../../parseAWSExports.mjs';
3
- import '../../../utils/getClientInfo/getClientInfo.mjs';
4
- import '../../../utils/retry/retry.mjs';
5
- import '../../../awsClients/cognitoIdentity/base.mjs';
6
- import '@aws-crypto/sha256-js';
7
- import '@smithy/util-hex-encoding';
8
- import '../../../storage/index.mjs';
9
1
  import { Cache } from '../../../Cache/index.mjs';
10
- import '../../../I18n/index.mjs';
11
- import '../../../Logger/ConsoleLogger.mjs';
12
- import '../../../types/errors.mjs';
13
- import '../../../errors/errorHelpers.mjs';
14
- import '../../../ServiceWorker/errorHelpers.mjs';
15
- import 'uuid';
16
- import '../../../awsClients/pinpoint/base.mjs';
17
- import '../../../awsClients/pinpoint/errorHelpers.mjs';
18
2
  import { getCacheKey } from './getCacheKey.mjs';
19
- import '../../../utils/sessionListener/index.mjs';
20
- import './PinpointEventBuffer.mjs';
21
- import '../types/errors.mjs';
22
3
 
23
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
24
5
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"getEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/getEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Cache } from '../../..';\nimport { getCacheKey } from './getCacheKey';\n/**\n * Returns an endpoint id from cache or `undefined` if not found.\n *\n * @internal\n */\nexport const getEndpointId = async (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n const cachedEndpointId = await Cache.getItem(cacheKey);\n return cachedEndpointId ?? undefined;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACxD,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD,IAAI,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3D,IAAI,OAAO,gBAAgB,IAAI,SAAS,CAAC;AACzC;;;;"}
1
+ {"version":3,"file":"getEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/getEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Cache } from '../../../Cache';\nimport { getCacheKey } from './getCacheKey';\n/**\n * Returns an endpoint id from cache or `undefined` if not found.\n *\n * @internal\n */\nexport const getEndpointId = async (appId, category) => {\n const cacheKey = getCacheKey(appId, category);\n const cachedEndpointId = await Cache.getItem(cacheKey);\n return cachedEndpointId ?? undefined;\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACY,MAAC,aAAa,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACxD,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAClD,IAAI,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC3D,IAAI,OAAO,gBAAgB,IAAI,SAAS,CAAC;AACzC;;;;"}
@@ -1,23 +1,7 @@
1
1
  import { AmplifyErrorCode } from '../../../types/errors.mjs';
2
2
  import { assert } from '../../../errors/errorHelpers.mjs';
3
3
  import { updateEndpoint } from '../apis/updateEndpoint.mjs';
4
- import 'uuid';
5
- import '../../../Hub/index.mjs';
6
- import '../../../parseAWSExports.mjs';
7
- import '../../../utils/getClientInfo/getClientInfo.mjs';
8
- import '../../../utils/retry/retry.mjs';
9
- import '../../../awsClients/cognitoIdentity/base.mjs';
10
- import '@aws-crypto/sha256-js';
11
- import '@smithy/util-hex-encoding';
12
- import '../../../storage/index.mjs';
13
- import '../../../Cache/index.mjs';
14
- import '../../../I18n/index.mjs';
15
- import '../../../Logger/ConsoleLogger.mjs';
16
- import '../../../ServiceWorker/errorHelpers.mjs';
17
- import '../types/errors.mjs';
18
4
  import { getEndpointId } from './getEndpointId.mjs';
19
- import '../../../utils/sessionListener/index.mjs';
20
- import './PinpointEventBuffer.mjs';
21
5
 
22
6
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
7
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"resolveEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/resolveEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assert } from '../../../errors';\nimport { AmplifyErrorCode } from '../../../types';\nimport { updateEndpoint } from '../apis';\nimport { getEndpointId } from './getEndpointId';\n/**\n * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,\n * which will generate and cache an endpoint id between calls.\n *\n * @internal\n */\nexport const resolveEndpointId = async ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }) => {\n let endpointId = await getEndpointId(appId, category);\n if (!endpointId) {\n await updateEndpoint({\n address,\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n endpointId = await getEndpointId(appId, category);\n }\n assert(!!endpointId, AmplifyErrorCode.NoEndpointId);\n return endpointId;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AACxI,IAAI,IAAI,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,MAAM,cAAc,CAAC;AAC7B,YAAY,OAAO;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ;AACpB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,SAAS,CAAC,CAAC;AACX,QAAQ,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxD,IAAI,OAAO,UAAU,CAAC;AACtB;;;;"}
1
+ {"version":3,"file":"resolveEndpointId.mjs","sources":["../../../../../src/providers/pinpoint/utils/resolveEndpointId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assert } from '../../../errors';\nimport { AmplifyErrorCode } from '../../../types';\nimport { updateEndpoint } from '../apis/updateEndpoint';\nimport { getEndpointId } from './getEndpointId';\n/**\n * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,\n * which will generate and cache an endpoint id between calls.\n *\n * @internal\n */\nexport const resolveEndpointId = async ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }) => {\n let endpointId = await getEndpointId(appId, category);\n if (!endpointId) {\n await updateEndpoint({\n address,\n appId,\n category,\n channelType,\n credentials,\n identityId,\n region,\n userAgentValue,\n });\n endpointId = await getEndpointId(appId, category);\n }\n assert(!!endpointId, AmplifyErrorCode.NoEndpointId);\n return endpointId;\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,KAAK;AACxI,IAAI,IAAI,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,IAAI,IAAI,CAAC,UAAU,EAAE;AACrB,QAAQ,MAAM,cAAc,CAAC;AAC7B,YAAY,OAAO;AACnB,YAAY,KAAK;AACjB,YAAY,QAAQ;AACpB,YAAY,WAAW;AACvB,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,SAAS,CAAC,CAAC;AACX,QAAQ,UAAU,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1D,KAAK;AACL,IAAI,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxD,IAAI,OAAO,UAAU,CAAC;AACtB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.0.1-mjs-test.20ead30.0+20ead30",
3
+ "version": "6.0.1-mjs-test.237504c.0+237504c",
4
4
  "description": "Core category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -60,7 +60,7 @@
60
60
  "uuid": "^9.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@aws-amplify/react-native": "1.0.1-mjs-test.20ead30.0+20ead30",
63
+ "@aws-amplify/react-native": "1.0.1-mjs-test.237504c.0+237504c",
64
64
  "@rollup/plugin-typescript": "11.1.5",
65
65
  "@types/js-cookie": "3.0.2",
66
66
  "genversion": "^2.2.0",
@@ -234,5 +234,5 @@
234
234
  "dist"
235
235
  ]
236
236
  },
237
- "gitHead": "20ead30dfcde204f693f598b063bc05745404e03"
237
+ "gitHead": "237504cce4524ce60d4772e5d99aaf2c75c4d3ef"
238
238
  }
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '6.0.1-mjs-test.20ead30.0+20ead30';
2
+ export const version = '6.0.1-mjs-test.237504c.0+237504c';
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { CompletionObserver, Observable, from } from 'rxjs';
5
- import { isWebWorker } from '../libraryUtils';
6
5
  import { NetworkStatus } from './types';
6
+ import { isWebWorker } from '../utils';
7
7
 
8
8
  export class Reachability {
9
9
  private static _observers: Array<CompletionObserver<NetworkStatus>> = [];
@@ -8,7 +8,8 @@ import {
8
8
  UpdateEndpointInput,
9
9
  } from '../../../awsClients/pinpoint';
10
10
  import { PinpointUpdateEndpointInput } from '../types';
11
- import { cacheEndpointId, getEndpointId } from '../utils';
11
+ import { cacheEndpointId } from '../utils/cacheEndpointId';
12
+ import { getEndpointId } from '../utils/getEndpointId';
12
13
 
13
14
  /**
14
15
  * @internal
@@ -1,7 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Cache } from '../../..';
4
+ import { Cache } from '../../../Cache';
5
5
  import { SupportedCategory } from '../types';
6
6
  import { getCacheKey } from './getCacheKey';
7
7
 
@@ -1,7 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Cache } from '../../..';
4
+ import { Cache } from '../../../Cache';
5
5
  import { SupportedCategory } from '../types';
6
6
  import { getCacheKey } from './getCacheKey';
7
7
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { assert } from '../../../errors';
5
5
  import { AmplifyErrorCode } from '../../../types';
6
- import { updateEndpoint } from '../apis';
6
+ import { updateEndpoint } from '../apis/updateEndpoint';
7
7
  import { PinpointUpdateEndpointInput } from '../types';
8
8
  import { getEndpointId } from './getEndpointId';
9
9