@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.
Files changed (182) 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 +81 -24
  5. package/lib/datastore/datastore.d.ts +3 -4
  6. package/lib/datastore/datastore.js +361 -227
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.js +25 -12
  9. package/lib/predicates/index.js +46 -12
  10. package/lib/predicates/next.d.ts +2 -2
  11. package/lib/predicates/next.js +172 -74
  12. package/lib/predicates/sort.js +3 -4
  13. package/lib/ssr/index.js +1 -1
  14. package/lib/storage/adapter/AsyncStorageAdapter.js +240 -128
  15. package/lib/storage/adapter/AsyncStorageDatabase.js +100 -39
  16. package/lib/storage/adapter/InMemoryStore.js +68 -17
  17. package/lib/storage/adapter/InMemoryStore.native.js +5 -3
  18. package/lib/storage/adapter/IndexedDBAdapter.js +355 -199
  19. package/lib/storage/adapter/StorageAdapterBase.js +154 -85
  20. package/lib/storage/adapter/getDefaultAdapter/index.js +8 -9
  21. package/lib/storage/adapter/getDefaultAdapter/index.native.js +4 -3
  22. package/lib/storage/adapter/index.js +0 -1
  23. package/lib/storage/relationship.js +31 -21
  24. package/lib/storage/storage.d.ts +3 -3
  25. package/lib/storage/storage.js +143 -61
  26. package/lib/sync/datastoreConnectivity.d.ts +1 -1
  27. package/lib/sync/datastoreConnectivity.js +57 -9
  28. package/lib/sync/datastoreReachability/index.js +3 -3
  29. package/lib/sync/datastoreReachability/index.native.js +7 -5
  30. package/lib/sync/index.d.ts +1 -1
  31. package/lib/sync/index.js +193 -125
  32. package/lib/sync/merger.js +81 -10
  33. package/lib/sync/outbox.js +101 -30
  34. package/lib/sync/processors/errorMaps.d.ts +1 -1
  35. package/lib/sync/processors/errorMaps.js +41 -6
  36. package/lib/sync/processors/mutation.d.ts +1 -1
  37. package/lib/sync/processors/mutation.js +192 -101
  38. package/lib/sync/processors/subscription.d.ts +4 -1
  39. package/lib/sync/processors/subscription.js +190 -178
  40. package/lib/sync/processors/sync.d.ts +1 -1
  41. package/lib/sync/processors/sync.js +113 -47
  42. package/lib/sync/utils.d.ts +4 -4
  43. package/lib/sync/utils.js +162 -81
  44. package/lib/tsconfig.tsbuildinfo +1 -0
  45. package/lib/types.d.ts +138 -140
  46. package/lib/types.js +40 -5
  47. package/lib/util.d.ts +9 -17
  48. package/lib/util.js +216 -100
  49. package/lib-esm/authModeStrategies/defaultAuthStrategy.js +0 -1
  50. package/lib-esm/authModeStrategies/index.js +0 -1
  51. package/lib-esm/authModeStrategies/multiAuthStrategy.js +76 -21
  52. package/lib-esm/datastore/datastore.d.ts +3 -4
  53. package/lib-esm/datastore/datastore.js +206 -77
  54. package/lib-esm/index.d.ts +1 -1
  55. package/lib-esm/index.js +0 -1
  56. package/lib-esm/predicates/index.js +40 -7
  57. package/lib-esm/predicates/next.d.ts +2 -2
  58. package/lib-esm/predicates/next.js +148 -52
  59. package/lib-esm/predicates/sort.js +2 -4
  60. package/lib-esm/ssr/index.js +0 -1
  61. package/lib-esm/storage/adapter/AsyncStorageAdapter.js +203 -95
  62. package/lib-esm/storage/adapter/AsyncStorageDatabase.js +66 -5
  63. package/lib-esm/storage/adapter/InMemoryStore.js +52 -2
  64. package/lib-esm/storage/adapter/InMemoryStore.native.js +0 -1
  65. package/lib-esm/storage/adapter/IndexedDBAdapter.js +271 -138
  66. package/lib-esm/storage/adapter/StorageAdapterBase.js +130 -62
  67. package/lib-esm/storage/adapter/getDefaultAdapter/index.js +2 -5
  68. package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js +0 -1
  69. package/lib-esm/storage/adapter/index.js +1 -1
  70. package/lib-esm/storage/relationship.js +27 -18
  71. package/lib-esm/storage/storage.d.ts +3 -3
  72. package/lib-esm/storage/storage.js +87 -9
  73. package/lib-esm/sync/datastoreConnectivity.d.ts +1 -1
  74. package/lib-esm/sync/datastoreConnectivity.js +48 -3
  75. package/lib-esm/sync/datastoreReachability/index.js +1 -2
  76. package/lib-esm/sync/datastoreReachability/index.native.js +1 -2
  77. package/lib-esm/sync/index.d.ts +1 -1
  78. package/lib-esm/sync/index.js +136 -72
  79. package/lib-esm/sync/merger.js +73 -3
  80. package/lib-esm/sync/outbox.js +75 -5
  81. package/lib-esm/sync/processors/errorMaps.d.ts +1 -1
  82. package/lib-esm/sync/processors/errorMaps.js +39 -5
  83. package/lib-esm/sync/processors/mutation.d.ts +1 -1
  84. package/lib-esm/sync/processors/mutation.js +130 -44
  85. package/lib-esm/sync/processors/subscription.d.ts +4 -1
  86. package/lib-esm/sync/processors/subscription.js +134 -126
  87. package/lib-esm/sync/processors/sync.d.ts +1 -1
  88. package/lib-esm/sync/processors/sync.js +74 -12
  89. package/lib-esm/sync/utils.d.ts +4 -4
  90. package/lib-esm/sync/utils.js +135 -55
  91. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  92. package/lib-esm/types.d.ts +138 -140
  93. package/lib-esm/types.js +36 -2
  94. package/lib-esm/util.d.ts +9 -17
  95. package/lib-esm/util.js +96 -16
  96. package/package.json +139 -132
  97. package/src/authModeStrategies/multiAuthStrategy.ts +11 -12
  98. package/src/datastore/datastore.ts +32 -25
  99. package/src/predicates/sort.ts +3 -1
  100. package/src/storage/adapter/InMemoryStore.ts +1 -1
  101. package/src/storage/adapter/IndexedDBAdapter.ts +1 -1
  102. package/src/storage/adapter/StorageAdapterBase.ts +1 -1
  103. package/src/storage/adapter/getDefaultAdapter/index.ts +2 -3
  104. package/src/storage/storage.ts +1 -1
  105. package/src/sync/datastoreConnectivity.ts +2 -2
  106. package/src/sync/datastoreReachability/index.native.ts +1 -1
  107. package/src/sync/datastoreReachability/index.ts +1 -1
  108. package/src/sync/index.ts +69 -78
  109. package/src/sync/processors/mutation.ts +16 -10
  110. package/src/sync/processors/subscription.ts +55 -127
  111. package/src/sync/processors/sync.ts +8 -4
  112. package/src/sync/utils.ts +7 -8
  113. package/src/types.ts +4 -8
  114. package/src/util.ts +5 -6
  115. package/lib/.tsbuildinfo +0 -3
  116. package/lib/authModeStrategies/defaultAuthStrategy.js.map +0 -1
  117. package/lib/authModeStrategies/index.js.map +0 -1
  118. package/lib/authModeStrategies/multiAuthStrategy.js.map +0 -1
  119. package/lib/datastore/datastore.js.map +0 -1
  120. package/lib/index.js.map +0 -1
  121. package/lib/predicates/index.js.map +0 -1
  122. package/lib/predicates/next.js.map +0 -1
  123. package/lib/predicates/sort.js.map +0 -1
  124. package/lib/ssr/index.js.map +0 -1
  125. package/lib/storage/adapter/AsyncStorageAdapter.js.map +0 -1
  126. package/lib/storage/adapter/AsyncStorageDatabase.js.map +0 -1
  127. package/lib/storage/adapter/InMemoryStore.js.map +0 -1
  128. package/lib/storage/adapter/InMemoryStore.native.js.map +0 -1
  129. package/lib/storage/adapter/IndexedDBAdapter.js.map +0 -1
  130. package/lib/storage/adapter/StorageAdapterBase.js.map +0 -1
  131. package/lib/storage/adapter/getDefaultAdapter/index.js.map +0 -1
  132. package/lib/storage/adapter/getDefaultAdapter/index.native.js.map +0 -1
  133. package/lib/storage/adapter/index.js.map +0 -1
  134. package/lib/storage/relationship.js.map +0 -1
  135. package/lib/storage/storage.js.map +0 -1
  136. package/lib/sync/datastoreConnectivity.js.map +0 -1
  137. package/lib/sync/datastoreReachability/index.js.map +0 -1
  138. package/lib/sync/datastoreReachability/index.native.js.map +0 -1
  139. package/lib/sync/index.js.map +0 -1
  140. package/lib/sync/merger.js.map +0 -1
  141. package/lib/sync/outbox.js.map +0 -1
  142. package/lib/sync/processors/errorMaps.js.map +0 -1
  143. package/lib/sync/processors/mutation.js.map +0 -1
  144. package/lib/sync/processors/subscription.js.map +0 -1
  145. package/lib/sync/processors/sync.js.map +0 -1
  146. package/lib/sync/utils.js.map +0 -1
  147. package/lib/types.js.map +0 -1
  148. package/lib/util.js.map +0 -1
  149. package/lib-esm/.tsbuildinfo +0 -3
  150. package/lib-esm/authModeStrategies/defaultAuthStrategy.js.map +0 -1
  151. package/lib-esm/authModeStrategies/index.js.map +0 -1
  152. package/lib-esm/authModeStrategies/multiAuthStrategy.js.map +0 -1
  153. package/lib-esm/datastore/datastore.js.map +0 -1
  154. package/lib-esm/index.js.map +0 -1
  155. package/lib-esm/predicates/index.js.map +0 -1
  156. package/lib-esm/predicates/next.js.map +0 -1
  157. package/lib-esm/predicates/sort.js.map +0 -1
  158. package/lib-esm/ssr/index.js.map +0 -1
  159. package/lib-esm/storage/adapter/AsyncStorageAdapter.js.map +0 -1
  160. package/lib-esm/storage/adapter/AsyncStorageDatabase.js.map +0 -1
  161. package/lib-esm/storage/adapter/InMemoryStore.js.map +0 -1
  162. package/lib-esm/storage/adapter/InMemoryStore.native.js.map +0 -1
  163. package/lib-esm/storage/adapter/IndexedDBAdapter.js.map +0 -1
  164. package/lib-esm/storage/adapter/StorageAdapterBase.js.map +0 -1
  165. package/lib-esm/storage/adapter/getDefaultAdapter/index.js.map +0 -1
  166. package/lib-esm/storage/adapter/getDefaultAdapter/index.native.js.map +0 -1
  167. package/lib-esm/storage/adapter/index.js.map +0 -1
  168. package/lib-esm/storage/relationship.js.map +0 -1
  169. package/lib-esm/storage/storage.js.map +0 -1
  170. package/lib-esm/sync/datastoreConnectivity.js.map +0 -1
  171. package/lib-esm/sync/datastoreReachability/index.js.map +0 -1
  172. package/lib-esm/sync/datastoreReachability/index.native.js.map +0 -1
  173. package/lib-esm/sync/index.js.map +0 -1
  174. package/lib-esm/sync/merger.js.map +0 -1
  175. package/lib-esm/sync/outbox.js.map +0 -1
  176. package/lib-esm/sync/processors/errorMaps.js.map +0 -1
  177. package/lib-esm/sync/processors/mutation.js.map +0 -1
  178. package/lib-esm/sync/processors/subscription.js.map +0 -1
  179. package/lib-esm/sync/processors/sync.js.map +0 -1
  180. package/lib-esm/sync/utils.js.map +0 -1
  181. package/lib-esm/types.js.map +0 -1
  182. package/lib-esm/util.js.map +0 -1
@@ -1,4 +1,39 @@
1
- import { __assign, __read, __spread } from "tslib";
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 __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
2
37
  import { extractPrimaryKeyFieldNames, extractPrimaryKeyValues } from '../util';
3
38
  export { ModelSortPredicateCreator } from './sort';
4
39
  var predicatesAllSet = new WeakSet();
@@ -23,7 +58,7 @@ var groupKeys = new Set(['and', 'or', 'not']);
23
58
  * @param o The object to test.
24
59
  */
25
60
  var isGroup = function (o) {
26
- var keys = __spread(Object.keys(o));
61
+ var keys = __spreadArray([], __read(Object.keys(o)), false);
27
62
  return keys.length === 1 && groupKeys.has(keys[0]);
28
63
  };
29
64
  /**
@@ -58,7 +93,7 @@ export var comparisonKeys = new Set([
58
93
  * @param o The object to test.
59
94
  */
60
95
  var isComparison = function (o) {
61
- var keys = __spread(Object.keys(o));
96
+ var keys = __spreadArray([], __read(Object.keys(o)), false);
62
97
  return !Array.isArray(o) && keys.length === 1 && comparisonKeys.has(keys[0]);
63
98
  };
64
99
  /**
@@ -85,13 +120,13 @@ var Predicates = /** @class */ (function () {
85
120
  predicatesAllSet.add(predicate);
86
121
  return predicate;
87
122
  },
88
- enumerable: true,
123
+ enumerable: false,
89
124
  configurable: true
90
125
  });
91
126
  return Predicates;
92
127
  }());
93
128
  export { Predicates };
94
- var ModelPredicateCreator = /** @class */ (function () {
129
+ export var ModelPredicateCreator = /** @class */ (function () {
95
130
  function ModelPredicateCreator() {
96
131
  }
97
132
  /**
@@ -250,5 +285,3 @@ var ModelPredicateCreator = /** @class */ (function () {
250
285
  ModelPredicateCreator.predicateGroupsMap = new WeakMap();
251
286
  return ModelPredicateCreator;
252
287
  }());
253
- export { ModelPredicateCreator };
254
- //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import { PersistentModel, ModelMeta, ModelPredicate as StoragePredicate, PredicateInternalsKey, V5ModelPredicate as ModelPredicate, RecursiveModelPredicate } from '../types';
2
2
  import { ExclusiveStorage as StorageAdapter } from '../storage/storage';
3
- declare type GroupOperator = 'and' | 'or' | 'not';
4
- declare type UntypedCondition = {
3
+ type GroupOperator = 'and' | 'or' | 'not';
4
+ type UntypedCondition = {
5
5
  fetch: (storage: StorageAdapter) => Promise<Record<string, any>[]>;
6
6
  matches: (item: Record<string, any>) => Promise<boolean>;
7
7
  copy(extract?: GroupCondition): [UntypedCondition, GroupCondition | undefined];
@@ -1,11 +1,100 @@
1
- import { __assign, __asyncValues, __awaiter, __generator, __read, __spread, __values } from "tslib";
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
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
49
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
50
+ var m = o[Symbol.asyncIterator], i;
51
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
52
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
53
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
54
+ };
55
+ var __read = (this && this.__read) || function (o, n) {
56
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
57
+ if (!m) return o;
58
+ var i = m.call(o), r, ar = [], e;
59
+ try {
60
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
61
+ }
62
+ catch (error) { e = { error: error }; }
63
+ finally {
64
+ try {
65
+ if (r && !r.done && (m = i["return"])) m.call(i);
66
+ }
67
+ finally { if (e) throw e.error; }
68
+ }
69
+ return ar;
70
+ };
71
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
72
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
73
+ if (ar || !(i in from)) {
74
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
75
+ ar[i] = from[i];
76
+ }
77
+ }
78
+ return to.concat(ar || Array.prototype.slice.call(from));
79
+ };
80
+ var __values = (this && this.__values) || function(o) {
81
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
82
+ if (m) return m.call(o);
83
+ if (o && typeof o.length === "number") return {
84
+ next: function () {
85
+ if (o && i >= o.length) o = void 0;
86
+ return { value: o && o[i++], done: !o };
87
+ }
88
+ };
89
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
90
+ };
2
91
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
92
  // SPDX-License-Identifier: Apache-2.0
4
93
  import { PredicateInternalsKey, } from '../types';
5
94
  import { ModelPredicateCreator as FlatModelPredicateCreator, comparisonKeys, } from './index';
6
95
  import { ModelRelationship } from '../storage/relationship';
7
96
  import { asyncSome, asyncEvery } from '../util';
8
- var ops = __spread(comparisonKeys);
97
+ var ops = __spreadArray([], __read(comparisonKeys), false);
9
98
  /**
10
99
  * A map from keys (exposed to customers) to the internal predicate data
11
100
  * structures invoking code should not muck with.
@@ -79,7 +168,7 @@ var FieldCondition = /** @class */ (function () {
79
168
  */
80
169
  FieldCondition.prototype.copy = function (extract) {
81
170
  return [
82
- new FieldCondition(this.field, this.operator, __spread(this.operands)),
171
+ new FieldCondition(this.field, this.operator, __spreadArray([], __read(this.operands), false)),
83
172
  undefined,
84
173
  ];
85
174
  };
@@ -186,7 +275,7 @@ var FieldCondition = /** @class */ (function () {
186
275
  return [2 /*return*/, result];
187
276
  }
188
277
  else {
189
- throw new Error("Invalid operator given: " + this.operator);
278
+ throw new Error("Invalid operator given: ".concat(this.operator));
190
279
  }
191
280
  return [2 /*return*/];
192
281
  });
@@ -206,7 +295,7 @@ var FieldCondition = /** @class */ (function () {
206
295
  var argsClause = count === 1 ? 'argument is' : 'arguments are';
207
296
  return function () {
208
297
  if (_this.operands.length !== count) {
209
- return "Exactly " + count + " " + argsClause + " required.";
298
+ return "Exactly ".concat(count, " ").concat(argsClause, " required.");
210
299
  }
211
300
  };
212
301
  };
@@ -234,10 +323,10 @@ var FieldCondition = /** @class */ (function () {
234
323
  if (validate) {
235
324
  var e = validate();
236
325
  if (typeof e === 'string')
237
- throw new Error("Incorrect usage of `" + this.operator + "()`: " + e);
326
+ throw new Error("Incorrect usage of `".concat(this.operator, "()`: ").concat(e));
238
327
  }
239
328
  else {
240
- throw new Error("Non-existent operator: `" + this.operator + "()`");
329
+ throw new Error("Non-existent operator: `".concat(this.operator, "()`"));
241
330
  }
242
331
  };
243
332
  return FieldCondition;
@@ -250,7 +339,7 @@ export { FieldCondition };
250
339
  */
251
340
  var getGroupId = (function () {
252
341
  var seed = 1;
253
- return function () { return "group_" + seed++; };
342
+ return function () { return "group_".concat(seed++); };
254
343
  })();
255
344
  /**
256
345
  * A set of sub-conditions to operate against a model, optionally scoped to
@@ -454,7 +543,7 @@ var GroupCondition = /** @class */ (function () {
454
543
  case 2:
455
544
  if (!!groups_1_1.done) return [3 /*break*/, 9];
456
545
  g = groups_1_1.value;
457
- return [4 /*yield*/, g.fetch(storage, __spread(breadcrumb, [this.groupId]), negateChildren)];
546
+ return [4 /*yield*/, g.fetch(storage, __spreadArray(__spreadArray([], __read(breadcrumb), false), [this.groupId], false), negateChildren)];
458
547
  case 3:
459
548
  relatives = _r.sent();
460
549
  // no relatives -> no need to attempt to perform a "join" query for
@@ -643,23 +732,23 @@ var GroupCondition = /** @class */ (function () {
643
732
  * @returns A boolean (promise): `true` if matched, `false` otherwise.
644
733
  */
645
734
  GroupCondition.prototype.matches = function (item, ignoreFieldName) {
735
+ var _a, e_7, _b, _c;
646
736
  if (ignoreFieldName === void 0) { ignoreFieldName = false; }
647
- var e_7, _a;
648
737
  return __awaiter(this, void 0, void 0, function () {
649
- var itemToCheck, _b, itemToCheck_1, itemToCheck_1_1, singleItem, e_7_1;
650
- return __generator(this, function (_c) {
651
- switch (_c.label) {
738
+ var itemToCheck, _d, _e, itemToCheck_1, itemToCheck_1_1, singleItem, e_7_1;
739
+ return __generator(this, function (_f) {
740
+ switch (_f.label) {
652
741
  case 0:
653
742
  if (!(this.field && !ignoreFieldName)) return [3 /*break*/, 2];
654
743
  return [4 /*yield*/, item[this.field]];
655
744
  case 1:
656
- _b = _c.sent();
745
+ _d = _f.sent();
657
746
  return [3 /*break*/, 3];
658
747
  case 2:
659
- _b = item;
660
- _c.label = 3;
748
+ _d = item;
749
+ _f.label = 3;
661
750
  case 3:
662
- itemToCheck = _b;
751
+ itemToCheck = _d;
663
752
  // if there is no item to check, we can stop recursing immediately.
664
753
  // a condition cannot match against an item that does not exist. this
665
754
  // can occur when `item.field` is optional in the schema.
@@ -667,55 +756,63 @@ var GroupCondition = /** @class */ (function () {
667
756
  return [2 /*return*/, false];
668
757
  }
669
758
  if (!(this.relationshipType === 'HAS_MANY' &&
670
- typeof itemToCheck[Symbol.asyncIterator] === 'function')) return [3 /*break*/, 17];
671
- _c.label = 4;
759
+ typeof itemToCheck[Symbol.asyncIterator] === 'function')) return [3 /*break*/, 19];
760
+ _f.label = 4;
672
761
  case 4:
673
- _c.trys.push([4, 10, 11, 16]);
674
- itemToCheck_1 = __asyncValues(itemToCheck);
675
- _c.label = 5;
762
+ _f.trys.push([4, 12, 13, 18]);
763
+ _e = true, itemToCheck_1 = __asyncValues(itemToCheck);
764
+ _f.label = 5;
676
765
  case 5: return [4 /*yield*/, itemToCheck_1.next()];
677
766
  case 6:
678
- if (!(itemToCheck_1_1 = _c.sent(), !itemToCheck_1_1.done)) return [3 /*break*/, 9];
679
- singleItem = itemToCheck_1_1.value;
680
- return [4 /*yield*/, this.matches(singleItem, true)];
767
+ if (!(itemToCheck_1_1 = _f.sent(), _a = itemToCheck_1_1.done, !_a)) return [3 /*break*/, 11];
768
+ _c = itemToCheck_1_1.value;
769
+ _e = false;
770
+ _f.label = 7;
681
771
  case 7:
682
- if (_c.sent()) {
772
+ _f.trys.push([7, , 9, 10]);
773
+ singleItem = _c;
774
+ return [4 /*yield*/, this.matches(singleItem, true)];
775
+ case 8:
776
+ if (_f.sent()) {
683
777
  return [2 /*return*/, true];
684
778
  }
685
- _c.label = 8;
686
- case 8: return [3 /*break*/, 5];
687
- case 9: return [3 /*break*/, 16];
688
- case 10:
689
- e_7_1 = _c.sent();
690
- e_7 = { error: e_7_1 };
691
- return [3 /*break*/, 16];
692
- case 11:
693
- _c.trys.push([11, , 14, 15]);
694
- if (!(itemToCheck_1_1 && !itemToCheck_1_1.done && (_a = itemToCheck_1.return))) return [3 /*break*/, 13];
695
- return [4 /*yield*/, _a.call(itemToCheck_1)];
779
+ return [3 /*break*/, 10];
780
+ case 9:
781
+ _e = true;
782
+ return [7 /*endfinally*/];
783
+ case 10: return [3 /*break*/, 5];
784
+ case 11: return [3 /*break*/, 18];
696
785
  case 12:
697
- _c.sent();
698
- _c.label = 13;
699
- case 13: return [3 /*break*/, 15];
786
+ e_7_1 = _f.sent();
787
+ e_7 = { error: e_7_1 };
788
+ return [3 /*break*/, 18];
789
+ case 13:
790
+ _f.trys.push([13, , 16, 17]);
791
+ if (!(!_e && !_a && (_b = itemToCheck_1.return))) return [3 /*break*/, 15];
792
+ return [4 /*yield*/, _b.call(itemToCheck_1)];
700
793
  case 14:
794
+ _f.sent();
795
+ _f.label = 15;
796
+ case 15: return [3 /*break*/, 17];
797
+ case 16:
701
798
  if (e_7) throw e_7.error;
702
799
  return [7 /*endfinally*/];
703
- case 15: return [7 /*endfinally*/];
704
- case 16: return [2 /*return*/, false];
705
- case 17:
706
- if (!(this.operator === 'or')) return [3 /*break*/, 18];
800
+ case 17: return [7 /*endfinally*/];
801
+ case 18: return [2 /*return*/, false];
802
+ case 19:
803
+ if (!(this.operator === 'or')) return [3 /*break*/, 20];
707
804
  return [2 /*return*/, asyncSome(this.operands, function (c) { return c.matches(itemToCheck); })];
708
- case 18:
709
- if (!(this.operator === 'and')) return [3 /*break*/, 19];
805
+ case 20:
806
+ if (!(this.operator === 'and')) return [3 /*break*/, 21];
710
807
  return [2 /*return*/, asyncEvery(this.operands, function (c) { return c.matches(itemToCheck); })];
711
- case 19:
712
- if (!(this.operator === 'not')) return [3 /*break*/, 21];
808
+ case 21:
809
+ if (!(this.operator === 'not')) return [3 /*break*/, 23];
713
810
  if (this.operands.length !== 1) {
714
811
  throw new Error('Invalid arguments! `not()` accepts exactly one predicate expression.');
715
812
  }
716
813
  return [4 /*yield*/, this.operands[0].matches(itemToCheck)];
717
- case 20: return [2 /*return*/, !(_c.sent())];
718
- case 21: throw new Error('Invalid group operator!');
814
+ case 22: return [2 /*return*/, !(_f.sent())];
815
+ case 23: throw new Error('Invalid group operator!');
719
816
  }
720
817
  });
721
818
  });
@@ -800,7 +897,7 @@ export function recursivePredicateFor(ModelType, allowRecursion, field, query, t
800
897
  var _a = copyLink(), query = _a.query, newTail = _a.newTail;
801
898
  var childConditions = builder(recursivePredicateFor(ModelType, allowRecursion));
802
899
  if (!Array.isArray(childConditions)) {
803
- throw new Error("Invalid predicate. `" + op + "` groups must return an array of child conditions.");
900
+ throw new Error("Invalid predicate. `".concat(op, "` groups must return an array of child conditions."));
804
901
  }
805
902
  // the customer will supply a child predicate, which apply to the `model.field`
806
903
  // of the tail GroupCondition.
@@ -905,4 +1002,3 @@ export function predicateFor(ModelType) {
905
1002
  // the recursive type.
906
1003
  return recursivePredicateFor(ModelType, false);
907
1004
  }
908
- //# sourceMappingURL=next.js.map
@@ -1,4 +1,4 @@
1
- var ModelSortPredicateCreator = /** @class */ (function () {
1
+ export var ModelSortPredicateCreator = /** @class */ (function () {
2
2
  function ModelSortPredicateCreator() {
3
3
  }
4
4
  ModelSortPredicateCreator.createPredicateBuilder = function (modelDefinition) {
@@ -9,7 +9,7 @@ var ModelSortPredicateCreator = /** @class */ (function () {
9
9
  get: function (_target, propertyKey, receiver) {
10
10
  var field = propertyKey;
11
11
  if (!fieldNames.has(field)) {
12
- throw new Error("Invalid field for model. field: " + field + ", model: " + modelName);
12
+ throw new Error("Invalid field for model. field: ".concat(String(field), ", model: ").concat(modelName));
13
13
  }
14
14
  var result = function (sortDirection) {
15
15
  var _a;
@@ -50,5 +50,3 @@ var ModelSortPredicateCreator = /** @class */ (function () {
50
50
  ModelSortPredicateCreator.sortPredicateGroupsMap = new WeakMap();
51
51
  return ModelSortPredicateCreator;
52
52
  }());
53
- export { ModelSortPredicateCreator };
54
- //# sourceMappingURL=sort.js.map
@@ -11,4 +11,3 @@ export function deserializeModel(Model, init) {
11
11
  export function serializeModel(model) {
12
12
  return JSON.parse(JSON.stringify(model));
13
13
  }
14
- //# sourceMappingURL=index.js.map