@aws-amplify/core 6.0.1-console-preview.8f82e46.0 → 6.0.1-console-preview.b278dcb.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 (122) hide show
  1. package/lib/Cache/StorageCacheCommon.js +1 -4
  2. package/lib/I18n/I18n.js +1 -6
  3. package/lib/Platform/types.d.ts +18 -8
  4. package/lib/Platform/types.js +10 -2
  5. package/lib/Platform/version.d.ts +1 -1
  6. package/lib/Platform/version.js +1 -1
  7. package/lib/Reachability/Reachability.js +6 -1
  8. package/lib/errors/errorHelpers.d.ts +2 -0
  9. package/lib/errors/errorHelpers.js +20 -0
  10. package/lib/errors/index.d.ts +1 -0
  11. package/lib/errors/index.js +3 -1
  12. package/lib/index.d.ts +3 -1
  13. package/lib/index.js +4 -1
  14. package/lib/libraryUtils.d.ts +6 -5
  15. package/lib/libraryUtils.js +12 -12
  16. package/lib/parseAWSExports.js +34 -19
  17. package/lib/providers/pinpoint/apis/record.d.ts +1 -1
  18. package/lib/providers/pinpoint/apis/record.js +5 -21
  19. package/lib/providers/pinpoint/index.d.ts +2 -2
  20. package/lib/providers/pinpoint/index.js +4 -2
  21. package/lib/providers/pinpoint/types/errors.d.ts +9 -0
  22. package/lib/providers/pinpoint/types/errors.js +15 -0
  23. package/lib/providers/pinpoint/types/index.d.ts +1 -0
  24. package/lib/providers/pinpoint/types/index.js +3 -0
  25. package/lib/providers/pinpoint/types/pinpoint.d.ts +2 -2
  26. package/lib/providers/pinpoint/utils/index.d.ts +1 -0
  27. package/lib/providers/pinpoint/utils/index.js +3 -1
  28. package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  29. package/lib/providers/pinpoint/utils/resolveEndpointId.js +85 -0
  30. package/lib/singleton/Interactions/types.d.ts +21 -0
  31. package/lib/singleton/Interactions/types.js +4 -0
  32. package/lib/singleton/Notifications/PushNotification/types.d.ts +2 -0
  33. package/lib/singleton/Notifications/PushNotification/types.js +4 -0
  34. package/lib/singleton/Notifications/types.d.ts +3 -1
  35. package/lib/singleton/types.d.ts +3 -5
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/lib/types/errors.d.ts +1 -0
  38. package/lib/types/errors.js +1 -0
  39. package/lib/utils/deepFreeze.js +1 -1
  40. package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
  41. package/lib/utils/sessionListener/SessionListener.js +55 -0
  42. package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
  43. package/lib/utils/sessionListener/SessionListener.native.js +54 -0
  44. package/lib/utils/sessionListener/index.d.ts +2 -0
  45. package/lib/utils/sessionListener/index.js +7 -0
  46. package/lib/utils/sessionListener/types.d.ts +6 -0
  47. package/lib/utils/sessionListener/types.js +4 -0
  48. package/lib-esm/Cache/StorageCacheCommon.js +1 -4
  49. package/lib-esm/I18n/I18n.js +1 -6
  50. package/lib-esm/Platform/types.d.ts +18 -8
  51. package/lib-esm/Platform/types.js +10 -2
  52. package/lib-esm/Platform/version.d.ts +1 -1
  53. package/lib-esm/Platform/version.js +1 -1
  54. package/lib-esm/Reachability/Reachability.js +7 -2
  55. package/lib-esm/errors/errorHelpers.d.ts +2 -0
  56. package/lib-esm/errors/errorHelpers.js +17 -0
  57. package/lib-esm/errors/index.d.ts +1 -0
  58. package/lib-esm/errors/index.js +1 -0
  59. package/lib-esm/index.d.ts +3 -1
  60. package/lib-esm/index.js +2 -0
  61. package/lib-esm/libraryUtils.d.ts +6 -5
  62. package/lib-esm/libraryUtils.js +5 -4
  63. package/lib-esm/parseAWSExports.js +34 -19
  64. package/lib-esm/providers/pinpoint/apis/record.d.ts +1 -1
  65. package/lib-esm/providers/pinpoint/apis/record.js +6 -22
  66. package/lib-esm/providers/pinpoint/index.d.ts +2 -2
  67. package/lib-esm/providers/pinpoint/index.js +2 -1
  68. package/lib-esm/providers/pinpoint/types/errors.d.ts +9 -0
  69. package/lib-esm/providers/pinpoint/types/errors.js +12 -0
  70. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
  71. package/lib-esm/providers/pinpoint/types/index.js +1 -0
  72. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +2 -2
  73. package/lib-esm/providers/pinpoint/utils/index.d.ts +1 -0
  74. package/lib-esm/providers/pinpoint/utils/index.js +1 -0
  75. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  76. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +81 -0
  77. package/lib-esm/singleton/Interactions/types.d.ts +21 -0
  78. package/lib-esm/singleton/Interactions/types.js +3 -0
  79. package/lib-esm/singleton/Notifications/PushNotification/types.d.ts +2 -0
  80. package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
  81. package/lib-esm/singleton/Notifications/types.d.ts +3 -1
  82. package/lib-esm/singleton/types.d.ts +3 -5
  83. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  84. package/lib-esm/types/errors.d.ts +1 -0
  85. package/lib-esm/types/errors.js +1 -0
  86. package/lib-esm/utils/deepFreeze.js +1 -1
  87. package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
  88. package/lib-esm/utils/sessionListener/SessionListener.js +52 -0
  89. package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
  90. package/lib-esm/utils/sessionListener/SessionListener.native.js +51 -0
  91. package/lib-esm/utils/sessionListener/index.d.ts +2 -0
  92. package/lib-esm/utils/sessionListener/index.js +4 -0
  93. package/lib-esm/utils/sessionListener/types.d.ts +6 -0
  94. package/lib-esm/utils/sessionListener/types.js +3 -0
  95. package/package.json +4 -4
  96. package/src/Cache/StorageCacheCommon.ts +0 -4
  97. package/src/I18n/I18n.ts +1 -6
  98. package/src/Platform/types.ts +20 -11
  99. package/src/Platform/version.ts +1 -1
  100. package/src/Reachability/Reachability.ts +8 -2
  101. package/src/errors/errorHelpers.ts +20 -0
  102. package/src/errors/index.ts +1 -0
  103. package/src/index.ts +4 -1
  104. package/src/libraryUtils.ts +15 -8
  105. package/src/parseAWSExports.ts +28 -14
  106. package/src/providers/pinpoint/apis/record.ts +11 -25
  107. package/src/providers/pinpoint/index.ts +6 -2
  108. package/src/providers/pinpoint/types/errors.ts +12 -0
  109. package/src/providers/pinpoint/types/index.ts +1 -0
  110. package/src/providers/pinpoint/types/pinpoint.ts +2 -2
  111. package/src/providers/pinpoint/utils/index.ts +1 -0
  112. package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
  113. package/src/singleton/Interactions/types.ts +29 -0
  114. package/src/singleton/Notifications/PushNotification/types.ts +6 -0
  115. package/src/singleton/Notifications/types.ts +3 -1
  116. package/src/singleton/types.ts +3 -7
  117. package/src/types/errors.ts +1 -0
  118. package/src/utils/deepFreeze.ts +1 -1
  119. package/src/utils/sessionListener/SessionListener.native.ts +70 -0
  120. package/src/utils/sessionListener/SessionListener.ts +74 -0
  121. package/src/utils/sessionListener/index.ts +6 -0
  122. package/src/utils/sessionListener/types.ts +11 -0
@@ -61,7 +61,6 @@ var __values = (this && this.__values) || function(o) {
61
61
  };
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.StorageCacheCommon = void 0;
64
- var singleton_1 = require("../singleton");
65
64
  var Logger_1 = require("../Logger");
66
65
  var constants_1 = require("./constants");
67
66
  var utils_1 = require("./utils");
@@ -79,9 +78,7 @@ var StorageCacheCommon = /** @class */ (function () {
79
78
  */
80
79
  function StorageCacheCommon(_a) {
81
80
  var config = _a.config, keyValueStorage = _a.keyValueStorage;
82
- var _b;
83
- var globalCacheConfig = (_b = singleton_1.Amplify.getConfig().Cache) !== null && _b !== void 0 ? _b : {};
84
- this.config = __assign(__assign(__assign({}, constants_1.defaultConfig), globalCacheConfig), config);
81
+ this.config = __assign(__assign({}, constants_1.defaultConfig), config);
85
82
  this.keyValueStorage = keyValueStorage;
86
83
  this.sanitizeConfig();
87
84
  }
package/lib/I18n/I18n.js CHANGED
@@ -15,7 +15,6 @@ var __assign = (this && this.__assign) || function () {
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.I18n = void 0;
17
17
  var Logger_1 = require("../Logger");
18
- var singleton_1 = require("../singleton");
19
18
  var logger = new Logger_1.ConsoleLogger('I18n');
20
19
  /**
21
20
  * Language translation utility.
@@ -44,11 +43,7 @@ var I18n = /** @class */ (function () {
44
43
  * Sets the default language from the configuration when required.
45
44
  */
46
45
  I18n.prototype.setDefaultLanguage = function () {
47
- if (!this._lang) {
48
- var i18nConfig = singleton_1.Amplify.getConfig().I18n;
49
- this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
50
- }
51
- // Default to window language if not set in config
46
+ // Default to window language if not set in instance
52
47
  if (!this._lang &&
53
48
  typeof window !== 'undefined' &&
54
49
  window &&
@@ -73,7 +73,14 @@ export declare enum DataStoreAction {
73
73
  GraphQl = "2"
74
74
  }
75
75
  export declare enum GeoAction {
76
- None = "0"
76
+ SearchByText = "0",
77
+ SearchByCoordinates = "1",
78
+ SearchForSuggestions = "2",
79
+ SearchByPlaceId = "3",
80
+ SaveGeofences = "4",
81
+ GetGeofence = "5",
82
+ ListGeofences = "6",
83
+ DeleteGeofences = "7"
77
84
  }
78
85
  export declare enum InAppMessagingAction {
79
86
  SyncMessages = "1",
@@ -92,7 +99,8 @@ export declare enum PubSubAction {
92
99
  Subscribe = "1"
93
100
  }
94
101
  export declare enum PushNotificationAction {
95
- None = "0"
102
+ InitializePushNotifications = "1",
103
+ IdentifyUser = "2"
96
104
  }
97
105
  export declare enum StorageAction {
98
106
  UploadData = "1",
@@ -139,23 +147,25 @@ export type CategoryUserAgentStateMap = Record<string, {
139
147
  }>;
140
148
  export type CustomUserAgentStateMap = Record<string, CategoryUserAgentStateMap>;
141
149
  export type AdditionalDetails = [string, string?][];
142
- type StorageUserAgentInput = {
150
+ export type StorageUserAgentInput = {
143
151
  category: Category.Storage;
144
152
  apis: StorageAction[];
153
+ additionalDetails: AdditionalDetails;
145
154
  };
146
- type AuthUserAgentInput = {
155
+ export type AuthUserAgentInput = {
147
156
  category: Category.Auth;
148
157
  apis: AuthAction[];
158
+ additionalDetails: AdditionalDetails;
149
159
  };
150
- type InAppMessagingUserAgentInput = {
160
+ export type InAppMessagingUserAgentInput = {
151
161
  category: Category.InAppMessaging;
152
162
  apis: InAppMessagingAction[];
163
+ additionalDetails: AdditionalDetails;
153
164
  };
154
- type GeoUserAgentInput = {
165
+ export type GeoUserAgentInput = {
155
166
  category: Category.Geo;
156
167
  apis: GeoAction[];
157
- };
158
- export type SetCustomUserAgentInput = (StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput) & {
159
168
  additionalDetails: AdditionalDetails;
160
169
  };
170
+ export type SetCustomUserAgentInput = StorageUserAgentInput | AuthUserAgentInput | InAppMessagingUserAgentInput | GeoUserAgentInput;
161
171
  export {};
@@ -88,7 +88,14 @@ var DataStoreAction;
88
88
  })(DataStoreAction = exports.DataStoreAction || (exports.DataStoreAction = {}));
89
89
  var GeoAction;
90
90
  (function (GeoAction) {
91
- GeoAction["None"] = "0";
91
+ GeoAction["SearchByText"] = "0";
92
+ GeoAction["SearchByCoordinates"] = "1";
93
+ GeoAction["SearchForSuggestions"] = "2";
94
+ GeoAction["SearchByPlaceId"] = "3";
95
+ GeoAction["SaveGeofences"] = "4";
96
+ GeoAction["GetGeofence"] = "5";
97
+ GeoAction["ListGeofences"] = "6";
98
+ GeoAction["DeleteGeofences"] = "7";
92
99
  })(GeoAction = exports.GeoAction || (exports.GeoAction = {}));
93
100
  var InAppMessagingAction;
94
101
  (function (InAppMessagingAction) {
@@ -112,7 +119,8 @@ var PubSubAction;
112
119
  })(PubSubAction = exports.PubSubAction || (exports.PubSubAction = {}));
113
120
  var PushNotificationAction;
114
121
  (function (PushNotificationAction) {
115
- PushNotificationAction["None"] = "0";
122
+ PushNotificationAction["InitializePushNotifications"] = "1";
123
+ PushNotificationAction["IdentifyUser"] = "2";
116
124
  })(PushNotificationAction = exports.PushNotificationAction || (exports.PushNotificationAction = {}));
117
125
  var StorageAction;
118
126
  (function (StorageAction) {
@@ -1 +1 @@
1
- export declare const version = "6.0.1-console-preview.8f82e46.0+8f82e46";
1
+ export declare const version = "6.0.1-console-preview.b278dcb.0+b278dcb";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '6.0.1-console-preview.8f82e46.0+8f82e46';
5
+ exports.version = '6.0.1-console-preview.b278dcb.0+b278dcb';
@@ -20,7 +20,12 @@ var Reachability = exports.Reachability = /** @class */ (function () {
20
20
  function Reachability() {
21
21
  }
22
22
  Reachability.prototype.networkMonitor = function (_) {
23
- var globalObj = (0, libraryUtils_1.isWebWorker)() ? self : window;
23
+ var globalObj = (0, libraryUtils_1.isWebWorker)()
24
+ ? self
25
+ : typeof window !== 'undefined' && window;
26
+ if (!globalObj) {
27
+ return (0, rxjs_1.from)([{ online: true }]);
28
+ }
24
29
  return new rxjs_1.Observable(function (observer) {
25
30
  observer.next({ online: globalObj.navigator.onLine });
26
31
  var notifyOnline = function () { return observer.next({ online: true }); };
@@ -0,0 +1,2 @@
1
+ import { AmplifyErrorCode, AssertionFunction } from '../types';
2
+ export declare const assert: AssertionFunction<AmplifyErrorCode>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var _a;
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.assert = void 0;
7
+ var createAssertionFunction_1 = require("./createAssertionFunction");
8
+ var types_1 = require("../types");
9
+ var amplifyErrorMap = (_a = {},
10
+ _a[types_1.AmplifyErrorCode.NoEndpointId] = {
11
+ message: 'Endpoint ID was not found and was unable to be created.',
12
+ },
13
+ _a[types_1.AmplifyErrorCode.PlatformNotSupported] = {
14
+ message: 'Function not supported on current platform.',
15
+ },
16
+ _a[types_1.AmplifyErrorCode.Unknown] = {
17
+ message: 'An unknown error occurred.',
18
+ },
19
+ _a);
20
+ exports.assert = (0, createAssertionFunction_1.createAssertionFunction)(amplifyErrorMap);
@@ -1,3 +1,4 @@
1
1
  export { AmplifyError } from './AmplifyError';
2
2
  export { createAssertionFunction } from './createAssertionFunction';
3
3
  export { PlatformNotSupportedError } from './PlatformNotSupportedError';
4
+ export { assert } from './errorHelpers';
@@ -2,10 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.PlatformNotSupportedError = exports.createAssertionFunction = exports.AmplifyError = void 0;
5
+ exports.assert = exports.PlatformNotSupportedError = exports.createAssertionFunction = exports.AmplifyError = void 0;
6
6
  var AmplifyError_1 = require("./AmplifyError");
7
7
  Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return AmplifyError_1.AmplifyError; } });
8
8
  var createAssertionFunction_1 = require("./createAssertionFunction");
9
9
  Object.defineProperty(exports, "createAssertionFunction", { enumerable: true, get: function () { return createAssertionFunction_1.createAssertionFunction; } });
10
10
  var PlatformNotSupportedError_1 = require("./PlatformNotSupportedError");
11
11
  Object.defineProperty(exports, "PlatformNotSupportedError", { enumerable: true, get: function () { return PlatformNotSupportedError_1.PlatformNotSupportedError; } });
12
+ var errorHelpers_1 = require("./errorHelpers");
13
+ Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return errorHelpers_1.assert; } });
package/lib/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  export { Hub } from './Hub';
2
2
  export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
3
3
  export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
4
- export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, CacheConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
4
+ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
5
5
  export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
6
6
  export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
7
7
  export { UserProfile } from './types';
8
8
  export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
9
9
  export { KeyValueStorageInterface } from './types';
10
10
  export { Cache } from './Cache';
11
+ export { CacheConfig } from './Cache/types';
11
12
  export { I18n } from './I18n';
13
+ export { ConsoleLogger } from './Logger';
12
14
  export { ServiceWorker } from './ServiceWorker';
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.ServiceWorker = exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
5
+ exports.ServiceWorker = exports.ConsoleLogger = exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
6
6
  /*
7
7
  This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
8
8
  */
@@ -30,6 +30,9 @@ Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { r
30
30
  // Internationalization utilities
31
31
  var I18n_1 = require("./I18n");
32
32
  Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return I18n_1.I18n; } });
33
+ // Logging utilities
34
+ var Logger_1 = require("./Logger");
35
+ Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
33
36
  // Service worker
34
37
  var ServiceWorker_1 = require("./ServiceWorker");
35
38
  Object.defineProperty(exports, "ServiceWorker", { enumerable: true, get: function () { return ServiceWorker_1.ServiceWorker; } });
@@ -7,19 +7,20 @@ export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, asser
7
7
  export { isTokenExpired } from './singleton/Auth';
8
8
  export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
9
9
  export { Signer } from './Signer';
10
- export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials } from './singleton/Auth/types';
11
- export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
10
+ export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials, } from './singleton/Auth/types';
12
11
  export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
13
- export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, } from './Platform/types';
12
+ export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, StorageUserAgentInput, AuthUserAgentInput, InAppMessagingUserAgentInput, GeoUserAgentInput, } from './Platform/types';
14
13
  export { setCustomUserAgent } from './Platform/customUserAgent';
14
+ export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
15
+ export { AmplifyErrorCode, AmplifyErrorMap, AmplifyErrorParams, AssertionFunction, ServiceError, } from './types';
15
16
  export { BackgroundProcessManager } from './BackgroundProcessManager';
16
17
  export { Mutex } from './Mutex';
17
18
  export { Reachability } from './Reachability';
18
- export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
19
- export { AmplifyErrorCode, AmplifyErrorMap, AmplifyErrorParams, AssertionFunction, ServiceError, } from './types';
20
19
  export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
21
20
  export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
22
21
  export { AMPLIFY_SYMBOL } from './Hub';
23
22
  export { base64Decoder, base64Encoder } from './utils/convert';
24
23
  export { getCrypto } from './utils/globalHelpers';
25
24
  export { HubInternal } from './Hub';
25
+ export { sessionListener } from './utils/sessionListener';
26
+ export { SessionState } from './utils/sessionListener/types';
@@ -2,8 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.setCustomUserAgent = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.AmplifyUrlSearchParams = exports.AmplifyUrl = exports.amplifyUuid = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
6
- exports.HubInternal = exports.getCrypto = exports.base64Encoder = exports.base64Decoder = void 0;
5
+ exports.base64Encoder = exports.base64Decoder = exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.setCustomUserAgent = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.AmplifyUrlSearchParams = exports.AmplifyUrl = exports.amplifyUuid = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
6
+ exports.sessionListener = exports.HubInternal = exports.getCrypto = void 0;
7
7
  /*
8
8
  This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
9
9
  utils for use throughout the library.
@@ -37,10 +37,6 @@ var Auth_1 = require("./singleton/Auth");
37
37
  Object.defineProperty(exports, "isTokenExpired", { enumerable: true, get: function () { return Auth_1.isTokenExpired; } });
38
38
  var Signer_1 = require("./Signer");
39
39
  Object.defineProperty(exports, "Signer", { enumerable: true, get: function () { return Signer_1.Signer; } });
40
- // Logging utilities
41
- var Logger_1 = require("./Logger");
42
- Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
43
- Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
44
40
  // Platform & user-agent utilities
45
41
  var Platform_1 = require("./Platform");
46
42
  Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return Platform_1.Platform; } });
@@ -62,6 +58,13 @@ Object.defineProperty(exports, "PushNotificationAction", { enumerable: true, get
62
58
  Object.defineProperty(exports, "StorageAction", { enumerable: true, get: function () { return types_1.StorageAction; } });
63
59
  var customUserAgent_1 = require("./Platform/customUserAgent");
64
60
  Object.defineProperty(exports, "setCustomUserAgent", { enumerable: true, get: function () { return customUserAgent_1.setCustomUserAgent; } });
61
+ // Error handling
62
+ var errors_1 = require("./errors");
63
+ Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return errors_1.AmplifyError; } });
64
+ Object.defineProperty(exports, "PlatformNotSupportedError", { enumerable: true, get: function () { return errors_1.PlatformNotSupportedError; } });
65
+ Object.defineProperty(exports, "createAssertionFunction", { enumerable: true, get: function () { return errors_1.createAssertionFunction; } });
66
+ var types_2 = require("./types");
67
+ Object.defineProperty(exports, "AmplifyErrorCode", { enumerable: true, get: function () { return types_2.AmplifyErrorCode; } });
65
68
  // Other utilities & constants
66
69
  var BackgroundProcessManager_1 = require("./BackgroundProcessManager");
67
70
  Object.defineProperty(exports, "BackgroundProcessManager", { enumerable: true, get: function () { return BackgroundProcessManager_1.BackgroundProcessManager; } });
@@ -69,12 +72,6 @@ var Mutex_1 = require("./Mutex");
69
72
  Object.defineProperty(exports, "Mutex", { enumerable: true, get: function () { return Mutex_1.Mutex; } });
70
73
  var Reachability_1 = require("./Reachability");
71
74
  Object.defineProperty(exports, "Reachability", { enumerable: true, get: function () { return Reachability_1.Reachability; } });
72
- var errors_1 = require("./errors");
73
- Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return errors_1.AmplifyError; } });
74
- Object.defineProperty(exports, "PlatformNotSupportedError", { enumerable: true, get: function () { return errors_1.PlatformNotSupportedError; } });
75
- Object.defineProperty(exports, "createAssertionFunction", { enumerable: true, get: function () { return errors_1.createAssertionFunction; } });
76
- var types_2 = require("./types");
77
- Object.defineProperty(exports, "AmplifyErrorCode", { enumerable: true, get: function () { return types_2.AmplifyErrorCode; } });
78
75
  var constants_1 = require("./constants");
79
76
  Object.defineProperty(exports, "INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER", { enumerable: true, get: function () { return constants_1.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER; } });
80
77
  Object.defineProperty(exports, "USER_AGENT_HEADER", { enumerable: true, get: function () { return constants_1.USER_AGENT_HEADER; } });
@@ -90,3 +87,6 @@ Object.defineProperty(exports, "getCrypto", { enumerable: true, get: function ()
90
87
  // Hub
91
88
  var Hub_2 = require("./Hub");
92
89
  Object.defineProperty(exports, "HubInternal", { enumerable: true, get: function () { return Hub_2.HubInternal; } });
90
+ // Session listener
91
+ var sessionListener_1 = require("./utils/sessionListener");
92
+ Object.defineProperty(exports, "sessionListener", { enumerable: true, get: function () { return sessionListener_1.sessionListener; } });
@@ -58,9 +58,9 @@ var authTypeMapping = {
58
58
  * @returns A {@link ResourcesConfig} object.
59
59
  */
60
60
  var parseAWSExports = function (config) {
61
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
61
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
62
62
  if (config === void 0) { config = {}; }
63
- var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
63
+ var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_bots = config.aws_bots, aws_bots_config = config.aws_bots_config, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
64
64
  var amplifyConfig = {};
65
65
  // Analytics
66
66
  if (aws_mobile_analytics_app_id) {
@@ -72,18 +72,33 @@ var parseAWSExports = function (config) {
72
72
  };
73
73
  }
74
74
  // Notifications
75
- if (Notifications) {
76
- if ((_a = Notifications.InAppMessaging) === null || _a === void 0 ? void 0 : _a.AWSPinpoint) {
77
- var _p = Notifications.InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
78
- amplifyConfig.Notifications = {
79
- InAppMessaging: {
80
- Pinpoint: {
81
- appId: appId,
82
- region: region,
83
- },
75
+ var _o = Notifications !== null && Notifications !== void 0 ? Notifications : {}, InAppMessaging = _o.InAppMessaging, Push = _o.Push;
76
+ if ((InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) || (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint)) {
77
+ amplifyConfig.Notifications = {};
78
+ if (InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) {
79
+ var _p = InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
80
+ amplifyConfig.Notifications.InAppMessaging = {
81
+ Pinpoint: {
82
+ appId: appId,
83
+ region: region,
84
84
  },
85
85
  };
86
86
  }
87
+ if (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint) {
88
+ var _q = Push.AWSPinpoint, appId = _q.appId, region = _q.region;
89
+ amplifyConfig.Notifications.PushNotification = {
90
+ Pinpoint: {
91
+ appId: appId,
92
+ region: region,
93
+ },
94
+ };
95
+ }
96
+ }
97
+ // Interactions
98
+ if (Array.isArray(aws_bots_config)) {
99
+ amplifyConfig.Interactions = {
100
+ LexV1: Object.fromEntries(aws_bots_config.map(function (bot) { return [bot.name, bot]; })),
101
+ };
87
102
  }
88
103
  // API
89
104
  if (aws_appsync_graphqlEndpoint) {
@@ -105,17 +120,17 @@ var parseAWSExports = function (config) {
105
120
  ? {
106
121
  status: aws_cognito_mfa_configuration &&
107
122
  aws_cognito_mfa_configuration.toLowerCase(),
108
- totpEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _b !== void 0 ? _b : false,
109
- smsEnabled: (_c = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _c !== void 0 ? _c : false,
123
+ totpEnabled: (_a = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _a !== void 0 ? _a : false,
124
+ smsEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _b !== void 0 ? _b : false,
110
125
  }
111
126
  : undefined;
112
127
  var passwordFormatConfig = aws_cognito_password_protection_settings
113
128
  ? {
114
129
  minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
115
- requireLowercase: (_e = (_d = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _d === void 0 ? void 0 : _d.includes('REQUIRES_LOWERCASE')) !== null && _e !== void 0 ? _e : false,
116
- requireUppercase: (_g = (_f = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _f === void 0 ? void 0 : _f.includes('REQUIRES_UPPERCASE')) !== null && _g !== void 0 ? _g : false,
117
- requireNumbers: (_j = (_h = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _h === void 0 ? void 0 : _h.includes('REQUIRES_NUMBERS')) !== null && _j !== void 0 ? _j : false,
118
- requireSpecialCharacters: (_l = (_k = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _k === void 0 ? void 0 : _k.includes('REQUIRES_SYMBOLS')) !== null && _l !== void 0 ? _l : false,
130
+ requireLowercase: (_d = (_c = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _c === void 0 ? void 0 : _c.includes('REQUIRES_LOWERCASE')) !== null && _d !== void 0 ? _d : false,
131
+ requireUppercase: (_f = (_e = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _e === void 0 ? void 0 : _e.includes('REQUIRES_UPPERCASE')) !== null && _f !== void 0 ? _f : false,
132
+ requireNumbers: (_h = (_g = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _g === void 0 ? void 0 : _g.includes('REQUIRES_NUMBERS')) !== null && _h !== void 0 ? _h : false,
133
+ requireSpecialCharacters: (_k = (_j = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _j === void 0 ? void 0 : _j.includes('REQUIRES_SYMBOLS')) !== null && _k !== void 0 ? _k : false,
119
134
  }
120
135
  : undefined;
121
136
  var mergedUserAttributes = Array.from(new Set(__spreadArray(__spreadArray([], __read((aws_cognito_verification_mechanisms !== null && aws_cognito_verification_mechanisms !== void 0 ? aws_cognito_verification_mechanisms : [])), false), __read((aws_cognito_signup_attributes !== null && aws_cognito_signup_attributes !== void 0 ? aws_cognito_signup_attributes : [])), false)));
@@ -127,8 +142,8 @@ var parseAWSExports = function (config) {
127
142
  },
128
143
  _a);
129
144
  });
130
- var loginWithEmailEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _m !== void 0 ? _m : false;
131
- var loginWithPhoneEnabled = (_o = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _o !== void 0 ? _o : false;
145
+ var loginWithEmailEnabled = (_l = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _l !== void 0 ? _l : false;
146
+ var loginWithPhoneEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _m !== void 0 ? _m : false;
132
147
  if (aws_cognito_identity_pool_id || aws_user_pools_id) {
133
148
  amplifyConfig.Auth = {
134
149
  Cognito: {
@@ -2,4 +2,4 @@ import { PinpointRecordInput } from '../types';
2
2
  /**
3
3
  * @internal
4
4
  */
5
- export declare const record: ({ appId, category, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
5
+ export declare const record: ({ appId, category, channelType, credentials, event, identityId, region, userAgentValue, }: PinpointRecordInput) => Promise<void>;
@@ -42,26 +42,21 @@ exports.record = void 0;
42
42
  var amplifyUuid_1 = require("../../../utils/amplifyUuid");
43
43
  var utils_1 = require("../utils");
44
44
  var constants_1 = require("../utils/constants");
45
- var updateEndpoint_1 = require("./updateEndpoint");
46
45
  var getEventBuffer_1 = require("../utils/getEventBuffer");
47
- var errors_1 = require("../../../errors");
48
46
  // TODO(v6) Refactor when we add support for session tracking & `autoTrack`
49
47
  var session;
50
48
  /**
51
49
  * @internal
52
50
  */
53
51
  var record = function (_a) {
54
- var appId = _a.appId, category = _a.category, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
52
+ var appId = _a.appId, category = _a.category, channelType = _a.channelType, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
55
53
  return __awaiter(void 0, void 0, void 0, function () {
56
- var timestampISOString, eventId, endpointId, buffer, sessionId;
54
+ var timestampISOString, eventId, buffer, endpointId, sessionId;
57
55
  return __generator(this, function (_b) {
58
56
  switch (_b.label) {
59
57
  case 0:
60
58
  timestampISOString = new Date().toISOString();
61
59
  eventId = (0, amplifyUuid_1.amplifyUuid)();
62
- return [4 /*yield*/, (0, utils_1.getEndpointId)(appId, category)];
63
- case 1:
64
- endpointId = _b.sent();
65
60
  buffer = (0, getEventBuffer_1.getEventBuffer)({
66
61
  appId: appId,
67
62
  bufferSize: constants_1.BUFFER_SIZE,
@@ -73,28 +68,17 @@ var record = function (_a) {
73
68
  resendLimit: constants_1.RESEND_LIMIT,
74
69
  userAgentValue: userAgentValue,
75
70
  });
76
- if (!!endpointId) return [3 /*break*/, 4];
77
- return [4 /*yield*/, (0, updateEndpoint_1.updateEndpoint)({
71
+ return [4 /*yield*/, (0, utils_1.resolveEndpointId)({
78
72
  appId: appId,
79
73
  category: category,
74
+ channelType: channelType,
80
75
  credentials: credentials,
81
76
  identityId: identityId,
82
77
  region: region,
83
78
  userAgentValue: userAgentValue,
84
79
  })];
85
- case 2:
86
- _b.sent();
87
- return [4 /*yield*/, (0, utils_1.getEndpointId)(appId, category)];
88
- case 3:
80
+ case 1:
89
81
  endpointId = _b.sent();
90
- _b.label = 4;
91
- case 4:
92
- if (!endpointId) {
93
- throw new errors_1.AmplifyError({
94
- name: 'ENDPOINT_NOT_CREATED',
95
- message: 'Endpoint was not created.',
96
- });
97
- }
98
82
  // Generate session if required
99
83
  if (!session) {
100
84
  sessionId = (0, amplifyUuid_1.amplifyUuid)();
@@ -1,3 +1,3 @@
1
1
  export * from './apis';
2
- export { PinpointAnalyticsEvent, PinpointServiceOptions } from './types';
3
- export { getEndpointId } from './utils';
2
+ export { PinpointAnalyticsEvent, PinpointServiceOptions, UpdateEndpointException, } from './types';
3
+ export { resolveEndpointId } from './utils';
@@ -16,7 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.getEndpointId = void 0;
19
+ exports.resolveEndpointId = exports.UpdateEndpointException = void 0;
20
20
  __exportStar(require("./apis"), exports);
21
+ var types_1 = require("./types");
22
+ Object.defineProperty(exports, "UpdateEndpointException", { enumerable: true, get: function () { return types_1.UpdateEndpointException; } });
21
23
  var utils_1 = require("./utils");
22
- Object.defineProperty(exports, "getEndpointId", { enumerable: true, get: function () { return utils_1.getEndpointId; } });
24
+ Object.defineProperty(exports, "resolveEndpointId", { enumerable: true, get: function () { return utils_1.resolveEndpointId; } });
@@ -0,0 +1,9 @@
1
+ export declare enum UpdateEndpointException {
2
+ BadRequestException = "BadRequestException",
3
+ ForbiddenException = "ForbiddenException",
4
+ InternalServerErrorException = "InternalServerErrorException",
5
+ MethodNotAllowedException = "MethodNotAllowedException",
6
+ NotFoundException = "NotFoundException",
7
+ PayloadTooLargeException = "PayloadTooLargeException",
8
+ TooManyRequestsException = "TooManyRequestsException"
9
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.UpdateEndpointException = void 0;
6
+ var UpdateEndpointException;
7
+ (function (UpdateEndpointException) {
8
+ UpdateEndpointException["BadRequestException"] = "BadRequestException";
9
+ UpdateEndpointException["ForbiddenException"] = "ForbiddenException";
10
+ UpdateEndpointException["InternalServerErrorException"] = "InternalServerErrorException";
11
+ UpdateEndpointException["MethodNotAllowedException"] = "MethodNotAllowedException";
12
+ UpdateEndpointException["NotFoundException"] = "NotFoundException";
13
+ UpdateEndpointException["PayloadTooLargeException"] = "PayloadTooLargeException";
14
+ UpdateEndpointException["TooManyRequestsException"] = "TooManyRequestsException";
15
+ })(UpdateEndpointException = exports.UpdateEndpointException || (exports.UpdateEndpointException = {}));
@@ -1 +1,2 @@
1
+ export { UpdateEndpointException } from './errors';
1
2
  export * from './pinpoint';
@@ -16,4 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.UpdateEndpointException = void 0;
20
+ var errors_1 = require("./errors");
21
+ Object.defineProperty(exports, "UpdateEndpointException", { enumerable: true, get: function () { return errors_1.UpdateEndpointException; } });
19
22
  __exportStar(require("./pinpoint"), exports);
@@ -1,7 +1,7 @@
1
1
  import { AuthSession } from '../../../singleton/Auth/types';
2
2
  import { UserProfile } from '../../../types';
3
3
  export type SupportedCategory = 'Analytics' | 'Core' | 'InAppMessaging' | 'PushNotification';
4
- export type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
4
+ type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
5
5
  export type PinpointProviderConfig = {
6
6
  Pinpoint?: {
7
7
  appId: string;
@@ -25,13 +25,13 @@ export type PinpointAnalyticsEvent = {
25
25
  type PinpointCommonParameters = {
26
26
  appId: string;
27
27
  category: SupportedCategory;
28
+ channelType?: SupportedChannelType;
28
29
  credentials: Required<AuthSession>['credentials'];
29
30
  identityId?: AuthSession['identityId'];
30
31
  region: string;
31
32
  userAgentValue?: string;
32
33
  };
33
34
  export type PinpointUpdateEndpointInput = PinpointCommonParameters & PinpointServiceOptions & {
34
- channelType?: SupportedChannelType;
35
35
  userId?: string;
36
36
  userProfile?: UserProfile;
37
37
  };
@@ -1,3 +1,4 @@
1
1
  export { cacheEndpointId } from './cacheEndpointId';
2
2
  export { getCacheKey } from './getCacheKey';
3
3
  export { getEndpointId } from './getEndpointId';
4
+ export { resolveEndpointId } from './resolveEndpointId';
@@ -2,10 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getEndpointId = exports.getCacheKey = exports.cacheEndpointId = void 0;
5
+ exports.resolveEndpointId = exports.getEndpointId = exports.getCacheKey = exports.cacheEndpointId = void 0;
6
6
  var cacheEndpointId_1 = require("./cacheEndpointId");
7
7
  Object.defineProperty(exports, "cacheEndpointId", { enumerable: true, get: function () { return cacheEndpointId_1.cacheEndpointId; } });
8
8
  var getCacheKey_1 = require("./getCacheKey");
9
9
  Object.defineProperty(exports, "getCacheKey", { enumerable: true, get: function () { return getCacheKey_1.getCacheKey; } });
10
10
  var getEndpointId_1 = require("./getEndpointId");
11
11
  Object.defineProperty(exports, "getEndpointId", { enumerable: true, get: function () { return getEndpointId_1.getEndpointId; } });
12
+ var resolveEndpointId_1 = require("./resolveEndpointId");
13
+ Object.defineProperty(exports, "resolveEndpointId", { enumerable: true, get: function () { return resolveEndpointId_1.resolveEndpointId; } });
@@ -0,0 +1,8 @@
1
+ import { PinpointUpdateEndpointInput } from '../types';
2
+ /**
3
+ * Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
4
+ * which will generate and cache an endpoint id between calls.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare const resolveEndpointId: ({ address, appId, category, channelType, credentials, identityId, region, userAgentValue, }: PinpointUpdateEndpointInput) => Promise<string>;