@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
package/lib-esm/types.js CHANGED
@@ -1,39 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- 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;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
1
  import { isAWSDate, isAWSTime, isAWSDateTime, isAWSTimestamp, isAWSEmail, isAWSJSON, isAWSURL, isAWSPhone, isAWSIPAddress, extractPrimaryKeyFieldNames, } from './util';
38
2
  export function isSchemaModel(obj) {
39
3
  return obj && obj.pluralName !== undefined;
@@ -45,11 +9,10 @@ export function isAssociatedWith(obj) {
45
9
  return obj && obj.associatedWith;
46
10
  }
47
11
  export function isTargetNameAssociation(obj) {
48
- return (obj === null || obj === void 0 ? void 0 : obj.targetName) || (obj === null || obj === void 0 ? void 0 : obj.targetNames);
12
+ return obj?.targetName || obj?.targetNames;
49
13
  }
50
14
  export function isFieldAssociation(obj, fieldName) {
51
- var _a, _b;
52
- 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;
15
+ return obj?.fields[fieldName]?.association?.connectionType;
53
16
  }
54
17
  export function isModelAttributeAuth(attr) {
55
18
  return (attr.type === 'auth' &&
@@ -160,26 +123,26 @@ export function isGraphQLScalarType(obj) {
160
123
  return obj && GraphQLScalarType[obj] !== undefined;
161
124
  }
162
125
  export function isModelFieldType(obj) {
163
- var modelField = 'model';
126
+ const modelField = 'model';
164
127
  if (obj && obj[modelField])
165
128
  return true;
166
129
  return false;
167
130
  }
168
131
  export function isNonModelFieldType(obj) {
169
- var typeField = 'nonModel';
132
+ const typeField = 'nonModel';
170
133
  if (obj && obj[typeField])
171
134
  return true;
172
135
  return false;
173
136
  }
174
137
  export function isEnumFieldType(obj) {
175
- var modelField = 'enum';
138
+ const modelField = 'enum';
176
139
  if (obj && obj[modelField])
177
140
  return true;
178
141
  return false;
179
142
  }
180
143
  export function isIdentifierObject(obj, modelDefinition) {
181
- var keys = extractPrimaryKeyFieldNames(modelDefinition);
182
- return (typeof obj === 'object' && obj && keys.every(function (k) { return obj[k] !== undefined; }));
144
+ const keys = extractPrimaryKeyFieldNames(modelDefinition);
145
+ return (typeof obj === 'object' && obj && keys.every(k => obj[k] !== undefined));
183
146
  }
184
147
  //#endregion
185
148
  //#region Subscription messages
@@ -217,15 +180,11 @@ export var ModelOperation;
217
180
  ModelOperation["UPDATE"] = "UPDATE";
218
181
  ModelOperation["DELETE"] = "DELETE";
219
182
  })(ModelOperation || (ModelOperation = {}));
220
- export function syncExpression(modelConstructor, conditionProducer) {
221
- return __awaiter(this, void 0, void 0, function () {
222
- return __generator(this, function (_a) {
223
- return [2 /*return*/, {
224
- modelConstructor: modelConstructor,
225
- conditionProducer: conditionProducer,
226
- }];
227
- });
228
- });
183
+ export async function syncExpression(modelConstructor, conditionProducer) {
184
+ return {
185
+ modelConstructor,
186
+ conditionProducer,
187
+ };
229
188
  }
230
189
  export var ProcessName;
231
190
  (function (ProcessName) {
@@ -233,7 +192,7 @@ export var ProcessName;
233
192
  ProcessName["mutate"] = "mutate";
234
193
  ProcessName["subscribe"] = "subscribe";
235
194
  })(ProcessName || (ProcessName = {}));
236
- export var DISCARD = Symbol('DISCARD');
195
+ export const DISCARD = Symbol('DISCARD');
237
196
  export var LimitTimerRaceResolvedValues;
238
197
  (function (LimitTimerRaceResolvedValues) {
239
198
  LimitTimerRaceResolvedValues["LIMIT"] = "LIMIT";
@@ -243,11 +202,9 @@ export var LimitTimerRaceResolvedValues;
243
202
  * A pointer used by DataStore internally to lookup predicate details
244
203
  * that should not be exposed on public customer interfaces.
245
204
  */
246
- var PredicateInternalsKey = /** @class */ (function () {
247
- function PredicateInternalsKey() {
205
+ export class PredicateInternalsKey {
206
+ constructor() {
248
207
  this.__isPredicateInternalsKeySentinel = true;
249
208
  }
250
- return PredicateInternalsKey;
251
- }());
252
- export { PredicateInternalsKey };
209
+ }
253
210
  // #endregion