@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.
- package/lib/authModeStrategies/defaultAuthStrategy.js +1 -1
- package/lib/authModeStrategies/multiAuthStrategy.js +29 -105
- package/lib/datastore/datastore.js +887 -1370
- package/lib/index.js +1 -1
- package/lib/predicates/index.js +53 -102
- package/lib/predicates/next.js +310 -557
- package/lib/predicates/sort.js +24 -27
- package/lib/ssr/index.js +1 -1
- package/lib/storage/adapter/AsyncStorageAdapter.js +115 -449
- package/lib/storage/adapter/AsyncStorageDatabase.js +215 -480
- package/lib/storage/adapter/InMemoryStore.js +27 -101
- package/lib/storage/adapter/InMemoryStore.native.js +1 -1
- package/lib/storage/adapter/IndexedDBAdapter.js +441 -1002
- package/lib/storage/adapter/StorageAdapterBase.js +177 -396
- package/lib/storage/adapter/getDefaultAdapter/index.js +5 -6
- package/lib/storage/adapter/getDefaultAdapter/index.native.js +2 -2
- package/lib/storage/relationship.js +174 -260
- package/lib/storage/storage.js +244 -507
- package/lib/sync/datastoreConnectivity.js +29 -84
- package/lib/sync/datastoreReachability/index.js +1 -1
- package/lib/sync/datastoreReachability/index.native.js +2 -2
- package/lib/sync/index.js +512 -885
- package/lib/sync/merger.js +30 -133
- package/lib/sync/outbox.js +147 -302
- package/lib/sync/processors/errorMaps.js +30 -80
- package/lib/sync/processors/mutation.js +331 -579
- package/lib/sync/processors/subscription.js +268 -428
- package/lib/sync/processors/sync.js +276 -464
- package/lib/sync/utils.js +248 -393
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.js +16 -58
- package/lib/util.js +335 -575
- package/lib-esm/authModeStrategies/defaultAuthStrategy.js +1 -1
- package/lib-esm/authModeStrategies/multiAuthStrategy.js +27 -103
- package/lib-esm/datastore/datastore.js +874 -1359
- package/lib-esm/index.js +6 -6
- package/lib-esm/predicates/index.js +54 -104
- package/lib-esm/predicates/next.js +306 -555
- package/lib-esm/predicates/sort.js +24 -27
- package/lib-esm/ssr/index.js +1 -1
- package/lib-esm/storage/adapter/AsyncStorageAdapter.js +111 -446
- package/lib-esm/storage/adapter/AsyncStorageDatabase.js +212 -477
- package/lib-esm/storage/adapter/InMemoryStore.js +27 -102
- package/lib-esm/storage/adapter/IndexedDBAdapter.js +436 -997
- package/lib-esm/storage/adapter/StorageAdapterBase.js +172 -392
- package/lib-esm/storage/adapter/getDefaultAdapter/index.js +2 -3
- package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +1 -1
- package/lib-esm/storage/relationship.js +173 -260
- package/lib-esm/storage/storage.js +236 -499
- package/lib-esm/sync/datastoreConnectivity.js +26 -82
- package/lib-esm/sync/datastoreReachability/index.js +1 -1
- package/lib-esm/sync/datastoreReachability/index.native.js +1 -1
- package/lib-esm/sync/index.js +498 -872
- package/lib-esm/sync/merger.js +28 -131
- package/lib-esm/sync/outbox.js +143 -298
- package/lib-esm/sync/processors/errorMaps.js +32 -82
- package/lib-esm/sync/processors/mutation.js +324 -572
- package/lib-esm/sync/processors/subscription.js +258 -418
- package/lib-esm/sync/processors/sync.js +269 -457
- package/lib-esm/sync/utils.js +245 -390
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types.js +16 -59
- package/lib-esm/util.js +335 -577
- package/package.json +12 -12
- package/src/datastore/datastore.ts +4 -3
- package/src/storage/adapter/getDefaultAdapter/index.ts +1 -3
- package/src/sync/processors/mutation.ts +1 -1
- package/src/sync/processors/sync.ts +1 -1
- package/src/sync/utils.ts +1 -1
- package/src/util.ts +44 -6
package/lib/types.js
CHANGED
|
@@ -1,43 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.PredicateInternalsKey = exports.LimitTimerRaceResolvedValues = exports.DISCARD = exports.ProcessName = exports.syncExpression = exports.ModelOperation = exports.AuthModeStrategyType = exports.SortDirection = exports.QueryOne = exports.isPredicateGroup = exports.isPredicateObj = exports.OpType = exports.isIdentifierObject = exports.isEnumFieldType = exports.isNonModelFieldType = exports.isModelFieldType = exports.isGraphQLScalarType = exports.GraphQLScalarType = exports.ModelAttributeAuthProvider = exports.ModelAttributeAuthAllow = exports.isModelAttributeCompositeKey = exports.isModelAttributePrimaryKey = exports.isModelAttributeKey = exports.isModelAttributeAuth = exports.isFieldAssociation = exports.isTargetNameAssociation = exports.isAssociatedWith = exports.isSchemaModelWithAttributes = exports.isSchemaModel = void 0;
|
|
40
|
-
|
|
4
|
+
const util_1 = require("./util");
|
|
41
5
|
function isSchemaModel(obj) {
|
|
42
6
|
return obj && obj.pluralName !== undefined;
|
|
43
7
|
}
|
|
@@ -51,12 +15,11 @@ function isAssociatedWith(obj) {
|
|
|
51
15
|
}
|
|
52
16
|
exports.isAssociatedWith = isAssociatedWith;
|
|
53
17
|
function isTargetNameAssociation(obj) {
|
|
54
|
-
return
|
|
18
|
+
return obj?.targetName || obj?.targetNames;
|
|
55
19
|
}
|
|
56
20
|
exports.isTargetNameAssociation = isTargetNameAssociation;
|
|
57
21
|
function isFieldAssociation(obj, fieldName) {
|
|
58
|
-
|
|
59
|
-
return (_b = (_a = obj === null || obj === void 0 ? void 0 : obj.fields[fieldName]) === null || _a === void 0 ? void 0 : _a.association) === null || _b === void 0 ? void 0 : _b.connectionType;
|
|
22
|
+
return obj?.fields[fieldName]?.association?.connectionType;
|
|
60
23
|
}
|
|
61
24
|
exports.isFieldAssociation = isFieldAssociation;
|
|
62
25
|
function isModelAttributeAuth(attr) {
|
|
@@ -173,29 +136,29 @@ function isGraphQLScalarType(obj) {
|
|
|
173
136
|
}
|
|
174
137
|
exports.isGraphQLScalarType = isGraphQLScalarType;
|
|
175
138
|
function isModelFieldType(obj) {
|
|
176
|
-
|
|
139
|
+
const modelField = 'model';
|
|
177
140
|
if (obj && obj[modelField])
|
|
178
141
|
return true;
|
|
179
142
|
return false;
|
|
180
143
|
}
|
|
181
144
|
exports.isModelFieldType = isModelFieldType;
|
|
182
145
|
function isNonModelFieldType(obj) {
|
|
183
|
-
|
|
146
|
+
const typeField = 'nonModel';
|
|
184
147
|
if (obj && obj[typeField])
|
|
185
148
|
return true;
|
|
186
149
|
return false;
|
|
187
150
|
}
|
|
188
151
|
exports.isNonModelFieldType = isNonModelFieldType;
|
|
189
152
|
function isEnumFieldType(obj) {
|
|
190
|
-
|
|
153
|
+
const modelField = 'enum';
|
|
191
154
|
if (obj && obj[modelField])
|
|
192
155
|
return true;
|
|
193
156
|
return false;
|
|
194
157
|
}
|
|
195
158
|
exports.isEnumFieldType = isEnumFieldType;
|
|
196
159
|
function isIdentifierObject(obj, modelDefinition) {
|
|
197
|
-
|
|
198
|
-
return (typeof obj === 'object' && obj && keys.every(
|
|
160
|
+
const keys = (0, util_1.extractPrimaryKeyFieldNames)(modelDefinition);
|
|
161
|
+
return (typeof obj === 'object' && obj && keys.every(k => obj[k] !== undefined));
|
|
199
162
|
}
|
|
200
163
|
exports.isIdentifierObject = isIdentifierObject;
|
|
201
164
|
//#endregion
|
|
@@ -236,15 +199,11 @@ var ModelOperation;
|
|
|
236
199
|
ModelOperation["UPDATE"] = "UPDATE";
|
|
237
200
|
ModelOperation["DELETE"] = "DELETE";
|
|
238
201
|
})(ModelOperation = exports.ModelOperation || (exports.ModelOperation = {}));
|
|
239
|
-
function syncExpression(modelConstructor, conditionProducer) {
|
|
240
|
-
return
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
conditionProducer: conditionProducer,
|
|
245
|
-
}];
|
|
246
|
-
});
|
|
247
|
-
});
|
|
202
|
+
async function syncExpression(modelConstructor, conditionProducer) {
|
|
203
|
+
return {
|
|
204
|
+
modelConstructor,
|
|
205
|
+
conditionProducer,
|
|
206
|
+
};
|
|
248
207
|
}
|
|
249
208
|
exports.syncExpression = syncExpression;
|
|
250
209
|
var ProcessName;
|
|
@@ -263,11 +222,10 @@ var LimitTimerRaceResolvedValues;
|
|
|
263
222
|
* A pointer used by DataStore internally to lookup predicate details
|
|
264
223
|
* that should not be exposed on public customer interfaces.
|
|
265
224
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
225
|
+
class PredicateInternalsKey {
|
|
226
|
+
constructor() {
|
|
268
227
|
this.__isPredicateInternalsKeySentinel = true;
|
|
269
228
|
}
|
|
270
|
-
|
|
271
|
-
}());
|
|
229
|
+
}
|
|
272
230
|
exports.PredicateInternalsKey = PredicateInternalsKey;
|
|
273
231
|
// #endregion
|