@warp-drive/legacy 5.6.0-alpha.15 → 5.6.0-alpha.18

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 (193) hide show
  1. package/declarations/adapter/-private/build-url-mixin.d.ts +41 -29
  2. package/declarations/adapter/-private/fastboot-interface.d.ts +4 -5
  3. package/declarations/adapter/-private/utils/continue-on-reject.d.ts +5 -6
  4. package/declarations/adapter/-private/utils/determine-body-promise.d.ts +1 -2
  5. package/declarations/adapter/-private/utils/fetch.d.ts +2 -3
  6. package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
  7. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +5 -6
  8. package/declarations/adapter/-private/utils/serialize-query-params.d.ts +5 -2
  9. package/declarations/adapter/-private.d.ts +5 -6
  10. package/declarations/adapter/error.d.ts +206 -178
  11. package/declarations/adapter/json-api.d.ts +206 -207
  12. package/declarations/adapter/rest.d.ts +805 -808
  13. package/declarations/adapter.d.ts +742 -766
  14. package/declarations/compat/-private.d.ts +10 -11
  15. package/declarations/compat/builders/find-all.d.ts +26 -24
  16. package/declarations/compat/builders/find-record.d.ts +41 -39
  17. package/declarations/compat/builders/query.d.ts +50 -45
  18. package/declarations/compat/builders/save-record.d.ts +26 -24
  19. package/declarations/compat/builders/utils.d.ts +1 -2
  20. package/declarations/compat/builders.d.ts +10 -11
  21. package/declarations/compat/extensions.d.ts +52 -106
  22. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +39 -38
  23. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +1 -2
  24. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +9 -10
  25. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +1 -2
  26. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +1 -2
  27. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +521 -517
  28. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +214 -215
  29. package/declarations/compat/legacy-network-handler/serializer-response.d.ts +5 -6
  30. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +83 -84
  31. package/declarations/compat/legacy-network-handler/snapshot.d.ts +228 -229
  32. package/declarations/compat/utils.d.ts +118 -119
  33. package/declarations/compat.d.ts +106 -104
  34. package/declarations/model/-private/attr.d.ts +164 -145
  35. package/declarations/model/-private/belongs-to.d.ts +135 -122
  36. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +15 -4
  37. package/declarations/model/-private/errors.d.ts +272 -267
  38. package/declarations/model/-private/has-many.d.ts +119 -116
  39. package/declarations/model/-private/hooks.d.ts +5 -6
  40. package/declarations/model/-private/legacy-relationships-support.d.ts +51 -52
  41. package/declarations/model/-private/model-for-mixin.d.ts +18 -3
  42. package/declarations/model/-private/model-methods.d.ts +29 -24
  43. package/declarations/model/-private/model.d.ts +1306 -1254
  44. package/declarations/model/-private/notify-changes.d.ts +3 -4
  45. package/declarations/model/-private/promise-belongs-to.d.ts +33 -27
  46. package/declarations/model/-private/promise-many-array.d.ts +125 -116
  47. package/declarations/model/-private/record-state.d.ts +63 -60
  48. package/declarations/model/-private/references/belongs-to.d.ts +491 -487
  49. package/declarations/model/-private/references/has-many.d.ts +495 -492
  50. package/declarations/model/-private/schema-provider.d.ts +53 -56
  51. package/declarations/model/-private/type-utils.d.ts +41 -41
  52. package/declarations/model/-private/util.d.ts +1 -2
  53. package/declarations/model/-private.d.ts +8 -8
  54. package/declarations/model/migration-support.d.ts +281 -279
  55. package/declarations/model.d.ts +48 -49
  56. package/declarations/serializer/-private/embedded-records-mixin.d.ts +70 -71
  57. package/declarations/serializer/-private/transforms/boolean.d.ts +37 -37
  58. package/declarations/serializer/-private/transforms/date.d.ts +22 -22
  59. package/declarations/serializer/-private/transforms/number.d.ts +22 -22
  60. package/declarations/serializer/-private/transforms/string.d.ts +22 -22
  61. package/declarations/serializer/-private/transforms/transform.d.ts +109 -110
  62. package/declarations/serializer/-private/utils.d.ts +0 -1
  63. package/declarations/serializer/json-api.d.ts +124 -494
  64. package/declarations/serializer/json.d.ts +62 -1031
  65. package/declarations/serializer/rest.d.ts +52 -552
  66. package/declarations/serializer/transform.d.ts +5 -6
  67. package/declarations/serializer.d.ts +217 -218
  68. package/dist/{-private-DFfBszo5.js → -private-CKrP0ogQ.js} +1 -1
  69. package/dist/adapter/-private.js +1 -1
  70. package/dist/adapter/error.js +17 -0
  71. package/dist/adapter/json-api.js +1 -1
  72. package/dist/adapter/rest.js +5 -7
  73. package/dist/adapter.js +6 -35
  74. package/dist/compat/-private.js +1 -1
  75. package/dist/compat/extensions.js +0 -2
  76. package/dist/compat.js +3 -4
  77. package/dist/{errors-_QQ7xpSn.js → errors-BX5wowuz.js} +11 -10
  78. package/dist/{json-DSOlH9A8.js → json-Et4mt_LM.js} +84 -157
  79. package/dist/model/-private.js +1 -1
  80. package/dist/model/migration-support.js +3 -4
  81. package/dist/model.js +3 -3
  82. package/dist/{schema-provider-D_P8ReX6.js → schema-provider-BdQhkT-Q.js} +20 -13
  83. package/dist/{serialize-into-hash-BxfqWC8u.js → serialize-into-hash-Bp58npke.js} +1 -1
  84. package/dist/serializer/json-api.js +42 -2
  85. package/dist/serializer/json.js +1 -1
  86. package/dist/serializer/rest.js +46 -41
  87. package/dist/serializer/transform.js +0 -44
  88. package/package.json +7 -7
  89. package/declarations/adapter/-private/build-url-mixin.d.ts.map +0 -1
  90. package/declarations/adapter/-private/fastboot-interface.d.ts.map +0 -1
  91. package/declarations/adapter/-private/utils/continue-on-reject.d.ts.map +0 -1
  92. package/declarations/adapter/-private/utils/determine-body-promise.d.ts.map +0 -1
  93. package/declarations/adapter/-private/utils/fetch.d.ts.map +0 -1
  94. package/declarations/adapter/-private/utils/parse-response-headers.d.ts.map +0 -1
  95. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts.map +0 -1
  96. package/declarations/adapter/-private/utils/serialize-query-params.d.ts.map +0 -1
  97. package/declarations/adapter/-private.d.ts.map +0 -1
  98. package/declarations/adapter/error.d.ts.map +0 -1
  99. package/declarations/adapter/json-api.d.ts.map +0 -1
  100. package/declarations/adapter/rest.d.ts.map +0 -1
  101. package/declarations/adapter.d.ts.map +0 -1
  102. package/declarations/compat/-private.d.ts.map +0 -1
  103. package/declarations/compat/builders/find-all.d.ts.map +0 -1
  104. package/declarations/compat/builders/find-record.d.ts.map +0 -1
  105. package/declarations/compat/builders/query.d.ts.map +0 -1
  106. package/declarations/compat/builders/save-record.d.ts.map +0 -1
  107. package/declarations/compat/builders/utils.d.ts.map +0 -1
  108. package/declarations/compat/builders.d.ts.map +0 -1
  109. package/declarations/compat/extensions.d.ts.map +0 -1
  110. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts.map +0 -1
  111. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts.map +0 -1
  112. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts.map +0 -1
  113. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts.map +0 -1
  114. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts.map +0 -1
  115. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts.map +0 -1
  116. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts.map +0 -1
  117. package/declarations/compat/legacy-network-handler/serializer-response.d.ts.map +0 -1
  118. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts.map +0 -1
  119. package/declarations/compat/legacy-network-handler/snapshot.d.ts.map +0 -1
  120. package/declarations/compat/utils.d.ts.map +0 -1
  121. package/declarations/compat.d.ts.map +0 -1
  122. package/declarations/model/-private/attr.d.ts.map +0 -1
  123. package/declarations/model/-private/attr.type-test.d.ts +0 -2
  124. package/declarations/model/-private/attr.type-test.d.ts.map +0 -1
  125. package/declarations/model/-private/belongs-to.d.ts.map +0 -1
  126. package/declarations/model/-private/belongs-to.type-test.d.ts +0 -2
  127. package/declarations/model/-private/belongs-to.type-test.d.ts.map +0 -1
  128. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  129. package/declarations/model/-private/errors.d.ts.map +0 -1
  130. package/declarations/model/-private/has-many.d.ts.map +0 -1
  131. package/declarations/model/-private/has-many.type-test.d.ts +0 -2
  132. package/declarations/model/-private/has-many.type-test.d.ts.map +0 -1
  133. package/declarations/model/-private/hooks.d.ts.map +0 -1
  134. package/declarations/model/-private/legacy-relationships-support.d.ts.map +0 -1
  135. package/declarations/model/-private/model-for-mixin.d.ts.map +0 -1
  136. package/declarations/model/-private/model-methods.d.ts.map +0 -1
  137. package/declarations/model/-private/model.d.ts.map +0 -1
  138. package/declarations/model/-private/model.type-test.d.ts +0 -2
  139. package/declarations/model/-private/model.type-test.d.ts.map +0 -1
  140. package/declarations/model/-private/notify-changes.d.ts.map +0 -1
  141. package/declarations/model/-private/promise-belongs-to.d.ts.map +0 -1
  142. package/declarations/model/-private/promise-many-array.d.ts.map +0 -1
  143. package/declarations/model/-private/promise-proxy-base.d.ts +0 -3
  144. package/declarations/model/-private/promise-proxy-base.d.ts.map +0 -1
  145. package/declarations/model/-private/record-state.d.ts.map +0 -1
  146. package/declarations/model/-private/references/belongs-to.d.ts.map +0 -1
  147. package/declarations/model/-private/references/has-many.d.ts.map +0 -1
  148. package/declarations/model/-private/schema-provider.d.ts.map +0 -1
  149. package/declarations/model/-private/type-utils.d.ts.map +0 -1
  150. package/declarations/model/-private/util.d.ts.map +0 -1
  151. package/declarations/model/-private.d.ts.map +0 -1
  152. package/declarations/model/migration-support.d.ts.map +0 -1
  153. package/declarations/model/migration-support.type-test.d.ts +0 -2
  154. package/declarations/model/migration-support.type-test.d.ts.map +0 -1
  155. package/declarations/model.d.ts.map +0 -1
  156. package/declarations/serializer/-private/embedded-records-mixin.d.ts.map +0 -1
  157. package/declarations/serializer/-private/transforms/boolean.d.ts.map +0 -1
  158. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts +0 -2
  159. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts.map +0 -1
  160. package/declarations/serializer/-private/transforms/date.d.ts.map +0 -1
  161. package/declarations/serializer/-private/transforms/number.d.ts.map +0 -1
  162. package/declarations/serializer/-private/transforms/string.d.ts.map +0 -1
  163. package/declarations/serializer/-private/transforms/transform.d.ts.map +0 -1
  164. package/declarations/serializer/-private/utils.d.ts.map +0 -1
  165. package/declarations/serializer/json-api.d.ts.map +0 -1
  166. package/declarations/serializer/json.d.ts.map +0 -1
  167. package/declarations/serializer/rest.d.ts.map +0 -1
  168. package/declarations/serializer/transform.d.ts.map +0 -1
  169. package/declarations/serializer.d.ts.map +0 -1
  170. package/dist/-private-DFfBszo5.js.map +0 -1
  171. package/dist/adapter/-private.js.map +0 -1
  172. package/dist/adapter/error.js.map +0 -1
  173. package/dist/adapter/json-api.js.map +0 -1
  174. package/dist/adapter/rest.js.map +0 -1
  175. package/dist/adapter.js.map +0 -1
  176. package/dist/compat/-private.js.map +0 -1
  177. package/dist/compat/builders.js.map +0 -1
  178. package/dist/compat/extensions.js.map +0 -1
  179. package/dist/compat/utils.js.map +0 -1
  180. package/dist/compat.js.map +0 -1
  181. package/dist/errors-_QQ7xpSn.js.map +0 -1
  182. package/dist/json-DSOlH9A8.js.map +0 -1
  183. package/dist/model/-private.js.map +0 -1
  184. package/dist/model/migration-support.js.map +0 -1
  185. package/dist/model.js.map +0 -1
  186. package/dist/runtime-BPCpkOf1-BKOwiRJp.js.map +0 -1
  187. package/dist/schema-provider-D_P8ReX6.js.map +0 -1
  188. package/dist/serialize-into-hash-BxfqWC8u.js.map +0 -1
  189. package/dist/serializer/json-api.js.map +0 -1
  190. package/dist/serializer/json.js.map +0 -1
  191. package/dist/serializer/rest.js.map +0 -1
  192. package/dist/serializer/transform.js.map +0 -1
  193. package/dist/serializer.js.map +0 -1
@@ -14,6 +14,12 @@ function coerceId(id) {
14
14
  return String(id);
15
15
  }
16
16
  }
17
+
18
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
19
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
20
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
21
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
17
23
  const SOURCE_POINTER_REGEXP = /^\/?data\/(attributes|relationships)\/(.*)/;
18
24
  const SOURCE_POINTER_PRIMARY_REGEXP = /^\/?data/;
19
25
  const PRIMARY_ATTRIBUTE_KEY = 'base';
@@ -93,6 +99,7 @@ const PRIMARY_ATTRIBUTE_KEY = 'base';
93
99
  @class JSONSerializer
94
100
  @public
95
101
  */
102
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
103
  const JSONSerializer = Serializer.extend({
97
104
  /**
98
105
  The `primaryKey` is used when serializing and deserializing
@@ -175,17 +182,14 @@ const JSONSerializer = Serializer.extend({
175
182
  JSON object. This method is typically called after the
176
183
  serializer's `normalize` method.
177
184
  @private
178
- @param {Model} typeClass
179
- @param {Object} data The data to transform
180
- @return {Object} data The transformed data object
181
185
  */
182
186
  applyTransforms(typeClass, data) {
183
187
  const attributes = typeClass.attributes;
184
- typeClass.eachTransformedAttribute((key, typeClass) => {
188
+ typeClass.eachTransformedAttribute((key, type) => {
185
189
  if (data[key] === undefined) {
186
190
  return;
187
191
  }
188
- const transform = this.transformFor(typeClass);
192
+ const transform = this.transformFor(type);
189
193
  const transformMeta = attributes.get(key);
190
194
  data[key] = transform.deserialize(data[key], transformMeta.options);
191
195
  });
@@ -212,34 +216,38 @@ const JSONSerializer = Serializer.extend({
212
216
  ```
213
217
  @since 1.13.0
214
218
  @public
215
- @param {Store} store
216
- @param {Model} primaryModelClass
217
- @param {Object} payload
218
- @param {String|Number} id
219
- @param {String} requestType
220
- @return {Object} JSON-API Document
221
219
  */
222
220
  normalizeResponse(store, primaryModelClass, payload, id, requestType) {
223
221
  switch (requestType) {
224
222
  case 'findRecord':
223
+ // @ts-expect-error
225
224
  return this.normalizeFindRecordResponse(...arguments);
226
225
  case 'queryRecord':
226
+ // @ts-expect-error
227
227
  return this.normalizeQueryRecordResponse(...arguments);
228
228
  case 'findAll':
229
+ // @ts-expect-error
229
230
  return this.normalizeFindAllResponse(...arguments);
230
231
  case 'findBelongsTo':
232
+ // @ts-expect-error
231
233
  return this.normalizeFindBelongsToResponse(...arguments);
232
234
  case 'findHasMany':
235
+ // @ts-expect-error
233
236
  return this.normalizeFindHasManyResponse(...arguments);
234
237
  case 'findMany':
238
+ // @ts-expect-error
235
239
  return this.normalizeFindManyResponse(...arguments);
236
240
  case 'query':
241
+ // @ts-expect-error
237
242
  return this.normalizeQueryResponse(...arguments);
238
243
  case 'createRecord':
244
+ // @ts-expect-error
239
245
  return this.normalizeCreateRecordResponse(...arguments);
240
246
  case 'deleteRecord':
247
+ // @ts-expect-error
241
248
  return this.normalizeDeleteRecordResponse(...arguments);
242
249
  case 'updateRecord':
250
+ // @ts-expect-error
243
251
  return this.normalizeUpdateRecordResponse(...arguments);
244
252
  }
245
253
  },
@@ -248,14 +256,9 @@ const JSONSerializer = Serializer.extend({
248
256
  type of request is `findRecord`
249
257
  @since 1.13.0
250
258
  @public
251
- @param {Store} store
252
- @param {Model} primaryModelClass
253
- @param {Object} payload
254
- @param {String|Number} id
255
- @param {String} requestType
256
- @return {Object} JSON-API Document
257
259
  */
258
260
  normalizeFindRecordResponse(store, primaryModelClass, payload, id, requestType) {
261
+ // @ts-expect-error
259
262
  return this.normalizeSingleResponse(...arguments);
260
263
  },
261
264
  /**
@@ -263,14 +266,9 @@ const JSONSerializer = Serializer.extend({
263
266
  type of request is `queryRecord`
264
267
  @since 1.13.0
265
268
  @public
266
- @param {Store} store
267
- @param {Model} primaryModelClass
268
- @param {Object} payload
269
- @param {String|Number} id
270
- @param {String} requestType
271
- @return {Object} JSON-API Document
272
269
  */
273
270
  normalizeQueryRecordResponse(store, primaryModelClass, payload, id, requestType) {
271
+ // @ts-expect-error
274
272
  return this.normalizeSingleResponse(...arguments);
275
273
  },
276
274
  /**
@@ -278,14 +276,9 @@ const JSONSerializer = Serializer.extend({
278
276
  type of request is `findAll`
279
277
  @since 1.13.0
280
278
  @public
281
- @param {Store} store
282
- @param {Model} primaryModelClass
283
- @param {Object} payload
284
- @param {String|Number} id
285
- @param {String} requestType
286
- @return {Object} JSON-API Document
287
279
  */
288
280
  normalizeFindAllResponse(store, primaryModelClass, payload, id, requestType) {
281
+ // @ts-expect-error
289
282
  return this.normalizeArrayResponse(...arguments);
290
283
  },
291
284
  /**
@@ -293,14 +286,9 @@ const JSONSerializer = Serializer.extend({
293
286
  type of request is `findBelongsTo`
294
287
  @since 1.13.0
295
288
  @public
296
- @param {Store} store
297
- @param {Model} primaryModelClass
298
- @param {Object} payload
299
- @param {String|Number} id
300
- @param {String} requestType
301
- @return {Object} JSON-API Document
302
289
  */
303
290
  normalizeFindBelongsToResponse(store, primaryModelClass, payload, id, requestType) {
291
+ // @ts-expect-error
304
292
  return this.normalizeSingleResponse(...arguments);
305
293
  },
306
294
  /**
@@ -308,14 +296,9 @@ const JSONSerializer = Serializer.extend({
308
296
  type of request is `findHasMany`
309
297
  @since 1.13.0
310
298
  @public
311
- @param {Store} store
312
- @param {Model} primaryModelClass
313
- @param {Object} payload
314
- @param {String|Number} id
315
- @param {String} requestType
316
- @return {Object} JSON-API Document
317
299
  */
318
300
  normalizeFindHasManyResponse(store, primaryModelClass, payload, id, requestType) {
301
+ // @ts-expect-error
319
302
  return this.normalizeArrayResponse(...arguments);
320
303
  },
321
304
  /**
@@ -323,14 +306,9 @@ const JSONSerializer = Serializer.extend({
323
306
  type of request is `findMany`
324
307
  @since 1.13.0
325
308
  @public
326
- @param {Store} store
327
- @param {Model} primaryModelClass
328
- @param {Object} payload
329
- @param {String|Number} id
330
- @param {String} requestType
331
- @return {Object} JSON-API Document
332
309
  */
333
310
  normalizeFindManyResponse(store, primaryModelClass, payload, id, requestType) {
311
+ // @ts-expect-error
334
312
  return this.normalizeArrayResponse(...arguments);
335
313
  },
336
314
  /**
@@ -338,14 +316,9 @@ const JSONSerializer = Serializer.extend({
338
316
  type of request is `query`
339
317
  @since 1.13.0
340
318
  @public
341
- @param {Store} store
342
- @param {Model} primaryModelClass
343
- @param {Object} payload
344
- @param {String|Number} id
345
- @param {String} requestType
346
- @return {Object} JSON-API Document
347
319
  */
348
320
  normalizeQueryResponse(store, primaryModelClass, payload, id, requestType) {
321
+ // @ts-expect-error
349
322
  return this.normalizeArrayResponse(...arguments);
350
323
  },
351
324
  /**
@@ -353,14 +326,9 @@ const JSONSerializer = Serializer.extend({
353
326
  type of request is `createRecord`
354
327
  @since 1.13.0
355
328
  @public
356
- @param {Store} store
357
- @param {Model} primaryModelClass
358
- @param {Object} payload
359
- @param {String|Number} id
360
- @param {String} requestType
361
- @return {Object} JSON-API Document
362
329
  */
363
330
  normalizeCreateRecordResponse(store, primaryModelClass, payload, id, requestType) {
331
+ // @ts-expect-error
364
332
  return this.normalizeSaveResponse(...arguments);
365
333
  },
366
334
  /**
@@ -368,14 +336,9 @@ const JSONSerializer = Serializer.extend({
368
336
  type of request is `deleteRecord`
369
337
  @since 1.13.0
370
338
  @public
371
- @param {Store} store
372
- @param {Model} primaryModelClass
373
- @param {Object} payload
374
- @param {String|Number} id
375
- @param {String} requestType
376
- @return {Object} JSON-API Document
377
339
  */
378
340
  normalizeDeleteRecordResponse(store, primaryModelClass, payload, id, requestType) {
341
+ // @ts-expect-error
379
342
  return this.normalizeSaveResponse(...arguments);
380
343
  },
381
344
  /**
@@ -383,14 +346,9 @@ const JSONSerializer = Serializer.extend({
383
346
  type of request is `updateRecord`
384
347
  @since 1.13.0
385
348
  @public
386
- @param {Store} store
387
- @param {Model} primaryModelClass
388
- @param {Object} payload
389
- @param {String|Number} id
390
- @param {String} requestType
391
- @return {Object} JSON-API Document
392
349
  */
393
350
  normalizeUpdateRecordResponse(store, primaryModelClass, payload, id, requestType) {
351
+ // @ts-expect-error
394
352
  return this.normalizeSaveResponse(...arguments);
395
353
  },
396
354
  /**
@@ -398,14 +356,9 @@ const JSONSerializer = Serializer.extend({
398
356
  normalizeDeleteRecordResponse delegate to this method by default.
399
357
  @since 1.13.0
400
358
  @public
401
- @param {Store} store
402
- @param {Model} primaryModelClass
403
- @param {Object} payload
404
- @param {String|Number} id
405
- @param {String} requestType
406
- @return {Object} JSON-API Document
407
359
  */
408
360
  normalizeSaveResponse(store, primaryModelClass, payload, id, requestType) {
361
+ // @ts-expect-error
409
362
  return this.normalizeSingleResponse(...arguments);
410
363
  },
411
364
  /**
@@ -413,12 +366,6 @@ const JSONSerializer = Serializer.extend({
413
366
  method by default.
414
367
  @since 1.13.0
415
368
  @public
416
- @param {Store} store
417
- @param {Model} primaryModelClass
418
- @param {Object} payload
419
- @param {String|Number} id
420
- @param {String} requestType
421
- @return {Object} JSON-API Document
422
369
  */
423
370
  normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) {
424
371
  return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, true);
@@ -428,24 +375,11 @@ const JSONSerializer = Serializer.extend({
428
375
  to this method by default.
429
376
  @since 1.13.0
430
377
  @public
431
- @param {Store} store
432
- @param {Model} primaryModelClass
433
- @param {Object} payload
434
- @param {String|Number} id
435
- @param {String} requestType
436
- @return {Object} JSON-API Document
437
378
  */
438
379
  normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
439
380
  return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, false);
440
381
  },
441
382
  /**
442
- @param {Store} store
443
- @param {Model} primaryModelClass
444
- @param {Object} payload
445
- @param {String|Number} id
446
- @param {String} requestType
447
- @param {Boolean} isSingle
448
- @return {Object} JSON-API Document
449
383
  @private
450
384
  */
451
385
  _normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {
@@ -460,9 +394,11 @@ const JSONSerializer = Serializer.extend({
460
394
  throw new Error('The `meta` returned from `extractMeta` has to be an object, not "' + typeof meta + '".');
461
395
  }
462
396
  })(typeof meta === 'object') : {};
397
+ // @ts-expect-error untyped
463
398
  documentHash.meta = meta;
464
399
  }
465
400
  if (isSingle) {
401
+ // @ts-expect-error untyped
466
402
  const {
467
403
  data,
468
404
  included
@@ -472,9 +408,12 @@ const JSONSerializer = Serializer.extend({
472
408
  documentHash.included = included;
473
409
  }
474
410
  } else {
411
+ // @ts-expect-error untyped
475
412
  const ret = new Array(payload.length);
413
+ // @ts-expect-error untyped
476
414
  for (let i = 0, l = payload.length; i < l; i++) {
477
415
  const item = payload[i];
416
+ // @ts-expect-error untyped
478
417
  const {
479
418
  data,
480
419
  included
@@ -484,6 +423,8 @@ const JSONSerializer = Serializer.extend({
484
423
  }
485
424
  ret[i] = data;
486
425
  }
426
+
427
+ // @ts-expect-error untyped
487
428
  documentHash.data = ret;
488
429
  }
489
430
  return documentHash;
@@ -524,18 +465,27 @@ const JSONSerializer = Serializer.extend({
524
465
  let data = null;
525
466
  if (resourceHash) {
526
467
  this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
468
+ // @ts-expect-error untyped
527
469
  if (typeof resourceHash.links === 'object') {
470
+ // @ts-expect-error untyped
528
471
  this.normalizeUsingDeclaredMapping(modelClass, resourceHash.links);
529
472
  }
473
+
474
+ // @ts-expect-error untyped
530
475
  data = {
531
476
  id: this.extractId(modelClass, resourceHash),
532
477
  type: modelClass.modelName,
533
478
  attributes: this.extractAttributes(modelClass, resourceHash),
534
479
  relationships: this.extractRelationships(modelClass, resourceHash)
535
480
  };
481
+
482
+ // @ts-expect-error untyped
536
483
  if (resourceHash.lid) {
484
+ // @ts-expect-error untyped
537
485
  data.lid = resourceHash.lid;
538
486
  }
487
+
488
+ // @ts-expect-error untyped
539
489
  this.applyTransforms(modelClass, data.attributes);
540
490
  }
541
491
  return {
@@ -545,9 +495,6 @@ const JSONSerializer = Serializer.extend({
545
495
  /**
546
496
  Returns the resource's ID.
547
497
  @public
548
- @param {Object} modelClass
549
- @param {Object} resourceHash
550
- @return {String}
551
498
  */
552
499
  extractId(modelClass, resourceHash) {
553
500
  const primaryKey = this.primaryKey;
@@ -577,9 +524,6 @@ const JSONSerializer = Serializer.extend({
577
524
  Returns a relationship formatted as a JSON-API "relationship object".
578
525
  http://jsonapi.org/format/#document-resource-object-relationships
579
526
  @public
580
- @param {Object} relationshipModelName
581
- @param {Object} relationshipHash
582
- @return {Object}
583
527
  */
584
528
  extractRelationship(relationshipModelName, relationshipHash) {
585
529
  if (!relationshipHash) {
@@ -591,11 +535,17 @@ const JSONSerializer = Serializer.extend({
591
535
  EmbeddedRecordsMixin has be able to process.
592
536
  */
593
537
  if (relationshipHash && typeof relationshipHash === 'object' && !Array.isArray(relationshipHash)) {
538
+ // @ts-expect-error untyped
594
539
  if (relationshipHash.id) {
540
+ // @ts-expect-error untyped
595
541
  relationshipHash.id = coerceId(relationshipHash.id);
596
542
  }
543
+
544
+ // @ts-expect-error store is dynamically injected
597
545
  const modelClass = this.store.modelFor(relationshipModelName);
546
+ // @ts-expect-error untyped
598
547
  if (relationshipHash.type && !modelClass.fields.has('type')) {
548
+ // @ts-expect-error untyped
599
549
  relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);
600
550
  }
601
551
  return relationshipHash;
@@ -616,10 +566,6 @@ const JSONSerializer = Serializer.extend({
616
566
  extracted from the resourceHash
617
567
  - `relationshipMeta` meta information about the relationship
618
568
  @public
619
- @param {Object} relationshipModelName
620
- @param {Object} relationshipHash
621
- @param {Object} relationshipOptions
622
- @return {Object}
623
569
  */
624
570
  extractPolymorphicRelationship(relationshipModelName, relationshipHash, relationshipOptions) {
625
571
  return this.extractRelationship(relationshipModelName, relationshipHash);
@@ -628,9 +574,6 @@ const JSONSerializer = Serializer.extend({
628
574
  Returns the resource's relationships formatted as a JSON-API "relationships object".
629
575
  http://jsonapi.org/format/#document-resource-object-relationships
630
576
  @public
631
- @param {Object} modelClass
632
- @param {Object} resourceHash
633
- @return {Object}
634
577
  */
635
578
  extractRelationships(modelClass, resourceHash) {
636
579
  const relationships = {};
@@ -646,20 +589,24 @@ const JSONSerializer = Serializer.extend({
646
589
  // than the type and the hash (which might only be an id) for the
647
590
  // relationship, hence we pass the key, resource and
648
591
  // relationshipMeta too
592
+ // @ts-expect-error untyped
649
593
  data = this.extractPolymorphicRelationship(relationshipMeta.type, relationshipHash, {
650
594
  key,
651
595
  resourceHash,
652
596
  relationshipMeta
653
597
  });
654
598
  } else {
599
+ // @ts-expect-error untyped
655
600
  data = this.extractRelationship(relationshipMeta.type, relationshipHash);
656
601
  }
657
602
  } else if (relationshipMeta.kind === 'hasMany') {
658
603
  if (relationshipHash) {
604
+ // @ts-expect-error untyped
659
605
  data = new Array(relationshipHash.length);
660
606
  if (relationshipMeta.options.polymorphic) {
661
607
  for (let i = 0, l = relationshipHash.length; i < l; i++) {
662
608
  const item = relationshipHash[i];
609
+ // @ts-expect-error untyped
663
610
  data[i] = this.extractPolymorphicRelationship(relationshipMeta.type, item, {
664
611
  key,
665
612
  resourceHash,
@@ -669,19 +616,25 @@ const JSONSerializer = Serializer.extend({
669
616
  } else {
670
617
  for (let i = 0, l = relationshipHash.length; i < l; i++) {
671
618
  const item = relationshipHash[i];
619
+ // @ts-expect-error untyped
672
620
  data[i] = this.extractRelationship(relationshipMeta.type, item);
673
621
  }
674
622
  }
675
623
  }
676
624
  }
625
+ // @ts-expect-error untyped
677
626
  relationship = {
678
627
  data
679
628
  };
680
629
  }
681
630
  const linkKey = this.keyForLink(key, relationshipMeta.kind);
631
+ // @ts-expect-error untyped
682
632
  if (resourceHash.links && resourceHash.links[linkKey] !== undefined) {
633
+ // @ts-expect-error untyped
683
634
  const related = resourceHash.links[linkKey];
635
+ // @ts-expect-error untyped
684
636
  relationship = relationship || {};
637
+ // @ts-expect-error untyped
685
638
  relationship.links = {
686
639
  related
687
640
  };
@@ -724,6 +677,7 @@ const JSONSerializer = Serializer.extend({
724
677
  @private
725
678
  */
726
679
  normalizeUsingDeclaredMapping(modelClass, hash) {
680
+ // @ts-expect-error attrs is dynamically injected
727
681
  const attrs = this.attrs;
728
682
  let normalizedKey;
729
683
  let payloadKey;
@@ -750,13 +704,12 @@ const JSONSerializer = Serializer.extend({
750
704
  Looks up the property key that was set by the custom `attr` mapping
751
705
  passed to the serializer.
752
706
  @private
753
- @param {String} key
754
- @return {String} key
755
707
  */
756
708
  _getMappedKey(key, modelClass) {
757
709
  warn('There is no attribute or relationship with the name `' + key + '` on `' + modelClass.modelName + '`. Check your serializers attrs hash.', modelClass.attributes.has(key) || modelClass.relationshipsByName.has(key), {
758
710
  id: 'ds.serializer.no-mapped-attrs-key'
759
711
  });
712
+ // @ts-expect-error attrs is dynamically injected
760
713
  const attrs = this.attrs;
761
714
  let mappedKey;
762
715
  if (attrs && attrs[key]) {
@@ -776,10 +729,10 @@ const JSONSerializer = Serializer.extend({
776
729
  Check attrs.key.serialize property to inform if the `key`
777
730
  can be serialized
778
731
  @private
779
- @param {String} key
780
- @return {Boolean} true if the key can be serialized
732
+ @return true if the key can be serialized
781
733
  */
782
734
  _canSerialize(key) {
735
+ // @ts-expect-error no idea what attrs is here
783
736
  const attrs = this.attrs;
784
737
  return !attrs || !attrs[key] || attrs[key].serialize !== false;
785
738
  },
@@ -788,10 +741,10 @@ const JSONSerializer = Serializer.extend({
788
741
  it takes priority over the other checks and the related
789
742
  attribute/relationship will be serialized
790
743
  @private
791
- @param {String} key
792
- @return {Boolean} true if the key must be serialized
744
+ @return true if the key must be serialized
793
745
  */
794
746
  _mustSerialize(key) {
747
+ // @ts-expect-error no idea what attrs is here
795
748
  const attrs = this.attrs;
796
749
  return attrs && attrs[key] && attrs[key].serialize === true;
797
750
  },
@@ -800,13 +753,12 @@ const JSONSerializer = Serializer.extend({
800
753
  By default only many-to-many and many-to-none relationships are serialized.
801
754
  This could be configured per relationship by Serializer's `attrs` object.
802
755
  @public
803
- @param {Snapshot} snapshot
804
- @param {String} key
805
- @param {RelationshipSchema} relationship
806
- @return {Boolean} true if the hasMany relationship should be serialized
756
+ @return true if the hasMany relationship should be serialized
807
757
  */
808
758
  shouldSerializeHasMany(snapshot, key, relationship) {
759
+ // @ts-expect-error store is dynamically injected
809
760
  const schema = this.store.modelFor(snapshot.modelName);
761
+ // @ts-expect-error store is dynamically injected
810
762
  const relationshipType = schema.determineRelationshipType(relationship, this.store);
811
763
  if (this._mustSerialize(key)) {
812
764
  return true;
@@ -924,12 +876,11 @@ const JSONSerializer = Serializer.extend({
924
876
  }
925
877
  ```
926
878
  @public
927
- @param {Snapshot} snapshot
928
- @param {Object} options
929
- @return {Object} json
930
879
  */
931
880
  serialize(snapshot, options) {
932
881
  const json = {};
882
+
883
+ // @ts-expect-error super loose typing here right now
933
884
  if (options && options.includeId) {
934
885
  const id = snapshot.id;
935
886
  if (id) {
@@ -967,10 +918,6 @@ const JSONSerializer = Serializer.extend({
967
918
  }
968
919
  ```
969
920
  @public
970
- @param {Object} hash
971
- @param {Model} typeClass
972
- @param {Snapshot} snapshot
973
- @param {Object} options
974
921
  */
975
922
  serializeIntoHash(hash, typeClass, snapshot, options) {
976
923
  Object.assign(hash, this.serialize(snapshot, options));
@@ -991,14 +938,11 @@ const JSONSerializer = Serializer.extend({
991
938
  }
992
939
  ```
993
940
  @public
994
- @param {Snapshot} snapshot
995
- @param {Object} json
996
- @param {String} key
997
- @param {Object} attribute
998
941
  */
999
942
  serializeAttribute(snapshot, json, key, attribute) {
1000
943
  if (this._canSerialize(key)) {
1001
944
  const type = attribute.type;
945
+ // @ts-expect-error we don't know what is on the snapshot
1002
946
  let value = snapshot.attr(key);
1003
947
  if (type) {
1004
948
  const transform = this.transformFor(type);
@@ -1007,6 +951,7 @@ const JSONSerializer = Serializer.extend({
1007
951
 
1008
952
  // if provided, use the mapping provided by `attrs` in
1009
953
  // the serializer
954
+ // @ts-expect-error store added dynamically
1010
955
  const schema = this.store.modelFor(snapshot.modelName);
1011
956
  let payloadKey = this._getMappedKey(key, schema);
1012
957
  if (payloadKey === key && this.keyForAttribute) {
@@ -1031,9 +976,6 @@ const JSONSerializer = Serializer.extend({
1031
976
  }
1032
977
  ```
1033
978
  @public
1034
- @param {Snapshot} snapshot
1035
- @param {Object} json
1036
- @param {Object} relationship
1037
979
  */
1038
980
  serializeBelongsTo(snapshot, json, relationship) {
1039
981
  const name = relationship.name;
@@ -1044,6 +986,7 @@ const JSONSerializer = Serializer.extend({
1044
986
 
1045
987
  // if provided, use the mapping provided by `attrs` in
1046
988
  // the serializer
989
+ // @ts-expect-error store added dynamically
1047
990
  const schema = this.store.modelFor(snapshot.modelName);
1048
991
  let payloadKey = this._getMappedKey(name, schema);
1049
992
  if (payloadKey === name && this.keyForRelationship) {
@@ -1079,9 +1022,6 @@ const JSONSerializer = Serializer.extend({
1079
1022
  }
1080
1023
  ```
1081
1024
  @public
1082
- @param {Snapshot} snapshot
1083
- @param {Object} json
1084
- @param {Object} relationship
1085
1025
  */
1086
1026
  serializeHasMany(snapshot, json, relationship) {
1087
1027
  const name = relationship.name;
@@ -1092,6 +1032,7 @@ const JSONSerializer = Serializer.extend({
1092
1032
  if (hasMany !== undefined) {
1093
1033
  // if provided, use the mapping provided by `attrs` in
1094
1034
  // the serializer
1035
+ // @ts-expect-error store added dynamically
1095
1036
  const schema = this.store.modelFor(snapshot.modelName);
1096
1037
  let payloadKey = this._getMappedKey(name, schema);
1097
1038
  if (payloadKey === name && this.keyForRelationship) {
@@ -1124,11 +1065,8 @@ const JSONSerializer = Serializer.extend({
1124
1065
  }
1125
1066
  ```
1126
1067
  @public
1127
- @param {Snapshot} snapshot
1128
- @param {Object} json
1129
- @param {Object} relationship
1130
1068
  */
1131
- serializePolymorphicType() {},
1069
+ serializePolymorphicType(snapshot, json, relationship) {},
1132
1070
  /**
1133
1071
  `extractMeta` is used to deserialize any meta information in the
1134
1072
  adapter payload. By default Ember Data expects meta information to
@@ -1147,13 +1085,12 @@ const JSONSerializer = Serializer.extend({
1147
1085
  }
1148
1086
  ```
1149
1087
  @public
1150
- @param {Store} store
1151
- @param {Model} modelClass
1152
- @param {Object} payload
1153
1088
  */
1154
1089
  extractMeta(store, modelClass, payload) {
1155
1090
  if (payload && payload['meta'] !== undefined) {
1091
+ // @ts-expect-error
1156
1092
  const meta = payload.meta;
1093
+ // @ts-expect-error
1157
1094
  delete payload.meta;
1158
1095
  return meta;
1159
1096
  }
@@ -1232,9 +1169,12 @@ const JSONSerializer = Serializer.extend({
1232
1169
  @return {Object} json The deserialized errors
1233
1170
  */
1234
1171
  extractErrors(store, typeClass, payload, id) {
1172
+ // @ts-expect-error
1235
1173
  if (payload && typeof payload === 'object' && payload.errors) {
1236
1174
  // the default assumption is that errors is already in JSON:API format
1237
1175
  const extracted = {};
1176
+
1177
+ // @ts-expect-error
1238
1178
  payload.errors.forEach(error => {
1239
1179
  if (error.source && error.source.pointer) {
1240
1180
  let key = error.source.pointer.match(SOURCE_POINTER_REGEXP);
@@ -1287,9 +1227,6 @@ const JSONSerializer = Serializer.extend({
1287
1227
  }
1288
1228
  ```
1289
1229
  @public
1290
- @param {String} key
1291
- @param {String} method
1292
- @return {String} normalized key
1293
1230
  */
1294
1231
  keyForAttribute(key, method) {
1295
1232
  return key;
@@ -1309,10 +1246,6 @@ const JSONSerializer = Serializer.extend({
1309
1246
  }
1310
1247
  ```
1311
1248
  @public
1312
- @param {String} key
1313
- @param {String} typeClass
1314
- @param {String} method
1315
- @return {String} normalized key
1316
1249
  */
1317
1250
  keyForRelationship(key, typeClass, method) {
1318
1251
  return key;
@@ -1321,9 +1254,6 @@ const JSONSerializer = Serializer.extend({
1321
1254
  `keyForLink` can be used to define a custom key when deserializing link
1322
1255
  properties.
1323
1256
  @public
1324
- @param {String} key
1325
- @param {String} kind `belongsTo` or `hasMany`
1326
- @return {String} normalized key
1327
1257
  */
1328
1258
  keyForLink(key, kind) {
1329
1259
  return key;
@@ -1332,12 +1262,9 @@ const JSONSerializer = Serializer.extend({
1332
1262
 
1333
1263
  /**
1334
1264
  @private
1335
- @param {String} attributeType
1336
- @param {Boolean} skipAssertion
1337
- @return {Transform} transform
1338
1265
  */
1339
1266
  transformFor(attributeType, skipAssertion) {
1340
- const transform = getOwner(this).lookup('transform:' + attributeType);
1267
+ const transform = getOwner(this).lookup(`transform:${attributeType}`);
1341
1268
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1342
1269
  if (!test) {
1343
1270
  throw new Error(`Unable to find the transform for \`attr('${attributeType}')\``);
@@ -1,2 +1,2 @@
1
- export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-_QQ7xpSn.js";
1
+ export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-BX5wowuz.js";
2
2
  export { RelatedCollection as ManyArray } from '@warp-drive/core/store/-private';