@warp-drive/legacy 5.6.0-alpha.11

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 (211) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE.md +23 -0
  3. package/README.md +54 -0
  4. package/addon-main.cjs +5 -0
  5. package/declarations/adapter/-private/build-url-mixin.d.ts +34 -0
  6. package/declarations/adapter/-private/build-url-mixin.d.ts.map +1 -0
  7. package/declarations/adapter/-private/fastboot-interface.d.ts +9 -0
  8. package/declarations/adapter/-private/fastboot-interface.d.ts.map +1 -0
  9. package/declarations/adapter/-private/utils/continue-on-reject.d.ts +8 -0
  10. package/declarations/adapter/-private/utils/continue-on-reject.d.ts.map +1 -0
  11. package/declarations/adapter/-private/utils/determine-body-promise.d.ts +5 -0
  12. package/declarations/adapter/-private/utils/determine-body-promise.d.ts.map +1 -0
  13. package/declarations/adapter/-private/utils/fetch.d.ts +9 -0
  14. package/declarations/adapter/-private/utils/fetch.d.ts.map +1 -0
  15. package/declarations/adapter/-private/utils/parse-response-headers.d.ts +2 -0
  16. package/declarations/adapter/-private/utils/parse-response-headers.d.ts.map +1 -0
  17. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +7 -0
  18. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts.map +1 -0
  19. package/declarations/adapter/-private/utils/serialize-query-params.d.ts +6 -0
  20. package/declarations/adapter/-private/utils/serialize-query-params.d.ts.map +1 -0
  21. package/declarations/adapter/-private.d.ts +6 -0
  22. package/declarations/adapter/-private.d.ts.map +1 -0
  23. package/declarations/adapter/error.d.ts +188 -0
  24. package/declarations/adapter/error.d.ts.map +1 -0
  25. package/declarations/adapter/json-api.d.ts +234 -0
  26. package/declarations/adapter/json-api.d.ts.map +1 -0
  27. package/declarations/adapter/rest.d.ts +823 -0
  28. package/declarations/adapter/rest.d.ts.map +1 -0
  29. package/declarations/adapter.d.ts +801 -0
  30. package/declarations/adapter.d.ts.map +1 -0
  31. package/declarations/compat/-private.d.ts +14 -0
  32. package/declarations/compat/-private.d.ts.map +1 -0
  33. package/declarations/compat/builders/find-all.d.ts +33 -0
  34. package/declarations/compat/builders/find-all.d.ts.map +1 -0
  35. package/declarations/compat/builders/find-record.d.ts +54 -0
  36. package/declarations/compat/builders/find-record.d.ts.map +1 -0
  37. package/declarations/compat/builders/query.d.ts +61 -0
  38. package/declarations/compat/builders/query.d.ts.map +1 -0
  39. package/declarations/compat/builders/save-record.d.ts +32 -0
  40. package/declarations/compat/builders/save-record.d.ts.map +1 -0
  41. package/declarations/compat/builders/utils.d.ts +4 -0
  42. package/declarations/compat/builders/utils.d.ts.map +1 -0
  43. package/declarations/compat/builders.d.ts +15 -0
  44. package/declarations/compat/builders.d.ts.map +1 -0
  45. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +47 -0
  46. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts.map +1 -0
  47. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +3 -0
  48. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts.map +1 -0
  49. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +12 -0
  50. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts.map +1 -0
  51. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +6 -0
  52. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts.map +1 -0
  53. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +3 -0
  54. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts.map +1 -0
  55. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +527 -0
  56. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts.map +1 -0
  57. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +224 -0
  58. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts.map +1 -0
  59. package/declarations/compat/legacy-network-handler/serializer-response.d.ts +7 -0
  60. package/declarations/compat/legacy-network-handler/serializer-response.d.ts.map +1 -0
  61. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +89 -0
  62. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts.map +1 -0
  63. package/declarations/compat/legacy-network-handler/snapshot.d.ts +237 -0
  64. package/declarations/compat/legacy-network-handler/snapshot.d.ts.map +1 -0
  65. package/declarations/compat/utils.d.ts +138 -0
  66. package/declarations/compat/utils.d.ts.map +1 -0
  67. package/declarations/compat.d.ts +134 -0
  68. package/declarations/compat.d.ts.map +1 -0
  69. package/declarations/model/-private/attr.d.ts +165 -0
  70. package/declarations/model/-private/attr.d.ts.map +1 -0
  71. package/declarations/model/-private/attr.type-test.d.ts +2 -0
  72. package/declarations/model/-private/attr.type-test.d.ts.map +1 -0
  73. package/declarations/model/-private/belongs-to.d.ts +173 -0
  74. package/declarations/model/-private/belongs-to.d.ts.map +1 -0
  75. package/declarations/model/-private/belongs-to.type-test.d.ts +2 -0
  76. package/declarations/model/-private/belongs-to.type-test.d.ts.map +1 -0
  77. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +6 -0
  78. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  79. package/declarations/model/-private/errors.d.ts +290 -0
  80. package/declarations/model/-private/errors.d.ts.map +1 -0
  81. package/declarations/model/-private/has-many.d.ts +164 -0
  82. package/declarations/model/-private/has-many.d.ts.map +1 -0
  83. package/declarations/model/-private/has-many.type-test.d.ts +2 -0
  84. package/declarations/model/-private/has-many.type-test.d.ts.map +1 -0
  85. package/declarations/model/-private/hooks.d.ts +11 -0
  86. package/declarations/model/-private/hooks.d.ts.map +1 -0
  87. package/declarations/model/-private/legacy-relationships-support.d.ts +57 -0
  88. package/declarations/model/-private/legacy-relationships-support.d.ts.map +1 -0
  89. package/declarations/model/-private/model-for-mixin.d.ts +4 -0
  90. package/declarations/model/-private/model-for-mixin.d.ts.map +1 -0
  91. package/declarations/model/-private/model-methods.d.ts +35 -0
  92. package/declarations/model/-private/model-methods.d.ts.map +1 -0
  93. package/declarations/model/-private/model.d.ts +1270 -0
  94. package/declarations/model/-private/model.d.ts.map +1 -0
  95. package/declarations/model/-private/model.type-test.d.ts +2 -0
  96. package/declarations/model/-private/model.type-test.d.ts.map +1 -0
  97. package/declarations/model/-private/notify-changes.d.ts +5 -0
  98. package/declarations/model/-private/notify-changes.d.ts.map +1 -0
  99. package/declarations/model/-private/promise-belongs-to.d.ts +40 -0
  100. package/declarations/model/-private/promise-belongs-to.d.ts.map +1 -0
  101. package/declarations/model/-private/promise-many-array.d.ts +126 -0
  102. package/declarations/model/-private/promise-many-array.d.ts.map +1 -0
  103. package/declarations/model/-private/promise-proxy-base.d.ts +3 -0
  104. package/declarations/model/-private/promise-proxy-base.d.ts.map +1 -0
  105. package/declarations/model/-private/record-state.d.ts +78 -0
  106. package/declarations/model/-private/record-state.d.ts.map +1 -0
  107. package/declarations/model/-private/references/belongs-to.d.ts +495 -0
  108. package/declarations/model/-private/references/belongs-to.d.ts.map +1 -0
  109. package/declarations/model/-private/references/has-many.d.ts +504 -0
  110. package/declarations/model/-private/references/has-many.d.ts.map +1 -0
  111. package/declarations/model/-private/schema-provider.d.ts +63 -0
  112. package/declarations/model/-private/schema-provider.d.ts.map +1 -0
  113. package/declarations/model/-private/type-utils.d.ts +57 -0
  114. package/declarations/model/-private/type-utils.d.ts.map +1 -0
  115. package/declarations/model/-private/util.d.ts +6 -0
  116. package/declarations/model/-private/util.d.ts.map +1 -0
  117. package/declarations/model/-private.d.ts +8 -0
  118. package/declarations/model/-private.d.ts.map +1 -0
  119. package/declarations/model/migration-support.d.ts +287 -0
  120. package/declarations/model/migration-support.d.ts.map +1 -0
  121. package/declarations/model/migration-support.type-test.d.ts +2 -0
  122. package/declarations/model/migration-support.type-test.d.ts.map +1 -0
  123. package/declarations/model.d.ts +50 -0
  124. package/declarations/model.d.ts.map +1 -0
  125. package/declarations/serializer/-private/embedded-records-mixin.d.ts +97 -0
  126. package/declarations/serializer/-private/embedded-records-mixin.d.ts.map +1 -0
  127. package/declarations/serializer/-private/transforms/boolean.d.ts +47 -0
  128. package/declarations/serializer/-private/transforms/boolean.d.ts.map +1 -0
  129. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts +2 -0
  130. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts.map +1 -0
  131. package/declarations/serializer/-private/transforms/date.d.ts +28 -0
  132. package/declarations/serializer/-private/transforms/date.d.ts.map +1 -0
  133. package/declarations/serializer/-private/transforms/number.d.ts +29 -0
  134. package/declarations/serializer/-private/transforms/number.d.ts.map +1 -0
  135. package/declarations/serializer/-private/transforms/string.d.ts +29 -0
  136. package/declarations/serializer/-private/transforms/string.d.ts.map +1 -0
  137. package/declarations/serializer/-private/transforms/transform.d.ts +119 -0
  138. package/declarations/serializer/-private/transforms/transform.d.ts.map +1 -0
  139. package/declarations/serializer/-private/utils.d.ts +4 -0
  140. package/declarations/serializer/-private/utils.d.ts.map +1 -0
  141. package/declarations/serializer/json-api.d.ts +496 -0
  142. package/declarations/serializer/json-api.d.ts.map +1 -0
  143. package/declarations/serializer/json.d.ts +1047 -0
  144. package/declarations/serializer/json.d.ts.map +1 -0
  145. package/declarations/serializer/rest.d.ts +554 -0
  146. package/declarations/serializer/rest.d.ts.map +1 -0
  147. package/declarations/serializer/transform.d.ts +6 -0
  148. package/declarations/serializer/transform.d.ts.map +1 -0
  149. package/declarations/serializer.d.ts +258 -0
  150. package/declarations/serializer.d.ts.map +1 -0
  151. package/dist/-private-DFfBszo5.js +1182 -0
  152. package/dist/-private-DFfBszo5.js.map +1 -0
  153. package/dist/adapter/-private.js +1 -0
  154. package/dist/adapter/-private.js.map +1 -0
  155. package/dist/adapter/error.js +254 -0
  156. package/dist/adapter/error.js.map +1 -0
  157. package/dist/adapter/json-api.js +129 -0
  158. package/dist/adapter/json-api.js.map +1 -0
  159. package/dist/adapter/rest.js +1262 -0
  160. package/dist/adapter/rest.js.map +1 -0
  161. package/dist/adapter.js +1284 -0
  162. package/dist/adapter.js.map +1 -0
  163. package/dist/compat/-private.js +1 -0
  164. package/dist/compat/-private.js.map +1 -0
  165. package/dist/compat/builders.js +292 -0
  166. package/dist/compat/builders.js.map +1 -0
  167. package/dist/compat/utils.js +225 -0
  168. package/dist/compat/utils.js.map +1 -0
  169. package/dist/compat.js +999 -0
  170. package/dist/compat.js.map +1 -0
  171. package/dist/errors-D74uk36r.js +2541 -0
  172. package/dist/errors-D74uk36r.js.map +1 -0
  173. package/dist/json-BCH3fil7.js +1349 -0
  174. package/dist/json-BCH3fil7.js.map +1 -0
  175. package/dist/model/-private.js +2 -0
  176. package/dist/model/-private.js.map +1 -0
  177. package/dist/model/migration-support.js +453 -0
  178. package/dist/model/migration-support.js.map +1 -0
  179. package/dist/model.js +736 -0
  180. package/dist/model.js.map +1 -0
  181. package/dist/runtime-BPCpkOf1-BKOwiRJp.js +65 -0
  182. package/dist/runtime-BPCpkOf1-BKOwiRJp.js.map +1 -0
  183. package/dist/schema-provider-CXFLTMjg.js +2228 -0
  184. package/dist/schema-provider-CXFLTMjg.js.map +1 -0
  185. package/dist/serialize-into-hash-BxfqWC8u.js +260 -0
  186. package/dist/serialize-into-hash-BxfqWC8u.js.map +1 -0
  187. package/dist/serializer/json-api.js +514 -0
  188. package/dist/serializer/json-api.js.map +1 -0
  189. package/dist/serializer/json.js +6 -0
  190. package/dist/serializer/json.js.map +1 -0
  191. package/dist/serializer/rest.js +1245 -0
  192. package/dist/serializer/rest.js.map +1 -0
  193. package/dist/serializer/transform.js +313 -0
  194. package/dist/serializer/transform.js.map +1 -0
  195. package/dist/serializer.js +252 -0
  196. package/dist/serializer.js.map +1 -0
  197. package/logos/NCC-1701-a-blue.svg +4 -0
  198. package/logos/NCC-1701-a-gold.svg +4 -0
  199. package/logos/NCC-1701-a-gold_100.svg +1 -0
  200. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  201. package/logos/NCC-1701-a.svg +4 -0
  202. package/logos/README.md +4 -0
  203. package/logos/docs-badge.svg +2 -0
  204. package/logos/ember-data-logo-dark.svg +12 -0
  205. package/logos/ember-data-logo-light.svg +12 -0
  206. package/logos/github-header.svg +444 -0
  207. package/logos/social1.png +0 -0
  208. package/logos/social2.png +0 -0
  209. package/logos/warp-drive-logo-dark.svg +4 -0
  210. package/logos/warp-drive-logo-gold.svg +4 -0
  211. package/package.json +72 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"-private-DFfBszo5.js","sources":["../src/compat/legacy-network-handler/snapshot-record-array.ts","../src/compat/legacy-network-handler/identifier-has-id.ts","../src/compat/legacy-network-handler/legacy-data-utils.ts","../src/compat/legacy-network-handler/serializer-response.ts","../src/compat/legacy-network-handler/snapshot.ts","../src/compat/legacy-network-handler/fetch-manager.ts","../src/compat/-private.ts"],"sourcesContent":["import type { Store } from '@warp-drive/core';\nimport type { LiveArray } from '@warp-drive/core/store/-private';\nimport { SOURCE } from '@warp-drive/core/store/-private';\nimport type { FindAllOptions, ModelSchema } from '@warp-drive/core/types';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\n\nimport { upgradeStore } from '../-private.ts';\nimport type { Snapshot } from './snapshot.ts';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain `findAll` requests.\n\n @class SnapshotRecordArray\n @public\n*/\nexport class SnapshotRecordArray {\n declare _snapshots: Snapshot[] | null;\n declare _type: ModelSchema | null;\n declare modelName: string;\n declare __store: Store;\n\n declare adapterOptions?: Record<string, unknown>;\n declare include?: string | string[];\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @private\n @constructor\n @param {Store} store\n @param {String} type\n @param options\n */\n constructor(store: Store, type: string, options: FindAllOptions = {}) {\n this.__store = store;\n /**\n An array of snapshots\n @private\n @property _snapshots\n @type {Array}\n */\n this._snapshots = null;\n\n /**\n The modelName of the underlying records for the snapshots in the array, as a Model\n @property modelName\n @public\n @type {Model}\n */\n this.modelName = type;\n\n /**\n A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @property adapterOptions\n @public\n @type {Object}\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n The relationships to include for this request.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n\n @property include\n @public\n @type {String|Array}\n */\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @property _recordArray\n @private\n @type {Array}\n */\n get _recordArray(): LiveArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n\n @property length\n @public\n @type {Number}\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```js [app/adapters/post.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @public\n @return {Array} Array of snapshots\n */\n snapshots() {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n this._snapshots = this._recordArray[SOURCE].map((identifier: StableRecordIdentifier) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\nimport type { StableExistingRecordIdentifier } from '@warp-drive/core/types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is StableExistingRecordIdentifier {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as StableExistingRecordIdentifier).id !== null\n );\n}\n","import type { AdapterPayload } from './minimum-adapter-interface.ts';\n\ntype IteratorCB<T> = ((o: T, index: number) => T) | ((o: T) => T);\n\nexport function iterateData<T>(data: T[] | T, fn: IteratorCB<T>) {\n if (Array.isArray(data)) {\n return data.map(fn);\n } else {\n return fn(data, 0);\n }\n}\n\nexport function payloadIsNotBlank<T>(adapterPayload: T | AdapterPayload): adapterPayload is AdapterPayload {\n if (Array.isArray(adapterPayload)) {\n return true;\n } else {\n return Object.keys(adapterPayload || {}).length !== 0;\n }\n}\n","import type { Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { ModelSchema } from '@warp-drive/core/types';\nimport type { JsonApiDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface.ts';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","import type { Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { FindRecordOptions } from '@warp-drive/core/types';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core/types/cache/relationship';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { Value } from '@warp-drive/core/types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n @class Snapshot\n @public\n*/\nexport class Snapshot<R = unknown> {\n declare __attributes: Record<keyof R & string, unknown> | null;\n declare _belongsToRelationships: Record<string, Snapshot>;\n declare _belongsToIds: Record<string, RecordId>;\n declare _hasManyRelationships: Record<string, Snapshot[]>;\n declare _hasManyIds: Record<string, RecordId[]>;\n declare _changedAttributes: ChangedAttributesHash;\n\n declare identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;\n declare modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;\n declare id: string | null;\n declare include?: string | string[];\n declare adapterOptions?: Record<string, unknown>;\n declare _store: Store;\n\n /**\n * @constructor\n * @private\n * @param options\n * @param identifier\n * @param _store\n */\n constructor(\n options: FindRecordOptions,\n identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>,\n store: Store\n ) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n\n /**\n The unique RecordIdentifier associated with this Snapshot.\n\n @property identifier\n @public\n @type {StableRecordIdentifier}\n */\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._attributes;\n }\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @property id\n @type {String}\n @public\n */\n this.id = identifier.id;\n\n /**\n A hash of adapter options\n @property adapterOptions\n @type {Object}\n @public\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n If `include` was passed to the options hash for the request, the value\n would be available here.\n\n @property include\n @type {String|Array}\n @public\n */\n this.include = options.include;\n\n /**\n The name of the type of the underlying record for this snapshot, as a string.\n\n @property modelName\n @type {String}\n @public\n */\n this.modelName = identifier.type;\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n Example\n\n ```javascript\n let json = snapshot.record.toJSON();\n ```\n\n @property record\n @type {Model}\n @public\n */\n get record(): R | null {\n const record = this._store.peekRecord<R>(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n get _attributes(): Record<keyof R & string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const attrs = this._store.schema.fields(identifier);\n const cache = this._store.cache;\n\n attrs.forEach((field, keyName) => {\n if (field.kind === 'attribute') {\n attributes[keyName] = cache.getAttr(identifier, keyName);\n }\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @param {String} keyName\n @return {Object} The attribute value or undefined\n @public\n */\n attr(keyName: keyof R & string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @return {Object} All attributes of the current snapshot\n @public\n */\n attributes(): Record<keyof R & string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @return {Object} All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Snapshot|String|null|undefined)} A snapshot or ID of a known\n relationship or null if the relationship is known but unset. undefined\n will be returned if the contents of the relationship is unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n assert(`snapshot.belongsTo only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.kind === 'belongsTo'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.identifierCache.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Array|undefined)} An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n assert(`snapshot.hasMany only supported when using a cache that supports the graph`, this._store._graph);\n\n const { identifier } = this;\n if (DEBUG) {\n const relationship = this._store.schema.fields(identifier)?.get(keyName);\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.kind === 'hasMany'\n );\n }\n\n const value = this._store.cache.getRelationship(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.identifierCache.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'attribute') {\n callback.call(binding, key, field);\n }\n });\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: LegacyRelationshipField) => void, binding?: unknown): void {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'belongsTo' || field.kind === 'hasMany') {\n callback.call(binding, key, field);\n }\n });\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```js [app/adapters/application.js]\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { warn } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { createDeferred } from '@warp-drive/core/request';\nimport type {\n FindRecordQuery,\n InstanceCache,\n Request,\n RequestStateService,\n SaveRecordMutation,\n} from '@warp-drive/core/store/-private';\nimport { coerceId, waitFor } from '@warp-drive/core/store/-private';\nimport type { FindRecordOptions, ModelSchema } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstance } from '@warp-drive/core/types/record';\nimport type { ImmutableRequestInfo } from '@warp-drive/core/types/request';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private.ts';\nimport { assertIdentifierHasId } from './identifier-has-id.ts';\nimport { payloadIsNotBlank } from './legacy-data-utils.ts';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface.ts';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface.ts';\nimport { normalizeResponseHelper } from './serializer-response.ts';\nimport { Snapshot } from './snapshot.ts';\n\ntype Deferred<T> = ReturnType<typeof createDeferred<T>>;\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp = getOrSetGlobal('SaveOp', Symbol('SaveOp'));\n\nexport type FetchMutationOptions = FindRecordOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: StableExistingRecordIdentifier;\n queryRequest: Request;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n options: FindRecordOptions;\n trace?: unknown;\n promise: Promise<StableExistingRecordIdentifier>;\n}\n\ninterface PendingSaveItem {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: StableRecordIdentifier;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\nexport class FetchManager {\n declare isDestroyed: boolean;\n declare requestCache: RequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n declare _pendingFetch: Map<string, Map<StableExistingRecordIdentifier, PendingFetchItem[]>>;\n declare _store: Store;\n\n constructor(store: Store) {\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot<T>(identifier: StableRecordIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;\n createSnapshot(identifier: StableRecordIdentifier, options?: FindRecordOptions): Snapshot;\n createSnapshot(identifier: StableRecordIdentifier, options: FindRecordOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @internal\n */\n scheduleSave(\n identifier: StableRecordIdentifier,\n options: FetchMutationOptions\n ): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: StableExistingRecordIdentifier,\n options: FindRecordOptions,\n request: ImmutableRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (store._graph) {\n const graph = store._graph;\n if (!cache) {\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n promise = waitFor(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions) {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches() {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: StableExistingRecordIdentifier,\n options: FindRecordOptions = {},\n request: ImmutableRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<StableExistingRecordIdentifier>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy() {\n this.isDestroyed = true;\n }\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n const arrCurrent = (Array.isArray(current) ? current : current.split(',')).sort();\n const arrExisting = (Array.isArray(existing) ? existing : existing.split(',')).sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindRecordOptions = {}, existingOptions: FindRecordOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // eslint-disable-next-line @typescript-eslint/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n }) as Promise<AdapterPayload>;\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<StableExistingRecordIdentifier, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type { Store } from '@warp-drive/core';\n\nimport type { CompatStore } from '../compat.ts';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of EmberData.\n *\n @module\n*/\nexport { SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array.ts';\nexport { SaveOp } from './legacy-network-handler/fetch-manager.ts';\nexport { FetchManager } from './legacy-network-handler/fetch-manager.ts';\nexport { Snapshot } from './legacy-network-handler/snapshot.ts';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"names":["SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","upgradeStore","_fetchManager","SOURCE","map","identifier","createSnapshot","assertIdentifierHasId","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","id","iterateData","data","fn","Array","isArray","payloadIsNotBlank","adapterPayload","Object","keys","validateDocumentStructure","doc","errors","push","meta","links","jsonapi","included","join","normalizeResponseHelper","serializer","modelClass","payload","requestType","normalizedResponse","normalizeResponse","Snapshot","_store","__attributes","_belongsToRelationships","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","_attributes","cache","_changedAttributes","changedAttrs","record","peekRecord","lid","attributes","attrs","schema","fields","forEach","field","keyName","kind","getAttr","isNew","attr","changedAttributes","changedAttributeKeys","i","key","slice","belongsTo","returnModeIsId","result","relationshipMeta","get","_graph","relationship","value","getRelationship","inverseIdentifier","identifierCache","getOrCreateRecordIdentifier","undefined","isDeleted","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","member","eachAttribute","callback","binding","call","eachRelationship","serialize","serializerFor","SaveOp","getOrSetGlobal","Symbol","FetchManager","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","scheduleSave","resolver","createDeferred","query","op","recordIdentifier","queryRequest","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","pendingFetchItem","resolverPromise","isInitialLoad","recordIsLoaded","then","potentiallyNewIm","_push","reload","error","isEmpty","isReleasable","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","set","requestsForIdentifier","TESTING","disableTestWaiter","waitFor","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","assign","destroy","instanceCache","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","arrCurrent","split","sort","arrExisting","includes","optionsSatisfies","existingOptions","_findMany","adapter","modelFor","s","every","v","findMany","ret","rejectFetchedItems","fetchMap","l","pair","reject","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","resources","resource","delete","rejected","snapshotArray","warn","values","_fetchRecord","findRecord","klass","isDestroying","coerceId","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation"],"mappings":";;;;;;AAQA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;AAS/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,WAAWA,CAACC,KAAY,EAAEC,IAAY,EAAEC,OAAuB,GAAG,EAAE,EAAE;IACpE,IAAI,CAACC,OAAO,GAAGH,KAAK;AACpB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACI,UAAU,GAAG,IAAI;;AAEtB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,SAAS,GAAGJ,IAAI;;AAErB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKI,IAAA,IAAI,CAACK,cAAc,GAAGJ,OAAO,CAACI,cAAc;;AAE5C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMI,IAAA,IAAI,CAACC,OAAO,GAAGL,OAAO,CAACK,OAAO;AAChC;;AAEA;AACF;AACA;AACA;AACA;AACA;EAEE,IAAIC,YAAYA,GAAc;IAC5B,OAAO,IAAI,CAACL,OAAO,CAACM,OAAO,CAAC,IAAI,CAACJ,SAAS,CAAC;AAC7C;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAKE,IAAIK,MAAMA,GAAW;AACnB,IAAA,OAAO,IAAI,CAACF,YAAY,CAACE,MAAM;AACjC;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMEC,EAAAA,SAASA,GAAG;AACV,IAAA,IAAI,IAAI,CAACP,UAAU,KAAK,IAAI,EAAE;MAC5B,OAAO,IAAI,CAACA,UAAU;AACxB;AACAQ,IAAAA,YAAY,CAAC,IAAI,CAACT,OAAO,CAAC;IAE1B,MAAM;AAAEU,MAAAA;KAAe,GAAG,IAAI,CAACV,OAAO;IACtC,IAAI,CAACC,UAAU,GAAG,IAAI,CAACI,YAAY,CAACM,MAAM,CAAC,CAACC,GAAG,CAAEC,UAAkC,IACjFH,aAAa,CAACI,cAAc,CAACD,UAAU,CACzC,CAAC;IAED,OAAO,IAAI,CAACZ,UAAU;AACxB;AACF;;AC7KO,SAASc,qBAAqBA,CAACF,UAAmB,EAAwD;EAC/GG,cAAA,CAAAC,eAAA,EA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gBAAAA,EAAAA,SAAS,CAA2D,yDAAA,CAAA,CAAA;AAAA;GACvFzG,EAAAA,OAAO,KAAKpC,SAAS,CAAA,GAAA,EAAA;AAGvBoC,EAAAA,OAAO,GAAGA,OAAO,CAACU,IAAI,CAAE/G,cAAc,IAAK;AACzC,IAAA,IAAIA,cAAc,EAAE;AAClB,MAAA,OAAOY,uBAAuB,CAACC,UAAU,EAAE9C,KAAK,EAAE+C,UAAU,EAAEd,cAAc,EAAEiG,QAAQ,CAACxG,EAAE,EAAEqN,SAAS,CAAC;AACvG;AACF,GAAC,CAA4B;AAE7BnH,EAAAA,QAAQ,CAACiC,OAAO,CAACvB,OAAO,CAAC;AAC3B;;AChnBA;AACA;AACA;AACA;AACA;AACA;AAMO,SAAS1H,YAAYA,CAACZ,KAAY,EAAgC;;;;"}
@@ -0,0 +1 @@
1
+ export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-BxfqWC8u.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,254 @@
1
+ import { getOrSetGlobal } from '@warp-drive/core/types/-private';
2
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
3
+ function _AdapterError(errors, message = 'Adapter operation failed') {
4
+ this.isAdapterError = true;
5
+ const error = Error.call(this, message);
6
+ if (error) {
7
+ this.stack = error.stack;
8
+ this.description = error.description;
9
+ this.fileName = error.fileName;
10
+ this.lineNumber = error.lineNumber;
11
+ this.message = error.message;
12
+ this.name = error.name;
13
+ this.number = error.number;
14
+ }
15
+ this.errors = errors || [{
16
+ title: 'Adapter Error',
17
+ detail: message
18
+ }];
19
+ }
20
+ _AdapterError.prototype = Object.create(Error.prototype);
21
+ _AdapterError.prototype.code = 'AdapterError';
22
+ _AdapterError.extend = extendFn(_AdapterError);
23
+ const AdapterError = getOrSetGlobal('AdapterError', _AdapterError);
24
+ function extendFn(ErrorClass) {
25
+ return function ({
26
+ message: defaultMessage
27
+ } = {}) {
28
+ return extend(ErrorClass, defaultMessage);
29
+ };
30
+ }
31
+ function extend(ParentErrorClass, defaultMessage) {
32
+ const ErrorClass = function (errors, message) {
33
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
34
+ if (!test) {
35
+ throw new Error('`AdapterError` expects json-api formatted errors array.');
36
+ }
37
+ })(Array.isArray(errors || [])) : {};
38
+ ParentErrorClass.call(this, errors, message || defaultMessage);
39
+ };
40
+ ErrorClass.prototype = Object.create(ParentErrorClass.prototype);
41
+ ErrorClass.extend = extendFn(ErrorClass);
42
+ return ErrorClass;
43
+ }
44
+
45
+ /**
46
+ A `InvalidError` is used by an adapter to signal the external API
47
+ was unable to process a request because the content was not
48
+ semantically correct or meaningful per the API. Usually, this means a
49
+ record failed some form of server-side validation. When a promise
50
+ from an adapter is rejected with a `InvalidError` the record will
51
+ transition to the `invalid` state and the errors will be set to the
52
+ `errors` property on the record.
53
+
54
+ For Ember Data to correctly map errors to their corresponding
55
+ properties on the model, Ember Data expects each error to be
56
+ a valid JSON-API error object with a `source/pointer` that matches
57
+ the property name. For example, if you had a Post model that
58
+ looked like this.
59
+
60
+ ```js [app/models/post.js]
61
+ import { Model, attr } from '@warp-drive/legacy/model';
62
+
63
+ export default class PostModel extends Model {
64
+ @attr('string') title;
65
+ @attr('string') content;
66
+ }
67
+ ```
68
+
69
+ To show an error from the server related to the `title` and
70
+ `content` properties your adapter could return a promise that
71
+ rejects with a `InvalidError` object that looks like this:
72
+
73
+ ```js [app/adapters/post.js]
74
+ import RSVP from 'RSVP';
75
+ import RESTAdapter from '@ember-data/adapter/rest';
76
+ import { InvalidError } from '@ember-data/adapter/error';
77
+
78
+ export default class ApplicationAdapter extends RESTAdapter {
79
+ updateRecord() {
80
+ // Fictional adapter that always rejects
81
+ return RSVP.reject(new InvalidError([
82
+ {
83
+ detail: 'Must be unique',
84
+ source: { pointer: '/data/attributes/title' }
85
+ },
86
+ {
87
+ detail: 'Must not be blank',
88
+ source: { pointer: '/data/attributes/content'}
89
+ }
90
+ ]));
91
+ }
92
+ }
93
+ ```
94
+
95
+ Your backend may use different property names for your records the
96
+ store will attempt to extract and normalize the errors using the
97
+ serializer's `extractErrors` method before the errors get added to
98
+ the model. As a result, it is safe for the `InvalidError` to
99
+ wrap the error payload unaltered.
100
+
101
+ @class InvalidError
102
+ @public
103
+ */
104
+ // TODO @deprecate extractError documentation
105
+ const InvalidError = getOrSetGlobal('InvalidError', extend(AdapterError, 'The adapter rejected the commit because it was invalid'));
106
+ InvalidError.prototype.code = 'InvalidError';
107
+
108
+ /**
109
+ A `TimeoutError` is used by an adapter to signal that a request
110
+ to the external API has timed out. I.e. no response was received from
111
+ the external API within an allowed time period.
112
+
113
+ An example use case would be to warn the user to check their internet
114
+ connection if an adapter operation has timed out:
115
+
116
+ ```js [app/routes/application.js]
117
+ import { TimeoutError } from '@ember-data/adapter/error';
118
+
119
+ export default class ApplicationRoute extends Route {
120
+ @action
121
+ error(error, transition) {
122
+ if (error instanceof TimeoutError) {
123
+ // alert the user
124
+ alert('Are you still connected to the Internet?');
125
+ return;
126
+ }
127
+
128
+ // ...other error handling logic
129
+ }
130
+ }
131
+ ```
132
+
133
+ @class TimeoutError
134
+ @public
135
+ */
136
+ const TimeoutError = getOrSetGlobal('TimeoutError', extend(AdapterError, 'The adapter operation timed out'));
137
+ TimeoutError.prototype.code = 'TimeoutError';
138
+
139
+ /**
140
+ A `AbortError` is used by an adapter to signal that a request to
141
+ the external API was aborted. For example, this can occur if the user
142
+ navigates away from the current page after a request to the external API
143
+ has been initiated but before a response has been received.
144
+
145
+ @class AbortError
146
+ @public
147
+ */
148
+ const AbortError = getOrSetGlobal('AbortError', extend(AdapterError, 'The adapter operation was aborted'));
149
+ AbortError.prototype.code = 'AbortError';
150
+
151
+ /**
152
+ A `UnauthorizedError` equates to a HTTP `401 Unauthorized` response
153
+ status. It is used by an adapter to signal that a request to the external
154
+ API was rejected because authorization is required and has failed or has not
155
+ yet been provided.
156
+
157
+ An example use case would be to redirect the user to a login route if a
158
+ request is unauthorized:
159
+
160
+ ```js [app/routes/application.js]
161
+ import { UnauthorizedError } from '@ember-data/adapter/error';
162
+
163
+ export default class ApplicationRoute extends Route {
164
+ @action
165
+ error(error, transition) {
166
+ if (error instanceof UnauthorizedError) {
167
+ // go to the login route
168
+ this.transitionTo('login');
169
+ return;
170
+ }
171
+
172
+ // ...other error handling logic
173
+ }
174
+ }
175
+ ```
176
+
177
+ @class UnauthorizedError
178
+ @public
179
+ */
180
+ const UnauthorizedError = getOrSetGlobal('UnauthorizedError', extend(AdapterError, 'The adapter operation is unauthorized'));
181
+ UnauthorizedError.prototype.code = 'UnauthorizedError';
182
+
183
+ /**
184
+ A `ForbiddenError` equates to a HTTP `403 Forbidden` response status.
185
+ It is used by an adapter to signal that a request to the external API was
186
+ valid but the server is refusing to respond to it. If authorization was
187
+ provided and is valid, then the authenticated user does not have the
188
+ necessary permissions for the request.
189
+
190
+ @class ForbiddenError
191
+ @public
192
+ */
193
+ const ForbiddenError = getOrSetGlobal('ForbiddenError', extend(AdapterError, 'The adapter operation is forbidden'));
194
+ ForbiddenError.prototype.code = 'ForbiddenError';
195
+
196
+ /**
197
+ A `NotFoundError` equates to a HTTP `404 Not Found` response status.
198
+ It is used by an adapter to signal that a request to the external API
199
+ was rejected because the resource could not be found on the API.
200
+
201
+ An example use case would be to detect if the user has entered a route
202
+ for a specific model that does not exist. For example:
203
+
204
+ ```js [app/routes/post.js]
205
+ import { NotFoundError } from '@ember-data/adapter/error';
206
+
207
+ export default class PostRoute extends Route {
208
+ @service store;
209
+ model(params) {
210
+ return this.store.findRecord('post', params.post_id);
211
+ }
212
+ @action
213
+ error(error, transition) {
214
+ if (error instanceof NotFoundError) {
215
+ // redirect to a list of all posts instead
216
+ this.transitionTo('posts');
217
+ } else {
218
+ // otherwise let the error bubble
219
+ return true;
220
+ }
221
+ }
222
+ }
223
+ ```
224
+
225
+ @class NotFoundError
226
+ @public
227
+ */
228
+ const NotFoundError = getOrSetGlobal('NotFoundError', extend(AdapterError, 'The adapter could not find the resource'));
229
+ NotFoundError.prototype.code = 'NotFoundError';
230
+
231
+ /**
232
+ A `ConflictError` equates to a HTTP `409 Conflict` response status.
233
+ It is used by an adapter to indicate that the request could not be processed
234
+ because of a conflict in the request. An example scenario would be when
235
+ creating a record with a client-generated ID but that ID is already known
236
+ to the external API.
237
+
238
+ @class ConflictError
239
+ @public
240
+ */
241
+ const ConflictError = getOrSetGlobal('ConflictError', extend(AdapterError, 'The adapter operation failed due to a conflict'));
242
+ ConflictError.prototype.code = 'ConflictError';
243
+
244
+ /**
245
+ A `ServerError` equates to a HTTP `500 Internal Server Error` response
246
+ status. It is used by the adapter to indicate that a request has failed
247
+ because of an error in the external API.
248
+
249
+ @class ServerError
250
+ @public
251
+ */
252
+ const ServerError = getOrSetGlobal('ServerError', extend(AdapterError, 'The adapter operation failed due to a server error'));
253
+ ServerError.prototype.code = 'ServerError';
254
+ export { AbortError, AdapterError, ConflictError, ForbiddenError, InvalidError, NotFoundError, ServerError, TimeoutError, UnauthorizedError };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sources":["../../src/adapter/error.js"],"sourcesContent":["import { assert } from '@warp-drive/core/build-config/macros';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\n\n/**\n ## Overview\n\n <blockquote style=\"margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;\">\n <p>\n ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n <a href=\"/ember-data/release/classes/%3CInterface%3E%20Handler\">Handler</a> instead to be used with the <a href=\"https://github.com/emberjs/data/tree/main/packages/request#readme\">RequestManager</a>\n </p>\n </blockquote>\n\n An `AdapterError` is used by an adapter to signal that an error occurred\n during a request to an external API. It indicates a generic error, and\n subclasses are used to indicate specific error states.\n\n To create a custom error to signal a specific error state in communicating\n with an external API, extend the `AdapterError`. For example, if the\n external API exclusively used HTTP `503 Service Unavailable` to indicate\n it was closed for maintenance:\n\n ```js [app/adapters/maintenance-error.js]\n import AdapterError from '@ember-data/adapter/error';\n\n export default AdapterError.extend({ message: \"Down for maintenance.\" });\n ```\n\n This error would then be returned by an adapter's `handleResponse` method:\n\n ```js [app/adapters/application.js]\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n import MaintenanceError from './maintenance-error';\n\n export default class ApplicationAdapter extends JSONAPIAdapter {\n handleResponse(status) {\n if (503 === status) {\n return new MaintenanceError();\n }\n\n return super.handleResponse(...arguments);\n }\n }\n ```\n\n And can then be detected in an application and used to send the user to an\n `under-maintenance` route:\n\n ```js [app/routes/application.js]\n import MaintenanceError from '../adapters/maintenance-error';\n\n export default class ApplicationRoute extends Route {\n actions: {\n error(error, transition) {\n if (error instanceof MaintenanceError) {\n this.transitionTo('under-maintenance');\n return;\n }\n\n // ...other error handling logic\n }\n }\n }\n ```\n\n @class AdapterError\n @public\n*/\nfunction _AdapterError(errors, message = 'Adapter operation failed') {\n this.isAdapterError = true;\n const error = Error.call(this, message);\n\n if (error) {\n this.stack = error.stack;\n this.description = error.description;\n this.fileName = error.fileName;\n this.lineNumber = error.lineNumber;\n this.message = error.message;\n this.name = error.name;\n this.number = error.number;\n }\n\n this.errors = errors || [\n {\n title: 'Adapter Error',\n detail: message,\n },\n ];\n}\n\n_AdapterError.prototype = Object.create(Error.prototype);\n_AdapterError.prototype.code = 'AdapterError';\n_AdapterError.extend = extendFn(_AdapterError);\n\nexport const AdapterError = getOrSetGlobal('AdapterError', _AdapterError);\n\nfunction extendFn(ErrorClass) {\n return function ({ message: defaultMessage } = {}) {\n return extend(ErrorClass, defaultMessage);\n };\n}\n\nfunction extend(ParentErrorClass, defaultMessage) {\n const ErrorClass = function (errors, message) {\n assert('`AdapterError` expects json-api formatted errors array.', Array.isArray(errors || []));\n ParentErrorClass.call(this, errors, message || defaultMessage);\n };\n ErrorClass.prototype = Object.create(ParentErrorClass.prototype);\n ErrorClass.extend = extendFn(ErrorClass);\n\n return ErrorClass;\n}\n\n/**\n A `InvalidError` is used by an adapter to signal the external API\n was unable to process a request because the content was not\n semantically correct or meaningful per the API. Usually, this means a\n record failed some form of server-side validation. When a promise\n from an adapter is rejected with a `InvalidError` the record will\n transition to the `invalid` state and the errors will be set to the\n `errors` property on the record.\n\n For Ember Data to correctly map errors to their corresponding\n properties on the model, Ember Data expects each error to be\n a valid JSON-API error object with a `source/pointer` that matches\n the property name. For example, if you had a Post model that\n looked like this.\n\n ```js [app/models/post.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @attr('string') title;\n @attr('string') content;\n }\n ```\n\n To show an error from the server related to the `title` and\n `content` properties your adapter could return a promise that\n rejects with a `InvalidError` object that looks like this:\n\n ```js [app/adapters/post.js]\n import RSVP from 'RSVP';\n import RESTAdapter from '@ember-data/adapter/rest';\n import { InvalidError } from '@ember-data/adapter/error';\n\n export default class ApplicationAdapter extends RESTAdapter {\n updateRecord() {\n // Fictional adapter that always rejects\n return RSVP.reject(new InvalidError([\n {\n detail: 'Must be unique',\n source: { pointer: '/data/attributes/title' }\n },\n {\n detail: 'Must not be blank',\n source: { pointer: '/data/attributes/content'}\n }\n ]));\n }\n }\n ```\n\n Your backend may use different property names for your records the\n store will attempt to extract and normalize the errors using the\n serializer's `extractErrors` method before the errors get added to\n the model. As a result, it is safe for the `InvalidError` to\n wrap the error payload unaltered.\n\n @class InvalidError\n @public\n*/\n// TODO @deprecate extractError documentation\nexport const InvalidError = getOrSetGlobal(\n 'InvalidError',\n extend(AdapterError, 'The adapter rejected the commit because it was invalid')\n);\nInvalidError.prototype.code = 'InvalidError';\n\n/**\n A `TimeoutError` is used by an adapter to signal that a request\n to the external API has timed out. I.e. no response was received from\n the external API within an allowed time period.\n\n An example use case would be to warn the user to check their internet\n connection if an adapter operation has timed out:\n\n ```js [app/routes/application.js]\n import { TimeoutError } from '@ember-data/adapter/error';\n\n export default class ApplicationRoute extends Route {\n @action\n error(error, transition) {\n if (error instanceof TimeoutError) {\n // alert the user\n alert('Are you still connected to the Internet?');\n return;\n }\n\n // ...other error handling logic\n }\n }\n ```\n\n @class TimeoutError\n @public\n*/\nexport const TimeoutError = getOrSetGlobal('TimeoutError', extend(AdapterError, 'The adapter operation timed out'));\nTimeoutError.prototype.code = 'TimeoutError';\n\n/**\n A `AbortError` is used by an adapter to signal that a request to\n the external API was aborted. For example, this can occur if the user\n navigates away from the current page after a request to the external API\n has been initiated but before a response has been received.\n\n @class AbortError\n @public\n*/\nexport const AbortError = getOrSetGlobal('AbortError', extend(AdapterError, 'The adapter operation was aborted'));\nAbortError.prototype.code = 'AbortError';\n\n/**\n A `UnauthorizedError` equates to a HTTP `401 Unauthorized` response\n status. It is used by an adapter to signal that a request to the external\n API was rejected because authorization is required and has failed or has not\n yet been provided.\n\n An example use case would be to redirect the user to a login route if a\n request is unauthorized:\n\n ```js [app/routes/application.js]\n import { UnauthorizedError } from '@ember-data/adapter/error';\n\n export default class ApplicationRoute extends Route {\n @action\n error(error, transition) {\n if (error instanceof UnauthorizedError) {\n // go to the login route\n this.transitionTo('login');\n return;\n }\n\n // ...other error handling logic\n }\n }\n ```\n\n @class UnauthorizedError\n @public\n*/\nexport const UnauthorizedError = getOrSetGlobal(\n 'UnauthorizedError',\n extend(AdapterError, 'The adapter operation is unauthorized')\n);\nUnauthorizedError.prototype.code = 'UnauthorizedError';\n\n/**\n A `ForbiddenError` equates to a HTTP `403 Forbidden` response status.\n It is used by an adapter to signal that a request to the external API was\n valid but the server is refusing to respond to it. If authorization was\n provided and is valid, then the authenticated user does not have the\n necessary permissions for the request.\n\n @class ForbiddenError\n @public\n*/\nexport const ForbiddenError = getOrSetGlobal(\n 'ForbiddenError',\n extend(AdapterError, 'The adapter operation is forbidden')\n);\nForbiddenError.prototype.code = 'ForbiddenError';\n\n/**\n A `NotFoundError` equates to a HTTP `404 Not Found` response status.\n It is used by an adapter to signal that a request to the external API\n was rejected because the resource could not be found on the API.\n\n An example use case would be to detect if the user has entered a route\n for a specific model that does not exist. For example:\n\n ```js [app/routes/post.js]\n import { NotFoundError } from '@ember-data/adapter/error';\n\n export default class PostRoute extends Route {\n @service store;\n model(params) {\n return this.store.findRecord('post', params.post_id);\n }\n @action\n error(error, transition) {\n if (error instanceof NotFoundError) {\n // redirect to a list of all posts instead\n this.transitionTo('posts');\n } else {\n // otherwise let the error bubble\n return true;\n }\n }\n }\n ```\n\n @class NotFoundError\n @public\n*/\nexport const NotFoundError = getOrSetGlobal(\n 'NotFoundError',\n extend(AdapterError, 'The adapter could not find the resource')\n);\nNotFoundError.prototype.code = 'NotFoundError';\n\n/**\n A `ConflictError` equates to a HTTP `409 Conflict` response status.\n It is used by an adapter to indicate that the request could not be processed\n because of a conflict in the request. An example scenario would be when\n creating a record with a client-generated ID but that ID is already known\n to the external API.\n\n @class ConflictError\n @public\n*/\nexport const ConflictError = getOrSetGlobal(\n 'ConflictError',\n extend(AdapterError, 'The adapter operation failed due to a conflict')\n);\nConflictError.prototype.code = 'ConflictError';\n\n/**\n A `ServerError` equates to a HTTP `500 Internal Server Error` response\n status. It is used by the adapter to indicate that a request has failed\n because of an error in the external API.\n\n @class ServerError\n @public\n*/\nexport const ServerError = getOrSetGlobal(\n 'ServerError',\n extend(AdapterError, 'The adapter operation failed due to a server error')\n);\nServerError.prototype.code = 'ServerError';\n"],"names":["_AdapterError","errors","message","isAdapterError","error","Error","call","stack","description","fileName","lineNumber","name","number","title","detail","prototype","Object","create","code","extend","extendFn","AdapterError","getOrSetGlobal","ErrorClass","defaultMessage","ParentErrorClass","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Array","isArray","InvalidError","TimeoutError","AbortError","UnauthorizedError","ForbiddenError","NotFoundError","ConflictError","ServerError"],"mappings":";;;AAqEA,SAASA,aAAaA,CAACC,MAAM,EAAEC,OAAO,GAAG,0BAA0B,EA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AS,CAACG,IAAI,GAAG,cAAc;;AAE5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACakB,MAAAA,UAAU,GAAGd,cAAc,CAAC,YAAY,EAAEH,MAAM,CAACE,YAAY,EAAE,mCAAmC,CAAC;AAChHe,UAAU,CAACrB,SAAS,CAACG,IAAI,GAAG,YAAY;;AAExC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACamB,MAAAA,iBAAiB,GAAGf,cAAc,CAC7C,mBAAmB,EACnBH,MAAM,CAACE,YAAY,EAAE,uCAAuC,CAC9D;AACAgB,iBAAiB,CAACtB,SAAS,CAACG,IAAI,GAAG,mBAAmB;;AAEtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACaoB,MAAAA,cAAc,GAAGhB,cAAc,CAC1C,gBAAgB,EAChBH,MAAM,CAACE,YAAY,EAAE,oCAAoC,CAC3D;AACAiB,cAAc,CAACvB,SAAS,CAACG,IAAI,GAAG,gBAAgB;;AAEhD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACaqB,MAAAA,aAAa,GAAGjB,cAAc,CACzC,eAAe,EACfH,MAAM,CAACE,YAAY,EAAE,yCAAyC,CAChE;AACAkB,aAAa,CAACxB,SAAS,CAACG,IAAI,GAAG,eAAe;;AAE9C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACasB,MAAAA,aAAa,GAAGlB,cAAc,CACzC,eAAe,EACfH,MAAM,CAACE,YAAY,EAAE,gDAAgD,CACvE;AACAmB,aAAa,CAACzB,SAAS,CAACG,IAAI,GAAG,eAAe;;AAE9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACauB,MAAAA,WAAW,GAAGnB,cAAc,CACvC,aAAa,EACbH,MAAM,CAACE,YAAY,EAAE,oDAAoD,CAC3E;AACAoB,WAAW,CAAC1B,SAAS,CAACG,IAAI,GAAG,aAAa;;;;"}
@@ -0,0 +1,129 @@
1
+ import { dasherize, pluralize } from '@warp-drive/utilities/string';
2
+ import '@ember/debug';
3
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
+ import { b as serializeIntoHash } from "../serialize-into-hash-BxfqWC8u.js";
5
+ import { RESTAdapter } from "./rest.js";
6
+ class JSONAPIAdapter extends RESTAdapter {
7
+ _defaultContentType = 'application/vnd.api+json';
8
+
9
+ /**
10
+ @private
11
+ @param {String} url
12
+ @param {String} type The request type GET, POST, PUT, DELETE etc.
13
+ @param {Object} options
14
+ @return {Object}
15
+ */
16
+ ajaxOptions(url, type, options = {}) {
17
+ const hash = super.ajaxOptions(url, type, options);
18
+ const headers = hash.headers = hash.headers || {};
19
+ headers['Accept'] = headers['Accept'] || 'application/vnd.api+json';
20
+ return hash;
21
+ }
22
+
23
+ /**
24
+ By default the JSONAPIAdapter will send each find request coming from a `store.find`
25
+ or from accessing a relationship separately to the server. If your server supports passing
26
+ ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
27
+ within a single runloop.
28
+ For example, if you have an initial payload of:
29
+ ```javascript
30
+ {
31
+ data: {
32
+ id: 1,
33
+ type: 'post',
34
+ relationship: {
35
+ comments: {
36
+ data: [
37
+ { id: 1, type: 'comment' },
38
+ { id: 2, type: 'comment' }
39
+ ]
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+ By default calling `post.comments` will trigger the following requests(assuming the
46
+ comments haven't been loaded before):
47
+ ```
48
+ GET /comments/1
49
+ GET /comments/2
50
+ ```
51
+ If you set coalesceFindRequests to `true` it will instead trigger the following request:
52
+ ```
53
+ GET /comments?filter[id]=1,2
54
+ ```
55
+ Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
56
+ relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
57
+ ```javascript
58
+ store.findRecord('comment', 1);
59
+ store.findRecord('comment', 2);
60
+ ```
61
+ will also send a request to: `GET /comments?filter[id]=1,2`
62
+ Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
63
+ `groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
64
+ @property coalesceFindRequests
65
+ @public
66
+ @type {Boolean}
67
+ */
68
+ get coalesceFindRequests() {
69
+ const coalesceFindRequests = this._coalesceFindRequests;
70
+ if (typeof coalesceFindRequests === 'boolean') {
71
+ return coalesceFindRequests;
72
+ }
73
+ return this._coalesceFindRequests = false;
74
+ }
75
+ set coalesceFindRequests(value) {
76
+ this._coalesceFindRequests = value;
77
+ }
78
+ findMany(store, type, ids, snapshots) {
79
+ const url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
80
+ return this.ajax(url, 'GET', {
81
+ data: {
82
+ filter: {
83
+ id: ids.join(',')
84
+ }
85
+ }
86
+ });
87
+ }
88
+ pathForType(modelName) {
89
+ const dasherized = dasherize(modelName);
90
+ return pluralize(dasherized);
91
+ }
92
+ updateRecord(store, schema, snapshot) {
93
+ const data = serializeIntoHash(store, schema, snapshot);
94
+ const type = snapshot.modelName;
95
+ const id = snapshot.id;
96
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
97
+ if (!test) {
98
+ throw new Error(`Attempted to update the ${type} record, but the record has no id`);
99
+ }
100
+ })(typeof id === 'string' && id.length > 0) : {};
101
+ const url = this.buildURL(type, id, snapshot, 'updateRecord');
102
+ return this.ajax(url, 'PATCH', {
103
+ data: data
104
+ });
105
+ }
106
+
107
+ /**
108
+ Used by `findAll` and `findRecord` to build the query's `data` hash
109
+ supplied to the ajax method.
110
+ @since 2.5.0
111
+ @public
112
+ @param {Snapshot} snapshot
113
+ @return {Object}
114
+ */
115
+ buildQuery(snapshot) {
116
+ const query = {};
117
+ if (snapshot) {
118
+ const {
119
+ include
120
+ } = snapshot;
121
+ const normalizedInclude = Array.isArray(include) ? include.join(',') : include;
122
+ if (normalizedInclude) {
123
+ query.include = normalizedInclude;
124
+ }
125
+ }
126
+ return query;
127
+ }
128
+ }
129
+ export { JSONAPIAdapter };