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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/declarations/adapter/-private/build-url-mixin.d.ts +41 -29
  2. package/declarations/adapter/-private/fastboot-interface.d.ts +4 -5
  3. package/declarations/adapter/-private/utils/continue-on-reject.d.ts +5 -6
  4. package/declarations/adapter/-private/utils/determine-body-promise.d.ts +1 -2
  5. package/declarations/adapter/-private/utils/fetch.d.ts +2 -3
  6. package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
  7. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +5 -6
  8. package/declarations/adapter/-private/utils/serialize-query-params.d.ts +5 -2
  9. package/declarations/adapter/-private.d.ts +5 -6
  10. package/declarations/adapter/error.d.ts +206 -178
  11. package/declarations/adapter/json-api.d.ts +206 -207
  12. package/declarations/adapter/rest.d.ts +805 -808
  13. package/declarations/adapter.d.ts +742 -766
  14. package/declarations/compat/-private.d.ts +10 -11
  15. package/declarations/compat/builders/find-all.d.ts +26 -24
  16. package/declarations/compat/builders/find-record.d.ts +41 -39
  17. package/declarations/compat/builders/query.d.ts +50 -45
  18. package/declarations/compat/builders/save-record.d.ts +26 -24
  19. package/declarations/compat/builders/utils.d.ts +1 -2
  20. package/declarations/compat/builders.d.ts +10 -11
  21. package/declarations/compat/extensions.d.ts +52 -106
  22. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +39 -38
  23. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +1 -2
  24. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +9 -10
  25. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +1 -2
  26. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +1 -2
  27. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +521 -517
  28. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +214 -215
  29. package/declarations/compat/legacy-network-handler/serializer-response.d.ts +5 -6
  30. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +83 -84
  31. package/declarations/compat/legacy-network-handler/snapshot.d.ts +228 -229
  32. package/declarations/compat/utils.d.ts +118 -119
  33. package/declarations/compat.d.ts +106 -104
  34. package/declarations/model/-private/attr.d.ts +164 -145
  35. package/declarations/model/-private/belongs-to.d.ts +135 -122
  36. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +15 -4
  37. package/declarations/model/-private/errors.d.ts +272 -267
  38. package/declarations/model/-private/has-many.d.ts +119 -116
  39. package/declarations/model/-private/hooks.d.ts +5 -6
  40. package/declarations/model/-private/legacy-relationships-support.d.ts +51 -52
  41. package/declarations/model/-private/model-for-mixin.d.ts +18 -3
  42. package/declarations/model/-private/model-methods.d.ts +29 -24
  43. package/declarations/model/-private/model.d.ts +1306 -1254
  44. package/declarations/model/-private/notify-changes.d.ts +3 -4
  45. package/declarations/model/-private/promise-belongs-to.d.ts +33 -27
  46. package/declarations/model/-private/promise-many-array.d.ts +125 -116
  47. package/declarations/model/-private/record-state.d.ts +63 -60
  48. package/declarations/model/-private/references/belongs-to.d.ts +491 -487
  49. package/declarations/model/-private/references/has-many.d.ts +495 -492
  50. package/declarations/model/-private/schema-provider.d.ts +53 -56
  51. package/declarations/model/-private/type-utils.d.ts +41 -41
  52. package/declarations/model/-private/util.d.ts +1 -2
  53. package/declarations/model/-private.d.ts +8 -8
  54. package/declarations/model/migration-support.d.ts +281 -279
  55. package/declarations/model.d.ts +48 -49
  56. package/declarations/serializer/-private/embedded-records-mixin.d.ts +70 -71
  57. package/declarations/serializer/-private/transforms/boolean.d.ts +37 -37
  58. package/declarations/serializer/-private/transforms/date.d.ts +22 -22
  59. package/declarations/serializer/-private/transforms/number.d.ts +22 -22
  60. package/declarations/serializer/-private/transforms/string.d.ts +22 -22
  61. package/declarations/serializer/-private/transforms/transform.d.ts +109 -110
  62. package/declarations/serializer/-private/utils.d.ts +0 -1
  63. package/declarations/serializer/json-api.d.ts +124 -494
  64. package/declarations/serializer/json.d.ts +62 -1031
  65. package/declarations/serializer/rest.d.ts +52 -552
  66. package/declarations/serializer/transform.d.ts +5 -6
  67. package/declarations/serializer.d.ts +217 -218
  68. package/dist/{-private-DFfBszo5.js → -private-CKrP0ogQ.js} +1 -1
  69. package/dist/adapter/-private.js +1 -1
  70. package/dist/adapter/error.js +17 -0
  71. package/dist/adapter/json-api.js +1 -1
  72. package/dist/adapter/rest.js +5 -7
  73. package/dist/adapter.js +6 -35
  74. package/dist/compat/-private.js +1 -1
  75. package/dist/compat/extensions.js +0 -2
  76. package/dist/compat.js +3 -4
  77. package/dist/{errors-_QQ7xpSn.js → errors-BX5wowuz.js} +11 -10
  78. package/dist/{json-DSOlH9A8.js → json-Et4mt_LM.js} +84 -157
  79. package/dist/model/-private.js +1 -1
  80. package/dist/model/migration-support.js +3 -4
  81. package/dist/model.js +3 -3
  82. package/dist/{schema-provider-D_P8ReX6.js → schema-provider-BdQhkT-Q.js} +20 -13
  83. package/dist/{serialize-into-hash-BxfqWC8u.js → serialize-into-hash-Bp58npke.js} +1 -1
  84. package/dist/serializer/json-api.js +42 -2
  85. package/dist/serializer/json.js +1 -1
  86. package/dist/serializer/rest.js +46 -41
  87. package/dist/serializer/transform.js +0 -44
  88. package/package.json +7 -7
  89. package/declarations/adapter/-private/build-url-mixin.d.ts.map +0 -1
  90. package/declarations/adapter/-private/fastboot-interface.d.ts.map +0 -1
  91. package/declarations/adapter/-private/utils/continue-on-reject.d.ts.map +0 -1
  92. package/declarations/adapter/-private/utils/determine-body-promise.d.ts.map +0 -1
  93. package/declarations/adapter/-private/utils/fetch.d.ts.map +0 -1
  94. package/declarations/adapter/-private/utils/parse-response-headers.d.ts.map +0 -1
  95. package/declarations/adapter/-private/utils/serialize-into-hash.d.ts.map +0 -1
  96. package/declarations/adapter/-private/utils/serialize-query-params.d.ts.map +0 -1
  97. package/declarations/adapter/-private.d.ts.map +0 -1
  98. package/declarations/adapter/error.d.ts.map +0 -1
  99. package/declarations/adapter/json-api.d.ts.map +0 -1
  100. package/declarations/adapter/rest.d.ts.map +0 -1
  101. package/declarations/adapter.d.ts.map +0 -1
  102. package/declarations/compat/-private.d.ts.map +0 -1
  103. package/declarations/compat/builders/find-all.d.ts.map +0 -1
  104. package/declarations/compat/builders/find-record.d.ts.map +0 -1
  105. package/declarations/compat/builders/query.d.ts.map +0 -1
  106. package/declarations/compat/builders/save-record.d.ts.map +0 -1
  107. package/declarations/compat/builders/utils.d.ts.map +0 -1
  108. package/declarations/compat/builders.d.ts.map +0 -1
  109. package/declarations/compat/extensions.d.ts.map +0 -1
  110. package/declarations/compat/legacy-network-handler/fetch-manager.d.ts.map +0 -1
  111. package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts.map +0 -1
  112. package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts.map +0 -1
  113. package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts.map +0 -1
  114. package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts.map +0 -1
  115. package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts.map +0 -1
  116. package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts.map +0 -1
  117. package/declarations/compat/legacy-network-handler/serializer-response.d.ts.map +0 -1
  118. package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts.map +0 -1
  119. package/declarations/compat/legacy-network-handler/snapshot.d.ts.map +0 -1
  120. package/declarations/compat/utils.d.ts.map +0 -1
  121. package/declarations/compat.d.ts.map +0 -1
  122. package/declarations/model/-private/attr.d.ts.map +0 -1
  123. package/declarations/model/-private/attr.type-test.d.ts +0 -2
  124. package/declarations/model/-private/attr.type-test.d.ts.map +0 -1
  125. package/declarations/model/-private/belongs-to.d.ts.map +0 -1
  126. package/declarations/model/-private/belongs-to.type-test.d.ts +0 -2
  127. package/declarations/model/-private/belongs-to.type-test.d.ts.map +0 -1
  128. package/declarations/model/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  129. package/declarations/model/-private/errors.d.ts.map +0 -1
  130. package/declarations/model/-private/has-many.d.ts.map +0 -1
  131. package/declarations/model/-private/has-many.type-test.d.ts +0 -2
  132. package/declarations/model/-private/has-many.type-test.d.ts.map +0 -1
  133. package/declarations/model/-private/hooks.d.ts.map +0 -1
  134. package/declarations/model/-private/legacy-relationships-support.d.ts.map +0 -1
  135. package/declarations/model/-private/model-for-mixin.d.ts.map +0 -1
  136. package/declarations/model/-private/model-methods.d.ts.map +0 -1
  137. package/declarations/model/-private/model.d.ts.map +0 -1
  138. package/declarations/model/-private/model.type-test.d.ts +0 -2
  139. package/declarations/model/-private/model.type-test.d.ts.map +0 -1
  140. package/declarations/model/-private/notify-changes.d.ts.map +0 -1
  141. package/declarations/model/-private/promise-belongs-to.d.ts.map +0 -1
  142. package/declarations/model/-private/promise-many-array.d.ts.map +0 -1
  143. package/declarations/model/-private/promise-proxy-base.d.ts +0 -3
  144. package/declarations/model/-private/promise-proxy-base.d.ts.map +0 -1
  145. package/declarations/model/-private/record-state.d.ts.map +0 -1
  146. package/declarations/model/-private/references/belongs-to.d.ts.map +0 -1
  147. package/declarations/model/-private/references/has-many.d.ts.map +0 -1
  148. package/declarations/model/-private/schema-provider.d.ts.map +0 -1
  149. package/declarations/model/-private/type-utils.d.ts.map +0 -1
  150. package/declarations/model/-private/util.d.ts.map +0 -1
  151. package/declarations/model/-private.d.ts.map +0 -1
  152. package/declarations/model/migration-support.d.ts.map +0 -1
  153. package/declarations/model/migration-support.type-test.d.ts +0 -2
  154. package/declarations/model/migration-support.type-test.d.ts.map +0 -1
  155. package/declarations/model.d.ts.map +0 -1
  156. package/declarations/serializer/-private/embedded-records-mixin.d.ts.map +0 -1
  157. package/declarations/serializer/-private/transforms/boolean.d.ts.map +0 -1
  158. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts +0 -2
  159. package/declarations/serializer/-private/transforms/boolean.type-test.d.ts.map +0 -1
  160. package/declarations/serializer/-private/transforms/date.d.ts.map +0 -1
  161. package/declarations/serializer/-private/transforms/number.d.ts.map +0 -1
  162. package/declarations/serializer/-private/transforms/string.d.ts.map +0 -1
  163. package/declarations/serializer/-private/transforms/transform.d.ts.map +0 -1
  164. package/declarations/serializer/-private/utils.d.ts.map +0 -1
  165. package/declarations/serializer/json-api.d.ts.map +0 -1
  166. package/declarations/serializer/json.d.ts.map +0 -1
  167. package/declarations/serializer/rest.d.ts.map +0 -1
  168. package/declarations/serializer/transform.d.ts.map +0 -1
  169. package/declarations/serializer.d.ts.map +0 -1
  170. package/dist/-private-DFfBszo5.js.map +0 -1
  171. package/dist/adapter/-private.js.map +0 -1
  172. package/dist/adapter/error.js.map +0 -1
  173. package/dist/adapter/json-api.js.map +0 -1
  174. package/dist/adapter/rest.js.map +0 -1
  175. package/dist/adapter.js.map +0 -1
  176. package/dist/compat/-private.js.map +0 -1
  177. package/dist/compat/builders.js.map +0 -1
  178. package/dist/compat/extensions.js.map +0 -1
  179. package/dist/compat/utils.js.map +0 -1
  180. package/dist/compat.js.map +0 -1
  181. package/dist/errors-_QQ7xpSn.js.map +0 -1
  182. package/dist/json-DSOlH9A8.js.map +0 -1
  183. package/dist/model/-private.js.map +0 -1
  184. package/dist/model/migration-support.js.map +0 -1
  185. package/dist/model.js.map +0 -1
  186. package/dist/runtime-BPCpkOf1-BKOwiRJp.js.map +0 -1
  187. package/dist/schema-provider-D_P8ReX6.js.map +0 -1
  188. package/dist/serialize-into-hash-BxfqWC8u.js.map +0 -1
  189. package/dist/serializer/json-api.js.map +0 -1
  190. package/dist/serializer/json.js.map +0 -1
  191. package/dist/serializer/rest.js.map +0 -1
  192. package/dist/serializer/transform.js.map +0 -1
  193. package/dist/serializer.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-provider-D_P8ReX6.js","sources":["../src/model/-private/util.ts","../src/model/-private/model-methods.ts","../src/model/-private/notify-changes.ts","../src/model/-private/record-state.ts","../src/model/-private/model.ts","../src/model/-private/model-for-mixin.ts","../src/model/-private/schema-provider.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/core/build-config/deprecations';\nimport { dasherize } from '@warp-drive/utilities/string';\n\nexport type DecoratorPropertyDescriptor = (PropertyDescriptor & { initializer?: () => unknown }) | undefined;\n\nexport function isElementDescriptor(args: unknown[]): args is [object, string, DecoratorPropertyDescriptor] {\n const [maybeTarget, maybeKey, maybeDesc] = args;\n\n return (\n // Ensure we have the right number of args\n args.length === 3 &&\n // Make sure the target is a class or object (prototype)\n (typeof maybeTarget === 'function' || (typeof maybeTarget === 'object' && maybeTarget !== null)) &&\n // Make sure the key is a string\n typeof maybeKey === 'string' &&\n // Make sure the descriptor is the right shape\n ((typeof maybeDesc === 'object' &&\n maybeDesc !== null &&\n 'enumerable' in maybeDesc &&\n 'configurable' in maybeDesc) ||\n // TS compatibility\n maybeDesc === undefined)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n","import type { Store } from '@warp-drive/core';\nimport { recordIdentifierFor } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { peekCache } from '@warp-drive/core/store/-private';\nimport type { ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport { RecordStore } from '@warp-drive/core/types/symbols';\n\nimport type { Snapshot } from '../../compat/-private.ts';\nimport { FetchManager, upgradeStore } from '../../compat/-private.ts';\nimport type { Errors } from './errors.ts';\nimport { lookupLegacySupport } from './legacy-relationships-support.ts';\nimport type RecordState from './record-state.ts';\nimport type BelongsToReference from './references/belongs-to.ts';\nimport type HasManyReference from './references/has-many.ts';\nimport type { MaybeBelongsToFields, MaybeHasManyFields } from './type-utils.ts';\n\nexport interface MinimalLegacyRecord {\n errors: Errors;\n ___recordState: RecordState;\n currentState: RecordState;\n isDestroyed: boolean;\n isDestroying: boolean;\n isReloading: boolean;\n isValid: boolean;\n [RecordStore]: Store;\n\n deleteRecord(): void;\n unloadRecord(): void;\n save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n}\n\nexport function rollbackAttributes<T extends MinimalLegacyRecord>(this: T) {\n const { currentState } = this;\n const { isNew } = currentState;\n\n this[RecordStore]._join(() => {\n peekCache(this).rollbackAttrs(recordIdentifierFor(this));\n this.errors.clear();\n currentState.cleanErrorRequests();\n if (isNew) {\n this.unloadRecord();\n }\n });\n}\n\nexport function unloadRecord<T extends MinimalLegacyRecord>(this: T) {\n if (this.currentState.isNew && (this.isDestroyed || this.isDestroying)) {\n return;\n }\n this[RecordStore].unloadRecord(this);\n}\n\nexport function belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(\n this: T,\n prop: K\n): BelongsToReference<T, K> {\n return lookupLegacySupport(this).referenceFor('belongsTo', prop) as BelongsToReference<T, K>;\n}\n\nexport function hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(\n this: T,\n prop: K\n): HasManyReference<T, K> {\n return lookupLegacySupport(this).referenceFor('hasMany', prop) as HasManyReference<T, K>;\n}\n\nexport function reload<T extends MinimalLegacyRecord>(this: T, options: Record<string, unknown> = {}): Promise<T> {\n options.isReloading = true;\n options.reload = true;\n\n const identifier = recordIdentifierFor(this);\n assert(`You cannot reload a record without an ID`, identifier.id);\n\n this.isReloading = true;\n const promise = this[RecordStore].request({\n op: 'findRecord',\n data: {\n options,\n record: identifier,\n },\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n })\n .then(() => this)\n .finally(() => {\n this.isReloading = false;\n });\n\n return promise;\n}\n\nexport function changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash {\n return peekCache(this).changedAttrs(recordIdentifierFor(this));\n}\n\nexport function serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown {\n upgradeStore(this[RecordStore]);\n return this[RecordStore].serializeRecord(this, options);\n}\n\nexport function deleteRecord<T extends MinimalLegacyRecord>(this: T): void {\n // ensure we've populated currentState prior to deleting a new record\n if (this.currentState) {\n this[RecordStore].deleteRecord(this);\n }\n}\n\nexport function save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n let promise: Promise<T>;\n\n if (this.currentState.isNew && this.currentState.isDeleted) {\n promise = Promise.resolve(this);\n } else {\n this.errors.clear();\n promise = this[RecordStore].saveRecord(this, options);\n }\n\n return promise;\n}\n\nexport function destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n const { isNew } = this.currentState;\n this.deleteRecord();\n if (isNew) {\n return Promise.resolve(this);\n }\n return this.save(options).then((_) => {\n this.unloadRecord();\n return this;\n });\n}\n\nexport function createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T> {\n const store = this[RecordStore];\n\n upgradeStore(store);\n if (!store._fetchManager) {\n store._fetchManager = new FetchManager(store);\n }\n\n // @ts-expect-error Typescript isn't able to curry narrowed args that are divorced from each other.\n return store._fetchManager.createSnapshot<T>(recordIdentifierFor(this));\n}\n","import { cacheFor } from '@ember/object/internals';\n\nimport type { NotificationType, Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport {\n ARRAY_SIGNAL,\n notifyInternalSignal,\n peekInternalSignal,\n withSignalStore,\n} from '@warp-drive/core/store/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core/types/schema/fields';\n\nimport { LEGACY_SUPPORT } from './legacy-relationships-support.ts';\nimport type { Model } from './model.ts';\n\nexport default function notifyChanges(\n identifier: StableRecordIdentifier,\n value: NotificationType,\n key: string | undefined,\n record: Model,\n store: Store\n) {\n switch (value) {\n case 'added':\n case 'attributes':\n if (key) {\n notifyAttribute(store, identifier, key, record);\n } else {\n record.eachAttribute((name) => {\n notifyAttribute(store, identifier, name, record);\n });\n }\n break;\n\n case 'relationships':\n if (key) {\n const meta = (record.constructor as typeof Model).relationshipsByName.get(key);\n assert(`Expected to find a relationship for ${key} on ${identifier.type}`, meta);\n notifyRelationship(identifier, key, record, meta);\n } else {\n record.eachRelationship((name, meta) => {\n notifyRelationship(identifier, name, record, meta);\n });\n }\n break;\n\n case 'identity':\n notifyInternalSignal(peekInternalSignal(withSignalStore(record), 'id'));\n break;\n }\n}\n\nfunction notifyRelationship(identifier: StableRecordIdentifier, key: string, record: Model, meta: RelationshipSchema) {\n if (meta.kind === 'belongsTo') {\n record.notifyPropertyChange(key);\n } else if (meta.kind === 'hasMany') {\n const support = LEGACY_SUPPORT.get(identifier);\n const manyArray = support && support._manyArrayCache[key];\n const hasPromise = support && support._relationshipPromisesCache[key];\n\n if (manyArray && hasPromise) {\n // do nothing, we will notify the ManyArray directly\n // once the fetch has completed.\n return;\n }\n\n if (manyArray) {\n notifyInternalSignal(manyArray[ARRAY_SIGNAL]);\n\n //We need to notifyPropertyChange in the adding case because we need to make sure\n //we fetch the newly added record in case it is unloaded\n //TODO(Igor): Consider whether we could do this only if the record state is unloaded\n assert(`Expected options to exist on relationship meta`, meta.options);\n assert(`Expected async to exist on relationship meta options`, 'async' in meta.options);\n if (meta.options.async) {\n record.notifyPropertyChange(key);\n }\n }\n }\n}\n\nfunction notifyAttribute(store: Store, identifier: StableRecordIdentifier, key: string, record: Model) {\n const currentValue = cacheFor(record, key);\n const cache = store.cache;\n if (currentValue !== cache.getAttr(identifier, key)) {\n record.notifyPropertyChange(key);\n }\n}\n","import type { NotificationType, Store } from '@warp-drive/core';\nimport { storeFor } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { RequestCacheRequestState, RequestStateService } from '@warp-drive/core/store/-private';\nimport {\n defineSignal,\n gate,\n memoized,\n notifyInternalSignal,\n peekInternalSignal,\n recordIdentifierFor,\n withSignalStore,\n} from '@warp-drive/core/store/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\n\nimport type { Errors } from './errors';\nimport type { MinimalLegacyRecord } from './model-methods';\n\nconst SOURCE_POINTER_REGEXP = /^\\/?data\\/(attributes|relationships)\\/(.*)/;\nconst SOURCE_POINTER_PRIMARY_REGEXP = /^\\/?data/;\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\nfunction isInvalidError(error: unknown): error is Error & { isAdapterError: true; code: 'InvalidError' } {\n return (\n !!error &&\n error instanceof Error &&\n 'isAdapterError' in error &&\n error.isAdapterError === true &&\n 'code' in error &&\n error.code === 'InvalidError'\n );\n}\n\n/**\nHistorically EmberData managed a state machine\nfor each record, the localState for which\nwas reflected onto Model.\n\nThis implements the flags and stateName for backwards compat\nwith the state tree that used to be possible (listed below).\n\nstateName and dirtyType are candidates for deprecation.\n\nroot\n empty\n deleted // hidden from stateName\n preloaded // hidden from stateName\n\n loading\n empty // hidden from stateName\n preloaded // hidden from stateName\n\n loaded\n saved\n updated\n uncommitted\n invalid\n inFlight\n created\n uncommitted\n invalid\n inFlight\n\n deleted\n saved\n new // hidden from stateName\n uncommitted\n invalid\n inFlight\n\n @internal\n*/\nexport default class RecordState {\n declare store: Store;\n declare identifier: StableRecordIdentifier;\n declare record: MinimalLegacyRecord;\n declare rs: RequestStateService;\n\n declare pendingCount: number;\n declare fulfilledCount: number;\n declare rejectedCount: number;\n declare cache: Cache;\n declare _errorRequests: RequestCacheRequestState[];\n declare _lastError: RequestCacheRequestState | null;\n declare handler: object;\n\n constructor(record: MinimalLegacyRecord) {\n const store = storeFor(record)!;\n const identity = recordIdentifierFor(record);\n\n this.identifier = identity;\n this.record = record;\n this.cache = store.cache;\n\n this.pendingCount = 0;\n this.fulfilledCount = 0;\n this.rejectedCount = 0;\n this._errorRequests = [];\n this._lastError = null;\n\n const requests = store.getRequestStateService();\n const notifications = store.notifications;\n\n const handleRequest = (req: RequestCacheRequestState) => {\n if (req.type === 'mutation') {\n switch (req.state) {\n case 'pending':\n this.isSaving = true;\n break;\n case 'rejected':\n this.isSaving = false;\n this._lastError = req;\n if (!(req.response && isInvalidError(req.response.data))) {\n this._errorRequests.push(req);\n }\n\n notifyErrorsStateChanged(this);\n break;\n case 'fulfilled':\n this._errorRequests = [];\n this._lastError = null;\n this.isSaving = false;\n this.notify('isDirty');\n notifyErrorsStateChanged(this);\n break;\n }\n } else {\n switch (req.state) {\n case 'pending':\n this.pendingCount++;\n this.notify('isLoading');\n break;\n case 'rejected':\n this.pendingCount--;\n this._lastError = req;\n if (!(req.response && isInvalidError(req.response.data))) {\n this._errorRequests.push(req);\n }\n this.notify('isLoading');\n notifyErrorsStateChanged(this);\n break;\n case 'fulfilled':\n this.pendingCount--;\n this.fulfilledCount++;\n this.notify('isLoading');\n this.notify('isDirty');\n notifyErrorsStateChanged(this);\n this._errorRequests = [];\n this._lastError = null;\n break;\n }\n }\n };\n\n requests.subscribeForRecord(identity, handleRequest);\n\n // we instantiate lazily\n // so we grab anything we don't have yet\n const lastRequest = requests.getLastRequestForRecord(identity);\n if (lastRequest) {\n handleRequest(lastRequest);\n }\n\n this.handler = notifications.subscribe(\n identity,\n (identifier: StableRecordIdentifier, type: NotificationType, key?: string) => {\n switch (type) {\n case 'state':\n this.notify('isSaved');\n this.notify('isNew');\n this.notify('isDeleted');\n this.notify('isDirty');\n break;\n case 'attributes':\n this.notify('isEmpty');\n this.notify('isDirty');\n break;\n case 'errors':\n this.updateInvalidErrors(this.record.errors);\n this.notify('isValid');\n break;\n }\n }\n );\n }\n\n destroy() {\n storeFor(this.record)!.notifications.unsubscribe(this.handler);\n }\n\n notify(key: keyof this & string) {\n const signals = withSignalStore(this);\n const signal = peekInternalSignal(signals, key);\n if (signal) {\n notifyInternalSignal(signal);\n }\n }\n\n updateInvalidErrors(errors: Errors) {\n assert(\n `Expected the Cache instance for ${this.identifier.lid} to implement getErrors(identifier)`,\n typeof this.cache.getErrors === 'function'\n );\n const jsonApiErrors = this.cache.getErrors(this.identifier);\n\n errors.clear();\n\n for (let i = 0; i < jsonApiErrors.length; i++) {\n const error = jsonApiErrors[i];\n\n if (error.source && error.source.pointer) {\n const keyMatch = error.source.pointer.match(SOURCE_POINTER_REGEXP);\n let key: string | undefined;\n\n if (keyMatch) {\n key = keyMatch[2];\n } else if (error.source.pointer.search(SOURCE_POINTER_PRIMARY_REGEXP) !== -1) {\n key = PRIMARY_ATTRIBUTE_KEY;\n }\n\n if (key) {\n const errMsg = error.detail || error.title;\n assert(`Expected field error to have a detail or title to use as the message`, errMsg);\n errors.add(key, errMsg);\n }\n }\n }\n }\n\n cleanErrorRequests() {\n this.notify('isValid');\n this.notify('isError');\n this.notify('adapterError');\n this._errorRequests = [];\n this._lastError = null;\n }\n\n declare isSaving: boolean;\n\n @gate\n get isLoading() {\n return !this.isLoaded && this.pendingCount > 0 && this.fulfilledCount === 0;\n }\n\n @gate\n get isLoaded() {\n if (this.isNew) {\n return true;\n }\n return this.fulfilledCount > 0 || !this.isEmpty;\n }\n\n @gate\n get isSaved() {\n const rd = this.cache;\n if (this.isDeleted) {\n assert(`Expected Cache to implement isDeletionCommitted()`, typeof rd.isDeletionCommitted === 'function');\n return rd.isDeletionCommitted(this.identifier);\n }\n if (this.isNew || this.isEmpty || !this.isValid || this.isDirty || this.isLoading) {\n return false;\n }\n return true;\n }\n\n @gate\n get isEmpty() {\n const rd = this.cache;\n // TODO this is not actually an RFC'd concept. Determine the\n // correct heuristic to replace this with.\n assert(`Expected Cache to implement isEmpty()`, typeof rd.isEmpty === 'function');\n return !this.isNew && rd.isEmpty(this.identifier);\n }\n\n @gate\n get isNew() {\n const rd = this.cache;\n assert(`Expected Cache to implement isNew()`, typeof rd.isNew === 'function');\n return rd.isNew(this.identifier);\n }\n\n @gate\n get isDeleted() {\n const rd = this.cache;\n assert(`Expected Cache to implement isDeleted()`, typeof rd.isDeleted === 'function');\n return rd.isDeleted(this.identifier);\n }\n\n @gate\n get isValid() {\n return this.record.errors.length === 0;\n }\n\n @gate\n get isDirty() {\n const rd = this.cache;\n if (this.isEmpty || rd.isDeletionCommitted(this.identifier) || (this.isDeleted && this.isNew)) {\n return false;\n }\n return this.isDeleted || this.isNew || rd.hasChangedAttrs(this.identifier);\n }\n\n @gate\n get isError() {\n const errorReq = this._errorRequests[this._errorRequests.length - 1];\n if (!errorReq) {\n return false;\n } else {\n return true;\n }\n }\n\n @gate\n get adapterError() {\n const request = this._lastError;\n if (!request) {\n return null;\n }\n return request.state === 'rejected' && request.response!.data;\n }\n\n @memoized\n get isPreloaded() {\n return !this.isEmpty && this.isLoading;\n }\n\n @memoized\n get stateName() {\n // we might be empty while loading so check this first\n if (this.isLoading) {\n return 'root.loading';\n\n // got nothing yet or were unloaded\n } else if (this.isEmpty) {\n return 'root.empty';\n\n // deleted substates\n } else if (this.isDeleted) {\n if (this.isSaving) {\n return 'root.deleted.inFlight';\n } else if (this.isSaved) {\n // TODO ensure isSaved isn't true from previous requests\n return 'root.deleted.saved';\n } else if (!this.isValid) {\n return 'root.deleted.invalid';\n } else {\n return 'root.deleted.uncommitted';\n }\n\n // loaded.created substates\n } else if (this.isNew) {\n if (this.isSaving) {\n return 'root.loaded.created.inFlight';\n } else if (!this.isValid) {\n return 'root.loaded.created.invalid';\n }\n return 'root.loaded.created.uncommitted';\n\n // loaded.updated substates\n } else if (this.isSaving) {\n return 'root.loaded.updated.inFlight';\n } else if (!this.isValid) {\n return 'root.loaded.updated.invalid';\n } else if (this.isDirty) {\n return 'root.loaded.updated.uncommitted';\n\n // if nothing remains, we are loaded saved!\n } else {\n return 'root.loaded.saved';\n }\n }\n\n @memoized\n get dirtyType() {\n // we might be empty while loading so check this first\n if (this.isLoading || this.isEmpty) {\n return '';\n\n // deleted substates\n } else if (this.isDirty && this.isDeleted) {\n return 'deleted';\n\n // loaded.created substates\n } else if (this.isNew) {\n return 'created';\n\n // loaded.updated substates\n } else if (this.isSaving || !this.isValid || this.isDirty) {\n return 'updated';\n\n // if nothing remains, we are loaded saved!\n } else {\n return '';\n }\n }\n}\ndefineSignal(RecordState.prototype, 'isSaving', false);\n\nfunction notifyErrorsStateChanged(state: RecordState) {\n state.notify('isValid');\n state.notify('isError');\n state.notify('adapterError');\n}\n","import EmberObject from '@ember/object';\n\nimport type { NotificationType, Store } from '@warp-drive/core';\nimport { recordIdentifierFor, storeFor } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport {\n coerceId,\n defineSignal,\n entangleSignal,\n gate,\n memoized,\n withSignalStore,\n} from '@warp-drive/core/store/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types';\nimport type { Cache, ChangedAttributesHash } from '@warp-drive/core/types/cache';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core/types/schema/fields';\nimport { RecordStore } from '@warp-drive/core/types/symbols';\n\nimport type { Snapshot } from '../../compat/-private.ts';\nimport { Errors } from './errors.ts';\nimport { LEGACY_SUPPORT } from './legacy-relationships-support.ts';\nimport type { MinimalLegacyRecord } from './model-methods.ts';\nimport {\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './model-methods.ts';\nimport notifyChanges from './notify-changes.ts';\nimport RecordState from './record-state.ts';\nimport type BelongsToReference from './references/belongs-to.ts';\nimport type HasManyReference from './references/has-many.ts';\nimport type {\n _MaybeBelongsToFields,\n isSubClass,\n MaybeAttrFields,\n MaybeHasManyFields,\n MaybeRelationshipFields,\n} from './type-utils.ts';\n\nexport type ModelCreateArgs = {\n _createProps: Record<string, unknown>;\n // TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for\n _secretInit: {\n identifier: StableRecordIdentifier;\n cache: Cache;\n store: Store;\n cb: (record: Model, cache: Cache, identifier: StableRecordIdentifier, store: Store) => void;\n };\n};\n\nexport type StaticModel = typeof Model & { create(options: ModelCreateArgs): Model };\nexport type ModelFactory = { class: StaticModel };\nexport type FactoryCache = Record<string, ModelFactory>;\n// we put this on the store for interop because it's used by modelFor and\n// instantiateRecord as well.\nexport type ModelStore = Store & { _modelFactoryCache: FactoryCache };\n\n/*\n * This decorator allows us to lazily compute\n * an expensive getter on first-access and thereafter\n * never recompute it.\n */\nfunction computeOnce(target: object, propertyName: string, desc: PropertyDescriptor) {\n const cache = new WeakMap<object, { hasComputed: boolean; value: unknown }>();\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const getter = desc.get;\n desc.get = function () {\n let meta = cache.get(this);\n\n if (!meta) {\n meta = { hasComputed: false, value: undefined };\n cache.set(this, meta);\n }\n\n if (!meta.hasComputed) {\n meta.value = (getter as () => unknown).call(this);\n meta.hasComputed = true;\n }\n\n return meta.value;\n };\n return desc;\n}\n\n/**\n * @noInheritDoc\n */\ninterface Model {\n /**\n Create a JSON representation of the record, using the serialization\n strategy of the store's adapter.\n\n `serialize` takes an optional hash as a parameter, currently\n supported options are:\n\n - `includeId`: `true` if the record's ID should be included in the\n JSON representation.\n\n @public\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n */\n serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown;\n\n /**\n Same as `deleteRecord`, but saves the record immediately.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n delete = () => {\n this.args.model.destroyRecord().then(function() {\n this.transitionToRoute('model.index');\n });\n }\n }\n ```\n\n If you pass an object on the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot\n\n ```js\n record.destroyRecord({ adapterOptions: { subscribe: false } });\n ```\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n deleteRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @public\n @param {Object} options\n @return {Promise} a promise that will be resolved when the adapter returns\n successfully or rejected if the adapter returns with an error.\n */\n destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n\n /**\n Unloads the record from the store. This will not send a delete request\n to your server, it just unloads the record from memory.\n\n @public\n */\n unloadRecord<T extends MinimalLegacyRecord>(this: T): void;\n\n /**\n Returns an object, whose keys are changed properties, and value is\n an [oldProp, newProp] array.\n\n The array represents the diff of the canonical state with the local state\n of the model. Note: if the model is created locally, the canonical state is\n empty since the adapter hasn't acknowledged the attributes yet:\n\n Example\n\n ```js [app/models/mascot.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class MascotModel extends Model {\n @attr('string') name;\n @attr('boolean', {\n defaultValue: false\n })\n isAdmin;\n }\n ```\n\n ```javascript\n let mascot = store.createRecord('mascot');\n\n mascot.changedAttributes(); // {}\n\n mascot.set('name', 'Tomster');\n mascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\n mascot.set('isAdmin', true);\n mascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\n mascot.save().then(function() {\n mascot.changedAttributes(); // {}\n\n mascot.set('isAdmin', false);\n mascot.changedAttributes(); // { isAdmin: [true, false] }\n });\n ```\n\n @public\n @return {Object} an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.\n */\n changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash;\n\n /**\n If the model `hasDirtyAttributes` this function will discard any unsaved\n changes. If the model `isNew` it will be removed from the store.\n\n Example\n\n ```javascript\n record.name; // 'Untitled Document'\n record.set('name', 'Doc 1');\n record.name; // 'Doc 1'\n record.rollbackAttributes();\n record.name; // 'Untitled Document'\n ```\n\n @since 1.13.0\n @public\n */\n rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;\n\n // TODO @deprecate in favor of a public API or examples of how to test successfully\n /**\n @private\n */\n _createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T>;\n\n /**\n Save the record and persist any changes to the record to an\n external source via the adapter.\n\n Example\n\n ```javascript\n record.set('name', 'Tomster');\n record.save().then(function() {\n // Success callback\n }, function() {\n // Error callback\n });\n ```\n\n If you pass an object using the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot.\n\n ```js\n record.save({ adapterOptions: { subscribe: false } });\n ```\n\n ```js [app/adapters/post.js]\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n updateRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @public\n @param {Object} options\n @return {Promise} a promise that will be resolved when the adapter returns\n successfully or rejected if the adapter returns with an error.\n */\n save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n\n /**\n Reload the record from the adapter.\n\n This will only work if the record has already finished loading.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n async reload = () => {\n await this.args.model.reload();\n // do something with the reloaded model\n }\n }\n ```\n\n @public\n @param {Object} options optional, may include `adapterOptions` hash which will be passed to adapter request\n\n @return {Promise} a promise that will be resolved with the record when the\n adapter returns successfully or rejected if the adapter returns\n with an error.\n */\n\n reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;\n\n // belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(\n // this: T,\n // prop: K\n // ): BelongsToReference<T, K>;\n\n /**\n Get the reference for the specified belongsTo relationship.\n\n For instance, given the following model\n\n ```js [app/models/blog-post.js]\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogPost extends Model {\n @belongsTo('user', { async: true, inverse: null }) author;\n }\n ```\n\n Then the reference for the author relationship would be\n retrieved from a record instance like so:\n\n ```js\n blogPost.belongsTo('author');\n ```\n\n A `BelongsToReference` is a low-level API that allows access\n and manipulation of a belongsTo relationship.\n\n It is especially useful when you're dealing with `async` relationships\n as it allows synchronous access to the relationship data if loaded, as\n well as APIs for loading, reloading the data or accessing available\n information without triggering a load.\n\n It may also be useful when using `sync` relationships that need to be\n loaded/reloaded with more precise timing than marking the\n relationship as `async` and relying on autofetch would have allowed.\n\n However,keep in mind that marking a relationship as `async: false` will introduce\n bugs into your application if the data is not always guaranteed to be available\n by the time the relationship is accessed. Ergo, it is recommended when using this\n approach to utilize `links` for unloaded relationship state instead of identifiers.\n\n Reference APIs are entangled with the relationship's underlying state,\n thus any getters or cached properties that utilize these will properly\n invalidate if the relationship state changes.\n\n References are \"stable\", meaning that multiple calls to retrieve the reference\n for a given relationship will always return the same HasManyReference.\n\n @public\n @param {String} name of the relationship\n @since 2.5.0\n @return {BelongsToReference} reference for this relationship\n */\n belongsTo<T extends Model, K extends keyof T & string>(\n this: T,\n prop: K & (K extends _MaybeBelongsToFields<T> ? K : never)\n ): BelongsToReference<T, K>;\n\n /**\n Get the reference for the specified hasMany relationship.\n\n For instance, given the following model\n\n ```js [app/models/blog-post.js]\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogPost extends Model {\n @hasMany('comment', { async: true, inverse: null }) comments;\n }\n ```\n\n Then the reference for the comments relationship would be\n retrieved from a record instance like so:\n\n ```js\n blogPost.hasMany('comments');\n ```\n\n A `HasManyReference` is a low-level API that allows access\n and manipulation of a hasMany relationship.\n\n It is especially useful when you are dealing with `async` relationships\n as it allows synchronous access to the relationship data if loaded, as\n well as APIs for loading, reloading the data or accessing available\n information without triggering a load.\n\n It may also be useful when using `sync` relationships with `@ember-data/model`\n that need to be loaded/reloaded with more precise timing than marking the\n relationship as `async` and relying on autofetch would have allowed.\n\n However,keep in mind that marking a relationship as `async: false` will introduce\n bugs into your application if the data is not always guaranteed to be available\n by the time the relationship is accessed. Ergo, it is recommended when using this\n approach to utilize `links` for unloaded relationship state instead of identifiers.\n\n Reference APIs are entangled with the relationship's underlying state,\n thus any getters or cached properties that utilize these will properly\n invalidate if the relationship state changes.\n\n References are \"stable\", meaning that multiple calls to retrieve the reference\n for a given relationship will always return the same HasManyReference.\n\n @public\n @param {String} name of the relationship\n @since 2.5.0\n @return {HasManyReference} reference for this relationship\n */\n hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(this: T, prop: K): HasManyReference<T, K>;\n\n /**\n Marks the record as deleted but does not save it. You must call\n `save` afterwards if you want to persist it. You might use this\n method if you want to allow the user to still `rollbackAttributes()`\n after a delete was made.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n softDelete = () => {\n this.args.model.deleteRecord();\n }\n\n confirm = () => {\n this.args.model.save();\n }\n\n undo = () => {\n this.args.model.rollbackAttributes();\n }\n }\n ```\n\n @public\n */\n deleteRecord<T extends MinimalLegacyRecord>(this: T): void;\n}\n\n/**\n * Base class from which Models can be defined.\n *\n * ::: code-group\n *\n * ```js [app/models/user.js]\n * import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';\n *\n * export default class User extends Model {\n * @attr name;\n * @attr('number') age;\n * @hasMany('post', { async: true, inverse: null }) posts;\n * @belongsTo('group', { async: false, inverse: 'users' }) group;\n * }\n * ```\n *\n * ```ts [app/models/user.ts]\n * import { Model, attr, belongsTo, hasMany, type AsyncHasMany } from '@warp-drive/legacy/model';\n * import type { NumberTransform } from '@ember-data/serializer/transform';\n * import type Group from './group';\n * import type Post from './post';\n *\n * export default class User extends Model {\n * @attr declare name: string;\n *\n * @attr<NumberTransform>('number')\n * declare age: number;\n *\n * @hasMany('post', { async: true, inverse: null })\n * declare posts: AsyncHasMany<Post>;\n *\n * @belongsTo('group', { async: false, inverse: 'users' })\n * declare group: Group | null;\n * }\n * ```\n *\n * :::\n *\n * Models both define the schema for a resource type and provide\n * the class to use as the reactive object for data of resource\n * of that type.\n *\n * @noInheritDoc\n */\nclass Model extends EmberObject implements MinimalLegacyRecord {\n // set during create by the store\n /**\n * The store service instance which created this record instance\n */\n declare store: Store;\n /** @internal */\n declare ___recordState: RecordState;\n /** @internal */\n declare ___private_notifications: object;\n /** @internal */\n declare [RecordStore]: Store;\n\n /** @internal */\n init(options: ModelCreateArgs) {\n if (DEBUG) {\n if (!options?._secretInit && !options?._createProps) {\n throw new Error(\n 'You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'\n );\n }\n }\n const createProps = options._createProps;\n const _secretInit = options._secretInit;\n (options as Record<string, unknown>)._createProps = null;\n (options as Record<string, unknown>)._secretInit = null;\n\n const store = (this.store = _secretInit.store);\n super.init(options);\n\n this[RecordStore] = store;\n\n const identity = _secretInit.identifier;\n _secretInit.cb(this, _secretInit.cache, identity, _secretInit.store);\n\n this.___recordState = DEBUG\n ? new RecordState(this as unknown as MinimalLegacyRecord)\n : (null as unknown as RecordState);\n\n this.setProperties(createProps);\n\n const notifications = store.notifications;\n this.___private_notifications = notifications.subscribe(\n identity,\n (identifier: StableRecordIdentifier, type: NotificationType, field?: string): void => {\n notifyChanges(identifier, type, field, this, store);\n }\n );\n }\n\n /** @internal */\n // @ts-expect-error destroy should not return a value, but ember's types force it to\n destroy(): this {\n const identifier = recordIdentifierFor(this);\n this.___recordState?.destroy();\n const store = storeFor(this)!;\n store.notifications.unsubscribe(this.___private_notifications);\n\n LEGACY_SUPPORT.get(this as unknown as MinimalLegacyRecord)?.destroy();\n LEGACY_SUPPORT.delete(this as unknown as MinimalLegacyRecord);\n LEGACY_SUPPORT.delete(identifier);\n\n super.destroy();\n }\n\n /**\n If this property is `true` the record is in the `empty`\n state. Empty is the first state all records enter after they have\n been created. Most records created by the store will quickly\n transition to the `loading` state if data needs to be fetched from\n the server or the `created` state if the record is created on the\n client. A record can also enter the empty state if the adapter is\n unable to locate the record.\n\n @property isEmpty\n @public\n @readonly\n */\n @memoized\n get isEmpty(): boolean {\n return this.currentState.isEmpty;\n }\n\n /**\n If this property is `true` the record is in the `loading` state. A\n record enters this state when the store asks the adapter for its\n data. It remains in this state until the adapter provides the\n requested data.\n\n @property isLoading\n @public\n @readonly\n */\n @memoized\n get isLoading(): boolean {\n return this.currentState.isLoading;\n }\n\n /**\n If this property is `true` the record is in the `loaded` state. A\n record enters this state when its data is populated. Most of a\n record's lifecycle is spent inside substates of the `loaded`\n state.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isLoaded; // true\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n model.isLoaded;\n ```\n\n @property isLoaded\n @public\n @readonly\n */\n @memoized\n get isLoaded(): boolean {\n return this.currentState.isLoaded;\n }\n\n /**\n If this property is `true` the record is in the `dirty` state. The\n record has local changes that have not yet been saved by the\n adapter. This includes records that have been created (but not yet\n saved) or deleted.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.hasDirtyAttributes; // true\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n\n model.hasDirtyAttributes; // false\n model.foo = 'some value';\n model.hasDirtyAttributes; // true\n ```\n\n @since 1.13.0\n @property hasDirtyAttributes\n @public\n @readonly\n */\n @memoized\n get hasDirtyAttributes(): boolean {\n return this.currentState.isDirty;\n }\n\n /**\n If this property is `true` the record is in the `saving` state. A\n record enters the saving state when `save` is called, but the\n adapter has not yet acknowledged that the changes have been\n persisted to the backend.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isSaving; // false\n let promise = record.save();\n record.isSaving; // true\n promise.then(function() {\n record.isSaving; // false\n });\n ```\n\n @property isSaving\n @public\n @readonly\n */\n @memoized\n get isSaving(): boolean {\n return this.currentState.isSaving;\n }\n\n /**\n If this property is `true` the record is in the `deleted` state\n and has been marked for deletion. When `isDeleted` is true and\n `hasDirtyAttributes` is true, the record is deleted locally but the deletion\n was not yet persisted. When `isSaving` is true, the change is\n in-flight. When both `hasDirtyAttributes` and `isSaving` are false, the\n change has persisted.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isDeleted; // false\n record.deleteRecord();\n\n // Locally deleted\n record.isDeleted; // true\n record.hasDirtyAttributes; // true\n record.isSaving; // false\n\n // Persisting the deletion\n let promise = record.save();\n record.isDeleted; // true\n record.isSaving; // true\n\n // Deletion Persisted\n promise.then(function() {\n record.isDeleted; // true\n record.isSaving; // false\n record.hasDirtyAttributes; // false\n });\n ```\n\n @property isDeleted\n @public\n @readonly\n */\n @memoized\n get isDeleted(): boolean {\n return this.currentState.isDeleted;\n }\n\n /**\n If this property is `true` the record is in the `new` state. A\n record will be in the `new` state when it has been created on the\n client and the adapter has not yet report that it was successfully\n saved.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isNew; // true\n\n record.save().then(function(model) {\n model.isNew; // false\n });\n ```\n\n @property isNew\n @public\n @readonly\n */\n @memoized\n get isNew(): boolean {\n return this.currentState.isNew;\n }\n\n /**\n If this property is `true` the record is in the `valid` state.\n\n A record will be in the `valid` state when the adapter did not report any\n server-side validation failures.\n\n @property isValid\n @public\n @readonly\n */\n @memoized\n get isValid(): boolean {\n return this.currentState.isValid;\n }\n\n /**\n If the record is in the dirty state this property will report what\n kind of change has caused it to move into the dirty\n state. Possible values are:\n\n - `created` The record has been created by the client and not yet saved to the adapter.\n - `updated` The record has been updated by the client and not yet saved to the adapter.\n - `deleted` The record has been deleted by the client and not yet saved to the adapter.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.dirtyType; // 'created'\n ```\n\n @property dirtyType\n @public\n @readonly\n */\n @memoized\n get dirtyType(): 'created' | 'updated' | 'deleted' | '' {\n return this.currentState.dirtyType;\n }\n\n /**\n If `true` the adapter reported that it was unable to save local\n changes to the backend for any reason other than a server-side\n validation error.\n\n Example\n\n ```javascript\n record.isError; // false\n record.set('foo', 'valid value');\n record.save().then(null, function() {\n record.isError; // true\n });\n ```\n\n @property isError\n @public\n @readonly\n */\n @memoized\n get isError(): boolean {\n return this.currentState.isError;\n }\n set isError(v) {\n if (DEBUG) {\n throw new Error(`isError is not directly settable`);\n }\n }\n\n /**\n If `true` the store is attempting to reload the record from the adapter.\n\n Example\n\n ```javascript\n record.isReloading; // false\n record.reload();\n record.isReloading; // true\n ```\n\n @property isReloading\n @public\n @readonly\n */\n declare isReloading: boolean;\n\n /**\n All ember models have an id property. This is an identifier\n managed by an external source. These are always coerced to be\n strings before being used internally. Note when declaring the\n attributes for a model it is an error to declare an id\n attribute.\n\n ```javascript\n let record = store.createRecord('model');\n record.id; // null\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n model.id; // '1'\n ```\n\n @property id\n @public\n */\n @gate\n get id(): string | null {\n // this guard exists, because some dev-only deprecation code\n // (addListener via validatePropertyInjections) invokes toString before the\n // object is real.\n if (DEBUG) {\n try {\n return recordIdentifierFor(this).id;\n } catch {\n return null;\n }\n }\n return recordIdentifierFor(this).id;\n }\n set id(id) {\n const normalizedId = coerceId(id);\n const identifier = recordIdentifierFor(this);\n const didChange = normalizedId !== identifier.id;\n assert(\n `Cannot set ${identifier.type} record's id to ${id}, because id is already ${identifier.id}`,\n !didChange || identifier.id === null\n );\n\n if (normalizedId !== null && didChange) {\n this.store._instanceCache.setRecordId(identifier, normalizedId);\n this.store.notifications.notify(identifier, 'identity');\n }\n }\n\n toString() {\n return `<model::${(this.constructor as unknown as { modelName: string }).modelName}:${this.id}>`;\n }\n\n /**\n @property currentState\n @private\n */\n // TODO we can probably make this a computeOnce\n // we likely do not need to notify the currentState root anymore\n @gate\n get currentState() {\n // descriptors are called with the wrong `this` context during mergeMixins\n // when using legacy/classic ember classes. Basically: lazy in prod and eager in dev.\n // so we do this to try to steer folks to the nicer \"dont user currentState\"\n // error.\n if (!DEBUG) {\n if (!this.___recordState) {\n this.___recordState = new RecordState(this as unknown as MinimalLegacyRecord);\n }\n }\n return this.___recordState;\n }\n set currentState(_v) {\n throw new Error('cannot set currentState');\n }\n\n /**\n The store service instance which created this record instance\n\n @property store\n @public\n */\n\n /**\n When the record is in the `invalid` state this object will contain\n any errors returned by the adapter. When present the errors hash\n contains keys corresponding to the invalid property names\n and values which are arrays of Javascript objects with two keys:\n\n - `message` A string containing the error message from the backend\n - `attribute` The name of the property associated with this error message\n\n ```javascript\n record.errors.length; // 0\n record.set('foo', 'invalid value');\n record.save().catch(function() {\n record.errors.foo;\n // [{message: 'foo should be a number.', attribute: 'foo'}]\n });\n ```\n\n The `errors` property is useful for displaying error messages to\n the user.\n\n ```handlebars\n <label>Username: <Input @value={{@model.username}} /> </label>\n {{#each @model.errors.username as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n <label>Email: <Input @value={{@model.email}} /> </label>\n {{#each @model.errors.email as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n ```\n\n\n You can also access the special `messages` property on the error\n object to get an array of all the error strings.\n\n ```handlebars\n {{#each @model.errors.messages as |message|}}\n <div class=\"error\">\n {{message}}\n </div>\n {{/each}}\n ```\n\n @property errors\n @public\n */\n @computeOnce\n get errors(): Errors {\n const errors = (Errors as unknown as { create(obj: object): Errors }).create({ __record: this });\n this.currentState.updateInvalidErrors(errors);\n return errors;\n }\n\n /**\n This property holds the `AdapterError` object with which\n last adapter operation was rejected.\n\n @property adapterError\n @public\n */\n @memoized\n get adapterError() {\n return this.currentState.adapterError;\n }\n set adapterError(v) {\n throw new Error(`adapterError is not directly settable`);\n }\n\n /*\n We hook the default implementation to ensure\n our tagged properties are properly notified\n as well. We still super for everything because\n sync observers require a direct call occuring\n to trigger their flush. We wouldn't need to\n super in 4.0+ where sync observers are removed.\n */\n // @ts-expect-error no return is necessary, but Ember's types are forcing it\n notifyPropertyChange(prop: string): this {\n const signals = withSignalStore(this);\n entangleSignal(signals, this, prop, undefined);\n super.notifyPropertyChange(prop);\n }\n\n /** @internal */\n attr() {\n assert(\n 'The `attr` method is not available on Model, a Snapshot was probably expected. Are you passing a Model instead of a Snapshot to your serializer?',\n false\n );\n }\n\n /**\n Given a callback, iterates over each of the relationships in the model,\n invoking the callback with the name of each relationship and its relationship\n descriptor.\n\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, descriptor);\n ```\n\n - `name` the name of the current property in the iteration\n - `descriptor` the meta object that describes this relationship\n\n The relationship descriptor argument is an object with the following properties.\n\n - **name** <span class=\"type\">String</span> the name of this relationship on the Model\n - **kind** <span class=\"type\">String</span> \"hasMany\" or \"belongsTo\"\n - **options** <span class=\"type\">Object</span> the original options hash passed when the relationship was declared\n - **parentType** <span class=\"type\">Model</span> the type of the Model that owns this relationship\n - **type** <span class=\"type\">String</span> the type name of the related Model\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n serialize(record, options) {\n let json = {};\n\n record.eachRelationship(function(name, descriptor) {\n if (descriptor.kind === 'hasMany') {\n let serializedHasManyName = name.toUpperCase() + '_IDS';\n json[serializedHasManyName] = record.get(name).map(r => r.id);\n }\n });\n\n return json;\n }\n }\n ```\n\n @public\n @param {Function} callback the callback to invoke\n @param {any} binding the value to which the callback's `this` should be bound\n */\n eachRelationship<T>(\n callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n (this.constructor as typeof Model).eachRelationship<T, this>(callback, binding);\n }\n\n relationshipFor(name: string): LegacyRelationshipField | undefined {\n return (this.constructor as typeof Model).relationshipsByName.get(name);\n }\n\n inverseFor(name: string) {\n return (this.constructor as typeof Model).inverseFor(name, storeFor(this)!);\n }\n\n eachAttribute<T>(\n callback: (\n this: NoInfer<T> | undefined,\n key: isSubClass<this> extends true ? MaybeAttrFields<this> : string,\n meta: LegacyAttributeField\n ) => void,\n binding?: T\n ): void {\n (this.constructor as typeof Model).eachAttribute<T, this>(callback, binding);\n }\n\n /**\n * @internal\n */\n static isModel = true;\n\n /**\n Represents the model's class name as a string. This can be used to look up the model's class name through\n `Store`'s modelFor method.\n\n `modelName` is generated for you by EmberData. It will be a lowercased, dasherized string.\n For example:\n\n ```javascript\n store.modelFor('post').modelName; // 'post'\n store.modelFor('blog-post').modelName; // 'blog-post'\n ```\n\n The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload\n keys to underscore (instead of dasherized), you might use the following code:\n\n ```javascript\n import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default const PostSerializer = RESTSerializer.extend({\n payloadKeyFromModelName(modelName) {\n return underscore(modelName);\n }\n });\n ```\n @property modelName\n @public\n @readonly\n */\n static modelName: string = null as unknown as string;\n\n /*\n These class methods below provide relationship\n introspection abilities about relationships.\n\n A note about the computed properties contained here:\n\n **These properties are effectively sealed once called for the first time.**\n To avoid repeatedly doing expensive iteration over a model's fields, these\n values are computed once and then cached for the remainder of the runtime of\n your application.\n\n If your application needs to modify a class after its initial definition\n (for example, using `reopen()` to add additional attributes), make sure you\n do it before using your model with the store, which uses these properties\n extensively.\n */\n\n /**\n For a given relationship name, returns the model type of the relationship.\n\n For example, if you define a model like this:\n\n ```js [app/models/post.js]\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @hasMany('comment') comments;\n }\n ```\n\n Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.\n\n @public\n @param {String} name the name of the relationship\n @param {store} store an instance of Store\n @return {Model} the type of the relationship, or undefined\n */\n static typeForRelationship(name: string, store: Store) {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationship = this.relationshipsByName.get(name);\n return relationship && store.modelFor(relationship.type);\n }\n\n @computeOnce\n static get inverseMap(): Record<string, LegacyRelationshipField | null> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n return Object.create(null) as Record<string, LegacyRelationshipField | null>;\n }\n\n /**\n Find the relationship which is the inverse of the one asked for.\n\n For example, if you define models like this:\n\n ```js [app/models/post.js]\n import { Model, hasMany } from '@warp-drive/legacy/model';\n\n export default class PostModel extends Model {\n @hasMany('message') comments;\n }\n ```\n\n ```js [app/models/message.js]\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class MessageModel extends Model {\n @belongsTo('post') owner;\n }\n ```\n\n ``` js\n store.modelFor('post').inverseFor('comments', store) // { type: 'message', name: 'owner', kind: 'belongsTo' }\n store.modelFor('message').inverseFor('owner', store) // { type: 'post', name: 'comments', kind: 'hasMany' }\n ```\n\n @public\n @param {String} name the name of the relationship\n @param {Store} store\n @return {Object} the inverse relationship, or null\n */\n static inverseFor(name: string, store: Store): LegacyRelationshipField | null {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const inverseMap = this.inverseMap;\n if (inverseMap[name]) {\n return inverseMap[name];\n } else {\n const inverse = this._findInverseFor(name, store);\n inverseMap[name] = inverse;\n return inverse;\n }\n }\n\n //Calculate the inverse, ignoring the cache\n static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationship = this.relationshipsByName.get(name)!;\n assert(`No relationship named '${name}' on '${this.modelName}' exists.`, relationship);\n\n if (!relationship) {\n return null;\n }\n\n const { options } = relationship;\n assert(\n `Expected the relationship ${name} on ${this.modelName} to define an inverse.`,\n options.inverse === null || (typeof options.inverse === 'string' && options.inverse.length > 0)\n );\n\n if (options.inverse === null) {\n return null;\n }\n\n const schemaExists = store.schema.hasResource(relationship);\n\n assert(\n `No associated schema found for '${relationship.type}' while calculating the inverse of ${name} on ${this.modelName}`,\n schemaExists\n );\n\n if (!schemaExists) {\n return null;\n }\n\n const inverseField = store.schema.fields(relationship).get(options.inverse);\n assert(\n `No inverse relationship found for '${name}' on '${this.modelName}'`,\n inverseField && (inverseField.kind === 'belongsTo' || inverseField.kind === 'hasMany')\n );\n\n return inverseField || null;\n }\n\n /**\n The model's relationships as a map, keyed on the type of the\n relationship. The value of each entry is an array containing a descriptor\n for each relationship with that type, describing the name of the relationship\n as well as the type.\n\n For example, given the following model definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n @hasMany('post') posts;\n }\n ```\n\n This computed property would return a map describing these\n relationships, like this:\n\n ```javascript\n import Blog from 'app/models/blog';\n import User from 'app/models/user';\n import Post from 'app/models/post';\n\n let relationships = Blog.relationships;\n relationships.user;\n //=> [ { name: 'users', kind: 'hasMany' },\n // { name: 'owner', kind: 'belongsTo' } ]\n relationships.post;\n //=> [ { name: 'posts', kind: 'hasMany' } ]\n ```\n\n @property relationships\n @public\n @readonly\n */\n\n @computeOnce\n static get relationships(): Map<string, LegacyRelationshipField[]> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, LegacyRelationshipField[]>();\n const relationshipsByName = this.relationshipsByName;\n\n // Loop through each computed property on the class\n relationshipsByName.forEach((desc) => {\n const { type } = desc;\n\n if (!map.has(type)) {\n map.set(type, []);\n }\n\n map.get(type)!.push(desc);\n });\n\n return map;\n }\n\n /**\n A hash containing lists of the model's relationships, grouped\n by the relationship kind. For example, given a model with this\n definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relationshipNames = Blog.relationshipNames;\n relationshipNames.hasMany;\n //=> ['users', 'posts']\n relationshipNames.belongsTo;\n //=> ['owner']\n ```\n\n @property relationshipNames\n @public\n @readonly\n */\n @computeOnce\n static get relationshipNames() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const names: { hasMany: string[]; belongsTo: string[] } = {\n hasMany: [],\n belongsTo: [],\n };\n\n this.eachComputedProperty((name, meta) => {\n if (isRelationshipSchema(meta)) {\n names[meta.kind].push(name);\n }\n });\n\n return names;\n }\n\n /**\n An array of types directly related to a model. Each type will be\n included once, regardless of the number of relationships it has with\n the model.\n\n For example, given a model with this definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relatedTypes = Blog.relatedTypes');\n //=> ['user', 'post']\n ```\n\n @property relatedTypes\n @public\n @readonly\n */\n @computeOnce\n static get relatedTypes(): string[] {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const types: string[] = [];\n\n const rels = this.relationshipsObject;\n const relationships = Object.keys(rels);\n\n // create an array of the unique types involved\n // in relationships\n for (let i = 0; i < relationships.length; i++) {\n const name = relationships[i];\n const meta = rels[name];\n const modelName = meta.type;\n\n if (!types.includes(modelName)) {\n types.push(modelName);\n }\n }\n\n return types;\n }\n\n /**\n A map whose keys are the relationships of a model and whose values are\n relationship descriptors.\n\n For example, given a model with this\n definition:\n\n ```js [app/models/blog.js]\n import { Model, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relationshipsByName = Blog.relationshipsByName;\n relationshipsByName.users;\n //=> { name: 'users', kind: 'hasMany', type: 'user', options: Object }\n relationshipsByName.owner;\n //=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }\n ```\n\n @property relationshipsByName\n @public\n @readonly\n */\n @computeOnce\n static get relationshipsByName(): Map<string, LegacyRelationshipField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const map = new Map();\n const rels = this.relationshipsObject;\n const relationships = Object.keys(rels);\n\n for (let i = 0; i < relationships.length; i++) {\n const name = relationships[i];\n const value = rels[name];\n\n map.set(value.name, value);\n }\n\n return map;\n }\n\n @computeOnce\n static get relationshipsObject(): Record<string, LegacyRelationshipField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationships = Object.create(null) as Record<string, LegacyRelationshipField>;\n const modelName = this.modelName;\n this.eachComputedProperty((name: string, meta: unknown) => {\n if (!isRelationshipSchema(meta)) {\n return;\n }\n // TODO deprecate key being here\n (meta as unknown as { key: string }).key = name;\n meta.name = name;\n relationships[name] = meta;\n\n assert(`Expected options in meta`, meta.options && typeof meta.options === 'object');\n assert(\n `You should not specify both options.as and options.inverse as null on ${modelName}.${meta.name}, as if there is no inverse field there is no abstract type to conform to. You may have intended for this relationship to be polymorphic, or you may have mistakenly set inverse to null.`,\n !(meta.options.inverse === null && meta.options.as?.length)\n );\n });\n return relationships;\n }\n\n /**\n A map whose keys are the fields of the model and whose values are strings\n describing the kind of the field. A model's fields are the union of all of its\n attributes and relationships.\n\n For example:\n\n ```js [app/models/blog.js]\n import { Model, attr, belongsTo, hasMany } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n\n @attr('string') title;\n }\n ```\n\n ```js\n import Blog from 'app/models/blog'\n\n let fields = Blog.fields;\n fields.forEach(function(kind, field) {\n // do thing\n });\n\n // prints:\n // users, hasMany\n // owner, belongsTo\n // posts, hasMany\n // title, attribute\n ```\n\n @property fields\n @public\n @readonly\n */\n @computeOnce\n static get fields(): Map<string, 'attribute' | 'belongsTo' | 'hasMany'> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const map = new Map();\n\n this.eachComputedProperty((name, meta) => {\n if (isRelationshipSchema(meta)) {\n map.set(name, meta.kind);\n } else if (isAttributeSchema(meta)) {\n map.set(name, 'attribute');\n }\n });\n\n return map;\n }\n\n /**\n Given a callback, iterates over each of the relationships in the model,\n invoking the callback with the name of each relationship and its relationship\n descriptor.\n\n @public\n @param {Function} callback the callback to invoke\n @param {any} binding the value to which the callback's `this` should be bound\n */\n static eachRelationship<T, Schema extends Model>(\n callback: (\n this: T | undefined,\n key: MaybeRelationshipFields<Schema>,\n relationship: LegacyRelationshipField\n ) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.relationshipsByName.forEach((relationship, name) => {\n callback.call(binding, name as MaybeRelationshipFields<Schema>, relationship);\n });\n }\n\n /**\n Given a callback, iterates over each of the types related to a model,\n invoking the callback with the related type's class. Each type will be\n returned just once, regardless of how many different relationships it has\n with a model.\n\n @public\n @param {Function} callback the callback to invoke\n @param {any} binding the value to which the callback's `this` should be bound\n */\n static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T) {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationshipTypes = this.relatedTypes;\n\n for (let i = 0; i < relationshipTypes.length; i++) {\n const type = relationshipTypes[i];\n callback.call(binding, type);\n }\n }\n\n /**\n *\n * @private\n * @deprecated\n */\n static determineRelationshipType(\n knownSide: LegacyRelationshipField,\n store: Store\n ): 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany' | 'oneToNone' | 'manyToNone' {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const knownKey = knownSide.name;\n const knownKind = knownSide.kind;\n const inverse = this.inverseFor(knownKey, store);\n // let key;\n\n if (!inverse) {\n return knownKind === 'belongsTo' ? 'oneToNone' : 'manyToNone';\n }\n\n // key = inverse.name;\n const otherKind = inverse.kind;\n\n if (otherKind === 'belongsTo') {\n return knownKind === 'belongsTo' ? 'oneToOne' : 'manyToOne';\n } else {\n return knownKind === 'belongsTo' ? 'oneToMany' : 'manyToMany';\n }\n }\n\n /**\n A map whose keys are the attributes of the model (properties\n described by attr) and whose values are the meta object for the\n property.\n\n Example\n\n ```js [app/models/person.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n ```\n\n ```javascript\n import Person from 'app/models/person'\n\n let attributes = Person.attributes\n\n attributes.forEach(function(meta, name) {\n // do thing\n });\n\n // prints:\n // firstName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"firstName\"}\n // lastName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"lastName\"}\n // birthday {type: \"date\", kind: 'attribute', options: Object, parentType: function, name: \"birthday\"}\n ```\n\n @property attributes\n @public\n @readonly\n */\n @computeOnce\n static get attributes(): Map<string, LegacyAttributeField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, LegacyAttributeField>();\n\n this.eachComputedProperty((name, meta) => {\n if (isAttributeSchema(meta)) {\n assert(\n \"You may not set 'id' as an attribute on your model. Please remove any lines that look like: `id: attr('<type>')` from \" +\n this.toString(),\n name !== 'id'\n );\n\n // TODO deprecate key being here\n (meta as unknown as { key: string }).key = name;\n meta.name = name;\n map.set(name, meta);\n }\n });\n\n return map;\n }\n\n /**\n A map whose keys are the attributes of the model (properties\n described by attr) and whose values are type of transformation\n applied to each attribute. This map does not include any\n attributes that do not have an transformation type.\n\n Example\n\n ```js [app/models/person.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class PersonModel extends Model {\n @attr firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n ```\n\n ```javascript\n import Person from 'app/models/person';\n\n let transformedAttributes = Person.transformedAttributes\n\n transformedAttributes.forEach(function(field, type) {\n // do thing\n });\n\n // prints:\n // lastName string\n // birthday date\n ```\n\n @property transformedAttributes\n @public\n @readonly\n */\n @computeOnce\n static get transformedAttributes() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, string>();\n\n this.eachAttribute((name: string, meta: LegacyAttributeField) => {\n if (meta.type) {\n map.set(name, meta.type);\n }\n });\n\n return map;\n }\n\n /**\n Iterates through the attributes of the model, calling the passed function on each\n attribute.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, meta);\n ```\n\n - `name` the name of the current property in the iteration\n - `meta` the meta object for the attribute property in the iteration\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```javascript\n import { Model, attr } from '@warp-drive/legacy/model';\n\n class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n\n PersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n // prints:\n // firstName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"firstName\"}\n // lastName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"lastName\"}\n // birthday {type: \"date\", kind: 'attribute', options: Object, parentType: function, name: \"birthday\"}\n ```\n\n @public\n @param {Function} callback The callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n */\n static eachAttribute<T, Schema extends Model>(\n callback: (this: T | undefined, key: MaybeAttrFields<Schema>, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.attributes.forEach((meta, name) => {\n callback.call(binding, name as MaybeAttrFields<Schema>, meta);\n });\n }\n\n /**\n Iterates through the transformedAttributes of the model, calling\n the passed function on each attribute. Note the callback will not be\n called for any attributes that do not have an transformation type.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, type);\n ```\n\n - `name` the name of the current property in the iteration\n - `type` a string containing the name of the type of transformed\n applied to the attribute\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```javascript\n import { Model, attr } from '@warp-drive/legacy/model';\n\n let Person = Model.extend({\n firstName: attr(),\n lastName: attr('string'),\n birthday: attr('date')\n });\n\n Person.eachTransformedAttribute(function(name, type) {\n // do thing\n });\n\n // prints:\n // lastName string\n // birthday date\n ```\n\n @public\n @param {Function} callback The callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n */\n static eachTransformedAttribute<T, Schema extends Model>(\n callback: (this: T | undefined, key: Exclude<keyof Schema & string, keyof Model & string>, type: string) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.transformedAttributes.forEach((type: string, name) => {\n callback.call(binding, name as Exclude<keyof Schema & string, keyof Model & string>, type);\n });\n }\n\n /**\n Returns the name of the model class.\n\n @public\n */\n static toString() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n return `model:${this.modelName}`;\n }\n}\n\n// @ts-expect-error TS doesn't know how to do `this` function overloads\nModel.prototype.save = save;\n// @ts-expect-error TS doesn't know how to do `this` function overloads\nModel.prototype.destroyRecord = destroyRecord;\nModel.prototype.unloadRecord = unloadRecord;\nModel.prototype.hasMany = hasMany;\nModel.prototype.belongsTo = belongsTo;\nModel.prototype.serialize = serialize;\nModel.prototype._createSnapshot = createSnapshot;\nModel.prototype.deleteRecord = deleteRecord;\nModel.prototype.changedAttributes = changedAttributes;\nModel.prototype.rollbackAttributes = rollbackAttributes;\nModel.prototype.reload = reload;\n\ndefineSignal(Model.prototype, 'isReloading', false);\n\n// this is required to prevent `init` from passing\n// the values initialized during create to `setUnknownProperty`\n(Model.prototype as unknown as { _createProps: null })._createProps = null;\n(Model.prototype as unknown as { _secretInit: null })._secretInit = null;\n\nif (DEBUG) {\n const lookupDescriptor = function lookupDescriptor(obj: object, keyName: string) {\n let current: object = obj;\n do {\n const descriptor = Object.getOwnPropertyDescriptor(current, keyName);\n if (descriptor !== undefined) {\n return descriptor;\n }\n current = Object.getPrototypeOf(current) as object;\n } while (current !== null);\n return null;\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const init = Model.prototype.init;\n Model.prototype.init = function (createArgs: ModelCreateArgs) {\n init.call(this, createArgs);\n\n const ourDescriptor = lookupDescriptor(Model.prototype, 'currentState');\n const theirDescriptor = lookupDescriptor(this, 'currentState');\n\n if (!ourDescriptor || !theirDescriptor) {\n throw new Error(\n `Unable to determine if 'currentState' is a reserved property name on instances of classes extending Model. Please ensure that 'currentState' is not defined as a property on ${this.constructor.toString()}`\n );\n }\n\n const realState = this.___recordState;\n if (ourDescriptor.get !== theirDescriptor.get || realState !== this.currentState) {\n throw new Error(\n `'currentState' is a reserved property name on instances of classes extending Model. Please choose a different property name for ${this.constructor.toString()}`\n );\n }\n\n const ID_DESCRIPTOR = lookupDescriptor(Model.prototype, 'id');\n const idDesc = lookupDescriptor(this, 'id');\n\n if (!ID_DESCRIPTOR || !idDesc) {\n throw new Error(\n `Unable to determine if 'id' is a reserved property name on instances of classes extending Model. Please ensure that 'id' is not defined as a property on ${this.constructor.toString()}`\n );\n }\n\n if (idDesc.get !== ID_DESCRIPTOR.get) {\n throw new Error(\n `You may not set 'id' as an attribute on your model. Please remove any lines that look like: \\`id: attr('<type>')\\` from ${this.constructor.toString()}`\n );\n }\n };\n\n delete (Model as unknown as { reopen: unknown }).reopen;\n delete (Model as unknown as { reopenClass: unknown }).reopenClass;\n}\n\nexport { Model };\n\nfunction isRelationshipSchema(meta: unknown): meta is LegacyRelationshipField {\n const hasKind = typeof meta === 'object' && meta !== null && 'kind' in meta && 'options' in meta;\n return hasKind && (meta.kind === 'hasMany' || meta.kind === 'belongsTo');\n}\n\nfunction isAttributeSchema(meta: unknown): meta is LegacyAttributeField {\n return typeof meta === 'object' && meta !== null && 'kind' in meta && meta.kind === 'attribute';\n}\n","import { getOwner } from '@ember/application';\n\nimport type { Store } from '@warp-drive/core';\n\nimport { Model, type ModelFactory } from './model';\n\n/*\n In case someone defined a relationship to a mixin, for example:\n ```ts\n class CommentModel extends Model {\n @belongsTo('commentable', { polymorphic: true }) owner;\n }\n\n let Commentable = Mixin.create({\n @hasMany('comment') comments;\n });\n ```\n we want to look up a Commentable class which has all the necessary\n relationship meta data. Thus, we look up the mixin and create a mock\n Model, so we can access the relationship CPs of the mixin (`comments`)\n in this case\n */\nexport default function modelForMixin(store: Store, normalizedModelName: string): ModelFactory | undefined {\n const owner = getOwner(store)!;\n const MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);\n const mixin = MaybeMixin && MaybeMixin.class;\n if (mixin) {\n const ModelForMixin = Model.extend(mixin) as unknown as { __isMixin: boolean; __mixin: typeof mixin };\n ModelForMixin.__isMixin = true;\n ModelForMixin.__mixin = mixin;\n //Cache the class as a model\n owner.register(`model:${normalizedModelName}`, ModelForMixin);\n }\n return owner.factoryFor(`model:${normalizedModelName}`) as ModelFactory | undefined;\n}\n","import { getOwner } from '@ember/application';\nimport { deprecate } from '@ember/debug';\n\nimport type { Store } from '@warp-drive/core';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { SchemaService } from '@warp-drive/core/types';\nimport type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { ObjectValue } from '@warp-drive/core/types/json/raw';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core/types/schema/concepts';\nimport type {\n ArrayField,\n DerivedField,\n GenericField,\n HashField,\n LegacyAttributeField,\n LegacyField,\n LegacyRelationshipField,\n ObjectField,\n ObjectSchema,\n ResourceSchema,\n} from '@warp-drive/core/types/schema/fields';\n\nimport type { FactoryCache, Model, ModelFactory, ModelStore } from './model.ts';\nimport _modelForMixin from './model-for-mixin.ts';\nimport { normalizeModelName } from './util.ts';\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ntype InternalSchema = {\n schema: ResourceSchema;\n fields: Map<string, LegacyAttributeField | LegacyRelationshipField>;\n attributes: Record<string, LegacyAttributeField>;\n relationships: Record<string, LegacyRelationshipField>;\n};\n\nexport interface ModelSchemaProvider {\n attributesDefinitionFor(resource: RecordIdentifier | { type: string }): AttributesSchema;\n\n relationshipsDefinitionFor(resource: RecordIdentifier | { type: string }): RelationshipsSchema;\n\n doesTypeExist(type: string): boolean;\n}\nexport class ModelSchemaProvider implements SchemaService {\n declare store: ModelStore;\n declare _schemas: Map<string, InternalSchema>;\n declare _typeMisses: Set<string>;\n\n constructor(store: ModelStore) {\n this.store = store;\n this._schemas = new Map();\n this._typeMisses = new Set();\n }\n\n resourceTypes(): Readonly<string[]> {\n return Array.from(this._schemas.keys());\n }\n\n hasTrait(type: string): boolean {\n assert(`hasTrait is not available with @ember-data/model's SchemaService`);\n return false;\n }\n resourceHasTrait(resource: StableRecordIdentifier | { type: string }, trait: string): boolean {\n assert(`resourceHasTrait is not available with @ember-data/model's SchemaService`);\n return false;\n }\n transformation(field: GenericField | ObjectField | ArrayField | { type: string }): Transformation {\n assert(`transformation is not available with @ember-data/model's SchemaService`);\n }\n derivation(field: DerivedField | { type: string }): Derivation {\n assert(`derivation is not available with @ember-data/model's SchemaService`);\n }\n hashFn(field: HashField | { type: string }): HashFn {\n assert(`hashFn is not available with @ember-data/model's SchemaService`);\n }\n resource(resource: StableRecordIdentifier | { type: string }): ResourceSchema | ObjectSchema {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.schema;\n }\n registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void {\n assert(`registerResources is not available with @ember-data/model's SchemaService`);\n }\n registerResource(schema: ResourceSchema | ObjectSchema): void {\n assert(`registerResource is not available with @ember-data/model's SchemaService`);\n }\n registerTransformation(transform: Transformation): void {\n assert(`registerTransformation is not available with @ember-data/model's SchemaService`);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n assert(`registerDerivation is not available with @ember-data/model's SchemaService`);\n }\n registerHashFn(hashFn: HashFn): void {\n assert(`registerHashFn is not available with @ember-data/model's SchemaService`);\n }\n _loadModelSchema(type: string) {\n const modelClass = this.store.modelFor(type) as typeof Model;\n const attributeMap = modelClass.attributes;\n\n const attributes = Object.create(null) as AttributesSchema;\n attributeMap.forEach((meta, name) => (attributes[name] = meta));\n const relationships = modelClass.relationshipsObject || null;\n const fields = new Map<string, LegacyAttributeField | LegacyRelationshipField>();\n\n for (const attr of Object.values(attributes)) {\n fields.set(attr.name, attr);\n }\n\n for (const rel of Object.values(relationships)) {\n fields.set(rel.name, rel);\n }\n\n const schema: ResourceSchema = {\n legacy: true,\n identity: { name: 'id', kind: '@id' },\n type,\n fields: Array.from(fields.values()),\n };\n\n const internalSchema: InternalSchema = {\n schema,\n attributes,\n relationships,\n fields,\n };\n\n this._schemas.set(type, internalSchema);\n\n return internalSchema;\n }\n\n fields(resource: RecordIdentifier | { type: string }): Map<string, LegacyField> {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.fields;\n }\n\n hasResource(resource: { type: string }): boolean {\n const type = normalizeModelName(resource.type);\n\n if (this._schemas.has(type)) {\n return true;\n }\n\n if (this._typeMisses.has(type)) {\n return false;\n }\n\n const factory = getModelFactory(this.store, type);\n const exists = factory !== null;\n\n if (!exists) {\n this._typeMisses.add(type);\n return false;\n }\n\n return true;\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n ModelSchemaProvider.prototype.doesTypeExist = function (type: string): boolean {\n deprecate(`Use \\`schema.hasResource({ type })\\` instead of \\`schema.doesTypeExist(type)\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n return this.hasResource({ type });\n };\n\n ModelSchemaProvider.prototype.attributesDefinitionFor = function (\n resource: RecordIdentifier | { type: string }\n ): AttributesSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.attributesDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.attributes;\n };\n\n ModelSchemaProvider.prototype.relationshipsDefinitionFor = function (\n resource: RecordIdentifier | { type: string }\n ): RelationshipsSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.relationshipsDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.relationships;\n };\n}\n\nexport function buildSchema(store: Store): SchemaService {\n return new ModelSchemaProvider(store as ModelStore);\n}\n\nexport function getModelFactory(store: ModelStore, type: string): ModelFactory | null {\n if (!store._modelFactoryCache) {\n store._modelFactoryCache = Object.create(null) as FactoryCache;\n }\n const cache = store._modelFactoryCache;\n let factory: ModelFactory | undefined = cache[type];\n\n if (!factory) {\n const owner = getOwner(store)!;\n factory = owner.factoryFor(`model:${type}`) as ModelFactory | undefined;\n\n if (!factory) {\n //Support looking up mixins as base types for polymorphic relationships\n factory = _modelForMixin(store, type);\n }\n\n if (!factory) {\n // we don't cache misses in case someone wants to register a missing model\n return null;\n }\n\n const klass = factory.class;\n\n if (klass.isModel) {\n const hasOwnModelNameSet = klass.modelName && Object.prototype.hasOwnProperty.call(klass, 'modelName');\n if (!hasOwnModelNameSet) {\n Object.defineProperty(klass, 'modelName', { value: type });\n }\n }\n\n cache[type] = factory;\n }\n\n return factory;\n}\n"],"names":["isElementDescriptor","args","maybeTarget","maybeKey","maybeDesc","length","undefined","normalizeModelName","type","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","id","until","for","since","available","enabled","rollbackAttributes","currentState","isNew","RecordStore","_join","peekCache","rollbackAttrs","recordIdentifierFor","errors","clear","cleanErrorRequests","unloadRecord","isDestroyed","isDestroying","belongsTo","prop","lookupLegacySupport","referenceFor","hasMany","reload","options","isReloading","identifier","env","DEBUG","test","Error","promise","request","op","data","record","cacheOptions","Symbol","then","finally","changedAttributes","changedAttrs","serialize","upgradeStore","serializeRecord","deleteRecord","save","isDeleted","Promise","resolve","saveRecord","destroyRecord","_","createSnapshot","store","_fetchManager","FetchManager","notifyChanges","value","key","notifyAttribute","eachAttribute","name","meta","constructor","relationshipsByName","get","notifyRelationship","eachRelationship","notifyInternalSignal","peekInternalSignal","withSignalStore","kind","notifyPropertyChange","support","LEGACY_SUPPORT","manyArray","_manyArrayCache","hasPromise","_relationshipPromisesCache","ARRAY_SIGNAL","async","currentValue","cacheFor","cache","getAttr","SOURCE_POINTER_REGEXP","SOURCE_POINTER_PRIMARY_REGEXP","PRIMARY_ATTRIBUTE_KEY","isInvalidError","error","isAdapterError","code","RecordState","storeFor","identity","pendingCount","fulfilledCount","rejectedCount","_errorRequests","_lastError","requests","getRequestStateService","notifications","handleRequest","req","state","isSaving","response","push","notifyErrorsStateChanged","notify","subscribeForRecord","lastRequest","getLastRequestForRecord","handler","subscribe","updateInvalidErrors","destroy","unsubscribe","signals","signal","lid","getErrors","jsonApiErrors","i","source","pointer","keyMatch","match","search","errMsg","detail","title","add","isLoading","isLoaded","n","prototype","gate","isEmpty","isSaved","rd","isDeletionCommitted","isValid","isDirty","hasChangedAttrs","isError","errorReq","adapterError","isPreloaded","memoized","stateName","dirtyType","defineSignal","computeOnce","target","propertyName","desc","WeakMap","getter","hasComputed","set","call","Model","EmberObject","init","_secretInit","_createProps","createProps","cb","___recordState","setProperties","___private_notifications","field","delete","hasDirtyAttributes","v","normalizedId","coerceId","didChange","_instanceCache","setRecordId","toString","modelName","_v","Errors","create","__record","entangleSignal","attr","callback","binding","relationshipFor","inverseFor","isModel","typeForRelationship","relationship","modelFor","inverseMap","Object","inverse","_findInverseFor","schemaExists","schema","hasResource","inverseField","fields","relationships","map","Map","forEach","has","relationshipNames","names","eachComputedProperty","isRelationshipSchema","relatedTypes","types","rels","relationshipsObject","keys","includes","as","isAttributeSchema","eachRelatedType","relationshipTypes","determineRelationshipType","knownSide","knownKey","knownKind","otherKind","attributes","transformedAttributes","eachTransformedAttribute","_createSnapshot","lookupDescriptor","obj","keyName","current","descriptor","getOwnPropertyDescriptor","getPrototypeOf","createArgs","ourDescriptor","theirDescriptor","realState","ID_DESCRIPTOR","idDesc","reopen","reopenClass","hasKind","modelForMixin","normalizedModelName","owner","getOwner","MaybeMixin","factoryFor","mixin","class","ModelForMixin","extend","__isMixin","__mixin","register","ModelSchemaProvider","_schemas","_typeMisses","Set","resourceTypes","Array","from","hasTrait","resourceHasTrait","resource","trait","transformation","derivation","hashFn","_loadModelSchema","registerResources","schemas","registerResource","registerTransformation","transform","registerDerivation","registerHashFn","modelClass","attributeMap","values","rel","legacy","internalSchema","factory","getModelFactory","exists","ENABLE_LEGACY_SCHEMA_SERVICE","doesTypeExist","attributesDefinitionFor","relationshipsDefinitionFor","buildSchema","_modelFactoryCache","_modelForMixin","klass","hasOwnModelNameSet","hasOwnProperty","defineProperty"],"mappings":";;;;;;;;;;;;;AAOO,SAASA,mBAAmBA,CAACC,IAAe,EAAyD;EAC1G,MAAM,CAACC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,CAAC,GAAGH,IAAI;AAE/C,EAAA;AACE;IACAA,IAAI,CAACI,MAAM,KAAK,CAAC;AACjB;AACC,IAAA,OAAOH,WAAW,KAAK,UAAU,I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CAAC0G,cAAc,CAACH,KAAK,EAAE,WAAW,EAAE;AAAErP,UAAAA,KAAK,EAAErE;AAAK,SAAC,CAAC;AAC5D;AACF;AAEA+F,IAAAA,KAAK,CAAC/F,IAAI,CAAC,GAAGgT,OAAO;AACvB;AAEA,EAAA,OAAOA,OAAO;AAChB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialize-into-hash-BxfqWC8u.js","sources":["../src/adapter/-private/utils/parse-response-headers.ts","../src/adapter/-private/utils/continue-on-reject.ts","../src/adapter/-private/utils/determine-body-promise.ts","../src/adapter/-private/utils/serialize-query-params.ts","../src/adapter/-private/utils/fetch.ts","../src/adapter/-private/utils/serialize-into-hash.ts"],"sourcesContent":["const newline = /\\r?\\n/;\n\nexport function parseResponseHeaders(headersString: string): Record<string, string> {\n const headers = Object.create(null) as Record<string, string>;\n\n if (!headersString) {\n return headers;\n }\n\n const headerPairs: string[] = headersString.split(newline);\n\n for (let i = 0; i < headerPairs.length; i++) {\n const header = headerPairs[i];\n let j = 0;\n let foundSep = false;\n\n for (; j < header.length; j++) {\n if (header.charCodeAt(j) === 58 /* ':' */) {\n foundSep = true;\n break;\n }\n }\n\n if (foundSep === false) {\n continue;\n }\n\n const field = header.substring(0, j).trim();\n const value = header.substring(j + 1, header.length).trim();\n\n if (value) {\n const lowerCasedField = field.toLowerCase();\n\n headers[lowerCasedField] = value;\n headers[field] = value;\n }\n }\n\n return headers;\n}\n","/**\n * A utility function that returns a promise that resolves\n * even when the source promise rejects.\n *\n * @internal\n */\nexport function continueOnReject<T>(promise: Promise<T>): Promise<T> {\n return Promise.resolve(promise).catch((e) => e as T);\n}\n","import { warn } from '@ember/debug';\n\nimport { DEBUG } from '@warp-drive/core/build-config/env';\n\nimport type { RequestData } from '../../rest.ts';\nimport { continueOnReject } from './continue-on-reject.ts';\n\ntype Payload = Error | Record<string, unknown> | unknown[] | string | undefined;\n\ninterface CustomSyntaxError extends SyntaxError {\n payload: Payload;\n}\n\n/*\n * Function that always attempts to parse the response as json, and if an error is thrown,\n * returns `undefined` if the response is successful and has a status code of 204 (No Content),\n * or 205 (Reset Content) or if the request method was 'HEAD', and the plain payload otherwise.\n */\nfunction _determineContent(response: Response, requestData: JQueryAjaxSettings, payload: Payload): Payload {\n let ret: Payload = payload;\n let error: Error | null = null;\n\n if (!response.ok) {\n return payload;\n }\n\n const status = response.status;\n const payloadIsEmpty = payload === '' || payload === null;\n const statusIndicatesEmptyResponse = status === 204 || status === 205 || requestData.method === 'HEAD';\n\n if (DEBUG) {\n if (payloadIsEmpty && !statusIndicatesEmptyResponse) {\n const message = `The server returned an empty string for ${requestData.method} ${requestData.url}, which cannot be parsed into a valid JSON. Return either null or {}.`;\n if (payload === '') {\n warn(message, {\n id: 'ds.adapter.returned-empty-string-as-JSON',\n });\n }\n }\n }\n\n if (response.ok && (statusIndicatesEmptyResponse || payloadIsEmpty)) {\n return;\n }\n\n try {\n ret = JSON.parse(payload as string) as Payload;\n } catch (e) {\n if (!(e instanceof SyntaxError)) {\n return e as Error;\n }\n (e as CustomSyntaxError).payload = payload;\n error = e;\n }\n\n if (error) {\n if (DEBUG) {\n // eslint-disable-next-line no-console\n console.warn('This response was unable to be parsed as json.', payload);\n }\n return error;\n }\n\n return ret;\n}\n\nexport function determineBodyPromise(response: Response, requestData: RequestData): Promise<Payload> {\n // response.text() may resolve or reject\n // it is a native promise, may not have finally\n return continueOnReject(response.text()).then((payload) => _determineContent(response, requestData, payload));\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\nconst RBRACKET = /\\[\\]$/;\n\ninterface PlainObject {\n [key: string]: string | PlainObject | PlainObject[] | string[];\n}\ntype ParamObject = { name: string; value: string };\n\nfunction isPlainObject<T>(obj: unknown): obj is T {\n return Object.prototype.toString.call(obj) === '[object Object]';\n}\n\nfunction isPrimitiveArray(obj: unknown): obj is Array<PlainObject | string> {\n return Array.isArray(obj);\n}\n\nfunction isParamsArray(obj: unknown): obj is ParamObject[] {\n return Array.isArray(obj);\n}\n\nfunction buildParams<T extends PlainObject>(\n prefix: string,\n obj: ParamObject | ParamObject[] | Array<T | string> | T | string,\n s: string[]\n) {\n let i: number, len: number, key: keyof T & string;\n\n if (prefix) {\n if (isPrimitiveArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n if (RBRACKET.test(prefix)) {\n add(s, prefix, obj[i] as string);\n } else {\n buildParams(prefix + '[' + (typeof obj[i] === 'object' && obj[i] !== null ? i : '') + ']', obj[i], s);\n }\n }\n } else if (isPlainObject<T>(obj)) {\n for (key in obj) {\n buildParams(prefix + '[' + key + ']', obj[key], s);\n }\n } else {\n assert(\n `query params cannot be a { name, value } pair if prefix is present`,\n obj === null || typeof obj !== 'object'\n );\n add(s, prefix, obj);\n }\n } else if (isParamsArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n add(s, obj[i].name, obj[i].value);\n }\n } else {\n assert(`query params cannot be a string if no prefix is present`, typeof obj !== 'string');\n assert(`query params should not be an array if no prefix is present`, !Array.isArray(obj));\n assert(`query params should not be a { name, value } pair if no prefix is present`, isPlainObject<T>(obj));\n for (key in obj) {\n buildParams(key, obj[key], s);\n }\n }\n return s;\n}\n\n/*\n * Helper function that turns the data/body of a request into a query param string.\n * This is directly copied from jQuery.param.\n */\nexport function serializeQueryParams(queryParamsObject: PlainObject | string): string {\n return buildParams('', queryParamsObject, []).join('&');\n}\n\n/*\n * Part of the `serializeQueryParams` helper function.\n */\nfunction add(s: string[], k: string, v?: string | (() => string)) {\n // Strip out keys with undefined value and replace null values with\n // empty strings (mimics jQuery.ajax)\n if (v === undefined) {\n return;\n } else if (v === null) {\n v = '';\n }\n\n v = typeof v === 'function' ? v() : v;\n s[s.length] = `${encodeURIComponent(k)}=${encodeURIComponent(v)}`;\n}\n","import { assert } from '@warp-drive/core/build-config/macros';\n\ntype FetchFunction = (input: RequestInfo, init?: RequestInit) => Promise<Response>;\n\nlet _fetch: (() => FetchFunction) | null = null;\ntype MockRequest = { protocol?: string; get(key: string): string | undefined };\nlet REQUEST: MockRequest = null as unknown as MockRequest;\n\nexport function getFetchFunction(): FetchFunction {\n // return cached fetch function\n if (_fetch !== null) {\n return _fetch();\n }\n\n // grab browser native fetch if available, or global fetch if otherwise configured\n if (typeof fetch === 'function') {\n // fallback to using global fetch\n _fetch = () => fetch;\n\n /* global FastBoot */\n // grab fetch from node-fetch\n } else if (typeof FastBoot !== 'undefined') {\n try {\n const nodeFetch = FastBoot.require('node-fetch') as typeof fetch;\n\n const httpRegex = /^https?:\\/\\//;\n const protocolRelativeRegex = /^\\/\\//;\n\n function parseRequest(request: MockRequest) {\n if (request === null) {\n throw new Error(\n \"Trying to fetch with relative url but the application hasn't finished loading FastBootInfo, see details at https://github.com/ember-cli/ember-fetch#relative-url\"\n );\n }\n // Old Prember version is not sending protocol\n const protocol = request.protocol === 'undefined:' ? 'http:' : request.protocol;\n return [request.get('host'), protocol];\n }\n\n function buildAbsoluteUrl(url: string) {\n if (protocolRelativeRegex.test(url)) {\n const [host] = parseRequest(REQUEST);\n url = host + url;\n } else if (!httpRegex.test(url)) {\n const [host, protocol] = parseRequest(REQUEST);\n url = protocol + '//' + host + url;\n }\n return url;\n }\n\n function patchedFetch(input: string | { href: string } | RequestInfo, options?: RequestInit) {\n if (input && typeof input === 'object' && 'href' in input) {\n const url = buildAbsoluteUrl(input.href);\n const info = Object.assign({}, input, { url }) as unknown as RequestInfo;\n return nodeFetch(info, options);\n } else if (typeof input === 'string') {\n const url = buildAbsoluteUrl(input);\n return nodeFetch(url, options);\n }\n\n return nodeFetch(input, options);\n }\n\n _fetch = () => patchedFetch;\n } catch {\n throw new Error(`Unable to create a compatible 'fetch' for FastBoot with node-fetch`);\n }\n }\n\n assert(`Cannot find a 'fetch' global and did not detect FastBoot.`, _fetch);\n\n return _fetch();\n}\n\nexport function setupFastboot(fastBootRequest: MockRequest) {\n REQUEST = fastBootRequest;\n}\n","import type { Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { ModelSchema } from '@warp-drive/core/types';\n\nimport type { MinimumSerializerInterface, SerializerOptions } from '../../../compat.ts';\nimport { type Snapshot, upgradeStore } from '../../../compat/-private.ts';\n\ntype SerializerWithSerializeIntoHash = MinimumSerializerInterface & {\n serializeIntoHash?(hash: object, modelClass: ModelSchema, snapshot: Snapshot, options?: SerializerOptions): void;\n};\n\nexport function serializeIntoHash(\n store: Store,\n modelClass: ModelSchema,\n snapshot: Snapshot,\n options: { includeId?: boolean } = { includeId: true }\n) {\n upgradeStore(store);\n const serializer: SerializerWithSerializeIntoHash | null = store.serializerFor(modelClass.modelName);\n\n assert(`Cannot serialize record, no serializer defined`, serializer);\n\n if (typeof serializer.serializeIntoHash === 'function') {\n const data = {};\n serializer.serializeIntoHash(data, modelClass, snapshot, options);\n return data;\n }\n\n return serializer.serialize(snapshot, options);\n}\n"],"names":["newline","parseResponseHeaders","headersString","headers","Object","create","headerPairs","split","i","length","header","j","foundSep","charCodeAt","field","substring","trim","value","lowerCasedField","toLowerCase","continueOnReject","promise","Promise","resolve","catch","e","_determineContent","response","requestData","payload","ret","error","ok","status","payloadIsEmpty","statusIndicatesEmptyResponse","method","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","message","url","warn","id","JSON","parse","SyntaxError","console","determineBodyPromise","text","then","RBRACKET","isPlainObject","obj","prototype","toString","call","isPrimitiveArray","Array","isArray","isParamsArray","buildParams","prefix","s","len","key","test","add","Error","name","serializeQueryParams","queryParamsObject","join","k","v","undefined","encodeURIComponent","_fetch","REQUEST","getFetchFunction","fetch","FastBoot","nodeFetch","require","httpRegex","protocolRelativeRegex","parseRequest","request","protocol","get","buildAbsoluteUrl","host","patchedFetch","input","options","href","info","assign","setupFastboot","fastBootRequest","serializeIntoHash","store","modelClass","snapshot","includeId","serializer","serializerFor","modelName","data","serialize"],"mappings":";;;;;AAAA,MAAMA,OAAO,GAAG,OAAO;AAEhB,SAASC,oBAAoBA,CAACC,aAAqB,EAA0B;AAClF,EAAA,MAAMC,OA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AA,OAAOH,UAAU,CAACI,SAAS,CAACN,QAAQ,EAAET,OAAO,CAAC;AAChD;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-api.js","sources":["../../src/serializer/json-api.js"],"sourcesContent":["import { warn } from '@ember/debug';\n\nimport { dasherize, pluralize, singularize } from '@warp-drive/utilities/string';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport { JSONSerializer } from './json.js';\n\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 In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.\n\n This serializer normalizes a JSON API payload that looks like:\n\n ```js [app/models/player.js]\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n export default class Player extends Model {\n @attr('string') name;\n @attr('string') skill;\n @attr('number') gamesPlayed;\n @belongsTo('club') club;\n }\n ```\n\n ```js [app/models/club.js]\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Club extends Model {\n @attr('string') name;\n @attr('string') location;\n @hasMany('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```js [app/serializers/application.js]\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```\n\n @since 1.13.0\n @class JSONAPISerializer\n @public\n*/\nconst JSONAPISerializer = JSONSerializer.extend({\n /**\n @param {Object} documentHash\n @return {Object}\n @private\n */\n _normalizeDocumentHelper(documentHash) {\n if (Array.isArray(documentHash.data)) {\n const ret = new Array(documentHash.data.length);\n\n for (let i = 0; i < documentHash.data.length; i++) {\n const data = documentHash.data[i];\n ret[i] = this._normalizeResourceHelper(data);\n }\n\n documentHash.data = ret;\n } else if (documentHash.data && typeof documentHash.data === 'object') {\n documentHash.data = this._normalizeResourceHelper(documentHash.data);\n }\n\n if (Array.isArray(documentHash.included)) {\n const ret = new Array();\n for (let i = 0; i < documentHash.included.length; i++) {\n const included = documentHash.included[i];\n const normalized = this._normalizeResourceHelper(included);\n if (normalized !== null) {\n // can be null when unknown type is encountered\n ret.push(normalized);\n }\n }\n\n documentHash.included = ret;\n }\n\n return documentHash;\n },\n\n /**\n @param {Object} relationshipDataHash\n @return {Object}\n @private\n */\n _normalizeRelationshipDataHelper(relationshipDataHash) {\n relationshipDataHash.type = this.modelNameFromPayloadKey(relationshipDataHash.type);\n\n return relationshipDataHash;\n },\n\n /**\n @param {Object} resourceHash\n @return {Object}\n @private\n */\n _normalizeResourceHelper(resourceHash) {\n assert(this.warnMessageForUndefinedType(), resourceHash.type);\n\n const type = this.modelNameFromPayloadKey(resourceHash.type);\n\n if (!this.store.schema.hasResource({ type })) {\n if (DEBUG) {\n warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {\n id: 'ds.serializer.model-for-type-missing',\n });\n }\n return null;\n }\n\n const modelClass = this.store.modelFor(type);\n const serializer = this.store.serializerFor(type);\n const { data } = serializer.normalize(modelClass, resourceHash);\n return data;\n },\n\n /**\n Normalize some data and push it into the store.\n\n @public\n @param {Store} store\n @param {Object} payload\n */\n pushPayload(store, payload) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n store.push(normalizedPayload);\n },\n\n /**\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @param {Boolean} isSingle\n @return {Object} JSON-API Document\n @private\n */\n _normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n return normalizedPayload;\n },\n\n normalizeQueryRecordResponse() {\n const normalized = this._super(...arguments);\n\n assert(\n 'Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.',\n !Array.isArray(normalized.data)\n );\n\n return normalized;\n },\n\n extractAttributes(modelClass, resourceHash) {\n const attributes = {};\n\n if (resourceHash.attributes) {\n modelClass.eachAttribute((key) => {\n const attributeKey = this.keyForAttribute(key, 'deserialize');\n if (resourceHash.attributes[attributeKey] !== undefined) {\n attributes[key] = resourceHash.attributes[attributeKey];\n }\n if (DEBUG) {\n if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${attributeKey}'. This is most likely because Ember Data's JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement 'keyForAttribute(key) { return key; }' to prevent Ember Data from customizing your attribute keys.`,\n false\n );\n }\n }\n });\n }\n\n return attributes;\n },\n\n /**\n Returns a relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @public\n @param {Object} relationshipHash\n @return {Object}\n */\n extractRelationship(relationshipHash) {\n if (Array.isArray(relationshipHash.data)) {\n const ret = new Array(relationshipHash.data.length);\n\n for (let i = 0; i < relationshipHash.data.length; i++) {\n const data = relationshipHash.data[i];\n ret[i] = this._normalizeRelationshipDataHelper(data);\n }\n\n relationshipHash.data = ret;\n } else if (relationshipHash.data && typeof relationshipHash.data === 'object') {\n relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);\n }\n\n return relationshipHash;\n },\n\n /**\n Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractRelationships(modelClass, resourceHash) {\n const relationships = {};\n\n if (resourceHash.relationships) {\n modelClass.eachRelationship((key, relationshipMeta) => {\n const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');\n if (resourceHash.relationships[relationshipKey] !== undefined) {\n const relationshipHash = resourceHash.relationships[relationshipKey];\n relationships[key] = this.extractRelationship(relationshipHash);\n }\n if (DEBUG) {\n if (\n resourceHash.relationships[relationshipKey] === undefined &&\n resourceHash.relationships[key] !== undefined\n ) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${relationshipKey}'. This is most likely because Ember Data's JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement 'keyForRelationship(key) { return key; }' to prevent Ember Data from customizing your relationship keys.`,\n false\n );\n }\n }\n });\n }\n\n return relationships;\n },\n\n /**\n @param {Model} modelClass\n @param {Object} resourceHash\n @return {String}\n @private\n */\n _extractType(modelClass, resourceHash) {\n return this.modelNameFromPayloadKey(resourceHash.type);\n },\n\n /**\n Dasherizes and singularizes the model name in the payload to match\n the format Ember Data uses internally for the model name.\n\n For example the key `posts` would be converted to `post` and the\n key `studentAssesments` would be converted to `student-assesment`.\n\n @public\n @param {String} key\n @return {String} the model's modelName\n */\n modelNameFromPayloadKey(key) {\n return dasherize(singularize(key));\n },\n\n /**\n Converts the model name to a pluralized version of the model name.\n\n For example `post` would be converted to `posts` and\n `student-assesment` would be converted to `student-assesments`.\n\n @public\n @param {String} modelName\n @return {String}\n */\n payloadKeyFromModelName(modelName) {\n return pluralize(modelName);\n },\n\n normalize(modelClass, resourceHash) {\n if (resourceHash.attributes) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.attributes);\n }\n\n if (resourceHash.relationships) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);\n }\n\n const data = {\n id: this.extractId(modelClass, resourceHash),\n type: this._extractType(modelClass, resourceHash),\n attributes: this.extractAttributes(modelClass, resourceHash),\n relationships: this.extractRelationships(modelClass, resourceHash),\n };\n\n if (resourceHash.lid) {\n data.lid = resourceHash.lid;\n }\n\n this.applyTransforms(modelClass, data.attributes);\n\n return { data };\n },\n\n /**\n `keyForAttribute` can be used to define rules for how to convert an\n attribute name in your model to a key in your JSON.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as the word separator in the JSON\n attribute keys.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { dasherize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForAttribute(attr, method) {\n return dasherize(attr).toUpperCase();\n }\n }\n ```\n\n @public\n @param {String} key\n @param {String} method\n @return {String} normalized key\n */\n keyForAttribute(key, method) {\n return dasherize(key);\n },\n\n /**\n `keyForRelationship` can be used to define a custom key when\n serializing and deserializing relationship properties.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as word separators in\n relationship properties.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```js [app/serializers/post.js]\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForRelationship(key, relationship, method) {\n return underscore(key);\n }\n }\n ```\n @public\n @param {String} key\n @param {String} typeClass\n @param {String} method\n @return {String} normalized key\n */\n keyForRelationship(key, typeClass, method) {\n return dasherize(key);\n },\n\n /**\n Called when a record is saved in order to convert the\n record into JSON.\n\n For example, consider this model:\n\n ```js [app/models/comment.js]\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n export default class CommentModel extends Model {\n @attr title;\n @attr body;\n\n @belongsTo('user', { async: false, inverse: null })\n author;\n }\n ```\n\n The default serialization would create a JSON-API resource object like:\n\n ```javascript\n {\n \"data\": {\n \"type\": \"comments\",\n \"attributes\": {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n },\n \"relationships\": {\n \"author\": {\n \"data\": {\n \"id\": \"12\",\n \"type\": \"users\"\n }\n }\n }\n }\n }\n ```\n\n By default, attributes are passed through as-is, unless\n you specified an attribute type (`attr('date')`). If\n you specify a transform, the JavaScript value will be\n serialized when inserted into the attributes hash.\n\n Belongs-to relationships are converted into JSON-API\n resource identifier objects.\n\n ## IDs\n\n `serialize` takes an options hash with a single option:\n `includeId`. If this option is `true`, `serialize` will,\n by default include the ID in the JSON object it builds.\n\n The JSONAPIAdapter passes in `includeId: true` when serializing a record\n for `createRecord` or `updateRecord`.\n\n ## Customization\n\n Your server may expect data in a different format than the\n built-in serialization format.\n\n In that case, you can implement `serialize` yourself and\n return data formatted to match your API's expectations, or override\n the invoked adapter method and do the serialization in the adapter directly\n by using the provided snapshot.\n\n If your API's format differs greatly from the JSON:API spec, you should\n consider authoring your own adapter and serializer instead of extending\n this class.\n\n ```js [app/serializers/post.js]\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n ```\n\n ## Customizing an App-Wide Serializer\n\n If you want to define a serializer for your entire\n application, you'll probably want to use `eachAttribute`\n and `eachRelationship` on the record.\n\n ```js [app/serializers/application.js]\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { underscore, singularize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n\n function serverAttributeName(attribute) {\n return underscore(attribute).toUpperCase();\n }\n\n function serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + '_IDS';\n }\n ```\n\n This serializer will generate JSON that looks like this:\n\n ```javascript\n {\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n }\n ```\n\n ## Tweaking the Default Formatting\n\n If you just want to do some small tweaks on the default JSON:API formatted response,\n you can call `super.serialize` first and make the tweaks\n on the returned object.\n\n ```js [app/serializers/post.js]\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.data.attributes.subject = json.data.attributes.title;\n delete json.data.attributes.title;\n\n return json;\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} options\n @return {Object} json\n */\n serialize(snapshot, options) {\n const data = this._super(...arguments);\n data.type = this.payloadKeyFromModelName(snapshot.modelName);\n\n return { data };\n },\n\n serializeAttribute(snapshot, json, key, attribute) {\n const type = attribute.type;\n\n if (this._canSerialize(key)) {\n json.attributes = json.attributes || {};\n\n let value = snapshot.attr(key);\n if (type) {\n const transform = this.transformFor(type);\n value = transform.serialize(value, attribute.options);\n }\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(key, schema);\n\n if (payloadKey === key) {\n payloadKey = this.keyForAttribute(key, 'serialize');\n }\n\n json.attributes[payloadKey] = value;\n }\n },\n\n serializeBelongsTo(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this._canSerialize(name)) {\n const belongsTo = snapshot.belongsTo(name);\n const belongsToIsNotNew = belongsTo && !belongsTo.isNew;\n\n if (belongsTo === null || belongsToIsNotNew) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name) {\n payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');\n }\n\n let data = null;\n if (belongsTo) {\n const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);\n\n data = {\n type: payloadType,\n id: belongsTo.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n\n serializeHasMany(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this.shouldSerializeHasMany(snapshot, name, relationship)) {\n const hasMany = snapshot.hasMany(name);\n if (hasMany !== undefined) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name && this.keyForRelationship) {\n payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');\n }\n\n // only serialize has many relationships that are not new\n const nonNewHasMany = hasMany.filter((item) => !item.isNew);\n const data = new Array(nonNewHasMany.length);\n\n for (let i = 0; i < nonNewHasMany.length; i++) {\n const item = hasMany[i];\n const payloadType = this.payloadKeyFromModelName(item.modelName);\n\n data[i] = {\n type: payloadType,\n id: item.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n});\n\nif (DEBUG) {\n JSONAPISerializer.reopen({\n init(...args) {\n this._super(...args);\n\n assert(\n `You've used the EmbeddedRecordsMixin in ${this.toString()} which is not fully compatible with the JSON:API specification. Please confirm that this works for your specific API and add \\`this.isEmbeddedRecordsMixinCompatible = true\\` to your serializer.`,\n !this.isEmbeddedRecordsMixin || this.isEmbeddedRecordsMixinCompatible === true\n );\n\n const constructor = this.constructor;\n warn(\n `You've defined 'extractMeta' in ${constructor.toString()} which is not used for serializers extending JSONAPISerializer. Read more at https://api.emberjs.com/ember-data/release/classes/JSONAPISerializer on how to customize meta when using JSON API.`,\n this.extractMeta === JSONSerializer.prototype.extractMeta,\n {\n id: 'ds.serializer.json-api.extractMeta',\n }\n );\n },\n warnMessageForUndefinedType() {\n return (\n 'Encountered a resource object with an undefined type (resolved resource using ' +\n this.constructor.toString() +\n ')'\n );\n },\n warnMessageNoModelForType(modelName, originalType, usedLookup) {\n return `Encountered a resource object with type \"${originalType}\", but no model was found for model name \"${modelName}\" (resolved model name using '${this.constructor.toString()}.${usedLookup}(\"${originalType}\")').`;\n },\n });\n}\n\nexport { JSONAPISerializer };\n"],"names":["JSONAPISerializer","JSONSerializer","extend","_normalizeDocumentHelper","documentHash","Array","isArray","data","ret","length","i","_normalizeResourceHelper","included","normalized","push","_normalizeRelationshipDataHelper","relationshipDataHash","type","modelNameFromPayloadKey","resourceHash","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","warnMessageForUndefinedType","store","schema","hasResource","warn","warnMessageNoModelForType","id","modelClass","modelFor","serializer","serializerFor","normalize","pushPayload","payload","normalizedPayload","_normalizeResponse","primaryModelClass","requestType","isSingle","normalizeQueryRecordResponse","_super","arguments","extractAttributes","attributes","eachAttribute","key","attributeKey","keyForAttribute","undefined","modelName","extractRelationship","relationshipHash","extractRelationships","relationships","eachRelationship","relationshipMeta","relationshipKey","keyForRelationship","kind","_extractType","dasherize","singularize","payloadKeyFromModelName","pluralize","normalizeUsingDeclaredMapping","extractId","lid","applyTransforms","method","typeClass","serialize","snapshot","options","serializeAttribute","json","attribute","_canSerialize","value","attr","transform","transformFor","payloadKey","_getMappedKey","serializeBelongsTo","relationship","name","belongsTo","belongsToIsNotNew","isNew","payloadType","serializeHasMany","shouldSerializeHasMany","hasMany","nonNewHasMany","filter","item","reopen","init","args","toString","isEmbeddedRecordsMixin","isEmbeddedRecordsMixinCompatible","constructor","extractMeta","prototype","originalType","usedLookup"],"mappings":";;;;;AAmIA,MAAMA,iBAAiB,GAAGC,cAAc,CAACC,MAAM,CAAC;AAC9C;AACF;AACA;AACA;AACA;EACEC,wBAAwBA,CAACC,YAAY,EAAE;IACrC,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAACG,IAAI,CAAC,EAAE;MACpC,MAAMC,GAAG,GAAG,IAAIH,KAAK,CAACD,YAAY,CAACG,IAAI,CAACE,MAAM,CAAC;AAE/C,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACG,IAAI,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;AACjD,QAAA,MAAMH,IAAI,GAAGH,YAAY,CAACG,IAAI,CAACG,CAAC,CAAC;QACjCF,GAAG,CAACE,CAAC,CAAC,GAAG,IAAI,CAACC,wBAAwB,CAACJ,IAAI,CAAC;AAC9C;MAEAH,YAAY,CAACG,IAAI,GAAGC,GAAG;AACzB,KAAC,MAAM,IAAIJ,YAAY,CAACG,IAAI,IAAI,OAAOH,YAAY,CAACG,IAAI,KAAK,QAAQ,EAAE;MACr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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEY,EAAAA,kBAAkBA,CAACZ,GAAG,EAAEwB,SAAS,EAAED,MAAM,EAAE;IACzC,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuCEyB,EAAAA,SAASA,CAACC,QAAQ,EAAEC,OAAO,EAAE;IAC3B,MAAMxE,IAAI,GAAG,IAAI,CAACwC,MAAM,CAAC,GAAGC,SAAS,CAAC;IACtCzC,IAAI,CAACU,IAAI,GAAG,IAAI,CAACoD,uBAAuB,CAACS,QAAQ,CAACtB,SAAS,CAAC;IAE5D,OAAO;AAAEjD,MAAAA;KAAM;GAChB;EAEDyE,kBAAkBA,CAACF,QAAQ,EAAEG,IAAI,EAAE7B,GAAG,EAAE8B,SAAS,EAAE;AACjD,IAAA,MAAMjE,IAAI,GAAGiE,SAAS,CAACjE,IAAI;AAE3B,IAAA,IAAI,IAAI,CAACkE,aAAa,CAAC/B,GAAG,CAAC,EAAE;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