@aws-amplify/datastore 4.7.5 → 5.0.1-console-preview.4208d73.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/README.md +4 -0
- package/lib/authModeStrategies/defaultAuthStrategy.js +3 -2
- package/lib/authModeStrategies/index.js +3 -3
- package/lib/authModeStrategies/multiAuthStrategy.js +81 -24
- package/lib/datastore/datastore.d.ts +3 -4
- package/lib/datastore/datastore.js +361 -227
- package/lib/index.d.ts +1 -1
- package/lib/index.js +25 -12
- package/lib/predicates/index.js +46 -12
- package/lib/predicates/next.d.ts +2 -2
- package/lib/predicates/next.js +172 -74
- package/lib/predicates/sort.js +3 -4
- package/lib/ssr/index.js +1 -1
- package/lib/storage/adapter/AsyncStorageAdapter.js +240 -128
- package/lib/storage/adapter/AsyncStorageDatabase.js +100 -39
- package/lib/storage/adapter/InMemoryStore.js +68 -17
- package/lib/storage/adapter/InMemoryStore.native.js +5 -3
- package/lib/storage/adapter/IndexedDBAdapter.js +355 -199
- package/lib/storage/adapter/StorageAdapterBase.js +154 -85
- package/lib/storage/adapter/getDefaultAdapter/index.js +8 -9
- package/lib/storage/adapter/getDefaultAdapter/index.native.js +4 -3
- package/lib/storage/adapter/index.js +0 -1
- package/lib/storage/relationship.js +31 -21
- package/lib/storage/storage.d.ts +3 -3
- package/lib/storage/storage.js +143 -61
- package/lib/sync/datastoreConnectivity.d.ts +1 -1
- package/lib/sync/datastoreConnectivity.js +57 -9
- package/lib/sync/datastoreReachability/index.js +3 -3
- package/lib/sync/datastoreReachability/index.native.js +7 -5
- package/lib/sync/index.d.ts +1 -1
- package/lib/sync/index.js +193 -125
- package/lib/sync/merger.js +81 -10
- package/lib/sync/outbox.js +101 -30
- package/lib/sync/processors/errorMaps.d.ts +1 -1
- package/lib/sync/processors/errorMaps.js +41 -6
- package/lib/sync/processors/mutation.d.ts +1 -1
- package/lib/sync/processors/mutation.js +192 -101
- package/lib/sync/processors/subscription.d.ts +4 -1
- package/lib/sync/processors/subscription.js +190 -178
- package/lib/sync/processors/sync.d.ts +1 -1
- package/lib/sync/processors/sync.js +113 -47
- package/lib/sync/utils.d.ts +4 -4
- package/lib/sync/utils.js +162 -81
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types.d.ts +138 -140
- package/lib/types.js +40 -5
- package/lib/util.d.ts +9 -17
- package/lib/util.js +216 -100
- package/lib-esm/authModeStrategies/defaultAuthStrategy.js +0 -1
- package/lib-esm/authModeStrategies/index.js +0 -1
- package/lib-esm/authModeStrategies/multiAuthStrategy.js +76 -21
- package/lib-esm/datastore/datastore.d.ts +3 -4
- package/lib-esm/datastore/datastore.js +206 -77
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/index.js +0 -1
- package/lib-esm/predicates/index.js +40 -7
- package/lib-esm/predicates/next.d.ts +2 -2
- package/lib-esm/predicates/next.js +148 -52
- package/lib-esm/predicates/sort.js +2 -4
- package/lib-esm/ssr/index.js +0 -1
- package/lib-esm/storage/adapter/AsyncStorageAdapter.js +203 -95
- package/lib-esm/storage/adapter/AsyncStorageDatabase.js +66 -5
- package/lib-esm/storage/adapter/InMemoryStore.js +52 -2
- package/lib-esm/storage/adapter/InMemoryStore.native.js +0 -1
- package/lib-esm/storage/adapter/IndexedDBAdapter.js +271 -138
- package/lib-esm/storage/adapter/StorageAdapterBase.js +130 -62
- package/lib-esm/storage/adapter/getDefaultAdapter/index.js +2 -5
- package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +0 -1
- package/lib-esm/storage/adapter/index.js +1 -1
- package/lib-esm/storage/relationship.js +27 -18
- package/lib-esm/storage/storage.d.ts +3 -3
- package/lib-esm/storage/storage.js +87 -9
- package/lib-esm/sync/datastoreConnectivity.d.ts +1 -1
- package/lib-esm/sync/datastoreConnectivity.js +48 -3
- package/lib-esm/sync/datastoreReachability/index.js +1 -2
- package/lib-esm/sync/datastoreReachability/index.native.js +1 -2
- package/lib-esm/sync/index.d.ts +1 -1
- package/lib-esm/sync/index.js +136 -72
- package/lib-esm/sync/merger.js +73 -3
- package/lib-esm/sync/outbox.js +75 -5
- package/lib-esm/sync/processors/errorMaps.d.ts +1 -1
- package/lib-esm/sync/processors/errorMaps.js +39 -5
- package/lib-esm/sync/processors/mutation.d.ts +1 -1
- package/lib-esm/sync/processors/mutation.js +130 -44
- package/lib-esm/sync/processors/subscription.d.ts +4 -1
- package/lib-esm/sync/processors/subscription.js +134 -126
- package/lib-esm/sync/processors/sync.d.ts +1 -1
- package/lib-esm/sync/processors/sync.js +74 -12
- package/lib-esm/sync/utils.d.ts +4 -4
- package/lib-esm/sync/utils.js +135 -55
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/types.d.ts +138 -140
- package/lib-esm/types.js +36 -2
- package/lib-esm/util.d.ts +9 -17
- package/lib-esm/util.js +96 -16
- package/package.json +139 -132
- package/src/authModeStrategies/multiAuthStrategy.ts +11 -12
- package/src/datastore/datastore.ts +32 -25
- package/src/predicates/sort.ts +3 -1
- package/src/storage/adapter/InMemoryStore.ts +1 -1
- package/src/storage/adapter/IndexedDBAdapter.ts +1 -1
- package/src/storage/adapter/StorageAdapterBase.ts +1 -1
- package/src/storage/adapter/getDefaultAdapter/index.ts +2 -3
- package/src/storage/storage.ts +1 -1
- package/src/sync/datastoreConnectivity.ts +2 -2
- package/src/sync/datastoreReachability/index.native.ts +1 -1
- package/src/sync/datastoreReachability/index.ts +1 -1
- package/src/sync/index.ts +69 -78
- package/src/sync/processors/mutation.ts +16 -10
- package/src/sync/processors/subscription.ts +55 -127
- package/src/sync/processors/sync.ts +8 -4
- package/src/sync/utils.ts +7 -8
- package/src/types.ts +4 -8
- package/src/util.ts +5 -6
- package/lib/.tsbuildinfo +0 -3
- package/lib/authModeStrategies/defaultAuthStrategy.js.map +0 -1
- package/lib/authModeStrategies/index.js.map +0 -1
- package/lib/authModeStrategies/multiAuthStrategy.js.map +0 -1
- package/lib/datastore/datastore.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/predicates/index.js.map +0 -1
- package/lib/predicates/next.js.map +0 -1
- package/lib/predicates/sort.js.map +0 -1
- package/lib/ssr/index.js.map +0 -1
- package/lib/storage/adapter/AsyncStorageAdapter.js.map +0 -1
- package/lib/storage/adapter/AsyncStorageDatabase.js.map +0 -1
- package/lib/storage/adapter/InMemoryStore.js.map +0 -1
- package/lib/storage/adapter/InMemoryStore.native.js.map +0 -1
- package/lib/storage/adapter/IndexedDBAdapter.js.map +0 -1
- package/lib/storage/adapter/StorageAdapterBase.js.map +0 -1
- package/lib/storage/adapter/getDefaultAdapter/index.js.map +0 -1
- package/lib/storage/adapter/getDefaultAdapter/index.native.js.map +0 -1
- package/lib/storage/adapter/index.js.map +0 -1
- package/lib/storage/relationship.js.map +0 -1
- package/lib/storage/storage.js.map +0 -1
- package/lib/sync/datastoreConnectivity.js.map +0 -1
- package/lib/sync/datastoreReachability/index.js.map +0 -1
- package/lib/sync/datastoreReachability/index.native.js.map +0 -1
- package/lib/sync/index.js.map +0 -1
- package/lib/sync/merger.js.map +0 -1
- package/lib/sync/outbox.js.map +0 -1
- package/lib/sync/processors/errorMaps.js.map +0 -1
- package/lib/sync/processors/mutation.js.map +0 -1
- package/lib/sync/processors/subscription.js.map +0 -1
- package/lib/sync/processors/sync.js.map +0 -1
- package/lib/sync/utils.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/util.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/authModeStrategies/defaultAuthStrategy.js.map +0 -1
- package/lib-esm/authModeStrategies/index.js.map +0 -1
- package/lib-esm/authModeStrategies/multiAuthStrategy.js.map +0 -1
- package/lib-esm/datastore/datastore.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/predicates/index.js.map +0 -1
- package/lib-esm/predicates/next.js.map +0 -1
- package/lib-esm/predicates/sort.js.map +0 -1
- package/lib-esm/ssr/index.js.map +0 -1
- package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +0 -1
- package/lib-esm/storage/adapter/AsyncStorageDatabase.js.map +0 -1
- package/lib-esm/storage/adapter/InMemoryStore.js.map +0 -1
- package/lib-esm/storage/adapter/InMemoryStore.native.js.map +0 -1
- package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +0 -1
- package/lib-esm/storage/adapter/StorageAdapterBase.js.map +0 -1
- package/lib-esm/storage/adapter/getDefaultAdapter/index.js.map +0 -1
- package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js.map +0 -1
- package/lib-esm/storage/adapter/index.js.map +0 -1
- package/lib-esm/storage/relationship.js.map +0 -1
- package/lib-esm/storage/storage.js.map +0 -1
- package/lib-esm/sync/datastoreConnectivity.js.map +0 -1
- package/lib-esm/sync/datastoreReachability/index.js.map +0 -1
- package/lib-esm/sync/datastoreReachability/index.native.js.map +0 -1
- package/lib-esm/sync/index.js.map +0 -1
- package/lib-esm/sync/merger.js.map +0 -1
- package/lib-esm/sync/outbox.js.map +0 -1
- package/lib-esm/sync/processors/errorMaps.js.map +0 -1
- package/lib-esm/sync/processors/mutation.js.map +0 -1
- package/lib-esm/sync/processors/subscription.js.map +0 -1
- package/lib-esm/sync/processors/sync.js.map +0 -1
- package/lib-esm/sync/utils.js.map +0 -1
- package/lib-esm/types.js.map +0 -1
- package/lib-esm/util.js.map +0 -1
package/lib/storage/storage.js
CHANGED
|
@@ -1,16 +1,102 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
60
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
61
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
62
|
+
if (!m) return o;
|
|
63
|
+
var i = m.call(o), r, ar = [], e;
|
|
64
|
+
try {
|
|
65
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
66
|
+
}
|
|
67
|
+
catch (error) { e = { error: error }; }
|
|
68
|
+
finally {
|
|
69
|
+
try {
|
|
70
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
71
|
+
}
|
|
72
|
+
finally { if (e) throw e.error; }
|
|
73
|
+
}
|
|
74
|
+
return ar;
|
|
75
|
+
};
|
|
76
|
+
var __values = (this && this.__values) || function(o) {
|
|
77
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
78
|
+
if (m) return m.call(o);
|
|
79
|
+
if (o && typeof o.length === "number") return {
|
|
80
|
+
next: function () {
|
|
81
|
+
if (o && i >= o.length) o = void 0;
|
|
82
|
+
return { value: o && o[i++], done: !o };
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
86
|
+
};
|
|
87
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
88
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
89
|
+
};
|
|
2
90
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
var core_1 = require("@aws-amplify/core");
|
|
7
|
-
var zen_push_1 = tslib_1.__importDefault(require("zen-push"));
|
|
91
|
+
exports.ExclusiveStorage = void 0;
|
|
92
|
+
var zen_push_1 = __importDefault(require("zen-push"));
|
|
8
93
|
var predicates_1 = require("../predicates");
|
|
9
94
|
var types_1 = require("../types");
|
|
10
95
|
var util_1 = require("../util");
|
|
11
96
|
var utils_1 = require("../sync/utils");
|
|
12
|
-
var getDefaultAdapter_1 =
|
|
13
|
-
var
|
|
97
|
+
var getDefaultAdapter_1 = __importDefault(require("./adapter/getDefaultAdapter"));
|
|
98
|
+
var utils_2 = require("@aws-amplify/core/internals/utils");
|
|
99
|
+
var logger = new utils_2.Logger('DataStore');
|
|
14
100
|
var StorageClass = /** @class */ (function () {
|
|
15
101
|
function StorageClass(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator, adapter, sessionId) {
|
|
16
102
|
this.schema = schema;
|
|
@@ -19,7 +105,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
19
105
|
this.modelInstanceCreator = modelInstanceCreator;
|
|
20
106
|
this.adapter = adapter;
|
|
21
107
|
this.sessionId = sessionId;
|
|
22
|
-
this.adapter = this.adapter || getDefaultAdapter_1.default();
|
|
108
|
+
this.adapter = this.adapter || (0, getDefaultAdapter_1.default)();
|
|
23
109
|
this.pushStream = new zen_push_1.default();
|
|
24
110
|
}
|
|
25
111
|
StorageClass.getNamespace = function () {
|
|
@@ -33,9 +119,9 @@ var StorageClass = /** @class */ (function () {
|
|
|
33
119
|
return namespace;
|
|
34
120
|
};
|
|
35
121
|
StorageClass.prototype.init = function () {
|
|
36
|
-
return
|
|
122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
37
123
|
var resolve, reject;
|
|
38
|
-
return
|
|
124
|
+
return __generator(this, function (_a) {
|
|
39
125
|
switch (_a.label) {
|
|
40
126
|
case 0:
|
|
41
127
|
if (!(this.initialized !== undefined)) return [3 /*break*/, 2];
|
|
@@ -59,10 +145,10 @@ var StorageClass = /** @class */ (function () {
|
|
|
59
145
|
});
|
|
60
146
|
};
|
|
61
147
|
StorageClass.prototype.save = function (model, condition, mutator, patchesTuple) {
|
|
62
|
-
return
|
|
148
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
63
149
|
var result;
|
|
64
150
|
var _this = this;
|
|
65
|
-
return
|
|
151
|
+
return __generator(this, function (_a) {
|
|
66
152
|
switch (_a.label) {
|
|
67
153
|
case 0: return [4 /*yield*/, this.init()];
|
|
68
154
|
case 1:
|
|
@@ -74,7 +160,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
74
160
|
case 2:
|
|
75
161
|
result = _a.sent();
|
|
76
162
|
result.forEach(function (r) {
|
|
77
|
-
var _a =
|
|
163
|
+
var _a = __read(r, 2), savedElement = _a[0], opType = _a[1];
|
|
78
164
|
// truthy when save is called by the Merger
|
|
79
165
|
var syncResponse = !!mutator;
|
|
80
166
|
var updateMutationInput;
|
|
@@ -120,11 +206,11 @@ var StorageClass = /** @class */ (function () {
|
|
|
120
206
|
});
|
|
121
207
|
};
|
|
122
208
|
StorageClass.prototype.delete = function (modelOrModelConstructor, condition, mutator) {
|
|
123
|
-
return
|
|
209
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
210
|
var models, deleted, modelConstructor, namespaceName, modelDefinition, modelIds;
|
|
125
211
|
var _a;
|
|
126
212
|
var _this = this;
|
|
127
|
-
return
|
|
213
|
+
return __generator(this, function (_b) {
|
|
128
214
|
switch (_b.label) {
|
|
129
215
|
case 0: return [4 /*yield*/, this.init()];
|
|
130
216
|
case 1:
|
|
@@ -134,18 +220,18 @@ var StorageClass = /** @class */ (function () {
|
|
|
134
220
|
}
|
|
135
221
|
return [4 /*yield*/, this.adapter.delete(modelOrModelConstructor, condition)];
|
|
136
222
|
case 2:
|
|
137
|
-
_a =
|
|
138
|
-
modelConstructor = util_1.isModelConstructor(modelOrModelConstructor)
|
|
223
|
+
_a = __read.apply(void 0, [_b.sent(), 2]), models = _a[0], deleted = _a[1];
|
|
224
|
+
modelConstructor = (0, util_1.isModelConstructor)(modelOrModelConstructor)
|
|
139
225
|
? modelOrModelConstructor
|
|
140
226
|
: Object.getPrototypeOf(modelOrModelConstructor || {})
|
|
141
227
|
.constructor;
|
|
142
228
|
namespaceName = this.namespaceResolver(modelConstructor);
|
|
143
229
|
modelDefinition = this.schema.namespaces[namespaceName].models[modelConstructor.name];
|
|
144
230
|
modelIds = new Set(models.map(function (model) {
|
|
145
|
-
var modelId = utils_1.getIdentifierValue(modelDefinition, model);
|
|
231
|
+
var modelId = (0, utils_1.getIdentifierValue)(modelDefinition, model);
|
|
146
232
|
return modelId;
|
|
147
233
|
}));
|
|
148
|
-
if (!util_1.isModelConstructor(modelOrModelConstructor) &&
|
|
234
|
+
if (!(0, util_1.isModelConstructor)(modelOrModelConstructor) &&
|
|
149
235
|
!Array.isArray(deleted)) {
|
|
150
236
|
deleted = [deleted];
|
|
151
237
|
}
|
|
@@ -153,8 +239,8 @@ var StorageClass = /** @class */ (function () {
|
|
|
153
239
|
var modelConstructor = Object.getPrototypeOf(model)
|
|
154
240
|
.constructor;
|
|
155
241
|
var theCondition;
|
|
156
|
-
if (!util_1.isModelConstructor(modelOrModelConstructor)) {
|
|
157
|
-
var modelId = utils_1.getIdentifierValue(modelDefinition, model);
|
|
242
|
+
if (!(0, util_1.isModelConstructor)(modelOrModelConstructor)) {
|
|
243
|
+
var modelId = (0, utils_1.getIdentifierValue)(modelDefinition, model);
|
|
158
244
|
theCondition = modelIds.has(modelId)
|
|
159
245
|
? predicates_1.ModelPredicateCreator.getPredicates(condition, false)
|
|
160
246
|
: undefined;
|
|
@@ -173,8 +259,8 @@ var StorageClass = /** @class */ (function () {
|
|
|
173
259
|
});
|
|
174
260
|
};
|
|
175
261
|
StorageClass.prototype.query = function (modelConstructor, predicate, pagination) {
|
|
176
|
-
return
|
|
177
|
-
return
|
|
262
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
263
|
+
return __generator(this, function (_a) {
|
|
178
264
|
switch (_a.label) {
|
|
179
265
|
case 0: return [4 /*yield*/, this.init()];
|
|
180
266
|
case 1:
|
|
@@ -190,8 +276,8 @@ var StorageClass = /** @class */ (function () {
|
|
|
190
276
|
};
|
|
191
277
|
StorageClass.prototype.queryOne = function (modelConstructor, firstOrLast) {
|
|
192
278
|
if (firstOrLast === void 0) { firstOrLast = types_1.QueryOne.FIRST; }
|
|
193
|
-
return
|
|
194
|
-
return
|
|
279
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
280
|
+
return __generator(this, function (_a) {
|
|
195
281
|
switch (_a.label) {
|
|
196
282
|
case 0: return [4 /*yield*/, this.init()];
|
|
197
283
|
case 1:
|
|
@@ -215,7 +301,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
215
301
|
return !skipOwn || mutator !== skipOwn;
|
|
216
302
|
})
|
|
217
303
|
.map(function (_a) {
|
|
218
|
-
var _mutator = _a.mutator, message =
|
|
304
|
+
var _mutator = _a.mutator, message = __rest(_a, ["mutator"]);
|
|
219
305
|
return message;
|
|
220
306
|
});
|
|
221
307
|
if (!listenToAll) {
|
|
@@ -225,7 +311,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
225
311
|
return false;
|
|
226
312
|
}
|
|
227
313
|
if (!!predicates && !!type) {
|
|
228
|
-
return util_1.validatePredicate(element, type, predicates);
|
|
314
|
+
return (0, util_1.validatePredicate)(element, type, predicates);
|
|
229
315
|
}
|
|
230
316
|
return true;
|
|
231
317
|
});
|
|
@@ -234,8 +320,8 @@ var StorageClass = /** @class */ (function () {
|
|
|
234
320
|
};
|
|
235
321
|
StorageClass.prototype.clear = function (completeObservable) {
|
|
236
322
|
if (completeObservable === void 0) { completeObservable = true; }
|
|
237
|
-
return
|
|
238
|
-
return
|
|
323
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
324
|
+
return __generator(this, function (_a) {
|
|
239
325
|
switch (_a.label) {
|
|
240
326
|
case 0:
|
|
241
327
|
this.initialized = undefined;
|
|
@@ -254,10 +340,10 @@ var StorageClass = /** @class */ (function () {
|
|
|
254
340
|
});
|
|
255
341
|
};
|
|
256
342
|
StorageClass.prototype.batchSave = function (modelConstructor, items, mutator) {
|
|
257
|
-
return
|
|
343
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
258
344
|
var result;
|
|
259
345
|
var _this = this;
|
|
260
|
-
return
|
|
346
|
+
return __generator(this, function (_a) {
|
|
261
347
|
switch (_a.label) {
|
|
262
348
|
case 0: return [4 /*yield*/, this.init()];
|
|
263
349
|
case 1:
|
|
@@ -269,7 +355,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
269
355
|
case 2:
|
|
270
356
|
result = _a.sent();
|
|
271
357
|
result.forEach(function (_a) {
|
|
272
|
-
var _b =
|
|
358
|
+
var _b = __read(_a, 2), element = _b[0], opType = _b[1];
|
|
273
359
|
_this.pushStream.next({
|
|
274
360
|
model: modelConstructor,
|
|
275
361
|
opType: opType,
|
|
@@ -291,7 +377,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
291
377
|
if (!containsPatches) {
|
|
292
378
|
return null;
|
|
293
379
|
}
|
|
294
|
-
var _c =
|
|
380
|
+
var _c = __read(patchesTuple, 2), patches = _c[0], source = _c[1];
|
|
295
381
|
var updatedElement = {};
|
|
296
382
|
// extract array of updated fields from patches
|
|
297
383
|
var updatedFields = (patches.map(function (patch) { return patch.path && patch.path[0]; }));
|
|
@@ -305,26 +391,26 @@ var StorageClass = /** @class */ (function () {
|
|
|
305
391
|
updatedFields.forEach(function (field) {
|
|
306
392
|
var e_2, _a, e_3, _b, e_4, _c, e_5, _d, e_6, _e;
|
|
307
393
|
var _f;
|
|
308
|
-
var targetNames = types_1.isTargetNameAssociation((_f = fields[field]) === null || _f === void 0 ? void 0 : _f.association);
|
|
394
|
+
var targetNames = (0, types_1.isTargetNameAssociation)((_f = fields[field]) === null || _f === void 0 ? void 0 : _f.association);
|
|
309
395
|
if (Array.isArray(targetNames)) {
|
|
310
396
|
try {
|
|
311
397
|
// if field refers to a belongsTo relation, use the target field instead
|
|
312
|
-
for (var targetNames_1 =
|
|
398
|
+
for (var targetNames_1 = __values(targetNames), targetNames_1_1 = targetNames_1.next(); !targetNames_1_1.done; targetNames_1_1 = targetNames_1.next()) {
|
|
313
399
|
var targetName = targetNames_1_1.value;
|
|
314
400
|
// check field values by value. Ignore unchanged fields
|
|
315
|
-
if (!util_1.valuesEqual(source[targetName], originalElement[targetName])) {
|
|
401
|
+
if (!(0, util_1.valuesEqual)(source[targetName], originalElement[targetName])) {
|
|
316
402
|
// if the field was updated to 'undefined', replace with 'null' for compatibility with JSON and GraphQL
|
|
317
403
|
updatedElement[targetName] =
|
|
318
404
|
originalElement[targetName] === undefined
|
|
319
405
|
? null
|
|
320
406
|
: originalElement[targetName];
|
|
321
407
|
try {
|
|
322
|
-
for (var compositeKeys_1 = (e_3 = void 0,
|
|
408
|
+
for (var compositeKeys_1 = (e_3 = void 0, __values(compositeKeys)), compositeKeys_1_1 = compositeKeys_1.next(); !compositeKeys_1_1.done; compositeKeys_1_1 = compositeKeys_1.next()) {
|
|
323
409
|
var fieldSet = compositeKeys_1_1.value;
|
|
324
410
|
// include all of the fields that comprise the composite key
|
|
325
411
|
if (fieldSet.has(targetName)) {
|
|
326
412
|
try {
|
|
327
|
-
for (var fieldSet_1 = (e_4 = void 0,
|
|
413
|
+
for (var fieldSet_1 = (e_4 = void 0, __values(fieldSet)), fieldSet_1_1 = fieldSet_1.next(); !fieldSet_1_1.done; fieldSet_1_1 = fieldSet_1.next()) {
|
|
328
414
|
var compositeField = fieldSet_1_1.value;
|
|
329
415
|
updatedElement[compositeField] =
|
|
330
416
|
originalElement[compositeField];
|
|
@@ -363,17 +449,17 @@ var StorageClass = /** @class */ (function () {
|
|
|
363
449
|
// if field refers to a belongsTo relation, use the target field instead
|
|
364
450
|
var key = targetNames || field;
|
|
365
451
|
// check field values by value. Ignore unchanged fields
|
|
366
|
-
if (!util_1.valuesEqual(source[key], originalElement[key])) {
|
|
452
|
+
if (!(0, util_1.valuesEqual)(source[key], originalElement[key])) {
|
|
367
453
|
// if the field was updated to 'undefined', replace with 'null' for compatibility with JSON and GraphQL
|
|
368
454
|
updatedElement[key] =
|
|
369
455
|
originalElement[key] === undefined ? null : originalElement[key];
|
|
370
456
|
try {
|
|
371
|
-
for (var compositeKeys_2 =
|
|
457
|
+
for (var compositeKeys_2 = __values(compositeKeys), compositeKeys_2_1 = compositeKeys_2.next(); !compositeKeys_2_1.done; compositeKeys_2_1 = compositeKeys_2.next()) {
|
|
372
458
|
var fieldSet = compositeKeys_2_1.value;
|
|
373
459
|
// include all of the fields that comprise the composite key
|
|
374
460
|
if (fieldSet.has(key)) {
|
|
375
461
|
try {
|
|
376
|
-
for (var fieldSet_2 = (e_6 = void 0,
|
|
462
|
+
for (var fieldSet_2 = (e_6 = void 0, __values(fieldSet)), fieldSet_2_1 = fieldSet_2.next(); !fieldSet_2_1.done; fieldSet_2_1 = fieldSet_2.next()) {
|
|
377
463
|
var compositeField = fieldSet_2_1.value;
|
|
378
464
|
updatedElement[compositeField] =
|
|
379
465
|
originalElement[compositeField];
|
|
@@ -406,7 +492,7 @@ var StorageClass = /** @class */ (function () {
|
|
|
406
492
|
// include field(s) from custom PK if one is specified for the model
|
|
407
493
|
if (primaryKey && primaryKey.length) {
|
|
408
494
|
try {
|
|
409
|
-
for (var primaryKey_1 =
|
|
495
|
+
for (var primaryKey_1 = __values(primaryKey), primaryKey_1_1 = primaryKey_1.next(); !primaryKey_1_1.done; primaryKey_1_1 = primaryKey_1.next()) {
|
|
410
496
|
var pkField = primaryKey_1_1.value;
|
|
411
497
|
updatedElement[pkField] = originalElement[pkField];
|
|
412
498
|
}
|
|
@@ -422,24 +508,21 @@ var StorageClass = /** @class */ (function () {
|
|
|
422
508
|
var id = originalElement.id, _version = originalElement._version, _lastChangedAt = originalElement._lastChangedAt, _deleted = originalElement._deleted;
|
|
423
509
|
// For update mutations we only want to send fields with changes
|
|
424
510
|
// and the required internal fields
|
|
425
|
-
return
|
|
426
|
-
_version: _version,
|
|
427
|
-
_lastChangedAt: _lastChangedAt,
|
|
428
|
-
_deleted: _deleted });
|
|
511
|
+
return __assign(__assign({}, updatedElement), { id: id, _version: _version, _lastChangedAt: _lastChangedAt, _deleted: _deleted });
|
|
429
512
|
};
|
|
430
513
|
return StorageClass;
|
|
431
514
|
}());
|
|
432
515
|
var ExclusiveStorage = /** @class */ (function () {
|
|
433
516
|
function ExclusiveStorage(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator, adapter, sessionId) {
|
|
434
|
-
this.mutex = new
|
|
517
|
+
this.mutex = new utils_2.Mutex();
|
|
435
518
|
this.storage = new StorageClass(schema, namespaceResolver, getModelConstructorByModelName, modelInstanceCreator, adapter, sessionId);
|
|
436
519
|
}
|
|
437
520
|
ExclusiveStorage.prototype.runExclusive = function (fn) {
|
|
438
521
|
return this.mutex.runExclusive(fn.bind(this, this.storage));
|
|
439
522
|
};
|
|
440
523
|
ExclusiveStorage.prototype.save = function (model, condition, mutator, patchesTuple) {
|
|
441
|
-
return
|
|
442
|
-
return
|
|
524
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
525
|
+
return __generator(this, function (_a) {
|
|
443
526
|
return [2 /*return*/, this.runExclusive(function (storage) {
|
|
444
527
|
return storage.save(model, condition, mutator, patchesTuple);
|
|
445
528
|
})];
|
|
@@ -447,10 +530,10 @@ var ExclusiveStorage = /** @class */ (function () {
|
|
|
447
530
|
});
|
|
448
531
|
};
|
|
449
532
|
ExclusiveStorage.prototype.delete = function (modelOrModelConstructor, condition, mutator) {
|
|
450
|
-
return
|
|
451
|
-
return
|
|
533
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
534
|
+
return __generator(this, function (_a) {
|
|
452
535
|
return [2 /*return*/, this.runExclusive(function (storage) {
|
|
453
|
-
if (util_1.isModelConstructor(modelOrModelConstructor)) {
|
|
536
|
+
if ((0, util_1.isModelConstructor)(modelOrModelConstructor)) {
|
|
454
537
|
var modelConstructor = modelOrModelConstructor;
|
|
455
538
|
return storage.delete(modelConstructor, condition, mutator);
|
|
456
539
|
}
|
|
@@ -463,8 +546,8 @@ var ExclusiveStorage = /** @class */ (function () {
|
|
|
463
546
|
});
|
|
464
547
|
};
|
|
465
548
|
ExclusiveStorage.prototype.query = function (modelConstructor, predicate, pagination) {
|
|
466
|
-
return
|
|
467
|
-
return
|
|
549
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
550
|
+
return __generator(this, function (_a) {
|
|
468
551
|
return [2 /*return*/, this.runExclusive(function (storage) {
|
|
469
552
|
return storage.query(modelConstructor, predicate, pagination);
|
|
470
553
|
})];
|
|
@@ -473,8 +556,8 @@ var ExclusiveStorage = /** @class */ (function () {
|
|
|
473
556
|
};
|
|
474
557
|
ExclusiveStorage.prototype.queryOne = function (modelConstructor, firstOrLast) {
|
|
475
558
|
if (firstOrLast === void 0) { firstOrLast = types_1.QueryOne.FIRST; }
|
|
476
|
-
return
|
|
477
|
-
return
|
|
559
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
560
|
+
return __generator(this, function (_a) {
|
|
478
561
|
return [2 /*return*/, this.runExclusive(function (storage) {
|
|
479
562
|
return storage.queryOne(modelConstructor, firstOrLast);
|
|
480
563
|
})];
|
|
@@ -488,8 +571,8 @@ var ExclusiveStorage = /** @class */ (function () {
|
|
|
488
571
|
return this.storage.observe(modelConstructor, predicate, skipOwn);
|
|
489
572
|
};
|
|
490
573
|
ExclusiveStorage.prototype.clear = function () {
|
|
491
|
-
return
|
|
492
|
-
return
|
|
574
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
575
|
+
return __generator(this, function (_a) {
|
|
493
576
|
switch (_a.label) {
|
|
494
577
|
case 0: return [4 /*yield*/, this.runExclusive(function (storage) { return storage.clear(); })];
|
|
495
578
|
case 1:
|
|
@@ -503,8 +586,8 @@ var ExclusiveStorage = /** @class */ (function () {
|
|
|
503
586
|
return this.storage.batchSave(modelConstructor, items);
|
|
504
587
|
};
|
|
505
588
|
ExclusiveStorage.prototype.init = function () {
|
|
506
|
-
return
|
|
507
|
-
return
|
|
589
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
590
|
+
return __generator(this, function (_a) {
|
|
508
591
|
return [2 /*return*/, this.storage.init()];
|
|
509
592
|
});
|
|
510
593
|
});
|
|
@@ -512,4 +595,3 @@ var ExclusiveStorage = /** @class */ (function () {
|
|
|
512
595
|
return ExclusiveStorage;
|
|
513
596
|
}());
|
|
514
597
|
exports.ExclusiveStorage = ExclusiveStorage;
|
|
515
|
-
//# sourceMappingURL=storage.js.map
|
|
@@ -1,12 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
2
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
53
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
54
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
var zen_observable_ts_1 =
|
|
7
|
-
var core_1 = require("@aws-amplify/core");
|
|
55
|
+
var zen_observable_ts_1 = __importDefault(require("zen-observable-ts"));
|
|
8
56
|
var datastoreReachability_1 = require("./datastoreReachability");
|
|
9
|
-
var
|
|
57
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
58
|
+
var logger = new utils_1.Logger('DataStore');
|
|
10
59
|
var RECONNECTING_IN = 5000; // 5s this may be configurable in the future
|
|
11
60
|
var DataStoreConnectivity = /** @class */ (function () {
|
|
12
61
|
function DataStoreConnectivity() {
|
|
@@ -25,7 +74,7 @@ var DataStoreConnectivity = /** @class */ (function () {
|
|
|
25
74
|
_this.subscription = datastoreReachability_1.ReachabilityMonitor.subscribe(function (_a) {
|
|
26
75
|
var online = _a.online;
|
|
27
76
|
_this.connectionStatus.online = online;
|
|
28
|
-
var observerResult =
|
|
77
|
+
var observerResult = __assign({}, _this.connectionStatus); // copyOf status
|
|
29
78
|
observer.next(observerResult);
|
|
30
79
|
});
|
|
31
80
|
return function () {
|
|
@@ -42,8 +91,8 @@ var DataStoreConnectivity = /** @class */ (function () {
|
|
|
42
91
|
};
|
|
43
92
|
// for consistency with other background processors.
|
|
44
93
|
DataStoreConnectivity.prototype.stop = function () {
|
|
45
|
-
return
|
|
46
|
-
return
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
47
96
|
this.unsubscribe();
|
|
48
97
|
return [2 /*return*/];
|
|
49
98
|
});
|
|
@@ -54,7 +103,7 @@ var DataStoreConnectivity = /** @class */ (function () {
|
|
|
54
103
|
if (this.observer && typeof this.observer.next === 'function') {
|
|
55
104
|
this.observer.next({ online: false }); // Notify network issue from the socket
|
|
56
105
|
this.timeout = setTimeout(function () {
|
|
57
|
-
var observerResult =
|
|
106
|
+
var observerResult = __assign({}, _this.connectionStatus); // copyOf status
|
|
58
107
|
_this.observer.next(observerResult);
|
|
59
108
|
}, RECONNECTING_IN); // giving time for socket cleanup and network status stabilization
|
|
60
109
|
}
|
|
@@ -62,4 +111,3 @@ var DataStoreConnectivity = /** @class */ (function () {
|
|
|
62
111
|
return DataStoreConnectivity;
|
|
63
112
|
}());
|
|
64
113
|
exports.default = DataStoreConnectivity;
|
|
65
|
-
//# sourceMappingURL=datastoreConnectivity.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReachabilityMonitor = void 0;
|
|
3
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
var
|
|
6
|
-
exports.ReachabilityMonitor = new
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
6
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
exports.ReachabilityMonitor = new utils_1.Reachability().networkMonitor();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
6
|
+
exports.ReachabilityMonitor = void 0;
|
|
4
7
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
var
|
|
7
|
-
var netinfo_1 =
|
|
8
|
-
exports.ReachabilityMonitor = new
|
|
9
|
-
//# sourceMappingURL=index.native.js.map
|
|
9
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
10
|
+
var netinfo_1 = __importDefault(require("@react-native-community/netinfo"));
|
|
11
|
+
exports.ReachabilityMonitor = new utils_1.Reachability().networkMonitor(netinfo_1.default);
|
package/lib/sync/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ConflictHandler, ControlMessageType, ErrorHandler, InternalSchema, Mode
|
|
|
5
5
|
import type { __modelMeta__ } from '../types';
|
|
6
6
|
import DataStoreConnectivity from './datastoreConnectivity';
|
|
7
7
|
import { TransformerMutationType } from './utils';
|
|
8
|
-
|
|
8
|
+
type StartParams = {
|
|
9
9
|
fullSyncInterval: number;
|
|
10
10
|
};
|
|
11
11
|
export declare class MutationEvent {
|