@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.
Files changed (98) hide show
  1. package/lib/Platform/types.d.ts +18 -8
  2. package/lib/Platform/types.js +10 -2
  3. package/lib/Platform/version.d.ts +1 -1
  4. package/lib/Platform/version.js +1 -1
  5. package/lib/ServiceWorker/ServiceWorker.js +69 -17
  6. package/lib/ServiceWorker/index.d.ts +0 -12
  7. package/lib/ServiceWorker/index.js +0 -12
  8. package/lib/errors/errorHelpers.d.ts +2 -0
  9. package/lib/errors/errorHelpers.js +20 -0
  10. package/lib/errors/index.d.ts +1 -0
  11. package/lib/errors/index.js +3 -1
  12. package/lib/index.d.ts +2 -0
  13. package/lib/index.js +7 -1
  14. package/lib/libraryUtils.d.ts +4 -6
  15. package/lib/libraryUtils.js +9 -15
  16. package/lib/parseAWSExports.js +27 -18
  17. package/lib/providers/pinpoint/apis/record.d.ts +1 -1
  18. package/lib/providers/pinpoint/apis/record.js +5 -21
  19. package/lib/providers/pinpoint/index.d.ts +2 -2
  20. package/lib/providers/pinpoint/index.js +4 -2
  21. package/lib/providers/pinpoint/types/errors.d.ts +9 -0
  22. package/lib/providers/pinpoint/types/errors.js +15 -0
  23. package/lib/providers/pinpoint/types/index.d.ts +1 -0
  24. package/lib/providers/pinpoint/types/index.js +3 -0
  25. package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -3
  26. package/lib/providers/pinpoint/utils/index.d.ts +1 -0
  27. package/lib/providers/pinpoint/utils/index.js +3 -1
  28. package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  29. package/lib/providers/pinpoint/utils/resolveEndpointId.js +85 -0
  30. package/lib/singleton/Auth/types.d.ts +2 -2
  31. package/lib/singleton/Notifications/PushNotification/types.d.ts +2 -0
  32. package/lib/singleton/Notifications/PushNotification/types.js +4 -0
  33. package/lib/singleton/Notifications/types.d.ts +3 -1
  34. package/lib/tsconfig.tsbuildinfo +1 -1
  35. package/lib/types/errors.d.ts +1 -0
  36. package/lib/types/errors.js +1 -0
  37. package/lib-esm/Platform/types.d.ts +18 -8
  38. package/lib-esm/Platform/types.js +10 -2
  39. package/lib-esm/Platform/version.d.ts +1 -1
  40. package/lib-esm/Platform/version.js +1 -1
  41. package/lib-esm/ServiceWorker/ServiceWorker.js +69 -17
  42. package/lib-esm/ServiceWorker/index.d.ts +0 -12
  43. package/lib-esm/ServiceWorker/index.js +0 -12
  44. package/lib-esm/errors/errorHelpers.d.ts +2 -0
  45. package/lib-esm/errors/errorHelpers.js +17 -0
  46. package/lib-esm/errors/index.d.ts +1 -0
  47. package/lib-esm/errors/index.js +1 -0
  48. package/lib-esm/index.d.ts +2 -0
  49. package/lib-esm/index.js +4 -0
  50. package/lib-esm/libraryUtils.d.ts +4 -6
  51. package/lib-esm/libraryUtils.js +3 -6
  52. package/lib-esm/parseAWSExports.js +27 -18
  53. package/lib-esm/providers/pinpoint/apis/record.d.ts +1 -1
  54. package/lib-esm/providers/pinpoint/apis/record.js +6 -22
  55. package/lib-esm/providers/pinpoint/index.d.ts +2 -2
  56. package/lib-esm/providers/pinpoint/index.js +2 -1
  57. package/lib-esm/providers/pinpoint/types/errors.d.ts +9 -0
  58. package/lib-esm/providers/pinpoint/types/errors.js +12 -0
  59. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
  60. package/lib-esm/providers/pinpoint/types/index.js +1 -0
  61. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -3
  62. package/lib-esm/providers/pinpoint/utils/index.d.ts +1 -0
  63. package/lib-esm/providers/pinpoint/utils/index.js +1 -0
  64. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  65. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +81 -0
  66. package/lib-esm/singleton/Auth/types.d.ts +2 -2
  67. package/lib-esm/singleton/Notifications/PushNotification/types.d.ts +2 -0
  68. package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
  69. package/lib-esm/singleton/Notifications/types.d.ts +3 -1
  70. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  71. package/lib-esm/types/errors.d.ts +1 -0
  72. package/lib-esm/types/errors.js +1 -0
  73. package/package.json +3 -3
  74. package/src/Platform/types.ts +20 -11
  75. package/src/Platform/version.ts +1 -1
  76. package/src/ServiceWorker/ServiceWorker.ts +20 -17
  77. package/src/ServiceWorker/index.ts +0 -12
  78. package/src/errors/errorHelpers.ts +20 -0
  79. package/src/errors/index.ts +1 -0
  80. package/src/index.ts +6 -0
  81. package/src/libraryUtils.ts +11 -11
  82. package/src/parseAWSExports.ts +19 -14
  83. package/src/providers/pinpoint/apis/record.ts +11 -25
  84. package/src/providers/pinpoint/index.ts +6 -2
  85. package/src/providers/pinpoint/types/errors.ts +12 -0
  86. package/src/providers/pinpoint/types/index.ts +1 -0
  87. package/src/providers/pinpoint/types/pinpoint.ts +3 -2
  88. package/src/providers/pinpoint/utils/index.ts +1 -0
  89. package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
  90. package/src/singleton/Auth/types.ts +2 -2
  91. package/src/singleton/Notifications/PushNotification/types.ts +6 -0
  92. package/src/singleton/Notifications/types.ts +3 -1
  93. package/src/types/errors.ts +1 -0
  94. package/lib/Amplify.d.ts +0 -29
  95. package/lib/Amplify.js +0 -118
  96. package/lib-esm/Amplify.d.ts +0 -29
  97. package/lib-esm/Amplify.js +0 -115
  98. package/src/Amplify.ts +0 -106
@@ -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
+ };
@@ -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;
@@ -0,0 +1,2 @@
1
+ import { PinpointProviderConfig } from '../../../providers/pinpoint/types';
2
+ export type PushNotificationConfig = PinpointProviderConfig;
@@ -0,0 +1,3 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ 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: InAppMessagingConfig;
4
+ InAppMessaging?: InAppMessagingConfig;
5
+ PushNotification?: PushNotificationConfig;
4
6
  };