@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.
- package/lib/Cache/StorageCacheCommon.js +1 -4
- package/lib/I18n/I18n.js +1 -6
- package/lib/Platform/types.d.ts +18 -8
- package/lib/Platform/types.js +10 -2
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Reachability/Reachability.js +6 -1
- package/lib/errors/errorHelpers.d.ts +2 -0
- package/lib/errors/errorHelpers.js +20 -0
- package/lib/errors/index.d.ts +1 -0
- package/lib/errors/index.js +3 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +4 -1
- package/lib/libraryUtils.d.ts +6 -5
- package/lib/libraryUtils.js +12 -12
- package/lib/parseAWSExports.js +34 -19
- package/lib/providers/pinpoint/apis/record.d.ts +1 -1
- package/lib/providers/pinpoint/apis/record.js +5 -21
- package/lib/providers/pinpoint/index.d.ts +2 -2
- package/lib/providers/pinpoint/index.js +4 -2
- package/lib/providers/pinpoint/types/errors.d.ts +9 -0
- package/lib/providers/pinpoint/types/errors.js +15 -0
- package/lib/providers/pinpoint/types/index.d.ts +1 -0
- package/lib/providers/pinpoint/types/index.js +3 -0
- package/lib/providers/pinpoint/types/pinpoint.d.ts +2 -2
- package/lib/providers/pinpoint/utils/index.d.ts +1 -0
- package/lib/providers/pinpoint/utils/index.js +3 -1
- package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
- package/lib/providers/pinpoint/utils/resolveEndpointId.js +85 -0
- package/lib/singleton/Interactions/types.d.ts +21 -0
- package/lib/singleton/Interactions/types.js +4 -0
- package/lib/singleton/Notifications/PushNotification/types.d.ts +2 -0
- package/lib/singleton/Notifications/PushNotification/types.js +4 -0
- package/lib/singleton/Notifications/types.d.ts +3 -1
- package/lib/singleton/types.d.ts +3 -5
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/errors.d.ts +1 -0
- package/lib/types/errors.js +1 -0
- package/lib/utils/deepFreeze.js +1 -1
- package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
- package/lib/utils/sessionListener/SessionListener.js +55 -0
- package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
- package/lib/utils/sessionListener/SessionListener.native.js +54 -0
- package/lib/utils/sessionListener/index.d.ts +2 -0
- package/lib/utils/sessionListener/index.js +7 -0
- package/lib/utils/sessionListener/types.d.ts +6 -0
- package/lib/utils/sessionListener/types.js +4 -0
- package/lib-esm/Cache/StorageCacheCommon.js +1 -4
- package/lib-esm/I18n/I18n.js +1 -6
- package/lib-esm/Platform/types.d.ts +18 -8
- package/lib-esm/Platform/types.js +10 -2
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Reachability/Reachability.js +7 -2
- package/lib-esm/errors/errorHelpers.d.ts +2 -0
- package/lib-esm/errors/errorHelpers.js +17 -0
- package/lib-esm/errors/index.d.ts +1 -0
- package/lib-esm/errors/index.js +1 -0
- package/lib-esm/index.d.ts +3 -1
- package/lib-esm/index.js +2 -0
- package/lib-esm/libraryUtils.d.ts +6 -5
- package/lib-esm/libraryUtils.js +5 -4
- package/lib-esm/parseAWSExports.js +34 -19
- package/lib-esm/providers/pinpoint/apis/record.d.ts +1 -1
- package/lib-esm/providers/pinpoint/apis/record.js +6 -22
- package/lib-esm/providers/pinpoint/index.d.ts +2 -2
- package/lib-esm/providers/pinpoint/index.js +2 -1
- package/lib-esm/providers/pinpoint/types/errors.d.ts +9 -0
- package/lib-esm/providers/pinpoint/types/errors.js +12 -0
- package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
- package/lib-esm/providers/pinpoint/types/index.js +1 -0
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +2 -2
- package/lib-esm/providers/pinpoint/utils/index.d.ts +1 -0
- package/lib-esm/providers/pinpoint/utils/index.js +1 -0
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +81 -0
- package/lib-esm/singleton/Interactions/types.d.ts +21 -0
- package/lib-esm/singleton/Interactions/types.js +3 -0
- package/lib-esm/singleton/Notifications/PushNotification/types.d.ts +2 -0
- package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
- package/lib-esm/singleton/Notifications/types.d.ts +3 -1
- package/lib-esm/singleton/types.d.ts +3 -5
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/errors.d.ts +1 -0
- package/lib-esm/types/errors.js +1 -0
- package/lib-esm/utils/deepFreeze.js +1 -1
- package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
- package/lib-esm/utils/sessionListener/SessionListener.js +52 -0
- package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
- package/lib-esm/utils/sessionListener/SessionListener.native.js +51 -0
- package/lib-esm/utils/sessionListener/index.d.ts +2 -0
- package/lib-esm/utils/sessionListener/index.js +4 -0
- package/lib-esm/utils/sessionListener/types.d.ts +6 -0
- package/lib-esm/utils/sessionListener/types.js +3 -0
- package/package.json +4 -4
- package/src/Cache/StorageCacheCommon.ts +0 -4
- package/src/I18n/I18n.ts +1 -6
- package/src/Platform/types.ts +20 -11
- package/src/Platform/version.ts +1 -1
- package/src/Reachability/Reachability.ts +8 -2
- package/src/errors/errorHelpers.ts +20 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +4 -1
- package/src/libraryUtils.ts +15 -8
- package/src/parseAWSExports.ts +28 -14
- package/src/providers/pinpoint/apis/record.ts +11 -25
- package/src/providers/pinpoint/index.ts +6 -2
- package/src/providers/pinpoint/types/errors.ts +12 -0
- package/src/providers/pinpoint/types/index.ts +1 -0
- package/src/providers/pinpoint/types/pinpoint.ts +2 -2
- package/src/providers/pinpoint/utils/index.ts +1 -0
- package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
- package/src/singleton/Interactions/types.ts +29 -0
- package/src/singleton/Notifications/PushNotification/types.ts +6 -0
- package/src/singleton/Notifications/types.ts +3 -1
- package/src/singleton/types.ts +3 -7
- package/src/types/errors.ts +1 -0
- package/src/utils/deepFreeze.ts +1 -1
- package/src/utils/sessionListener/SessionListener.native.ts +70 -0
- package/src/utils/sessionListener/SessionListener.ts +74 -0
- package/src/utils/sessionListener/index.ts +6 -0
- package/src/utils/sessionListener/types.ts +11 -0
package/lib/types/errors.d.ts
CHANGED
package/lib/types/errors.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.AmplifyErrorCode = void 0;
|
|
6
6
|
var AmplifyErrorCode;
|
|
7
7
|
(function (AmplifyErrorCode) {
|
|
8
|
+
AmplifyErrorCode["NoEndpointId"] = "NoEndpointId";
|
|
8
9
|
AmplifyErrorCode["PlatformNotSupported"] = "PlatformNotSupported";
|
|
9
10
|
AmplifyErrorCode["Unknown"] = "Unknown";
|
|
10
11
|
})(AmplifyErrorCode = exports.AmplifyErrorCode || (exports.AmplifyErrorCode = {}));
|
package/lib/utils/deepFreeze.js
CHANGED
|
@@ -21,7 +21,7 @@ var deepFreeze = function (object) {
|
|
|
21
21
|
for (var propNames_1 = __values(propNames), propNames_1_1 = propNames_1.next(); !propNames_1_1.done; propNames_1_1 = propNames_1.next()) {
|
|
22
22
|
var name_1 = propNames_1_1.value;
|
|
23
23
|
var value = object[name_1];
|
|
24
|
-
if ((value && typeof value ===
|
|
24
|
+
if ((value && typeof value === 'object') || typeof value === 'function') {
|
|
25
25
|
(0, exports.deepFreeze)(value);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionStateChangeListener, SessionListenerInterface } from './types';
|
|
2
|
+
export declare class SessionListener implements SessionListenerInterface {
|
|
3
|
+
private listenerActive;
|
|
4
|
+
constructor();
|
|
5
|
+
addStateChangeListener(listener: SessionStateChangeListener, notifyOnAdd?: boolean): void;
|
|
6
|
+
removeStateChangeListener(handler: SessionStateChangeListener): void;
|
|
7
|
+
private handleVisibilityChange;
|
|
8
|
+
private notifyHandlers;
|
|
9
|
+
private getSessionState;
|
|
10
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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.SessionListener = void 0;
|
|
6
|
+
var isBrowser_1 = require("../isBrowser");
|
|
7
|
+
var stateChangeListeners = new Set();
|
|
8
|
+
var SessionListener = /** @class */ (function () {
|
|
9
|
+
function SessionListener() {
|
|
10
|
+
this.listenerActive = false;
|
|
11
|
+
this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
|
|
12
|
+
// Setup state listeners
|
|
13
|
+
if ((0, isBrowser_1.isBrowser)()) {
|
|
14
|
+
document.addEventListener('visibilitychange', this.handleVisibilityChange, false);
|
|
15
|
+
this.listenerActive = true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
SessionListener.prototype.addStateChangeListener = function (listener, notifyOnAdd) {
|
|
19
|
+
if (notifyOnAdd === void 0) { notifyOnAdd = false; }
|
|
20
|
+
// No-op if document listener is not active
|
|
21
|
+
if (!this.listenerActive) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
stateChangeListeners.add(listener);
|
|
25
|
+
// Notify new handlers of the current status on add
|
|
26
|
+
if (notifyOnAdd) {
|
|
27
|
+
listener(this.getSessionState());
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
SessionListener.prototype.removeStateChangeListener = function (handler) {
|
|
31
|
+
// No-op if document listener is not active
|
|
32
|
+
if (!this.listenerActive) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
stateChangeListeners.delete(handler);
|
|
36
|
+
};
|
|
37
|
+
SessionListener.prototype.handleVisibilityChange = function () {
|
|
38
|
+
this.notifyHandlers();
|
|
39
|
+
};
|
|
40
|
+
SessionListener.prototype.notifyHandlers = function () {
|
|
41
|
+
var sessionState = this.getSessionState();
|
|
42
|
+
stateChangeListeners.forEach(function (listener) {
|
|
43
|
+
listener(sessionState);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
SessionListener.prototype.getSessionState = function () {
|
|
47
|
+
if ((0, isBrowser_1.isBrowser)() && document.visibilityState !== 'hidden') {
|
|
48
|
+
return 'started';
|
|
49
|
+
}
|
|
50
|
+
// If, for any reason, document is undefined the session will never start
|
|
51
|
+
return 'ended';
|
|
52
|
+
};
|
|
53
|
+
return SessionListener;
|
|
54
|
+
}());
|
|
55
|
+
exports.SessionListener = SessionListener;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SessionStateChangeListener, SessionListenerInterface } from './types';
|
|
2
|
+
export declare class SessionListener implements SessionListenerInterface {
|
|
3
|
+
private currentAppState?;
|
|
4
|
+
constructor();
|
|
5
|
+
addStateChangeListener(listener: SessionStateChangeListener, notifyOnAdd?: boolean): void;
|
|
6
|
+
removeStateChangeListener(handler: SessionStateChangeListener): void;
|
|
7
|
+
private handleStateChange;
|
|
8
|
+
private notifyHandlers;
|
|
9
|
+
private getSessionState;
|
|
10
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.SessionListener = void 0;
|
|
6
|
+
var react_native_1 = require("@aws-amplify/react-native");
|
|
7
|
+
var stateChangeListeners = new Set();
|
|
8
|
+
var isActive = function (appState) { return appState === 'active'; };
|
|
9
|
+
var isInactive = function (appState) {
|
|
10
|
+
return appState === 'inactive' || appState === 'background';
|
|
11
|
+
};
|
|
12
|
+
var SessionListener = /** @class */ (function () {
|
|
13
|
+
function SessionListener() {
|
|
14
|
+
this.handleStateChange = this.handleStateChange.bind(this);
|
|
15
|
+
// Setup state listeners
|
|
16
|
+
(0, react_native_1.loadAppState)().addEventListener('change', this.handleStateChange);
|
|
17
|
+
}
|
|
18
|
+
SessionListener.prototype.addStateChangeListener = function (listener, notifyOnAdd) {
|
|
19
|
+
if (notifyOnAdd === void 0) { notifyOnAdd = false; }
|
|
20
|
+
stateChangeListeners.add(listener);
|
|
21
|
+
// Notify new handlers of the current state on add if the current state has been determined
|
|
22
|
+
if (notifyOnAdd && this.currentAppState !== undefined) {
|
|
23
|
+
listener(this.getSessionState());
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
SessionListener.prototype.removeStateChangeListener = function (handler) {
|
|
27
|
+
stateChangeListeners.delete(handler);
|
|
28
|
+
};
|
|
29
|
+
SessionListener.prototype.handleStateChange = function (nextAppState) {
|
|
30
|
+
if ((this.currentAppState === undefined ||
|
|
31
|
+
isInactive(this.currentAppState)) &&
|
|
32
|
+
isActive(nextAppState)) {
|
|
33
|
+
this.notifyHandlers('started');
|
|
34
|
+
}
|
|
35
|
+
else if (isActive(this.currentAppState) && isInactive(nextAppState)) {
|
|
36
|
+
this.notifyHandlers('ended');
|
|
37
|
+
}
|
|
38
|
+
this.currentAppState = nextAppState;
|
|
39
|
+
};
|
|
40
|
+
SessionListener.prototype.notifyHandlers = function (state) {
|
|
41
|
+
stateChangeListeners.forEach(function (listener) {
|
|
42
|
+
listener(state);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
SessionListener.prototype.getSessionState = function () {
|
|
46
|
+
if (isActive(this.currentAppState)) {
|
|
47
|
+
return 'started';
|
|
48
|
+
}
|
|
49
|
+
// Consider any other app state as ended
|
|
50
|
+
return 'ended';
|
|
51
|
+
};
|
|
52
|
+
return SessionListener;
|
|
53
|
+
}());
|
|
54
|
+
exports.SessionListener = SessionListener;
|
|
@@ -0,0 +1,7 @@
|
|
|
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.sessionListener = void 0;
|
|
6
|
+
var SessionListener_1 = require("./SessionListener");
|
|
7
|
+
exports.sessionListener = new SessionListener_1.SessionListener();
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type SessionState = 'started' | 'ended';
|
|
2
|
+
export type SessionStateChangeListener = (state: SessionState) => void;
|
|
3
|
+
export interface SessionListenerInterface {
|
|
4
|
+
addStateChangeListener: (listener: SessionStateChangeListener) => void;
|
|
5
|
+
removeStateChangeListener: (listener: SessionStateChangeListener) => void;
|
|
6
|
+
}
|
|
@@ -58,7 +58,6 @@ var __values = (this && this.__values) || function(o) {
|
|
|
58
58
|
};
|
|
59
59
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
60
60
|
};
|
|
61
|
-
import { Amplify } from '../singleton';
|
|
62
61
|
import { ConsoleLogger as Logger } from '../Logger';
|
|
63
62
|
import { currentSizeKey, defaultConfig } from './constants';
|
|
64
63
|
import { getCurrentSizeKey, getCurrentTime, getByteLength } from './utils';
|
|
@@ -76,9 +75,7 @@ var StorageCacheCommon = /** @class */ (function () {
|
|
|
76
75
|
*/
|
|
77
76
|
function StorageCacheCommon(_a) {
|
|
78
77
|
var config = _a.config, keyValueStorage = _a.keyValueStorage;
|
|
79
|
-
|
|
80
|
-
var globalCacheConfig = (_b = Amplify.getConfig().Cache) !== null && _b !== void 0 ? _b : {};
|
|
81
|
-
this.config = __assign(__assign(__assign({}, defaultConfig), globalCacheConfig), config);
|
|
78
|
+
this.config = __assign(__assign({}, defaultConfig), config);
|
|
82
79
|
this.keyValueStorage = keyValueStorage;
|
|
83
80
|
this.sanitizeConfig();
|
|
84
81
|
}
|
package/lib-esm/I18n/I18n.js
CHANGED
|
@@ -12,7 +12,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
return __assign.apply(this, arguments);
|
|
13
13
|
};
|
|
14
14
|
import { ConsoleLogger as Logger } from '../Logger';
|
|
15
|
-
import { Amplify } from '../singleton';
|
|
16
15
|
var logger = new Logger('I18n');
|
|
17
16
|
/**
|
|
18
17
|
* Language translation utility.
|
|
@@ -41,11 +40,7 @@ var I18n = /** @class */ (function () {
|
|
|
41
40
|
* Sets the default language from the configuration when required.
|
|
42
41
|
*/
|
|
43
42
|
I18n.prototype.setDefaultLanguage = function () {
|
|
44
|
-
if
|
|
45
|
-
var i18nConfig = Amplify.getConfig().I18n;
|
|
46
|
-
this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
|
|
47
|
-
}
|
|
48
|
-
// Default to window language if not set in config
|
|
43
|
+
// Default to window language if not set in instance
|
|
49
44
|
if (!this._lang &&
|
|
50
45
|
typeof window !== 'undefined' &&
|
|
51
46
|
window &&
|
|
@@ -73,7 +73,14 @@ export declare enum DataStoreAction {
|
|
|
73
73
|
GraphQl = "2"
|
|
74
74
|
}
|
|
75
75
|
export declare enum GeoAction {
|
|
76
|
-
|
|
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
|
-
|
|
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 {};
|
|
@@ -85,7 +85,14 @@ export var DataStoreAction;
|
|
|
85
85
|
})(DataStoreAction || (DataStoreAction = {}));
|
|
86
86
|
export var GeoAction;
|
|
87
87
|
(function (GeoAction) {
|
|
88
|
-
GeoAction["
|
|
88
|
+
GeoAction["SearchByText"] = "0";
|
|
89
|
+
GeoAction["SearchByCoordinates"] = "1";
|
|
90
|
+
GeoAction["SearchForSuggestions"] = "2";
|
|
91
|
+
GeoAction["SearchByPlaceId"] = "3";
|
|
92
|
+
GeoAction["SaveGeofences"] = "4";
|
|
93
|
+
GeoAction["GetGeofence"] = "5";
|
|
94
|
+
GeoAction["ListGeofences"] = "6";
|
|
95
|
+
GeoAction["DeleteGeofences"] = "7";
|
|
89
96
|
})(GeoAction || (GeoAction = {}));
|
|
90
97
|
export var InAppMessagingAction;
|
|
91
98
|
(function (InAppMessagingAction) {
|
|
@@ -109,7 +116,8 @@ export var PubSubAction;
|
|
|
109
116
|
})(PubSubAction || (PubSubAction = {}));
|
|
110
117
|
export var PushNotificationAction;
|
|
111
118
|
(function (PushNotificationAction) {
|
|
112
|
-
PushNotificationAction["
|
|
119
|
+
PushNotificationAction["InitializePushNotifications"] = "1";
|
|
120
|
+
PushNotificationAction["IdentifyUser"] = "2";
|
|
113
121
|
})(PushNotificationAction || (PushNotificationAction = {}));
|
|
114
122
|
export var StorageAction;
|
|
115
123
|
(function (StorageAction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.b278dcb.0+b278dcb";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export var version = '6.0.1-console-preview.
|
|
2
|
+
export var version = '6.0.1-console-preview.b278dcb.0+b278dcb';
|
|
@@ -11,13 +11,18 @@ var __values = (this && this.__values) || function(o) {
|
|
|
11
11
|
};
|
|
12
12
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
13
13
|
};
|
|
14
|
-
import { Observable } from 'rxjs';
|
|
14
|
+
import { Observable, from } from 'rxjs';
|
|
15
15
|
import { isWebWorker } from '../libraryUtils';
|
|
16
16
|
export var Reachability = /** @class */ (function () {
|
|
17
17
|
function Reachability() {
|
|
18
18
|
}
|
|
19
19
|
Reachability.prototype.networkMonitor = function (_) {
|
|
20
|
-
var globalObj = isWebWorker()
|
|
20
|
+
var globalObj = isWebWorker()
|
|
21
|
+
? self
|
|
22
|
+
: typeof window !== 'undefined' && window;
|
|
23
|
+
if (!globalObj) {
|
|
24
|
+
return from([{ online: true }]);
|
|
25
|
+
}
|
|
21
26
|
return new Observable(function (observer) {
|
|
22
27
|
observer.next({ online: globalObj.navigator.onLine });
|
|
23
28
|
var notifyOnline = function () { return observer.next({ online: true }); };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var _a;
|
|
4
|
+
import { createAssertionFunction } from './createAssertionFunction';
|
|
5
|
+
import { AmplifyErrorCode } from '../types';
|
|
6
|
+
var amplifyErrorMap = (_a = {},
|
|
7
|
+
_a[AmplifyErrorCode.NoEndpointId] = {
|
|
8
|
+
message: 'Endpoint ID was not found and was unable to be created.',
|
|
9
|
+
},
|
|
10
|
+
_a[AmplifyErrorCode.PlatformNotSupported] = {
|
|
11
|
+
message: 'Function not supported on current platform.',
|
|
12
|
+
},
|
|
13
|
+
_a[AmplifyErrorCode.Unknown] = {
|
|
14
|
+
message: 'An unknown error occurred.',
|
|
15
|
+
},
|
|
16
|
+
_a);
|
|
17
|
+
export var assert = createAssertionFunction(amplifyErrorMap);
|
package/lib-esm/errors/index.js
CHANGED
package/lib-esm/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,
|
|
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-esm/index.js
CHANGED
|
@@ -14,5 +14,7 @@ export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, }
|
|
|
14
14
|
export { Cache } from './Cache';
|
|
15
15
|
// Internationalization utilities
|
|
16
16
|
export { I18n } from './I18n';
|
|
17
|
+
// Logging utilities
|
|
18
|
+
export { ConsoleLogger } from './Logger';
|
|
17
19
|
// Service worker
|
|
18
20
|
export { ServiceWorker } from './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';
|
package/lib-esm/libraryUtils.js
CHANGED
|
@@ -13,18 +13,17 @@ export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
|
|
|
13
13
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
14
14
|
export { isTokenExpired } from './singleton/Auth';
|
|
15
15
|
export { Signer } from './Signer';
|
|
16
|
-
// Logging utilities
|
|
17
|
-
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
18
16
|
// Platform & user-agent utilities
|
|
19
17
|
export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
|
|
20
18
|
export { ApiAction, AuthAction, AnalyticsAction, Category, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
|
|
21
19
|
export { setCustomUserAgent } from './Platform/customUserAgent';
|
|
20
|
+
// Error handling
|
|
21
|
+
export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
|
|
22
|
+
export { AmplifyErrorCode, } from './types';
|
|
22
23
|
// Other utilities & constants
|
|
23
24
|
export { BackgroundProcessManager } from './BackgroundProcessManager';
|
|
24
25
|
export { Mutex } from './Mutex';
|
|
25
26
|
export { Reachability } from './Reachability';
|
|
26
|
-
export { AmplifyError, PlatformNotSupportedError, createAssertionFunction, } from './errors';
|
|
27
|
-
export { AmplifyErrorCode, } from './types';
|
|
28
27
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './constants';
|
|
29
28
|
export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
|
|
30
29
|
export { AMPLIFY_SYMBOL } from './Hub';
|
|
@@ -32,3 +31,5 @@ export { base64Decoder, base64Encoder } from './utils/convert';
|
|
|
32
31
|
export { getCrypto } from './utils/globalHelpers';
|
|
33
32
|
// Hub
|
|
34
33
|
export { HubInternal } from './Hub';
|
|
34
|
+
// Session listener
|
|
35
|
+
export { sessionListener } from './utils/sessionListener';
|
|
@@ -55,9 +55,9 @@ var authTypeMapping = {
|
|
|
55
55
|
* @returns A {@link ResourcesConfig} object.
|
|
56
56
|
*/
|
|
57
57
|
export var parseAWSExports = function (config) {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
59
59
|
if (config === void 0) { config = {}; }
|
|
60
|
-
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;
|
|
60
|
+
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;
|
|
61
61
|
var amplifyConfig = {};
|
|
62
62
|
// Analytics
|
|
63
63
|
if (aws_mobile_analytics_app_id) {
|
|
@@ -69,18 +69,33 @@ export var parseAWSExports = function (config) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
// Notifications
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
var _o = Notifications !== null && Notifications !== void 0 ? Notifications : {}, InAppMessaging = _o.InAppMessaging, Push = _o.Push;
|
|
73
|
+
if ((InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) || (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint)) {
|
|
74
|
+
amplifyConfig.Notifications = {};
|
|
75
|
+
if (InAppMessaging === null || InAppMessaging === void 0 ? void 0 : InAppMessaging.AWSPinpoint) {
|
|
76
|
+
var _p = InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
|
|
77
|
+
amplifyConfig.Notifications.InAppMessaging = {
|
|
78
|
+
Pinpoint: {
|
|
79
|
+
appId: appId,
|
|
80
|
+
region: region,
|
|
81
81
|
},
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
+
if (Push === null || Push === void 0 ? void 0 : Push.AWSPinpoint) {
|
|
85
|
+
var _q = Push.AWSPinpoint, appId = _q.appId, region = _q.region;
|
|
86
|
+
amplifyConfig.Notifications.PushNotification = {
|
|
87
|
+
Pinpoint: {
|
|
88
|
+
appId: appId,
|
|
89
|
+
region: region,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Interactions
|
|
95
|
+
if (Array.isArray(aws_bots_config)) {
|
|
96
|
+
amplifyConfig.Interactions = {
|
|
97
|
+
LexV1: Object.fromEntries(aws_bots_config.map(function (bot) { return [bot.name, bot]; })),
|
|
98
|
+
};
|
|
84
99
|
}
|
|
85
100
|
// API
|
|
86
101
|
if (aws_appsync_graphqlEndpoint) {
|
|
@@ -102,17 +117,17 @@ export var parseAWSExports = function (config) {
|
|
|
102
117
|
? {
|
|
103
118
|
status: aws_cognito_mfa_configuration &&
|
|
104
119
|
aws_cognito_mfa_configuration.toLowerCase(),
|
|
105
|
-
totpEnabled: (
|
|
106
|
-
smsEnabled: (
|
|
120
|
+
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,
|
|
121
|
+
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,
|
|
107
122
|
}
|
|
108
123
|
: undefined;
|
|
109
124
|
var passwordFormatConfig = aws_cognito_password_protection_settings
|
|
110
125
|
? {
|
|
111
126
|
minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
|
|
112
|
-
requireLowercase: (
|
|
113
|
-
requireUppercase: (
|
|
114
|
-
requireNumbers: (
|
|
115
|
-
requireSpecialCharacters: (
|
|
127
|
+
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,
|
|
128
|
+
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,
|
|
129
|
+
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,
|
|
130
|
+
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,
|
|
116
131
|
}
|
|
117
132
|
: undefined;
|
|
118
133
|
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)));
|
|
@@ -124,8 +139,8 @@ export var parseAWSExports = function (config) {
|
|
|
124
139
|
},
|
|
125
140
|
_a);
|
|
126
141
|
});
|
|
127
|
-
var loginWithEmailEnabled = (
|
|
128
|
-
var loginWithPhoneEnabled = (
|
|
142
|
+
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;
|
|
143
|
+
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;
|
|
129
144
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
130
145
|
amplifyConfig.Auth = {
|
|
131
146
|
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>;
|
|
@@ -37,28 +37,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
40
|
-
import {
|
|
40
|
+
import { resolveEndpointId } from '../utils';
|
|
41
41
|
import { BUFFER_SIZE, FLUSH_INTERVAL, FLUSH_SIZE, RESEND_LIMIT, } from '../utils/constants';
|
|
42
|
-
import { updateEndpoint } from './updateEndpoint';
|
|
43
42
|
import { getEventBuffer } from '../utils/getEventBuffer';
|
|
44
|
-
import { AmplifyError } from '../../../errors';
|
|
45
43
|
// TODO(v6) Refactor when we add support for session tracking & `autoTrack`
|
|
46
44
|
var session;
|
|
47
45
|
/**
|
|
48
46
|
* @internal
|
|
49
47
|
*/
|
|
50
48
|
export var record = function (_a) {
|
|
51
|
-
var appId = _a.appId, category = _a.category, credentials = _a.credentials, event = _a.event, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
|
|
49
|
+
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;
|
|
52
50
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
-
var timestampISOString, eventId,
|
|
51
|
+
var timestampISOString, eventId, buffer, endpointId, sessionId;
|
|
54
52
|
return __generator(this, function (_b) {
|
|
55
53
|
switch (_b.label) {
|
|
56
54
|
case 0:
|
|
57
55
|
timestampISOString = new Date().toISOString();
|
|
58
56
|
eventId = amplifyUuid();
|
|
59
|
-
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
60
|
-
case 1:
|
|
61
|
-
endpointId = _b.sent();
|
|
62
57
|
buffer = getEventBuffer({
|
|
63
58
|
appId: appId,
|
|
64
59
|
bufferSize: BUFFER_SIZE,
|
|
@@ -70,28 +65,17 @@ export var record = function (_a) {
|
|
|
70
65
|
resendLimit: RESEND_LIMIT,
|
|
71
66
|
userAgentValue: userAgentValue,
|
|
72
67
|
});
|
|
73
|
-
|
|
74
|
-
return [4 /*yield*/, updateEndpoint({
|
|
68
|
+
return [4 /*yield*/, resolveEndpointId({
|
|
75
69
|
appId: appId,
|
|
76
70
|
category: category,
|
|
71
|
+
channelType: channelType,
|
|
77
72
|
credentials: credentials,
|
|
78
73
|
identityId: identityId,
|
|
79
74
|
region: region,
|
|
80
75
|
userAgentValue: userAgentValue,
|
|
81
76
|
})];
|
|
82
|
-
case
|
|
83
|
-
_b.sent();
|
|
84
|
-
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
85
|
-
case 3:
|
|
77
|
+
case 1:
|
|
86
78
|
endpointId = _b.sent();
|
|
87
|
-
_b.label = 4;
|
|
88
|
-
case 4:
|
|
89
|
-
if (!endpointId) {
|
|
90
|
-
throw new AmplifyError({
|
|
91
|
-
name: 'ENDPOINT_NOT_CREATED',
|
|
92
|
-
message: 'Endpoint was not created.',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
79
|
// Generate session if required
|
|
96
80
|
if (!session) {
|
|
97
81
|
sessionId = amplifyUuid();
|