@aws-amplify/core 6.0.1-console-preview.5a31ca1.0 → 6.0.1-console-preview.8d88eef.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/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/ServiceWorker/ServiceWorker.js +69 -17
- package/lib/ServiceWorker/index.d.ts +0 -12
- package/lib/ServiceWorker/index.js +0 -12
- 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 +2 -0
- package/lib/index.js +7 -1
- package/lib/libraryUtils.d.ts +4 -6
- package/lib/libraryUtils.js +9 -15
- package/lib/parseAWSExports.js +27 -18
- 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 +3 -3
- 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/Auth/types.d.ts +2 -2
- 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/tsconfig.tsbuildinfo +1 -1
- package/lib/types/errors.d.ts +1 -0
- package/lib/types/errors.js +1 -0
- 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/ServiceWorker/ServiceWorker.js +69 -17
- package/lib-esm/ServiceWorker/index.d.ts +0 -12
- package/lib-esm/ServiceWorker/index.js +0 -12
- 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 +2 -0
- package/lib-esm/index.js +4 -0
- package/lib-esm/libraryUtils.d.ts +4 -6
- package/lib-esm/libraryUtils.js +3 -6
- package/lib-esm/parseAWSExports.js +27 -18
- 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 +3 -3
- 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/Auth/types.d.ts +2 -2
- 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/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/errors.d.ts +1 -0
- package/lib-esm/types/errors.js +1 -0
- package/package.json +3 -3
- package/src/Platform/types.ts +20 -11
- package/src/Platform/version.ts +1 -1
- package/src/ServiceWorker/ServiceWorker.ts +20 -17
- package/src/ServiceWorker/index.ts +0 -12
- package/src/errors/errorHelpers.ts +20 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/libraryUtils.ts +11 -11
- package/src/parseAWSExports.ts +19 -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 +3 -2
- package/src/providers/pinpoint/utils/index.ts +1 -0
- package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
- package/src/singleton/Auth/types.ts +2 -2
- package/src/singleton/Notifications/PushNotification/types.ts +6 -0
- package/src/singleton/Notifications/types.ts +3 -1
- package/src/types/errors.ts +1 -0
- package/lib/Amplify.d.ts +0 -29
- package/lib/Amplify.js +0 -118
- package/lib-esm/Amplify.d.ts +0 -29
- package/lib-esm/Amplify.js +0 -115
- package/src/Amplify.ts +0 -106
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuthSession } from '../../../singleton/Auth/types';
|
|
2
2
|
import { UserProfile } from '../../../types';
|
|
3
|
-
export type SupportedCategory = 'Analytics' | 'InAppMessaging' | 'PushNotification';
|
|
4
|
-
|
|
3
|
+
export type SupportedCategory = 'Analytics' | 'Core' | 'InAppMessaging' | 'PushNotification';
|
|
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
|
};
|
|
@@ -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>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
15
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
16
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
17
|
+
function step(op) {
|
|
18
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
19
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
20
|
+
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;
|
|
21
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
22
|
+
switch (op[0]) {
|
|
23
|
+
case 0: case 1: t = op; break;
|
|
24
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
25
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
26
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
27
|
+
default:
|
|
28
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
29
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
30
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
31
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
32
|
+
if (t[2]) _.ops.pop();
|
|
33
|
+
_.trys.pop(); continue;
|
|
34
|
+
}
|
|
35
|
+
op = body.call(thisArg, _);
|
|
36
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
37
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.resolveEndpointId = void 0;
|
|
42
|
+
var errors_1 = require("../../../errors");
|
|
43
|
+
var types_1 = require("../../../types");
|
|
44
|
+
var apis_1 = require("../apis");
|
|
45
|
+
var getEndpointId_1 = require("./getEndpointId");
|
|
46
|
+
/**
|
|
47
|
+
* Resolves an endpoint id from cache or prepare via updateEndpoint if one does not already exist,
|
|
48
|
+
* which will generate and cache an endpoint id between calls.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
var resolveEndpointId = function (_a) {
|
|
53
|
+
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;
|
|
54
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var endpointId;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, (0, getEndpointId_1.getEndpointId)(appId, category)];
|
|
59
|
+
case 1:
|
|
60
|
+
endpointId = _b.sent();
|
|
61
|
+
if (!!endpointId) return [3 /*break*/, 4];
|
|
62
|
+
return [4 /*yield*/, (0, apis_1.updateEndpoint)({
|
|
63
|
+
address: address,
|
|
64
|
+
appId: appId,
|
|
65
|
+
category: category,
|
|
66
|
+
channelType: channelType,
|
|
67
|
+
credentials: credentials,
|
|
68
|
+
identityId: identityId,
|
|
69
|
+
region: region,
|
|
70
|
+
userAgentValue: userAgentValue,
|
|
71
|
+
})];
|
|
72
|
+
case 2:
|
|
73
|
+
_b.sent();
|
|
74
|
+
return [4 /*yield*/, (0, getEndpointId_1.getEndpointId)(appId, category)];
|
|
75
|
+
case 3:
|
|
76
|
+
endpointId = _b.sent();
|
|
77
|
+
_b.label = 4;
|
|
78
|
+
case 4:
|
|
79
|
+
(0, errors_1.assert)(!!endpointId, types_1.AmplifyErrorCode.NoEndpointId);
|
|
80
|
+
return [2 /*return*/, endpointId];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.resolveEndpointId = resolveEndpointId;
|
|
@@ -63,12 +63,12 @@ export type AuthIdentityPoolConfig = {
|
|
|
63
63
|
Cognito: CognitoIdentityPoolConfig & {
|
|
64
64
|
userPoolClientId?: never;
|
|
65
65
|
userPoolId?: never;
|
|
66
|
+
userPoolEndpoint?: never;
|
|
66
67
|
loginWith?: never;
|
|
67
68
|
signUpVerificationMethod?: never;
|
|
68
69
|
userAttributes?: never;
|
|
69
70
|
mfa?: never;
|
|
70
71
|
passwordFormat?: never;
|
|
71
|
-
endpoint?: never;
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
export type CognitoIdentityPoolConfig = {
|
|
@@ -84,6 +84,7 @@ export type AuthUserPoolConfig = {
|
|
|
84
84
|
export type CognitoUserPoolConfig = {
|
|
85
85
|
userPoolClientId: string;
|
|
86
86
|
userPoolId: string;
|
|
87
|
+
userPoolEndpoint?: string;
|
|
87
88
|
signUpVerificationMethod?: 'code' | 'link';
|
|
88
89
|
loginWith?: {
|
|
89
90
|
oauth?: OAuthConfig;
|
|
@@ -104,7 +105,6 @@ export type CognitoUserPoolConfig = {
|
|
|
104
105
|
requireNumbers?: boolean;
|
|
105
106
|
requireSpecialCharacters?: boolean;
|
|
106
107
|
};
|
|
107
|
-
endpoint?: string;
|
|
108
108
|
};
|
|
109
109
|
export type OAuthConfig = {
|
|
110
110
|
domain: string;
|
|
@@ -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
|
};
|