@aws-amplify/core 6.0.1-console-preview.8f82e46.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/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 +1 -0
- package/lib/index.js +4 -1
- package/lib/libraryUtils.d.ts +4 -5
- package/lib/libraryUtils.js +9 -12
- 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 +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/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/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 +1 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/libraryUtils.d.ts +4 -5
- package/lib-esm/libraryUtils.js +3 -4
- 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 +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/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/errors/errorHelpers.ts +20 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/libraryUtils.ts +11 -8
- 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 +2 -2
- package/src/providers/pinpoint/utils/index.ts +1 -0
- package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
- 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/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 = {}));
|
|
@@ -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.8d88eef.0+8d88eef";
|
|
@@ -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.8d88eef.0+8d88eef';
|
|
@@ -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
|
@@ -9,4 +9,5 @@ export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, }
|
|
|
9
9
|
export { KeyValueStorageInterface } from './types';
|
|
10
10
|
export { Cache } from './Cache';
|
|
11
11
|
export { I18n } from './I18n';
|
|
12
|
+
export { ConsoleLogger } from './Logger';
|
|
12
13
|
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,16 +7,15 @@ 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';
|
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';
|
|
@@ -55,7 +55,7 @@ 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
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;
|
|
61
61
|
var amplifyConfig = {};
|
|
@@ -69,15 +69,24 @@ 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
|
+
},
|
|
82
|
+
};
|
|
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,
|
|
81
90
|
},
|
|
82
91
|
};
|
|
83
92
|
}
|
|
@@ -102,17 +111,17 @@ export var parseAWSExports = function (config) {
|
|
|
102
111
|
? {
|
|
103
112
|
status: aws_cognito_mfa_configuration &&
|
|
104
113
|
aws_cognito_mfa_configuration.toLowerCase(),
|
|
105
|
-
totpEnabled: (
|
|
106
|
-
smsEnabled: (
|
|
114
|
+
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,
|
|
115
|
+
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
116
|
}
|
|
108
117
|
: undefined;
|
|
109
118
|
var passwordFormatConfig = aws_cognito_password_protection_settings
|
|
110
119
|
? {
|
|
111
120
|
minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
|
|
112
|
-
requireLowercase: (
|
|
113
|
-
requireUppercase: (
|
|
114
|
-
requireNumbers: (
|
|
115
|
-
requireSpecialCharacters: (
|
|
121
|
+
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,
|
|
122
|
+
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,
|
|
123
|
+
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,
|
|
124
|
+
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
125
|
}
|
|
117
126
|
: undefined;
|
|
118
127
|
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 +133,8 @@ export var parseAWSExports = function (config) {
|
|
|
124
133
|
},
|
|
125
134
|
_a);
|
|
126
135
|
});
|
|
127
|
-
var loginWithEmailEnabled = (
|
|
128
|
-
var loginWithPhoneEnabled = (
|
|
136
|
+
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;
|
|
137
|
+
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
138
|
if (aws_cognito_identity_pool_id || aws_user_pools_id) {
|
|
130
139
|
amplifyConfig.Auth = {
|
|
131
140
|
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();
|
|
@@ -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
|
+
};
|
|
@@ -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
|
};
|