@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
package/lib/Amplify.js DELETED
@@ -1,118 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.Amplify = exports.AmplifyClass = void 0;
20
- // @ts-nocheck
21
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
- // SPDX-License-Identifier: Apache-2.0
23
- var Logger_1 = require("./Logger");
24
- var logger = new Logger_1.ConsoleLogger('Amplify');
25
- var AmplifyClass = /** @class */ (function () {
26
- function AmplifyClass() {
27
- // Everything that is `register`ed is tracked here
28
- this._components = [];
29
- this._config = {};
30
- // All modules (with `getModuleName()`) are stored here for dependency injection
31
- this._modules = {};
32
- // for backward compatibility to avoid breaking change
33
- // if someone is using like Amplify.Auth
34
- this.Auth = null;
35
- this.Analytics = null;
36
- this.API = null;
37
- this.Credentials = null;
38
- this.Storage = null;
39
- this.I18n = null;
40
- this.Cache = null;
41
- this.PubSub = null;
42
- this.Interactions = null;
43
- this.Pushnotification = null;
44
- this.UI = null;
45
- this.XR = null;
46
- this.Predictions = null;
47
- this.DataStore = null;
48
- this.Geo = null;
49
- this.Notifications = null;
50
- this.Logger = Logger_1.ConsoleLogger;
51
- this.ServiceWorker = null;
52
- }
53
- Object.defineProperty(AmplifyClass.prototype, "config", {
54
- // TODO: update "any" when types are determined
55
- get: function () {
56
- return Object.assign({}, this._config);
57
- },
58
- enumerable: false,
59
- configurable: true
60
- });
61
- AmplifyClass.prototype.register = function (comp) {
62
- logger.debug('component registered in amplify', comp);
63
- this._components.push(comp);
64
- if (typeof comp.getModuleName === 'function') {
65
- this._modules[comp.getModuleName()] = comp;
66
- this[comp.getModuleName()] = comp;
67
- }
68
- else {
69
- logger.debug('no getModuleName method for component', comp);
70
- }
71
- // Finally configure this new component(category) loaded
72
- // With the new modularization changes in Amplify V3, all the Amplify
73
- // component are not loaded/registered right away but when they are
74
- // imported (and hence instantiated) in the client's app. This ensures
75
- // that all new components imported get correctly configured with the
76
- // configuration that Amplify.configure() was called with.
77
- comp.configure(this._config);
78
- };
79
- AmplifyClass.prototype.configure = function (config) {
80
- var _this = this;
81
- if (!config)
82
- return this._config;
83
- this._config = Object.assign(this._config, config);
84
- logger.debug('amplify config', this._config);
85
- // Dependency Injection via property-setting.
86
- // This avoids introducing a public method/interface/setter that's difficult to remove later.
87
- // Plus, it reduces `if` statements within the `constructor` and `configure` of each module
88
- Object.entries(this._modules).forEach(function (_a) {
89
- var _b = __read(_a, 2), Name = _b[0], comp = _b[1];
90
- // e.g. Auth.*
91
- Object.keys(comp).forEach(function (property) {
92
- // e.g. Auth["Credentials"] = this._modules["Credentials"] when set
93
- if (_this._modules[property]) {
94
- comp[property] = _this._modules[property];
95
- }
96
- });
97
- });
98
- this._components.map(function (comp) {
99
- comp.configure(_this._config);
100
- });
101
- return this._config;
102
- };
103
- AmplifyClass.prototype.addPluggable = function (pluggable) {
104
- if (pluggable &&
105
- pluggable['getCategory'] &&
106
- typeof pluggable['getCategory'] === 'function') {
107
- this._components.map(function (comp) {
108
- if (comp['addPluggable'] &&
109
- typeof comp['addPluggable'] === 'function') {
110
- comp.addPluggable(pluggable);
111
- }
112
- });
113
- }
114
- };
115
- return AmplifyClass;
116
- }());
117
- exports.AmplifyClass = AmplifyClass;
118
- exports.Amplify = new AmplifyClass();
@@ -1,29 +0,0 @@
1
- import { ConsoleLogger as LoggerClass } from './Logger';
2
- export declare class AmplifyClass {
3
- private _components;
4
- private _config;
5
- private _modules;
6
- Auth: null;
7
- Analytics: null;
8
- API: null;
9
- Credentials: null;
10
- Storage: null;
11
- I18n: null;
12
- Cache: null;
13
- PubSub: null;
14
- Interactions: null;
15
- Pushnotification: null;
16
- UI: null;
17
- XR: null;
18
- Predictions: null;
19
- DataStore: null;
20
- Geo: null;
21
- Notifications: null;
22
- Logger: typeof LoggerClass;
23
- ServiceWorker: null;
24
- get config(): any;
25
- register(comp: any): void;
26
- configure(config?: any): {};
27
- addPluggable(pluggable: any): void;
28
- }
29
- export declare const Amplify: AmplifyClass;
@@ -1,115 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- // @ts-nocheck
18
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
- // SPDX-License-Identifier: Apache-2.0
20
- import { ConsoleLogger as LoggerClass } from './Logger';
21
- var logger = new LoggerClass('Amplify');
22
- var AmplifyClass = /** @class */ (function () {
23
- function AmplifyClass() {
24
- // Everything that is `register`ed is tracked here
25
- this._components = [];
26
- this._config = {};
27
- // All modules (with `getModuleName()`) are stored here for dependency injection
28
- this._modules = {};
29
- // for backward compatibility to avoid breaking change
30
- // if someone is using like Amplify.Auth
31
- this.Auth = null;
32
- this.Analytics = null;
33
- this.API = null;
34
- this.Credentials = null;
35
- this.Storage = null;
36
- this.I18n = null;
37
- this.Cache = null;
38
- this.PubSub = null;
39
- this.Interactions = null;
40
- this.Pushnotification = null;
41
- this.UI = null;
42
- this.XR = null;
43
- this.Predictions = null;
44
- this.DataStore = null;
45
- this.Geo = null;
46
- this.Notifications = null;
47
- this.Logger = LoggerClass;
48
- this.ServiceWorker = null;
49
- }
50
- Object.defineProperty(AmplifyClass.prototype, "config", {
51
- // TODO: update "any" when types are determined
52
- get: function () {
53
- return Object.assign({}, this._config);
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- AmplifyClass.prototype.register = function (comp) {
59
- logger.debug('component registered in amplify', comp);
60
- this._components.push(comp);
61
- if (typeof comp.getModuleName === 'function') {
62
- this._modules[comp.getModuleName()] = comp;
63
- this[comp.getModuleName()] = comp;
64
- }
65
- else {
66
- logger.debug('no getModuleName method for component', comp);
67
- }
68
- // Finally configure this new component(category) loaded
69
- // With the new modularization changes in Amplify V3, all the Amplify
70
- // component are not loaded/registered right away but when they are
71
- // imported (and hence instantiated) in the client's app. This ensures
72
- // that all new components imported get correctly configured with the
73
- // configuration that Amplify.configure() was called with.
74
- comp.configure(this._config);
75
- };
76
- AmplifyClass.prototype.configure = function (config) {
77
- var _this = this;
78
- if (!config)
79
- return this._config;
80
- this._config = Object.assign(this._config, config);
81
- logger.debug('amplify config', this._config);
82
- // Dependency Injection via property-setting.
83
- // This avoids introducing a public method/interface/setter that's difficult to remove later.
84
- // Plus, it reduces `if` statements within the `constructor` and `configure` of each module
85
- Object.entries(this._modules).forEach(function (_a) {
86
- var _b = __read(_a, 2), Name = _b[0], comp = _b[1];
87
- // e.g. Auth.*
88
- Object.keys(comp).forEach(function (property) {
89
- // e.g. Auth["Credentials"] = this._modules["Credentials"] when set
90
- if (_this._modules[property]) {
91
- comp[property] = _this._modules[property];
92
- }
93
- });
94
- });
95
- this._components.map(function (comp) {
96
- comp.configure(_this._config);
97
- });
98
- return this._config;
99
- };
100
- AmplifyClass.prototype.addPluggable = function (pluggable) {
101
- if (pluggable &&
102
- pluggable['getCategory'] &&
103
- typeof pluggable['getCategory'] === 'function') {
104
- this._components.map(function (comp) {
105
- if (comp['addPluggable'] &&
106
- typeof comp['addPluggable'] === 'function') {
107
- comp.addPluggable(pluggable);
108
- }
109
- });
110
- }
111
- };
112
- return AmplifyClass;
113
- }());
114
- export { AmplifyClass };
115
- export var Amplify = new AmplifyClass();
package/src/Amplify.ts DELETED
@@ -1,106 +0,0 @@
1
- // @ts-nocheck
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- import { ConsoleLogger as LoggerClass } from './Logger';
5
-
6
- const logger = new LoggerClass('Amplify');
7
-
8
- export class AmplifyClass {
9
- // Everything that is `register`ed is tracked here
10
- private _components:any[] = [];
11
- private _config = {};
12
-
13
- // All modules (with `getModuleName()`) are stored here for dependency injection
14
- private _modules = {};
15
-
16
- // for backward compatibility to avoid breaking change
17
- // if someone is using like Amplify.Auth
18
- Auth = null;
19
- Analytics = null;
20
- API = null;
21
- Credentials = null;
22
- Storage = null;
23
- I18n = null;
24
- Cache = null;
25
- PubSub = null;
26
- Interactions = null;
27
- Pushnotification = null;
28
- UI = null;
29
- XR = null;
30
- Predictions = null;
31
- DataStore = null;
32
- Geo = null;
33
- Notifications = null;
34
-
35
- Logger = LoggerClass;
36
- ServiceWorker = null;
37
-
38
- // TODO: update "any" when types are determined
39
- public get config(): any {
40
- return Object.assign({}, this._config);
41
- }
42
-
43
- register(comp:any) {
44
- logger.debug('component registered in amplify', comp);
45
- this._components.push(comp);
46
- if (typeof comp.getModuleName === 'function') {
47
- this._modules[comp.getModuleName()] = comp;
48
- this[comp.getModuleName()] = comp;
49
- } else {
50
- logger.debug('no getModuleName method for component', comp);
51
- }
52
-
53
- // Finally configure this new component(category) loaded
54
- // With the new modularization changes in Amplify V3, all the Amplify
55
- // component are not loaded/registered right away but when they are
56
- // imported (and hence instantiated) in the client's app. This ensures
57
- // that all new components imported get correctly configured with the
58
- // configuration that Amplify.configure() was called with.
59
- comp.configure(this._config);
60
- }
61
-
62
- configure(config?) {
63
- if (!config) return this._config;
64
-
65
- this._config = Object.assign(this._config, config);
66
- logger.debug('amplify config', this._config);
67
-
68
- // Dependency Injection via property-setting.
69
- // This avoids introducing a public method/interface/setter that's difficult to remove later.
70
- // Plus, it reduces `if` statements within the `constructor` and `configure` of each module
71
- Object.entries(this._modules).forEach(([Name, comp]:[any, any]) => {
72
- // e.g. Auth.*
73
- Object.keys(comp).forEach(property => {
74
- // e.g. Auth["Credentials"] = this._modules["Credentials"] when set
75
- if (this._modules[property]) {
76
- comp[property] = this._modules[property];
77
- }
78
- });
79
- });
80
-
81
- this._components.map(comp => {
82
- comp.configure(this._config);
83
- });
84
-
85
- return this._config;
86
- }
87
-
88
- addPluggable(pluggable) {
89
- if (
90
- pluggable &&
91
- pluggable['getCategory'] &&
92
- typeof pluggable['getCategory'] === 'function'
93
- ) {
94
- this._components.map(comp => {
95
- if (
96
- comp['addPluggable'] &&
97
- typeof comp['addPluggable'] === 'function'
98
- ) {
99
- comp.addPluggable(pluggable);
100
- }
101
- });
102
- }
103
- }
104
- }
105
-
106
- export const Amplify = new AmplifyClass();