@aws-amplify/datastore 4.7.6-api-v6-models.b3abc9b.0 → 5.0.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 (187) hide show
  1. package/README.md +4 -0
  2. package/lib/authModeStrategies/defaultAuthStrategy.js +3 -2
  3. package/lib/authModeStrategies/index.js +3 -3
  4. package/lib/authModeStrategies/multiAuthStrategy.js +38 -53
  5. package/lib/datastore/datastore.d.ts +4 -5
  6. package/lib/datastore/datastore.js +929 -1284
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.js +26 -13
  9. package/lib/predicates/index.js +54 -69
  10. package/lib/predicates/next.d.ts +2 -2
  11. package/lib/predicates/next.js +313 -462
  12. package/lib/predicates/sort.js +24 -28
  13. package/lib/ssr/index.js +2 -2
  14. package/lib/storage/adapter/AsyncStorageAdapter.js +120 -342
  15. package/lib/storage/adapter/AsyncStorageDatabase.js +217 -421
  16. package/lib/storage/adapter/InMemoryStore.js +28 -51
  17. package/lib/storage/adapter/InMemoryStore.native.js +5 -3
  18. package/lib/storage/adapter/IndexedDBAdapter.js +466 -871
  19. package/lib/storage/adapter/StorageAdapterBase.js +180 -330
  20. package/lib/storage/adapter/getDefaultAdapter/index.js +8 -10
  21. package/lib/storage/adapter/getDefaultAdapter/index.native.js +5 -4
  22. package/lib/storage/adapter/index.js +0 -1
  23. package/lib/storage/relationship.js +177 -253
  24. package/lib/storage/storage.d.ts +4 -4
  25. package/lib/storage/storage.js +255 -433
  26. package/lib/sync/datastoreConnectivity.d.ts +2 -2
  27. package/lib/sync/datastoreConnectivity.js +29 -39
  28. package/lib/sync/datastoreReachability/index.d.ts +1 -3
  29. package/lib/sync/datastoreReachability/index.js +3 -3
  30. package/lib/sync/datastoreReachability/index.native.d.ts +1 -3
  31. package/lib/sync/datastoreReachability/index.native.js +4 -5
  32. package/lib/sync/index.d.ts +2 -2
  33. package/lib/sync/index.js +522 -827
  34. package/lib/sync/merger.js +31 -63
  35. package/lib/sync/outbox.js +148 -232
  36. package/lib/sync/processors/errorMaps.d.ts +1 -1
  37. package/lib/sync/processors/errorMaps.js +30 -47
  38. package/lib/sync/processors/mutation.d.ts +2 -2
  39. package/lib/sync/processors/mutation.js +343 -502
  40. package/lib/sync/processors/subscription.d.ts +5 -2
  41. package/lib/sync/processors/subscription.js +283 -437
  42. package/lib/sync/processors/sync.d.ts +2 -2
  43. package/lib/sync/processors/sync.js +279 -404
  44. package/lib/sync/utils.d.ts +5 -4
  45. package/lib/sync/utils.js +267 -320
  46. package/lib/tsconfig.tsbuildinfo +1 -0
  47. package/lib/types.d.ts +138 -140
  48. package/lib/types.js +17 -24
  49. package/lib/util.d.ts +9 -17
  50. package/lib/util.js +387 -511
  51. package/lib-esm/authModeStrategies/defaultAuthStrategy.js +1 -2
  52. package/lib-esm/authModeStrategies/index.js +0 -1
  53. package/lib-esm/authModeStrategies/multiAuthStrategy.js +35 -52
  54. package/lib-esm/datastore/datastore.d.ts +4 -5
  55. package/lib-esm/datastore/datastore.js +888 -1247
  56. package/lib-esm/index.d.ts +1 -1
  57. package/lib-esm/index.js +6 -7
  58. package/lib-esm/predicates/index.js +53 -70
  59. package/lib-esm/predicates/next.d.ts +2 -2
  60. package/lib-esm/predicates/next.js +306 -459
  61. package/lib-esm/predicates/sort.js +23 -28
  62. package/lib-esm/ssr/index.js +1 -2
  63. package/lib-esm/storage/adapter/AsyncStorageAdapter.js +111 -338
  64. package/lib-esm/storage/adapter/AsyncStorageDatabase.js +212 -416
  65. package/lib-esm/storage/adapter/InMemoryStore.js +27 -52
  66. package/lib-esm/storage/adapter/InMemoryStore.native.js +0 -1
  67. package/lib-esm/storage/adapter/IndexedDBAdapter.js +438 -866
  68. package/lib-esm/storage/adapter/StorageAdapterBase.js +173 -325
  69. package/lib-esm/storage/adapter/getDefaultAdapter/index.js +2 -6
  70. package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +1 -2
  71. package/lib-esm/storage/adapter/index.js +1 -1
  72. package/lib-esm/storage/relationship.js +173 -251
  73. package/lib-esm/storage/storage.d.ts +4 -4
  74. package/lib-esm/storage/storage.js +242 -424
  75. package/lib-esm/sync/datastoreConnectivity.d.ts +2 -2
  76. package/lib-esm/sync/datastoreConnectivity.js +28 -39
  77. package/lib-esm/sync/datastoreReachability/index.d.ts +1 -3
  78. package/lib-esm/sync/datastoreReachability/index.js +2 -3
  79. package/lib-esm/sync/datastoreReachability/index.native.d.ts +1 -3
  80. package/lib-esm/sync/datastoreReachability/index.native.js +3 -4
  81. package/lib-esm/sync/index.d.ts +2 -2
  82. package/lib-esm/sync/index.js +502 -812
  83. package/lib-esm/sync/merger.js +28 -61
  84. package/lib-esm/sync/outbox.js +143 -228
  85. package/lib-esm/sync/processors/errorMaps.d.ts +1 -1
  86. package/lib-esm/sync/processors/errorMaps.js +32 -50
  87. package/lib-esm/sync/processors/mutation.d.ts +2 -2
  88. package/lib-esm/sync/processors/mutation.js +329 -490
  89. package/lib-esm/sync/processors/subscription.d.ts +5 -2
  90. package/lib-esm/sync/processors/subscription.js +266 -421
  91. package/lib-esm/sync/processors/sync.d.ts +2 -2
  92. package/lib-esm/sync/processors/sync.js +271 -397
  93. package/lib-esm/sync/utils.d.ts +5 -4
  94. package/lib-esm/sync/utils.js +252 -307
  95. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  96. package/lib-esm/types.d.ts +138 -140
  97. package/lib-esm/types.js +16 -25
  98. package/lib-esm/util.d.ts +9 -17
  99. package/lib-esm/util.js +335 -497
  100. package/package.json +31 -26
  101. package/src/authModeStrategies/multiAuthStrategy.ts +15 -12
  102. package/src/datastore/datastore.ts +36 -35
  103. package/src/predicates/sort.ts +3 -1
  104. package/src/storage/adapter/InMemoryStore.ts +1 -1
  105. package/src/storage/adapter/IndexedDBAdapter.ts +2 -2
  106. package/src/storage/adapter/StorageAdapterBase.ts +2 -2
  107. package/src/storage/adapter/getDefaultAdapter/index.ts +1 -4
  108. package/src/storage/storage.ts +29 -24
  109. package/src/sync/datastoreConnectivity.ts +6 -6
  110. package/src/sync/datastoreReachability/index.native.ts +5 -3
  111. package/src/sync/datastoreReachability/index.ts +1 -1
  112. package/src/sync/index.ts +79 -89
  113. package/src/sync/processors/errorMaps.ts +7 -7
  114. package/src/sync/processors/mutation.ts +19 -13
  115. package/src/sync/processors/subscription.ts +221 -295
  116. package/src/sync/processors/sync.ts +11 -8
  117. package/src/sync/utils.ts +30 -15
  118. package/src/types.ts +4 -8
  119. package/src/util.ts +46 -9
  120. package/lib/.tsbuildinfo +0 -3
  121. package/lib/authModeStrategies/defaultAuthStrategy.js.map +0 -1
  122. package/lib/authModeStrategies/index.js.map +0 -1
  123. package/lib/authModeStrategies/multiAuthStrategy.js.map +0 -1
  124. package/lib/datastore/datastore.js.map +0 -1
  125. package/lib/index.js.map +0 -1
  126. package/lib/predicates/index.js.map +0 -1
  127. package/lib/predicates/next.js.map +0 -1
  128. package/lib/predicates/sort.js.map +0 -1
  129. package/lib/ssr/index.js.map +0 -1
  130. package/lib/storage/adapter/AsyncStorageAdapter.js.map +0 -1
  131. package/lib/storage/adapter/AsyncStorageDatabase.js.map +0 -1
  132. package/lib/storage/adapter/InMemoryStore.js.map +0 -1
  133. package/lib/storage/adapter/InMemoryStore.native.js.map +0 -1
  134. package/lib/storage/adapter/IndexedDBAdapter.js.map +0 -1
  135. package/lib/storage/adapter/StorageAdapterBase.js.map +0 -1
  136. package/lib/storage/adapter/getDefaultAdapter/index.js.map +0 -1
  137. package/lib/storage/adapter/getDefaultAdapter/index.native.js.map +0 -1
  138. package/lib/storage/adapter/index.js.map +0 -1
  139. package/lib/storage/relationship.js.map +0 -1
  140. package/lib/storage/storage.js.map +0 -1
  141. package/lib/sync/datastoreConnectivity.js.map +0 -1
  142. package/lib/sync/datastoreReachability/index.js.map +0 -1
  143. package/lib/sync/datastoreReachability/index.native.js.map +0 -1
  144. package/lib/sync/index.js.map +0 -1
  145. package/lib/sync/merger.js.map +0 -1
  146. package/lib/sync/outbox.js.map +0 -1
  147. package/lib/sync/processors/errorMaps.js.map +0 -1
  148. package/lib/sync/processors/mutation.js.map +0 -1
  149. package/lib/sync/processors/subscription.js.map +0 -1
  150. package/lib/sync/processors/sync.js.map +0 -1
  151. package/lib/sync/utils.js.map +0 -1
  152. package/lib/types.js.map +0 -1
  153. package/lib/util.js.map +0 -1
  154. package/lib-esm/.tsbuildinfo +0 -3
  155. package/lib-esm/authModeStrategies/defaultAuthStrategy.js.map +0 -1
  156. package/lib-esm/authModeStrategies/index.js.map +0 -1
  157. package/lib-esm/authModeStrategies/multiAuthStrategy.js.map +0 -1
  158. package/lib-esm/datastore/datastore.js.map +0 -1
  159. package/lib-esm/index.js.map +0 -1
  160. package/lib-esm/predicates/index.js.map +0 -1
  161. package/lib-esm/predicates/next.js.map +0 -1
  162. package/lib-esm/predicates/sort.js.map +0 -1
  163. package/lib-esm/ssr/index.js.map +0 -1
  164. package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +0 -1
  165. package/lib-esm/storage/adapter/AsyncStorageDatabase.js.map +0 -1
  166. package/lib-esm/storage/adapter/InMemoryStore.js.map +0 -1
  167. package/lib-esm/storage/adapter/InMemoryStore.native.js.map +0 -1
  168. package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +0 -1
  169. package/lib-esm/storage/adapter/StorageAdapterBase.js.map +0 -1
  170. package/lib-esm/storage/adapter/getDefaultAdapter/index.js.map +0 -1
  171. package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js.map +0 -1
  172. package/lib-esm/storage/adapter/index.js.map +0 -1
  173. package/lib-esm/storage/relationship.js.map +0 -1
  174. package/lib-esm/storage/storage.js.map +0 -1
  175. package/lib-esm/sync/datastoreConnectivity.js.map +0 -1
  176. package/lib-esm/sync/datastoreReachability/index.js.map +0 -1
  177. package/lib-esm/sync/datastoreReachability/index.native.js.map +0 -1
  178. package/lib-esm/sync/index.js.map +0 -1
  179. package/lib-esm/sync/merger.js.map +0 -1
  180. package/lib-esm/sync/outbox.js.map +0 -1
  181. package/lib-esm/sync/processors/errorMaps.js.map +0 -1
  182. package/lib-esm/sync/processors/mutation.js.map +0 -1
  183. package/lib-esm/sync/processors/subscription.js.map +0 -1
  184. package/lib-esm/sync/processors/sync.js.map +0 -1
  185. package/lib-esm/sync/utils.js.map +0 -1
  186. package/lib-esm/types.js.map +0 -1
  187. package/lib-esm/util.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import Observable from 'zen-observable-ts';
2
- declare type ConnectionStatus = {
1
+ import { Observable } from 'rxjs';
2
+ type ConnectionStatus = {
3
3
  online: boolean;
4
4
  };
5
5
  export default class DataStoreConnectivity {
@@ -1,63 +1,52 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
2
  // SPDX-License-Identifier: Apache-2.0
4
- import Observable from 'zen-observable-ts';
5
- import { ConsoleLogger as Logger } from '@aws-amplify/core';
3
+ import { Observable } from 'rxjs';
6
4
  import { ReachabilityMonitor } from './datastoreReachability';
7
- var logger = new Logger('DataStore');
8
- var RECONNECTING_IN = 5000; // 5s this may be configurable in the future
9
- var DataStoreConnectivity = /** @class */ (function () {
10
- function DataStoreConnectivity() {
5
+ import { ConsoleLogger } from '@aws-amplify/core';
6
+ const logger = new ConsoleLogger('DataStore');
7
+ const RECONNECTING_IN = 5000; // 5s this may be configurable in the future
8
+ export default class DataStoreConnectivity {
9
+ constructor() {
11
10
  this.connectionStatus = {
12
11
  online: false,
13
12
  };
14
13
  }
15
- DataStoreConnectivity.prototype.status = function () {
16
- var _this = this;
14
+ status() {
17
15
  if (this.observer) {
18
16
  throw new Error('Subscriber already exists');
19
17
  }
20
- return new Observable(function (observer) {
21
- _this.observer = observer;
18
+ return new Observable(observer => {
19
+ this.observer = observer;
22
20
  // Will be used to forward socket connection changes, enhancing Reachability
23
- _this.subscription = ReachabilityMonitor.subscribe(function (_a) {
24
- var online = _a.online;
25
- _this.connectionStatus.online = online;
26
- var observerResult = __assign({}, _this.connectionStatus); // copyOf status
21
+ this.subscription = ReachabilityMonitor.subscribe(({ online }) => {
22
+ this.connectionStatus.online = online;
23
+ const observerResult = { ...this.connectionStatus }; // copyOf status
27
24
  observer.next(observerResult);
28
25
  });
29
- return function () {
30
- clearTimeout(_this.timeout);
31
- _this.unsubscribe();
26
+ return () => {
27
+ clearTimeout(this.timeout);
28
+ this.unsubscribe();
32
29
  };
33
30
  });
34
- };
35
- DataStoreConnectivity.prototype.unsubscribe = function () {
31
+ }
32
+ unsubscribe() {
36
33
  if (this.subscription) {
37
34
  clearTimeout(this.timeout);
38
35
  this.subscription.unsubscribe();
39
36
  }
40
- };
37
+ }
41
38
  // for consistency with other background processors.
42
- DataStoreConnectivity.prototype.stop = function () {
43
- return __awaiter(this, void 0, void 0, function () {
44
- return __generator(this, function (_a) {
45
- this.unsubscribe();
46
- return [2 /*return*/];
47
- });
48
- });
49
- };
50
- DataStoreConnectivity.prototype.socketDisconnected = function () {
51
- var _this = this;
39
+ async stop() {
40
+ this.unsubscribe();
41
+ return;
42
+ }
43
+ socketDisconnected() {
52
44
  if (this.observer && typeof this.observer.next === 'function') {
53
45
  this.observer.next({ online: false }); // Notify network issue from the socket
54
- this.timeout = setTimeout(function () {
55
- var observerResult = __assign({}, _this.connectionStatus); // copyOf status
56
- _this.observer.next(observerResult);
46
+ this.timeout = setTimeout(() => {
47
+ const observerResult = { ...this.connectionStatus }; // copyOf status
48
+ this.observer.next(observerResult);
57
49
  }, RECONNECTING_IN); // giving time for socket cleanup and network status stabilization
58
50
  }
59
- };
60
- return DataStoreConnectivity;
61
- }());
62
- export default DataStoreConnectivity;
63
- //# sourceMappingURL=datastoreConnectivity.js.map
51
+ }
52
+ }
@@ -1,3 +1 @@
1
- export declare const ReachabilityMonitor: import("zen-observable-ts").default<{
2
- online: boolean;
3
- }>;
1
+ export declare const ReachabilityMonitor: import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
@@ -1,5 +1,4 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { Reachability } from '@aws-amplify/core';
4
- export var ReachabilityMonitor = new Reachability().networkMonitor();
5
- //# sourceMappingURL=index.js.map
3
+ import { Reachability } from '@aws-amplify/core/internals/utils';
4
+ export const ReachabilityMonitor = new Reachability().networkMonitor();
@@ -1,3 +1 @@
1
- export declare const ReachabilityMonitor: import("zen-observable-ts").default<{
2
- online: boolean;
3
- }>;
1
+ export declare const ReachabilityMonitor: import("rxjs").Observable<import("@aws-amplify/core/lib-esm/Reachability/types").NetworkStatus>;
@@ -1,6 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { Reachability } from '@aws-amplify/core';
4
- import { default as NetInfo } from '@react-native-community/netinfo';
5
- export var ReachabilityMonitor = new Reachability().networkMonitor(NetInfo);
6
- //# sourceMappingURL=index.native.js.map
3
+ import { Reachability } from '@aws-amplify/core/internals/utils';
4
+ import { loadNetInfo } from '@aws-amplify/react-native';
5
+ export const ReachabilityMonitor = new Reachability().networkMonitor(loadNetInfo());
@@ -1,11 +1,11 @@
1
- import Observable from 'zen-observable-ts';
1
+ import { Observable } from 'rxjs';
2
2
  import { ModelInstanceCreator } from '../datastore/datastore';
3
3
  import { ExclusiveStorage as Storage } from '../storage/storage';
4
4
  import { ConflictHandler, ControlMessageType, ErrorHandler, InternalSchema, ModelInit, MutableModel, NamespaceResolver, PersistentModelConstructor, SchemaModel, SchemaNamespace, TypeConstructorMap, ModelPredicate, AuthModeStrategy, ManagedIdentifier, OptionallyManagedIdentifier, AmplifyContext } from '../types';
5
5
  import type { __modelMeta__ } from '../types';
6
6
  import DataStoreConnectivity from './datastoreConnectivity';
7
7
  import { TransformerMutationType } from './utils';
8
- declare type StartParams = {
8
+ type StartParams = {
9
9
  fullSyncInterval: number;
10
10
  };
11
11
  export declare class MutationEvent {