@aws-amplify/datastore 5.0.1-api-v6-models.c1977f8.0 → 5.0.1-api-v6-models.891fe0d.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 (70) hide show
  1. package/lib/authModeStrategies/defaultAuthStrategy.js +1 -1
  2. package/lib/authModeStrategies/multiAuthStrategy.js +29 -105
  3. package/lib/datastore/datastore.js +887 -1370
  4. package/lib/index.js +1 -1
  5. package/lib/predicates/index.js +53 -102
  6. package/lib/predicates/next.js +310 -557
  7. package/lib/predicates/sort.js +24 -27
  8. package/lib/ssr/index.js +1 -1
  9. package/lib/storage/adapter/AsyncStorageAdapter.js +115 -449
  10. package/lib/storage/adapter/AsyncStorageDatabase.js +215 -480
  11. package/lib/storage/adapter/InMemoryStore.js +27 -101
  12. package/lib/storage/adapter/InMemoryStore.native.js +1 -1
  13. package/lib/storage/adapter/IndexedDBAdapter.js +441 -1002
  14. package/lib/storage/adapter/StorageAdapterBase.js +177 -396
  15. package/lib/storage/adapter/getDefaultAdapter/index.js +5 -6
  16. package/lib/storage/adapter/getDefaultAdapter/index.native.js +2 -2
  17. package/lib/storage/relationship.js +174 -260
  18. package/lib/storage/storage.js +244 -507
  19. package/lib/sync/datastoreConnectivity.js +29 -84
  20. package/lib/sync/datastoreReachability/index.js +1 -1
  21. package/lib/sync/datastoreReachability/index.native.js +2 -2
  22. package/lib/sync/index.js +512 -885
  23. package/lib/sync/merger.js +30 -133
  24. package/lib/sync/outbox.js +147 -302
  25. package/lib/sync/processors/errorMaps.js +30 -80
  26. package/lib/sync/processors/mutation.js +331 -579
  27. package/lib/sync/processors/subscription.js +268 -428
  28. package/lib/sync/processors/sync.js +276 -464
  29. package/lib/sync/utils.js +248 -393
  30. package/lib/tsconfig.tsbuildinfo +1 -1
  31. package/lib/types.js +16 -58
  32. package/lib/util.js +335 -575
  33. package/lib-esm/authModeStrategies/defaultAuthStrategy.js +1 -1
  34. package/lib-esm/authModeStrategies/multiAuthStrategy.js +27 -103
  35. package/lib-esm/datastore/datastore.js +874 -1359
  36. package/lib-esm/index.js +6 -6
  37. package/lib-esm/predicates/index.js +54 -104
  38. package/lib-esm/predicates/next.js +306 -555
  39. package/lib-esm/predicates/sort.js +24 -27
  40. package/lib-esm/ssr/index.js +1 -1
  41. package/lib-esm/storage/adapter/AsyncStorageAdapter.js +111 -446
  42. package/lib-esm/storage/adapter/AsyncStorageDatabase.js +212 -477
  43. package/lib-esm/storage/adapter/InMemoryStore.js +27 -102
  44. package/lib-esm/storage/adapter/IndexedDBAdapter.js +436 -997
  45. package/lib-esm/storage/adapter/StorageAdapterBase.js +172 -392
  46. package/lib-esm/storage/adapter/getDefaultAdapter/index.js +2 -3
  47. package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +1 -1
  48. package/lib-esm/storage/relationship.js +173 -260
  49. package/lib-esm/storage/storage.js +236 -499
  50. package/lib-esm/sync/datastoreConnectivity.js +26 -82
  51. package/lib-esm/sync/datastoreReachability/index.js +1 -1
  52. package/lib-esm/sync/datastoreReachability/index.native.js +1 -1
  53. package/lib-esm/sync/index.js +498 -872
  54. package/lib-esm/sync/merger.js +28 -131
  55. package/lib-esm/sync/outbox.js +143 -298
  56. package/lib-esm/sync/processors/errorMaps.js +32 -82
  57. package/lib-esm/sync/processors/mutation.js +324 -572
  58. package/lib-esm/sync/processors/subscription.js +258 -418
  59. package/lib-esm/sync/processors/sync.js +269 -457
  60. package/lib-esm/sync/utils.js +245 -390
  61. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  62. package/lib-esm/types.js +16 -59
  63. package/lib-esm/util.js +335 -577
  64. package/package.json +12 -12
  65. package/src/datastore/datastore.ts +4 -3
  66. package/src/storage/adapter/getDefaultAdapter/index.ts +1 -3
  67. package/src/sync/processors/mutation.ts +1 -1
  68. package/src/sync/processors/sync.ts +1 -1
  69. package/src/sync/utils.ts +1 -1
  70. package/src/util.ts +44 -6
@@ -1,108 +1,52 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- 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;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
49
2
  // SPDX-License-Identifier: Apache-2.0
50
3
  import { Observable } from 'rxjs';
51
4
  import { ReachabilityMonitor } from './datastoreReachability';
52
5
  import { ConsoleLogger } from '@aws-amplify/core';
53
- var logger = new ConsoleLogger('DataStore');
54
- var RECONNECTING_IN = 5000; // 5s this may be configurable in the future
55
- var DataStoreConnectivity = /** @class */ (function () {
56
- function DataStoreConnectivity() {
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() {
57
10
  this.connectionStatus = {
58
11
  online: false,
59
12
  };
60
13
  }
61
- DataStoreConnectivity.prototype.status = function () {
62
- var _this = this;
14
+ status() {
63
15
  if (this.observer) {
64
16
  throw new Error('Subscriber already exists');
65
17
  }
66
- return new Observable(function (observer) {
67
- _this.observer = observer;
18
+ return new Observable(observer => {
19
+ this.observer = observer;
68
20
  // Will be used to forward socket connection changes, enhancing Reachability
69
- _this.subscription = ReachabilityMonitor.subscribe(function (_a) {
70
- var online = _a.online;
71
- _this.connectionStatus.online = online;
72
- 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
73
24
  observer.next(observerResult);
74
25
  });
75
- return function () {
76
- clearTimeout(_this.timeout);
77
- _this.unsubscribe();
26
+ return () => {
27
+ clearTimeout(this.timeout);
28
+ this.unsubscribe();
78
29
  };
79
30
  });
80
- };
81
- DataStoreConnectivity.prototype.unsubscribe = function () {
31
+ }
32
+ unsubscribe() {
82
33
  if (this.subscription) {
83
34
  clearTimeout(this.timeout);
84
35
  this.subscription.unsubscribe();
85
36
  }
86
- };
37
+ }
87
38
  // for consistency with other background processors.
88
- DataStoreConnectivity.prototype.stop = function () {
89
- return __awaiter(this, void 0, void 0, function () {
90
- return __generator(this, function (_a) {
91
- this.unsubscribe();
92
- return [2 /*return*/];
93
- });
94
- });
95
- };
96
- DataStoreConnectivity.prototype.socketDisconnected = function () {
97
- var _this = this;
39
+ async stop() {
40
+ this.unsubscribe();
41
+ return;
42
+ }
43
+ socketDisconnected() {
98
44
  if (this.observer && typeof this.observer.next === 'function') {
99
45
  this.observer.next({ online: false }); // Notify network issue from the socket
100
- this.timeout = setTimeout(function () {
101
- var observerResult = __assign({}, _this.connectionStatus); // copyOf status
102
- _this.observer.next(observerResult);
46
+ this.timeout = setTimeout(() => {
47
+ const observerResult = { ...this.connectionStatus }; // copyOf status
48
+ this.observer.next(observerResult);
103
49
  }, RECONNECTING_IN); // giving time for socket cleanup and network status stabilization
104
50
  }
105
- };
106
- return DataStoreConnectivity;
107
- }());
108
- export default DataStoreConnectivity;
51
+ }
52
+ }
@@ -1,4 +1,4 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { Reachability } from '@aws-amplify/core/internals/utils';
4
- export var ReachabilityMonitor = new Reachability().networkMonitor();
4
+ export const ReachabilityMonitor = new Reachability().networkMonitor();
@@ -2,4 +2,4 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { Reachability } from '@aws-amplify/core/internals/utils';
4
4
  import { loadNetInfo } from '@aws-amplify/react-native';
5
- export var ReachabilityMonitor = new Reachability().networkMonitor(loadNetInfo());
5
+ export const ReachabilityMonitor = new Reachability().networkMonitor(loadNetInfo());