@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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './apis';
|
|
2
|
-
export { PinpointAnalyticsEvent, PinpointServiceOptions } from './types';
|
|
3
|
-
export {
|
|
2
|
+
export { PinpointAnalyticsEvent, PinpointServiceOptions, UpdateEndpointException, } from './types';
|
|
3
|
+
export { resolveEndpointId } from './utils';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export * from './apis';
|
|
4
|
-
export {
|
|
4
|
+
export { UpdateEndpointException, } from './types';
|
|
5
|
+
export { resolveEndpointId } from './utils';
|
|
@@ -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,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export var UpdateEndpointException;
|
|
4
|
+
(function (UpdateEndpointException) {
|
|
5
|
+
UpdateEndpointException["BadRequestException"] = "BadRequestException";
|
|
6
|
+
UpdateEndpointException["ForbiddenException"] = "ForbiddenException";
|
|
7
|
+
UpdateEndpointException["InternalServerErrorException"] = "InternalServerErrorException";
|
|
8
|
+
UpdateEndpointException["MethodNotAllowedException"] = "MethodNotAllowedException";
|
|
9
|
+
UpdateEndpointException["NotFoundException"] = "NotFoundException";
|
|
10
|
+
UpdateEndpointException["PayloadTooLargeException"] = "PayloadTooLargeException";
|
|
11
|
+
UpdateEndpointException["TooManyRequestsException"] = "TooManyRequestsException";
|
|
12
|
+
})(UpdateEndpointException || (UpdateEndpointException = {}));
|
|
@@ -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
|
-
|
|
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
|
};
|
|
@@ -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>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
import { assert } from '../../../errors';
|
|
40
|
+
import { AmplifyErrorCode } from '../../../types';
|
|
41
|
+
import { updateEndpoint } from '../apis';
|
|
42
|
+
import { getEndpointId } from './getEndpointId';
|
|
43
|
+
/**
|
|
44
|
+
* Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
|
|
45
|
+
* which will generate and cache an endpoint id between calls.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export var resolveEndpointId = function (_a) {
|
|
50
|
+
var address = _a.address, appId = _a.appId, category = _a.category, channelType = _a.channelType, credentials = _a.credentials, identityId = _a.identityId, region = _a.region, userAgentValue = _a.userAgentValue;
|
|
51
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var endpointId;
|
|
53
|
+
return __generator(this, function (_b) {
|
|
54
|
+
switch (_b.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, getEndpointId(appId, category)];
|
|
56
|
+
case 1:
|
|
57
|
+
endpointId = _b.sent();
|
|
58
|
+
if (!!endpointId) return [3 /*break*/, 4];
|
|
59
|
+
return [4 /*yield*/, updateEndpoint({
|
|
60
|
+
address: address,
|
|
61
|
+
appId: appId,
|
|
62
|
+
category: category,
|
|
63
|
+
channelType: channelType,
|
|
64
|
+
credentials: credentials,
|
|
65
|
+
identityId: identityId,
|
|
66
|
+
region: region,
|
|
67
|
+
userAgentValue: userAgentValue,
|
|
68
|
+
})];
|
|
69
|
+
case 2:
|
|
70
|
+
_b.sent();
|
|
71
|
+
return [4 /*yield*/, getEndpointId(appId, category)];
|
|
72
|
+
case 3:
|
|
73
|
+
endpointId = _b.sent();
|
|
74
|
+
_b.label = 4;
|
|
75
|
+
case 4:
|
|
76
|
+
assert(!!endpointId, AmplifyErrorCode.NoEndpointId);
|
|
77
|
+
return [2 /*return*/, endpointId];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface LexV1BotConfig {
|
|
2
|
+
alias: string;
|
|
3
|
+
region: string;
|
|
4
|
+
}
|
|
5
|
+
interface LexV2BotConfig {
|
|
6
|
+
botId: string;
|
|
7
|
+
aliasId: string;
|
|
8
|
+
localeId: string;
|
|
9
|
+
region: string;
|
|
10
|
+
}
|
|
11
|
+
type InteractionsLexV1Config = {
|
|
12
|
+
LexV1: Record<string, LexV1BotConfig>;
|
|
13
|
+
};
|
|
14
|
+
type InteractionsLexV2Config = {
|
|
15
|
+
LexV2: Record<string, LexV2BotConfig>;
|
|
16
|
+
};
|
|
17
|
+
type AtLeastOne<T, U = {
|
|
18
|
+
[K in keyof T]: Pick<T, K>;
|
|
19
|
+
}> = Partial<T> & U[keyof U];
|
|
20
|
+
export type InteractionsConfig = AtLeastOne<InteractionsLexV1Config & InteractionsLexV2Config>;
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { InAppMessagingConfig } from './InAppMessaging/types';
|
|
2
|
+
import { PushNotificationConfig } from './PushNotification/types';
|
|
2
3
|
export type NotificationsConfig = {
|
|
3
|
-
InAppMessaging
|
|
4
|
+
InAppMessaging?: InAppMessagingConfig;
|
|
5
|
+
PushNotification?: PushNotificationConfig;
|
|
4
6
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { APIConfig, LibraryAPIOptions } from './API/types';
|
|
2
2
|
import { AnalyticsConfig } from './Analytics/types';
|
|
3
3
|
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
|
|
4
|
-
import { CacheConfig } from './Cache/types';
|
|
5
4
|
import { GeoConfig } from './Geo/types';
|
|
6
5
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
7
|
-
import { I18nConfig } from '../I18n/types';
|
|
8
6
|
import { NotificationsConfig } from './Notifications/types';
|
|
7
|
+
import { InteractionsConfig } from './Interactions/types';
|
|
9
8
|
export type LegacyConfig = {
|
|
10
9
|
/**
|
|
11
10
|
* @deprecated The field should not be used.
|
|
@@ -16,8 +15,7 @@ export type ResourcesConfig = {
|
|
|
16
15
|
API?: APIConfig;
|
|
17
16
|
Analytics?: AnalyticsConfig;
|
|
18
17
|
Auth?: AuthConfig;
|
|
19
|
-
|
|
20
|
-
I18n?: I18nConfig;
|
|
18
|
+
Interactions?: InteractionsConfig;
|
|
21
19
|
Notifications?: NotificationsConfig;
|
|
22
20
|
Storage?: StorageConfig;
|
|
23
21
|
Geo?: GeoConfig;
|
|
@@ -28,4 +26,4 @@ export type LibraryOptions = {
|
|
|
28
26
|
Storage?: LibraryStorageOptions;
|
|
29
27
|
ssr?: boolean;
|
|
30
28
|
};
|
|
31
|
-
export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig,
|
|
29
|
+
export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, InteractionsConfig, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
|