@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.
- package/declarations/adapter/-private/build-url-mixin.d.ts +41 -29
- package/declarations/adapter/-private/fastboot-interface.d.ts +4 -5
- package/declarations/adapter/-private/utils/continue-on-reject.d.ts +5 -6
- package/declarations/adapter/-private/utils/determine-body-promise.d.ts +1 -2
- package/declarations/adapter/-private/utils/fetch.d.ts +2 -3
- package/declarations/adapter/-private/utils/parse-response-headers.d.ts +0 -1
- package/declarations/adapter/-private/utils/serialize-into-hash.d.ts +5 -6
- package/declarations/adapter/-private/utils/serialize-query-params.d.ts +5 -2
- package/declarations/adapter/-private.d.ts +5 -6
- package/declarations/adapter/error.d.ts +206 -178
- package/declarations/adapter/json-api.d.ts +206 -207
- package/declarations/adapter/rest.d.ts +805 -808
- package/declarations/adapter.d.ts +742 -766
- package/declarations/compat/-private.d.ts +10 -11
- package/declarations/compat/builders/find-all.d.ts +26 -24
- package/declarations/compat/builders/find-record.d.ts +41 -39
- package/declarations/compat/builders/query.d.ts +50 -45
- package/declarations/compat/builders/save-record.d.ts +26 -24
- package/declarations/compat/builders/utils.d.ts +1 -2
- package/declarations/compat/builders.d.ts +10 -11
- package/declarations/compat/extensions.d.ts +52 -106
- package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +39 -38
- package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +1 -2
- package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +9 -10
- package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts +1 -2
- package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts +1 -2
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts +521 -517
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts +214 -215
- package/declarations/compat/legacy-network-handler/serializer-response.d.ts +5 -6
- package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +83 -84
- package/declarations/compat/legacy-network-handler/snapshot.d.ts +228 -229
- package/declarations/compat/utils.d.ts +118 -119
- package/declarations/compat.d.ts +106 -104
- package/declarations/model/-private/attr.d.ts +164 -145
- package/declarations/model/-private/belongs-to.d.ts +135 -122
- package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +15 -4
- package/declarations/model/-private/errors.d.ts +272 -267
- package/declarations/model/-private/has-many.d.ts +119 -116
- package/declarations/model/-private/hooks.d.ts +5 -6
- package/declarations/model/-private/legacy-relationships-support.d.ts +51 -52
- package/declarations/model/-private/model-for-mixin.d.ts +18 -3
- package/declarations/model/-private/model-methods.d.ts +29 -24
- package/declarations/model/-private/model.d.ts +1306 -1254
- package/declarations/model/-private/notify-changes.d.ts +3 -4
- package/declarations/model/-private/promise-belongs-to.d.ts +33 -27
- package/declarations/model/-private/promise-many-array.d.ts +125 -116
- package/declarations/model/-private/record-state.d.ts +63 -60
- package/declarations/model/-private/references/belongs-to.d.ts +491 -487
- package/declarations/model/-private/references/has-many.d.ts +495 -492
- package/declarations/model/-private/schema-provider.d.ts +53 -56
- package/declarations/model/-private/type-utils.d.ts +41 -41
- package/declarations/model/-private/util.d.ts +1 -2
- package/declarations/model/-private.d.ts +8 -8
- package/declarations/model/migration-support.d.ts +281 -279
- package/declarations/model.d.ts +48 -49
- package/declarations/serializer/-private/embedded-records-mixin.d.ts +70 -71
- package/declarations/serializer/-private/transforms/boolean.d.ts +37 -37
- package/declarations/serializer/-private/transforms/date.d.ts +22 -22
- package/declarations/serializer/-private/transforms/number.d.ts +22 -22
- package/declarations/serializer/-private/transforms/string.d.ts +22 -22
- package/declarations/serializer/-private/transforms/transform.d.ts +109 -110
- package/declarations/serializer/-private/utils.d.ts +0 -1
- package/declarations/serializer/json-api.d.ts +124 -494
- package/declarations/serializer/json.d.ts +62 -1031
- package/declarations/serializer/rest.d.ts +52 -552
- package/declarations/serializer/transform.d.ts +5 -6
- package/declarations/serializer.d.ts +217 -218
- package/dist/{-private-DFfBszo5.js → -private-CKrP0ogQ.js} +1 -1
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/error.js +17 -0
- package/dist/adapter/json-api.js +1 -1
- package/dist/adapter/rest.js +5 -7
- package/dist/adapter.js +6 -35
- package/dist/compat/-private.js +1 -1
- package/dist/compat/extensions.js +0 -2
- package/dist/compat.js +3 -4
- package/dist/{errors-_QQ7xpSn.js → errors-BX5wowuz.js} +11 -10
- package/dist/{json-DSOlH9A8.js → json-Et4mt_LM.js} +84 -157
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +3 -4
- package/dist/model.js +3 -3
- package/dist/{schema-provider-D_P8ReX6.js → schema-provider-BdQhkT-Q.js} +20 -13
- package/dist/{serialize-into-hash-BxfqWC8u.js → serialize-into-hash-Bp58npke.js} +1 -1
- package/dist/serializer/json-api.js +42 -2
- package/dist/serializer/json.js +1 -1
- package/dist/serializer/rest.js +46 -41
- package/dist/serializer/transform.js +0 -44
- package/package.json +7 -7
- package/declarations/adapter/-private/build-url-mixin.d.ts.map +0 -1
- package/declarations/adapter/-private/fastboot-interface.d.ts.map +0 -1
- package/declarations/adapter/-private/utils/continue-on-reject.d.ts.map +0 -1
- package/declarations/adapter/-private/utils/determine-body-promise.d.ts.map +0 -1
- package/declarations/adapter/-private/utils/fetch.d.ts.map +0 -1
- package/declarations/adapter/-private/utils/parse-response-headers.d.ts.map +0 -1
- package/declarations/adapter/-private/utils/serialize-into-hash.d.ts.map +0 -1
- package/declarations/adapter/-private/utils/serialize-query-params.d.ts.map +0 -1
- package/declarations/adapter/-private.d.ts.map +0 -1
- package/declarations/adapter/error.d.ts.map +0 -1
- package/declarations/adapter/json-api.d.ts.map +0 -1
- package/declarations/adapter/rest.d.ts.map +0 -1
- package/declarations/adapter.d.ts.map +0 -1
- package/declarations/compat/-private.d.ts.map +0 -1
- package/declarations/compat/builders/find-all.d.ts.map +0 -1
- package/declarations/compat/builders/find-record.d.ts.map +0 -1
- package/declarations/compat/builders/query.d.ts.map +0 -1
- package/declarations/compat/builders/save-record.d.ts.map +0 -1
- package/declarations/compat/builders/utils.d.ts.map +0 -1
- package/declarations/compat/builders.d.ts.map +0 -1
- package/declarations/compat/extensions.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/fetch-manager.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/legacy-data-utils.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/legacy-network-handler.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/minimum-adapter-interface.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/minimum-serializer-interface.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/serializer-response.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts.map +0 -1
- package/declarations/compat/legacy-network-handler/snapshot.d.ts.map +0 -1
- package/declarations/compat/utils.d.ts.map +0 -1
- package/declarations/compat.d.ts.map +0 -1
- package/declarations/model/-private/attr.d.ts.map +0 -1
- package/declarations/model/-private/attr.type-test.d.ts +0 -2
- package/declarations/model/-private/attr.type-test.d.ts.map +0 -1
- package/declarations/model/-private/belongs-to.d.ts.map +0 -1
- package/declarations/model/-private/belongs-to.type-test.d.ts +0 -2
- package/declarations/model/-private/belongs-to.type-test.d.ts.map +0 -1
- package/declarations/model/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
- package/declarations/model/-private/errors.d.ts.map +0 -1
- package/declarations/model/-private/has-many.d.ts.map +0 -1
- package/declarations/model/-private/has-many.type-test.d.ts +0 -2
- package/declarations/model/-private/has-many.type-test.d.ts.map +0 -1
- package/declarations/model/-private/hooks.d.ts.map +0 -1
- package/declarations/model/-private/legacy-relationships-support.d.ts.map +0 -1
- package/declarations/model/-private/model-for-mixin.d.ts.map +0 -1
- package/declarations/model/-private/model-methods.d.ts.map +0 -1
- package/declarations/model/-private/model.d.ts.map +0 -1
- package/declarations/model/-private/model.type-test.d.ts +0 -2
- package/declarations/model/-private/model.type-test.d.ts.map +0 -1
- package/declarations/model/-private/notify-changes.d.ts.map +0 -1
- package/declarations/model/-private/promise-belongs-to.d.ts.map +0 -1
- package/declarations/model/-private/promise-many-array.d.ts.map +0 -1
- package/declarations/model/-private/promise-proxy-base.d.ts +0 -3
- package/declarations/model/-private/promise-proxy-base.d.ts.map +0 -1
- package/declarations/model/-private/record-state.d.ts.map +0 -1
- package/declarations/model/-private/references/belongs-to.d.ts.map +0 -1
- package/declarations/model/-private/references/has-many.d.ts.map +0 -1
- package/declarations/model/-private/schema-provider.d.ts.map +0 -1
- package/declarations/model/-private/type-utils.d.ts.map +0 -1
- package/declarations/model/-private/util.d.ts.map +0 -1
- package/declarations/model/-private.d.ts.map +0 -1
- package/declarations/model/migration-support.d.ts.map +0 -1
- package/declarations/model/migration-support.type-test.d.ts +0 -2
- package/declarations/model/migration-support.type-test.d.ts.map +0 -1
- package/declarations/model.d.ts.map +0 -1
- package/declarations/serializer/-private/embedded-records-mixin.d.ts.map +0 -1
- package/declarations/serializer/-private/transforms/boolean.d.ts.map +0 -1
- package/declarations/serializer/-private/transforms/boolean.type-test.d.ts +0 -2
- package/declarations/serializer/-private/transforms/boolean.type-test.d.ts.map +0 -1
- package/declarations/serializer/-private/transforms/date.d.ts.map +0 -1
- package/declarations/serializer/-private/transforms/number.d.ts.map +0 -1
- package/declarations/serializer/-private/transforms/string.d.ts.map +0 -1
- package/declarations/serializer/-private/transforms/transform.d.ts.map +0 -1
- package/declarations/serializer/-private/utils.d.ts.map +0 -1
- package/declarations/serializer/json-api.d.ts.map +0 -1
- package/declarations/serializer/json.d.ts.map +0 -1
- package/declarations/serializer/rest.d.ts.map +0 -1
- package/declarations/serializer/transform.d.ts.map +0 -1
- package/declarations/serializer.d.ts.map +0 -1
- package/dist/-private-DFfBszo5.js.map +0 -1
- package/dist/adapter/-private.js.map +0 -1
- package/dist/adapter/error.js.map +0 -1
- package/dist/adapter/json-api.js.map +0 -1
- package/dist/adapter/rest.js.map +0 -1
- package/dist/adapter.js.map +0 -1
- package/dist/compat/-private.js.map +0 -1
- package/dist/compat/builders.js.map +0 -1
- package/dist/compat/extensions.js.map +0 -1
- package/dist/compat/utils.js.map +0 -1
- package/dist/compat.js.map +0 -1
- package/dist/errors-_QQ7xpSn.js.map +0 -1
- package/dist/json-DSOlH9A8.js.map +0 -1
- package/dist/model/-private.js.map +0 -1
- package/dist/model/migration-support.js.map +0 -1
- package/dist/model.js.map +0 -1
- package/dist/runtime-BPCpkOf1-BKOwiRJp.js.map +0 -1
- package/dist/schema-provider-D_P8ReX6.js.map +0 -1
- package/dist/serialize-into-hash-BxfqWC8u.js.map +0 -1
- package/dist/serializer/json-api.js.map +0 -1
- package/dist/serializer/json.js.map +0 -1
- package/dist/serializer/rest.js.map +0 -1
- package/dist/serializer/transform.js.map +0 -1
- package/dist/serializer.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-_QQ7xpSn.js","sources":["../src/model/-private/promise-proxy-base.js","../src/model/-private/promise-belongs-to.ts","../src/model/-private/promise-many-array.ts","../src/model/-private/debug/assert-polymorphic-type.ts","../src/model/-private/references/has-many.ts","../src/model/-private/references/belongs-to.ts","../src/model/-private/legacy-relationships-support.ts","../src/model/-private/errors.ts"],"sourcesContent":["import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';\nimport ObjectProxy from '@ember/object/proxy';\n\nexport const PromiseObject = ObjectProxy.extend(PromiseProxyMixin);\n","import { computed } from '@ember/object';\nimport type PromiseProxyMixin from '@ember/object/promise-proxy-mixin';\nimport type ObjectProxy from '@ember/object/proxy';\n\nimport type { Store } from '@warp-drive/core';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport { memoized } from '@warp-drive/core/store/-private';\nimport type { OpaqueRecordInstance, TypeFromInstanceOrString } from '@warp-drive/core/types/record';\n\nimport type { LegacySupport } from './legacy-relationships-support.ts';\nimport { PromiseObject } from './promise-proxy-base';\n\nexport interface BelongsToProxyMeta<T = unknown> {\n key: string;\n store: Store;\n legacySupport: LegacySupport;\n modelName: TypeFromInstanceOrString<T>;\n}\nexport interface BelongsToProxyCreateArgs<T = unknown> {\n promise: Promise<T | null>;\n content?: T | null;\n _belongsToState: BelongsToProxyMeta<T>;\n}\n\nexport const LegacyPromiseProxy = Symbol.for('LegacyPromiseProxy');\n\ninterface PromiseObjectType<T> extends PromiseProxyMixin<T | null>, ObjectProxy<T> {\n // eslint-disable-next-line @typescript-eslint/no-misused-new\n new <PT>(...args: unknown[]): PromiseObjectType<PT>;\n}\n// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-extraneous-class\ndeclare class PromiseObjectType<T> {}\n\nconst Extended: PromiseObjectType<OpaqueRecordInstance> =\n PromiseObject as unknown as PromiseObjectType<OpaqueRecordInstance>;\n\n/**\n A PromiseBelongsTo is a PromiseObject that also proxies certain method calls\n to the underlying belongsTo model.\n Right now we proxy:\n * `reload()`\n @class PromiseBelongsTo\n @private\n*/\nclass PromiseBelongsTo<T = unknown> extends Extended<T> {\n declare _belongsToState: BelongsToProxyMeta<T>;\n\n @memoized\n get id(): string | null {\n const { key, legacySupport } = this._belongsToState;\n const ref = legacySupport.referenceFor('belongsTo', key);\n\n return ref.id();\n }\n\n // we don't proxy meta because we would need to proxy it to the relationship state container\n // however, meta on relationships does not trigger change notifications.\n // if you need relationship meta, you should do `record.belongsTo(relationshipName).meta()`\n @computed()\n get meta() {\n // eslint-disable-next-line no-constant-condition\n if (1) {\n assert(\n 'You attempted to access meta on the promise for the async belongsTo relationship ' +\n `${this._belongsToState.modelName}:${this._belongsToState.key}'.` +\n '\\nUse `record.belongsTo(relationshipName).meta()` instead.',\n false\n );\n }\n return;\n }\n\n async reload(options: Record<string, unknown>): Promise<this> {\n assert('You are trying to reload an async belongsTo before it has been created', this.content !== undefined);\n const { key, legacySupport } = this._belongsToState;\n await legacySupport.reloadBelongsTo(key, options);\n return this;\n }\n\n [LegacyPromiseProxy] = true as const;\n}\n\nexport { PromiseBelongsTo };\n","import { DEPRECATE_COMPUTED_CHAINS } from '@warp-drive/core/build-config/deprecations';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { RelatedCollection as ManyArray } from '@warp-drive/core/store/-private';\nimport { defineSignal, memoized } from '@warp-drive/core/store/-private';\nimport type { BaseFinderOptions } from '@warp-drive/core/types';\n\nimport { LegacyPromiseProxy } from './promise-belongs-to.ts';\n\nexport interface HasManyProxyCreateArgs<T = unknown> {\n promise: Promise<ManyArray<T>>;\n content?: ManyArray<T>;\n}\n\n/**\n This class is returned as the result of accessing an async hasMany relationship\n on an instance of a Model extending from `@ember-data/model`.\n\n A PromiseManyArray is an iterable proxy that allows templates to consume related\n ManyArrays and update once their contents are no longer pending.\n\n In your JS code you should resolve the promise first.\n\n ```js\n const comments = await post.comments;\n ```\n\n @class PromiseManyArray\n @public\n*/\nexport class PromiseManyArray<T = unknown> {\n declare promise: Promise<ManyArray<T>> | null;\n declare isDestroyed: boolean;\n declare content: ManyArray<T> | null;\n\n constructor(promise: Promise<ManyArray<T>>, content?: ManyArray<T>) {\n this._update(promise, content);\n this.isDestroyed = false;\n }\n\n /**\n * Retrieve the length of the content\n * @property length\n * @public\n */\n @memoized\n get length(): number {\n // shouldn't be needed, but ends up being needed\n // for computed chains even in 4.x\n if (DEPRECATE_COMPUTED_CHAINS) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this['[]'];\n }\n return this.content ? this.content.length : 0;\n }\n\n // this will error if someone tries to call\n // A(identifierArray) since it is not configurable\n // which is preferrable to the `meta` override we used\n // before which required importing all of Ember\n @memoized\n get '[]'() {\n // ember-source < 3.23 (e.g. 3.20 lts)\n // requires that the tag `'[]'` be notified\n // on the ArrayProxy in order for `{{#each}}`\n // to recompute. We entangle content.\n return this.content?.length && this.content;\n }\n\n /**\n * Iterate the proxied content. Called by the glimmer iterator in #each\n * We do not guarantee that forEach will always be available. This\n * may eventually be made to use Symbol.Iterator once glimmer supports it.\n *\n * @param cb\n * @return\n * @private\n */\n forEach(cb: (item: T, index: number, array: T[]) => void) {\n if (this.content && this.length) {\n this.content.forEach(cb);\n }\n }\n\n /**\n * Reload the relationship\n * @public\n * @param options\n * @return\n */\n reload(options: Omit<BaseFinderOptions, ''>) {\n assert('You are trying to reload an async manyArray before it has been created', this.content);\n void this.content.reload(options);\n return this;\n }\n\n //---- Properties/Methods from the PromiseProxyMixin that we will keep as our API\n\n /**\n * Whether the loading promise is still pending\n *\n * @property isPending\n * @type {Boolean}\n * @public\n */\n declare isPending: boolean;\n /**\n * Whether the loading promise rejected\n *\n * @property isRejected\n * @type {Boolean}\n * @public\n */\n declare isRejected: boolean;\n /**\n * Whether the loading promise succeeded\n *\n * @property isFulfilled\n * @type {Boolean}\n * @public\n */\n declare isFulfilled: boolean;\n /**\n * Whether the loading promise completed (resolved or rejected)\n *\n * @property isSettled\n * @type {Boolean}\n * @public\n */\n declare isSettled: boolean;\n\n /**\n * chain this promise\n *\n * @public\n * @param success\n * @param fail\n * @return {Promise}\n */\n then(s: Parameters<Promise<ManyArray<T>>['then']>[0], f?: Parameters<Promise<ManyArray<T>>['then']>[1]) {\n return this.promise!.then(s, f);\n }\n\n /**\n * catch errors thrown by this promise\n * @public\n * @param callback\n * @return {Promise}\n */\n catch(cb: Parameters<Promise<ManyArray<T>>['catch']>[0]) {\n return this.promise!.catch(cb);\n }\n\n /**\n * run cleanup after this promise completes\n *\n * @public\n * @param callback\n * @return {Promise}\n */\n finally(cb: Parameters<Promise<ManyArray<T>>['finally']>[0]) {\n return this.promise!.finally(cb);\n }\n\n //---- Methods on EmberObject that we should keep\n\n destroy() {\n this.isDestroyed = true;\n this.content = null;\n this.promise = null;\n }\n\n //---- Methods/Properties on ManyArray that we own and proxy to\n\n /**\n * Retrieve the links for this relationship\n * @property links\n * @public\n */\n @memoized\n get links() {\n return this.content ? this.content.links : undefined;\n }\n\n /**\n * Retrieve the meta for this relationship\n * @property meta\n * @public\n */\n @memoized\n get meta() {\n return this.content ? this.content.meta : undefined;\n }\n\n //---- Our own stuff\n\n _update(promise: Promise<ManyArray<T>>, content?: ManyArray<T>) {\n if (content !== undefined) {\n this.content = content;\n }\n\n this.promise = tapPromise(this, promise);\n }\n\n static create<T>({ promise, content }: HasManyProxyCreateArgs<T>): PromiseManyArray<T> {\n return new this(promise, content);\n }\n\n [LegacyPromiseProxy] = true as const;\n}\ndefineSignal(PromiseManyArray.prototype, 'content', null);\ndefineSignal(PromiseManyArray.prototype, 'isPending', false);\ndefineSignal(PromiseManyArray.prototype, 'isRejected', false);\ndefineSignal(PromiseManyArray.prototype, 'isFulfilled', false);\ndefineSignal(PromiseManyArray.prototype, 'isSettled', false);\n\nfunction tapPromise<T>(proxy: PromiseManyArray<T>, promise: Promise<ManyArray<T>>) {\n proxy.isPending = true;\n proxy.isSettled = false;\n proxy.isFulfilled = false;\n proxy.isRejected = false;\n return Promise.resolve(promise).then(\n (content) => {\n proxy.isPending = false;\n proxy.isFulfilled = true;\n proxy.isSettled = true;\n proxy.content = content;\n return content;\n },\n (error) => {\n proxy.isPending = false;\n proxy.isFulfilled = false;\n proxy.isRejected = true;\n proxy.isSettled = true;\n throw error;\n }\n );\n}\n","import type { Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { UpgradedMeta } from '@warp-drive/core/graph/-private';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\n\n/*\n Assert that `addedRecord` has a valid type so it can be added to the\n relationship of the `record`.\n\n The assert basically checks if the `addedRecord` can be added to the\n relationship (specified via `relationshipMeta`) of the `record`.\n\n This utility should only be used internally, as both record parameters must\n be stable record identifiers and the `relationshipMeta` needs to be the meta\n information about the relationship, retrieved via\n `record.relationshipFor(key)`.\n*/\nlet assertPolymorphicType: (\n parentIdentifier: StableRecordIdentifier,\n parentDefinition: UpgradedMeta,\n addedIdentifier: StableRecordIdentifier,\n store: Store\n) => void;\n\nif (DEBUG) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n assertPolymorphicType = function assertPolymorphicType(\n parentIdentifier: StableRecordIdentifier,\n parentDefinition: UpgradedMeta,\n addedIdentifier: StableRecordIdentifier,\n store: Store\n ) {\n if (parentDefinition.inverseIsImplicit) {\n return;\n }\n if (parentDefinition.isPolymorphic) {\n const meta = store.schema.fields(addedIdentifier)?.get(parentDefinition.inverseKey);\n if (meta) {\n assert(\n `Expected the schema for the field ${parentDefinition.inverseKey} on ${addedIdentifier.type} to be for a legacy relationship`,\n meta.kind === 'belongsTo' || meta.kind === 'hasMany'\n );\n assert(\n `The schema for the relationship '${parentDefinition.inverseKey}' on '${addedIdentifier.type}' type does not implement '${parentDefinition.type}' and thus cannot be assigned to the '${parentDefinition.key}' relationship in '${parentIdentifier.type}'. The definition should specify 'as: \"${parentDefinition.type}\"' in options.`,\n meta?.options?.as === parentDefinition.type\n );\n }\n }\n };\n}\n\nexport { assertPolymorphicType };\n","import type { NotificationType, Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { CollectionEdge, Graph } from '@warp-drive/core/graph/-private';\nimport type { RelatedCollection as ManyArray } from '@warp-drive/core/store/-private';\nimport { defineNonEnumerableSignal, memoized } from '@warp-drive/core/store/-private';\nimport type { BaseFinderOptions } from '@warp-drive/core/types';\nimport type { CollectionRelationship } from '@warp-drive/core/types/cache/relationship';\nimport type { StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstanceOrString } from '@warp-drive/core/types/record';\nimport type {\n CollectionResourceDocument,\n CollectionResourceRelationship,\n ExistingResourceObject,\n LinkObject,\n Meta,\n PaginationLinks,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { IsUnknown } from '../belongs-to.ts';\nimport { assertPolymorphicType } from '../debug/assert-polymorphic-type.ts';\nimport type { LegacySupport } from '../legacy-relationships-support.ts';\nimport { areAllInverseRecordsLoaded, LEGACY_SUPPORT } from '../legacy-relationships-support.ts';\nimport type { MaybeHasManyFields } from '../type-utils.ts';\n\ninterface ResourceIdentifier {\n links?: {\n related?: string | LinkObject;\n };\n meta?: Meta;\n}\n\ntype ArrayItemType<T> = T extends (infer U)[] ? U : never;\n\nfunction isResourceIdentiferWithRelatedLinks(\n value: CollectionResourceRelationship | ResourceIdentifier | null\n): value is ResourceIdentifier & { links: { related: string | LinkObject | null } } {\n return Boolean(value && value.links && value.links.related);\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're dealing with `async` relationships\n from `@ember-data/model` as it allows synchronous access to\n the relationship data if loaded, as well as APIs for loading, reloading\n the data or accessing available 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 @class HasManyReference\n @public\n */\nexport default class HasManyReference<\n T = unknown,\n K extends string = IsUnknown<T> extends true ? string : MaybeHasManyFields<T>,\n Related = K extends keyof T ? ArrayItemType<Awaited<T[K]>> : unknown,\n> {\n declare graph: Graph;\n declare store: Store;\n declare hasManyRelationship: CollectionEdge;\n /**\n * The field name on the parent record for this has-many relationship.\n *\n * @property key\n * @type {String}\n * @public\n */\n declare key: K;\n\n /**\n * The type of resource this relationship will contain.\n *\n * @property type\n * @type {String}\n * @public\n */\n declare type: TypeFromInstanceOrString<Related>;\n\n // unsubscribe tokens given to us by the notification manager\n ___token!: object;\n ___identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n ___relatedTokenMap!: Map<StableRecordIdentifier, object>;\n\n declare _ref: number;\n\n constructor(\n store: Store,\n graph: Graph,\n parentIdentifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>,\n hasManyRelationship: CollectionEdge,\n key: K\n ) {\n this.graph = graph;\n this.key = key;\n this.hasManyRelationship = hasManyRelationship;\n this.type = hasManyRelationship.definition.type as TypeFromInstanceOrString<Related>;\n\n this.store = store;\n this.___identifier = parentIdentifier;\n this.___token = store.notifications.subscribe(\n parentIdentifier,\n (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'relationships' && notifiedKey === key) {\n this._ref++;\n }\n }\n );\n this.___relatedTokenMap = new Map();\n // TODO inverse\n }\n\n /**\n * This method should never be called by user code.\n *\n * @internal\n */\n destroy() {\n this.store.notifications.unsubscribe(this.___token);\n this.___relatedTokenMap.forEach((token) => {\n this.store.notifications.unsubscribe(token);\n });\n this.___relatedTokenMap.clear();\n }\n\n /**\n * An array of identifiers for the records that this reference refers to.\n *\n * @property identifiers\n * @type {StableRecordIdentifier[]}\n * @public\n */\n @memoized\n get identifiers(): StableRecordIdentifier<TypeFromInstanceOrString<Related>>[] {\n ensureRefCanSubscribe(this);\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._ref;\n\n const resource = this._resource();\n\n const map = this.___relatedTokenMap;\n this.___relatedTokenMap = new Map();\n\n if (resource && resource.data) {\n return resource.data.map((resourceIdentifier) => {\n const identifier = this.store.identifierCache.getOrCreateRecordIdentifier(resourceIdentifier);\n let token = map.get(identifier);\n\n if (token) {\n map.delete(identifier);\n } else {\n token = this.store.notifications.subscribe(\n identifier,\n (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n }\n this.___relatedTokenMap.set(identifier, token);\n\n return identifier as StableRecordIdentifier<TypeFromInstanceOrString<Related>>;\n });\n }\n\n map.forEach((token) => {\n this.store.notifications.unsubscribe(token);\n });\n map.clear();\n\n return [];\n }\n\n _resource() {\n const cache = this.store.cache;\n return cache.getRelationship(this.___identifier, this.key) as CollectionResourceRelationship;\n }\n\n /**\n This returns a string that represents how the reference will be\n looked up when it is loaded. If the relationship has a link it will\n use the \"link\" otherwise it defaults to \"id\".\n\n Example\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', { async: true, inverse: null }) comments;\n }\n ```\n\n ```javascript\n let post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n });\n\n let commentsRef = post.hasMany('comments');\n\n // get the identifier of the reference\n if (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n } else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n }\n ```\n\n @public\n @return {String} The name of the remote type. This should either be `link` or `ids`\n */\n remoteType(): 'link' | 'ids' {\n const value = this._resource();\n if (value && value.links && value.links.related) {\n return 'link';\n }\n\n return 'ids';\n }\n\n /**\n `ids()` returns an array of the record IDs in this relationship.\n\n Example\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', { async: true, inverse: null }) comments;\n }\n ```\n\n ```javascript\n let post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n });\n\n let commentsRef = post.hasMany('comments');\n\n commentsRef.ids(); // ['1']\n ```\n\n @public\n @return {Array} The ids in this has-many relationship\n */\n ids(): Array<string | null> {\n return this.identifiers.map((identifier) => identifier.id);\n }\n\n /**\n The link Ember Data will use to fetch or reload this belongs-to\n relationship. By default it uses only the \"related\" resource linkage.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n export default Model.extend({\n user: belongsTo('user', { async: true, inverse: null })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: '/articles/1/author'\n }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n }\n ```\n\n @public\n @return {String} The link Ember Data will use to fetch or reload this belongs-to relationship.\n */\n link(): string | null {\n const resource = this._resource();\n\n if (isResourceIdentiferWithRelatedLinks(resource)) {\n if (resource.links) {\n const related = resource.links.related;\n return !related || typeof related === 'string' ? related : related.href;\n }\n }\n return null;\n }\n\n /**\n * any links that have been received for this relationship\n *\n * @public\n * @return\n */\n links(): PaginationLinks | null {\n const resource = this._resource();\n\n return resource && resource.links ? resource.links : null;\n }\n\n /**\n The meta data for the has-many relationship.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, hasMany } from '@warp-drive/legacy/model';\n export default Model.extend({\n users: hasMany('user', { async: true, inverse: null })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n users: {\n links: {\n related: {\n href: '/articles/1/authors'\n },\n },\n meta: {\n lastUpdated: 1458014400000\n }\n }\n }\n }\n });\n\n let usersRef = blog.hasMany('user');\n\n usersRef.meta() // { lastUpdated: 1458014400000 }\n ```\n\n @public\n @return {Object|null} The meta information for the belongs-to relationship.\n */\n meta(): Meta | null {\n let meta: Meta | null = null;\n const resource = this._resource();\n if (resource && resource.meta && typeof resource.meta === 'object') {\n meta = resource.meta;\n }\n return meta;\n }\n\n /**\n `push` can be used to update the data in the relationship and EmberData\n will treat the new data as the canonical value of this relationship on\n the backend. An empty array will signify the canonical value should be\n empty.\n\n Example model\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', { async: true, inverse: null }) comments;\n }\n ```\n\n Setup some initial state, note we haven't loaded the comments yet:\n\n ```js\n const post = store.push({\n data: {\n type: 'post',\n id: '1',\n relationships: {\n comments: {\n data: [{ type: 'comment', id: '1' }]\n }\n }\n }\n });\n\n const commentsRef = post.hasMany('comments');\n commentsRef.ids(); // ['1']\n ```\n\n Update the state using `push`, note we can do this even without\n having loaded these comments yet by providing resource identifiers.\n\n Both full resources and resource identifiers are supported.\n\n ```js\n await commentsRef.push({\n data: [\n { type: 'comment', id: '2' },\n { type: 'comment', id: '3' },\n ]\n });\n\n commentsRef.ids(); // ['2', '3']\n ```\n\n For convenience, you can also pass in an array of resources or resource identifiers\n without wrapping them in the `data` property:\n\n ```js\n await commentsRef.push([\n { type: 'comment', id: '4' },\n { type: 'comment', id: '5' },\n ]);\n\n commentsRef.ids(); // ['4', '5']\n ```\n\n When using the `data` property, you may also include other resource data via included,\n as well as provide new links and meta to the relationship.\n\n ```js\n await commentsRef.push({\n links: {\n related: '/posts/1/comments'\n },\n meta: {\n total: 2\n },\n data: [\n { type: 'comment', id: '4' },\n { type: 'comment', id: '5' },\n ],\n included: [\n { type: 'other-thing', id: '1', attributes: { foo: 'bar' },\n ]\n });\n ```\n\n By default, the store will attempt to fetch any unloaded records before resolving\n the returned promise with the ManyArray.\n\n Alternatively, pass `true` as the second argument to avoid fetching unloaded records\n and instead the promise will resolve with void without attempting to fetch. This is\n particularly useful if you want to update the state of the relationship without\n forcing the load of all of the associated records.\n\n @public\n @param {Array|Object} doc a JSONAPI document object describing the new value of this relationship.\n @param {Boolean} [skipFetch] if `true`, do not attempt to fetch unloaded records\n @return {Promise<ManyArray | void>}\n */\n async push(\n doc: ExistingResourceObject[] | CollectionResourceDocument,\n skipFetch?: boolean\n ): Promise<ManyArray<Related> | void> {\n const { store } = this;\n const dataDoc = Array.isArray(doc) ? { data: doc } : doc;\n const isResourceData = Array.isArray(dataDoc.data) && dataDoc.data.length > 0 && isMaybeResource(dataDoc.data[0]);\n\n // enforce that one of links, meta or data is present\n assert(\n `You must provide at least one of 'links', 'meta' or 'data' when calling hasManyReference.push`,\n 'links' in dataDoc || 'meta' in dataDoc || 'data' in dataDoc\n );\n\n const identifiers = !Array.isArray(dataDoc.data)\n ? []\n : isResourceData\n ? (store._push(dataDoc, true) as StableRecordIdentifier[])\n : dataDoc.data.map((i) => store.identifierCache.getOrCreateRecordIdentifier(i));\n const { identifier } = this.hasManyRelationship;\n\n if (DEBUG) {\n const relationshipMeta = this.hasManyRelationship.definition;\n\n identifiers.forEach((added) => {\n assertPolymorphicType(identifier, relationshipMeta, added, store);\n });\n }\n\n const newData: CollectionResourceRelationship = {};\n // only set data if it was passed in\n if (Array.isArray(dataDoc.data)) {\n newData.data = identifiers;\n }\n if ('links' in dataDoc) {\n newData.links = dataDoc.links;\n }\n if ('meta' in dataDoc) {\n newData.meta = dataDoc.meta;\n }\n store._join(() => {\n this.graph.push({\n op: 'updateRelationship',\n record: identifier,\n field: this.key,\n value: newData,\n });\n });\n\n if (!skipFetch) return this.load();\n }\n\n _isLoaded() {\n const hasRelationshipDataProperty = this.hasManyRelationship.state.hasReceivedData;\n if (!hasRelationshipDataProperty) {\n return false;\n }\n\n const relationship = this.graph.getData(this.hasManyRelationship.identifier, this.key) as CollectionRelationship;\n\n return relationship.data?.every((identifier) => {\n return this.store._instanceCache.recordIsLoaded(identifier, true) === true;\n });\n }\n\n /**\n `value()` synchronously returns the current value of the has-many\n relationship. Unlike `record.relationshipName`, calling\n `value()` on a reference does not trigger a fetch if the async\n relationship is not yet loaded. If the relationship is not loaded\n it will always return `null`.\n\n Example\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', { async: true, inverse: null }) comments;\n }\n ```\n\n ```javascript\n let post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n });\n\n let commentsRef = post.hasMany('comments');\n\n post.comments.then(function(comments) {\n commentsRef.value() === comments\n })\n ```\n\n @public\n @return {ManyArray}\n */\n value(): ManyArray<Related> | null {\n const support: LegacySupport = (LEGACY_SUPPORT as Map<StableRecordIdentifier, LegacySupport>).get(\n this.___identifier\n )!;\n\n if (!ensureRefCanSubscribe(this)) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._ref;\n return null;\n }\n\n return support.getManyArray<Related>(this.key);\n }\n\n /**\n Loads the relationship if it is not already loaded. If the\n relationship is already loaded this method does not trigger a new\n load. This causes a request to the specified\n relationship link or reloads all items currently in the relationship.\n\n Example\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', { async: true, inverse: null }) comments;\n }\n ```\n\n ```javascript\n let post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n });\n\n let commentsRef = post.hasMany('comments');\n\n commentsRef.load().then(function(comments) {\n //...\n });\n ```\n\n You may also pass in an options object whose properties will be\n fed forward. This enables you to pass `adapterOptions` into the\n request given to the adapter via the reference.\n\n Example\n\n ```javascript\n commentsRef.load({ adapterOptions: { isPrivate: true } })\n .then(function(comments) {\n //...\n });\n ```\n\n ```js [app/adapters/comment.js]\n export default ApplicationAdapter.extend({\n findMany(store, type, id, snapshots) {\n // In the adapter you will have access to adapterOptions.\n let adapterOptions = snapshots[0].adapterOptions;\n }\n });\n ```\n\n @public\n @param {Object} options the options to pass in.\n @return {Promise} a promise that resolves with the ManyArray in\n this has-many relationship.\n */\n async load(options?: BaseFinderOptions): Promise<ManyArray<Related>> {\n const support: LegacySupport = (LEGACY_SUPPORT as Map<StableRecordIdentifier, LegacySupport>).get(\n this.___identifier\n )!;\n const fetchSyncRel =\n !this.hasManyRelationship.definition.isAsync && !areAllInverseRecordsLoaded(this.store, this._resource());\n return fetchSyncRel\n ? (support.reloadHasMany(this.key, options) as Promise<ManyArray<Related>>)\n : // we cast to fix the return type since typescript and eslint don't understand async functions\n // properly\n (support.getHasMany(this.key, options) as Promise<ManyArray<Related>> | ManyArray<Related>);\n }\n\n /**\n Reloads this has-many relationship. This causes a request to the specified\n relationship link or reloads all items currently in the relationship.\n\n Example\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', { async: true, inverse: null }) comments;\n }\n ```\n\n ```javascript\n let post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n });\n\n let commentsRef = post.hasMany('comments');\n\n commentsRef.reload().then(function(comments) {\n //...\n });\n ```\n\n You may also pass in an options object whose properties will be\n fed forward. This enables you to pass `adapterOptions` into the\n request given to the adapter via the reference. A full example\n can be found in the `load` method.\n\n Example\n\n ```javascript\n commentsRef.reload({ adapterOptions: { isPrivate: true } })\n ```\n\n @public\n @param {Object} options the options to pass in.\n @return {Promise} a promise that resolves with the ManyArray in this has-many relationship.\n */\n reload(options?: BaseFinderOptions): Promise<ManyArray<Related>> {\n const support: LegacySupport = (LEGACY_SUPPORT as Map<StableRecordIdentifier, LegacySupport>).get(\n this.___identifier\n )!;\n return support.reloadHasMany(this.key, options) as Promise<ManyArray<Related>>;\n }\n}\ndefineNonEnumerableSignal(HasManyReference.prototype, '_ref', 0);\n\nexport function isMaybeResource(object: ExistingResourceObject | ResourceIdentifier): object is ExistingResourceObject {\n const keys = Object.keys(object).filter((k) => k !== 'id' && k !== 'type' && k !== 'lid');\n return keys.length > 0;\n}\n\nfunction ensureRefCanSubscribe(rel: HasManyReference) {\n const loaded = rel._isLoaded();\n\n if (!loaded) {\n // subscribe to changes\n // for when we are not loaded yet\n //\n // because the graph optimizes the case where a relationship has never been subscribed,\n // we force accessed to be true here. When we make the graph public we should create a\n // subscribe/unsubscribe API\n const edge = rel.graph.get(rel.___identifier, rel.key);\n assert(`Expected a hasMany relationship for ${rel.___identifier.type}:${rel.key}`, 'accessed' in edge);\n edge.accessed = true;\n\n return false;\n }\n return true;\n}\n","import type { NotificationType, Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport type { Graph, ResourceEdge } from '@warp-drive/core/graph/-private';\nimport { defineNonEnumerableSignal, memoized } from '@warp-drive/core/store/-private';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core/types/identifier';\nimport type { TypeFromInstance, TypeFromInstanceOrString } from '@warp-drive/core/types/record';\nimport type {\n LinkObject,\n Links,\n Meta,\n SingleResourceDocument,\n SingleResourceRelationship,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport type { IsUnknown } from '../belongs-to.ts';\nimport { assertPolymorphicType } from '../debug/assert-polymorphic-type.ts';\nimport type { LegacySupport } from '../legacy-relationships-support.ts';\nimport { areAllInverseRecordsLoaded, LEGACY_SUPPORT } from '../legacy-relationships-support.ts';\nimport type { MaybeBelongsToFields } from '../type-utils.ts';\nimport { isMaybeResource } from './has-many.ts';\n\ninterface ResourceIdentifier {\n links?: {\n related?: string | LinkObject;\n };\n meta?: Meta;\n}\n\nfunction isResourceIdentiferWithRelatedLinks(\n value: SingleResourceRelationship | ResourceIdentifier | null\n): value is ResourceIdentifier & { links: { related: string | LinkObject | null } } {\n return Boolean(value && value.links && value.links.related);\n}\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 from `@ember-data/model` as it allows synchronous access to\n the relationship data if loaded, as well as APIs for loading, reloading\n the data or accessing available 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 @class BelongsToReference\n @public\n */\nexport default class BelongsToReference<\n T = unknown,\n K extends string = IsUnknown<T> extends true ? string : MaybeBelongsToFields<T>,\n Related = K extends keyof T ? Exclude<Awaited<T[K]>, null> : unknown,\n> {\n declare graph: Graph;\n declare store: Store;\n declare belongsToRelationship: ResourceEdge;\n /**\n * The field name on the parent record for this has-many relationship.\n *\n * @property key\n * @type {String}\n * @public\n */\n declare key: K;\n\n /**\n * The type of resource this relationship will contain.\n *\n * @property type\n * @type {String}\n * @public\n */\n declare type: TypeFromInstanceOrString<Related>;\n\n // unsubscribe tokens given to us by the notification manager\n declare ___token: object;\n declare ___identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n declare ___relatedToken: object | null;\n\n declare _ref: number;\n\n constructor(\n store: Store,\n graph: Graph,\n parentIdentifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>,\n belongsToRelationship: ResourceEdge,\n key: K\n ) {\n this.graph = graph;\n this.key = key;\n this.belongsToRelationship = belongsToRelationship;\n this.type = belongsToRelationship.definition.type as TypeFromInstanceOrString<Related>;\n this.store = store;\n this.___identifier = parentIdentifier;\n this.___relatedToken = null;\n\n this.___token = store.notifications.subscribe(\n parentIdentifier,\n (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'relationships' && notifiedKey === key) {\n this._ref++;\n }\n }\n );\n\n // TODO inverse\n }\n\n destroy() {\n // TODO @feature we need the notification manager often enough\n // we should potentially just expose it fully public\n this.store.notifications.unsubscribe(this.___token);\n this.___token = null as unknown as object;\n if (this.___relatedToken) {\n this.store.notifications.unsubscribe(this.___relatedToken);\n this.___relatedToken = null;\n }\n }\n\n /**\n * The identifier of the record that this reference refers to.\n * `null` if no related record is known.\n *\n * @property identifier\n * @type {StableRecordIdentifier | null}\n * @public\n */\n @memoized\n get identifier(): StableRecordIdentifier<TypeFromInstanceOrString<Related>> | null {\n if (this.___relatedToken) {\n this.store.notifications.unsubscribe(this.___relatedToken);\n this.___relatedToken = null;\n }\n\n const resource = this._resource();\n if (resource && resource.data) {\n const identifier = this.store.identifierCache.getOrCreateRecordIdentifier(resource.data);\n this.___relatedToken = this.store.notifications.subscribe(\n identifier,\n (_: StableRecordIdentifier, bucket: NotificationType, notifiedKey?: string) => {\n if (bucket === 'identity' || (bucket === 'attributes' && notifiedKey === 'id')) {\n this._ref++;\n }\n }\n );\n\n return identifier as StableRecordIdentifier<TypeFromInstanceOrString<Related>>;\n }\n\n return null;\n }\n\n /**\n The `id` of the record that this reference refers to. Together, the\n `type()` and `id()` methods form a composite key for the identity\n map. This can be used to access the id of an async relationship\n without triggering a fetch that would normally happen if you\n attempted to use `record.relationship.id`.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @belongsTo('user', { async: true, inverse: null }) user;\n }\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n }\n ```\n\n @public\n @return {String} The id of the record in this belongsTo relationship.\n */\n id(): string | null {\n return this.identifier?.id || null;\n }\n\n /**\n The link Ember Data will use to fetch or reload this belongs-to\n relationship. By default it uses only the \"related\" resource linkage.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n export default Model.extend({\n user: belongsTo('user', { async: true, inverse: null })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: '/articles/1/author'\n }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n }\n ```\n\n @public\n @return {String} The link Ember Data will use to fetch or reload this belongs-to relationship.\n */\n link(): string | null {\n const resource = this._resource();\n\n if (isResourceIdentiferWithRelatedLinks(resource)) {\n if (resource.links) {\n const related = resource.links.related;\n return !related || typeof related === 'string' ? related : related.href;\n }\n }\n return null;\n }\n\n /**\n * any links that have been received for this relationship\n *\n * @public\n * @return\n */\n links(): Links | null {\n const resource = this._resource();\n\n return resource && resource.links ? resource.links : null;\n }\n\n /**\n The meta data for the belongs-to relationship.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n export default Model.extend({\n user: belongsTo('user', { async: true, inverse: null })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: {\n href: '/articles/1/author'\n },\n },\n meta: {\n lastUpdated: 1458014400000\n }\n }\n }\n }\n });\n\n let userRef = blog.belongsTo('user');\n\n userRef.meta() // { lastUpdated: 1458014400000 }\n ```\n\n @public\n @return {Object} The meta information for the belongs-to relationship.\n */\n meta(): Meta | null {\n let meta: Meta | null = null;\n const resource = this._resource();\n if (resource && resource.meta && typeof resource.meta === 'object') {\n meta = resource.meta;\n }\n return meta;\n }\n\n _resource() {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._ref; // subscribe\n const cache = this.store.cache;\n return cache.getRelationship(this.___identifier, this.key) as SingleResourceRelationship<\n StableRecordIdentifier<TypeFromInstance<Related>>\n >;\n }\n\n /**\n This returns a string that represents how the reference will be\n looked up when it is loaded. If the relationship has a link it will\n use the \"link\" otherwise it defaults to \"id\".\n\n Example\n\n ```js [app/models/post.js]\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment', { async: true, inverse: null }) comments;\n }\n ```\n\n ```javascript\n let post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n });\n\n let commentsRef = post.hasMany('comments');\n\n // get the identifier of the reference\n if (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n } else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n }\n ```\n\n @public\n @return {String} The name of the remote type. This should either be `link` or `id`\n */\n remoteType(): 'link' | 'id' {\n const value = this._resource();\n if (isResourceIdentiferWithRelatedLinks(value)) {\n return 'link';\n }\n return 'id';\n }\n\n /**\n `push` can be used to update the data in the relationship and EmberData\n will treat the new data as the canonical value of this relationship on\n the backend. A value of `null` (e.g. `{ data: null }`) can be passed to\n clear the relationship.\n\n Example model\n\n ```js [app/models/blog.js]\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @belongsTo('user', { async: true, inverse: null }) user;\n }\n ```\n\n Setup some initial state, note we haven't loaded the user yet:\n\n ```js\n const blog = store.push({\n data: {\n type: 'blog',\n id: '1',\n relationships: {\n user: {\n data: { type: 'user', id: '1' }\n }\n }\n }\n });\n\n const userRef = blog.belongsTo('user');\n userRef.id(); // '1'\n ```\n\n Update the state using `push`, note we can do this even without\n having loaded the user yet by providing a resource-identifier.\n\n Both full a resource and a resource-identifier are supported.\n\n ```js\n await userRef.push({\n data: {\n type: 'user',\n id: '2',\n }\n });\n\n userRef.id(); // '2'\n ```\n\n You may also pass in links and meta fore the relationship, and sideload\n additional resources that might be required.\n\n ```js\n await userRef.push({\n data: {\n type: 'user',\n id: '2',\n },\n links: {\n related: '/articles/1/author'\n },\n meta: {\n lastUpdated: Date.now()\n },\n included: [\n {\n type: 'user-preview',\n id: '2',\n attributes: {\n username: '@runspired'\n }\n }\n ]\n });\n ```\n\n By default, the store will attempt to fetch the record if it is not loaded or its\n resource data is not included in the call to `push` before resolving the returned\n promise with the new state..\n\n Alternatively, pass `true` as the second argument to avoid fetching unloaded records\n and instead the promise will resolve with void without attempting to fetch. This is\n particularly useful if you want to update the state of the relationship without\n forcing the load of all of the associated record.\n\n @public\n @param {Object} doc a JSONAPI document object describing the new value of this relationship.\n @param {Boolean} [skipFetch] if `true`, do not attempt to fetch unloaded records\n @return {Promise<OpaqueRecordInstance | null | void>}\n */\n async push(doc: SingleResourceDocument, skipFetch?: boolean): Promise<Related | null | void> {\n const { store } = this;\n const isResourceData = doc.data && isMaybeResource(doc.data);\n const added = isResourceData\n ? (store._push(doc, true) as StableExistingRecordIdentifier)\n : doc.data\n ? (store.identifierCache.getOrCreateRecordIdentifier(doc.data) as StableExistingRecordIdentifier)\n : null;\n const { identifier } = this.belongsToRelationship;\n\n if (DEBUG) {\n if (added) {\n assertPolymorphicType(identifier, this.belongsToRelationship.definition, added, store);\n }\n }\n\n const newData: SingleResourceRelationship = {};\n\n // only set data if it was passed in\n if (doc.data || doc.data === null) {\n newData.data = added;\n }\n if ('links' in doc) {\n newData.links = doc.links;\n }\n if ('meta' in doc) {\n newData.meta = doc.meta;\n }\n store._join(() => {\n this.graph.push({\n op: 'updateRelationship',\n record: identifier,\n field: this.key,\n value: newData,\n });\n });\n\n if (!skipFetch) return this.load();\n }\n\n /**\n `value()` synchronously returns the current value of the belongs-to\n relationship. Unlike `record.relationshipName`, calling\n `value()` on a reference does not trigger a fetch if the async\n relationship is not yet loaded. If the relationship is not loaded\n it will always return `null`.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @belongsTo('user', { async: true, inverse: null }) user;\n }\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.value(); // null\n\n // provide data for reference\n userRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value(); // user\n });\n ```\n\n @public\n @return {Model} the record in this relationship\n */\n value(): Related | null {\n const resource = this._resource();\n return resource && resource.data ? this.store.peekRecord(resource.data) : null;\n }\n\n /**\n Loads a record in a belongs-to relationship if it is not already\n loaded. If the relationship is already loaded this method does not\n trigger a new load.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @belongsTo('user', { async: true, inverse: null }) user;\n }\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.value(); // null\n\n userRef.load().then(function(user) {\n userRef.value() === user\n });\n ```\n\n You may also pass in an options object whose properties will be\n fed forward. This enables you to pass `adapterOptions` into the\n request given to the adapter via the reference.\n\n Example\n\n ```javascript\n userRef.load({ adapterOptions: { isPrivate: true } }).then(function(user) {\n userRef.value() === user;\n });\n ```\n ```js [app/adapters/user.js]\n import Adapter from '@ember-data/adapter';\n\n export default class UserAdapter extends Adapter {\n findRecord(store, type, id, snapshot) {\n // In the adapter you will have access to adapterOptions.\n let adapterOptions = snapshot.adapterOptions;\n }\n });\n ```\n\n @public\n @param {Object} options the options to pass in.\n @return {Promise} a promise that resolves with the record in this belongs-to relationship.\n */\n async load(options?: Record<string, unknown>): Promise<Related | null> {\n const support: LegacySupport = (LEGACY_SUPPORT as Map<StableRecordIdentifier, LegacySupport>).get(\n this.___identifier\n )!;\n const fetchSyncRel =\n !this.belongsToRelationship.definition.isAsync && !areAllInverseRecordsLoaded(this.store, this._resource());\n return fetchSyncRel\n ? support.reloadBelongsTo(this.key, options).then(() => this.value())\n : // we cast to fix the return type since typescript and eslint don't understand async functions\n // properly\n (support.getBelongsTo(this.key, options) as Promise<Related | null>);\n }\n\n /**\n Triggers a reload of the value in this relationship. If the\n remoteType is `\"link\"` Ember Data will use the relationship link to\n reload the relationship. Otherwise it will reload the record by its\n id.\n\n Example\n\n ```javascript\n // models/blog.js\n import { Model, belongsTo } from '@warp-drive/legacy/model';\n\n export default class BlogModel extends Model {\n @belongsTo('user', { async: true, inverse: null }) user;\n }\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.reload().then(function(user) {\n userRef.value() === user\n });\n ```\n\n You may also pass in an options object whose properties will be\n fed forward. This enables you to pass `adapterOptions` into the\n request given to the adapter via the reference. A full example\n can be found in the `load` method.\n\n Example\n\n ```javascript\n userRef.reload({ adapterOptions: { isPrivate: true } })\n ```\n\n @public\n @param {Object} options the options to pass in.\n @return {Promise} a promise that resolves with the record in this belongs-to relationship after the reload has completed.\n */\n reload(options?: Record<string, unknown>) {\n const support: LegacySupport = (LEGACY_SUPPORT as Map<StableRecordIdentifier, LegacySupport>).get(\n this.___identifier\n )!;\n return support.reloadBelongsTo(this.key, options).then(() => this.value());\n }\n}\ndefineNonEnumerableSignal(BelongsToReference.prototype, '_ref', 0);\n","import type { Document, Store } from '@warp-drive/core';\nimport { DEBUG } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/core/build-config/macros';\nimport type { CollectionEdge, Graph, GraphEdge, ResourceEdge, UpgradedMeta } from '@warp-drive/core/graph/-private';\nimport type { LiveArray } from '@warp-drive/core/store/-private';\nimport {\n ARRAY_SIGNAL,\n fastPush,\n isStableIdentifier,\n notifyInternalSignal,\n peekCache,\n recordIdentifierFor,\n RelatedCollection as ManyArray,\n SOURCE,\n storeFor,\n} from '@warp-drive/core/store/-private';\nimport type { BaseFinderOptions, StableRecordIdentifier } from '@warp-drive/core/types';\nimport { getOrSetGlobal } from '@warp-drive/core/types/-private';\nimport type { Cache } from '@warp-drive/core/types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core/types/cache/relationship';\nimport type { LocalRelationshipOperation } from '@warp-drive/core/types/graph';\nimport type { OpaqueRecordInstance, TypeFromInstanceOrString } from '@warp-drive/core/types/record';\nimport { EnableHydration } from '@warp-drive/core/types/request';\nimport type { LegacyHasManyField } from '@warp-drive/core/types/schema/fields.js';\nimport type {\n CollectionResourceRelationship,\n InnerRelationshipDocument,\n SingleResourceRelationship,\n} from '@warp-drive/core/types/spec/json-api-raw';\n\nimport { upgradeStore } from '../../compat/-private.ts';\nimport type { MinimalLegacyRecord } from './model-methods.ts';\nimport type { BelongsToProxyCreateArgs, BelongsToProxyMeta } from './promise-belongs-to.ts';\nimport { PromiseBelongsTo } from './promise-belongs-to.ts';\nimport type { HasManyProxyCreateArgs } from './promise-many-array.ts';\nimport { PromiseManyArray } from './promise-many-array.ts';\nimport BelongsToReference from './references/belongs-to.ts';\nimport HasManyReference from './references/has-many.ts';\n\ntype PromiseBelongsToFactory<T = unknown> = { create(args: BelongsToProxyCreateArgs<T>): PromiseBelongsTo<T> };\n\nexport const LEGACY_SUPPORT = getOrSetGlobal(\n 'LEGACY_SUPPORT',\n new Map<StableRecordIdentifier | MinimalLegacyRecord, LegacySupport>()\n);\n\nexport function lookupLegacySupport(record: MinimalLegacyRecord): LegacySupport {\n const identifier = recordIdentifierFor(record);\n assert(`Expected a record`, identifier);\n let support = LEGACY_SUPPORT.get(identifier);\n\n if (!support) {\n assert(`Memory Leak Detected`, !record.isDestroyed && !record.isDestroying);\n support = new LegacySupport(record);\n LEGACY_SUPPORT.set(identifier, support);\n LEGACY_SUPPORT.set(record, support);\n }\n\n return support;\n}\n\nexport class LegacySupport {\n declare record: MinimalLegacyRecord;\n declare store: Store;\n declare graph: Graph;\n declare cache: Cache;\n declare references: Record<string, BelongsToReference | HasManyReference>;\n declare identifier: StableRecordIdentifier;\n declare _manyArrayCache: Record<string, ManyArray>;\n declare _relationshipPromisesCache: Record<string, Promise<ManyArray | OpaqueRecordInstance>>;\n declare _relationshipProxyCache: Record<string, PromiseManyArray | PromiseBelongsTo | undefined>;\n declare _pending: Record<string, Promise<StableRecordIdentifier | null> | undefined>;\n\n declare isDestroying: boolean;\n declare isDestroyed: boolean;\n\n constructor(record: MinimalLegacyRecord) {\n this.record = record;\n this.store = storeFor(record)!;\n this.identifier = recordIdentifierFor(record);\n this.cache = peekCache(record);\n\n if (this.store._graph) {\n this.graph = this.store._graph;\n }\n\n this._manyArrayCache = Object.create(null) as Record<string, ManyArray>;\n this._relationshipPromisesCache = Object.create(null) as Record<string, Promise<ManyArray | OpaqueRecordInstance>>;\n this._relationshipProxyCache = Object.create(null) as Record<string, PromiseManyArray | PromiseBelongsTo>;\n this._pending = Object.create(null) as Record<string, Promise<StableRecordIdentifier | null>>;\n this.references = Object.create(null) as Record<string, BelongsToReference>;\n }\n\n _syncArray(array: LiveArray) {\n // It’s possible the parent side of the relationship may have been destroyed by this point\n if (this.isDestroyed || this.isDestroying) {\n return;\n }\n const currentState = array[SOURCE];\n const identifier = this.identifier;\n\n const [identifiers, jsonApi] = this._getCurrentState(identifier, (array as ManyArray).key);\n\n if (jsonApi.meta) {\n array.meta = jsonApi.meta;\n }\n\n if (jsonApi.links) {\n array.links = jsonApi.links;\n }\n\n currentState.length = 0;\n fastPush(currentState, identifiers);\n }\n\n mutate(mutation: LocalRelationshipOperation): void {\n this.cache.mutate(mutation);\n }\n\n _findBelongsTo(\n key: string,\n resource: SingleResourceRelationship,\n relationship: ResourceEdge,\n options?: BaseFinderOptions\n ): Promise<OpaqueRecordInstance | null> {\n // TODO @runspired follow up if parent isNew then we should not be attempting load here\n // TODO @runspired follow up on whether this should be in the relationship requests cache\n return this._findBelongsToByJsonApiResource(resource, this.identifier, relationship, options).then(\n (identifier: StableRecordIdentifier | null) =>\n handleCompletedRelationshipRequest(this, key, relationship, identifier),\n (e: Error) => handleCompletedRelationshipRequest(this, key, relationship, null, e)\n );\n }\n\n reloadBelongsTo(key: string, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null> {\n const loadingPromise = this._relationshipPromisesCache[key] as Promise<OpaqueRecordInstance | null> | undefined;\n if (loadingPromise) {\n return loadingPromise;\n }\n\n const relationship = this.graph.get(this.identifier, key);\n assert(`Expected ${key} to be a belongs-to relationship`, isBelongsTo(relationship));\n\n const resource = this.cache.getRelationship(this.identifier, key) as SingleResourceRelationship;\n relationship.state.hasFailedLoadAttempt = false;\n relationship.state.shouldForceReload = true;\n const promise = this._findBelongsTo(key, resource, relationship, options);\n if (this._relationshipProxyCache[key]) {\n // @ts-expect-error\n return this._updatePromiseProxyFor('belongsTo', key, { promise });\n }\n return promise;\n }\n\n getBelongsTo(key: string, options?: BaseFinderOptions): PromiseBelongsTo | OpaqueRecordInstance | null {\n const { identifier, cache } = this;\n const resource = cache.getRelationship(this.identifier, key) as SingleResourceRelationship;\n const relatedIdentifier = resource && resource.data ? resource.data : null;\n assert(`Expected a stable identifier`, !relatedIdentifier || isStableIdentifier(relatedIdentifier));\n\n const store = this.store;\n const relationship = this.graph.get(this.identifier, key);\n assert(`Expected ${key} to be a belongs-to relationship`, isBelongsTo(relationship));\n\n const isAsync = relationship.definition.isAsync;\n const _belongsToState: BelongsToProxyMeta = {\n key,\n store,\n legacySupport: this,\n modelName: relationship.definition.type,\n };\n\n if (isAsync) {\n if (relationship.state.hasFailedLoadAttempt) {\n return this._relationshipProxyCache[key] as PromiseBelongsTo;\n }\n\n const promise = this._findBelongsTo(key, resource, relationship, options);\n const isLoaded = relatedIdentifier && store._instanceCache.recordIsLoaded(relatedIdentifier);\n\n return this._updatePromiseProxyFor('belongsTo', key, {\n promise,\n content: isLoaded ? store._instanceCache.getRecord(relatedIdentifier) : null,\n _belongsToState,\n });\n } else {\n if (relatedIdentifier === null) {\n return null;\n } else {\n assert(\n `You looked up the '${key}' relationship on a '${identifier.type}' with id ${\n identifier.id || 'null'\n } but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (\\`belongsTo(<type>, { async: true, inverse: <inverse> })\\`)`,\n store._instanceCache.recordIsLoaded(relatedIdentifier, true)\n );\n return store._instanceCache.getRecord(relatedIdentifier);\n }\n }\n }\n\n setDirtyBelongsTo(key: string, value: OpaqueRecordInstance | null) {\n return this.cache.mutate(\n {\n op: 'replaceRelatedRecord',\n record: this.identifier,\n field: key,\n value: extractIdentifierFromRecord(value),\n },\n // @ts-expect-error\n true\n );\n }\n\n _getCurrentState<T>(\n identifier: StableRecordIdentifier,\n field: string\n ): [StableRecordIdentifier<TypeFromInstanceOrString<T>>[], CollectionRelationship] {\n const jsonApi = this.cache.getRelationship(identifier, field) as CollectionRelationship;\n const cache = this.store._instanceCache;\n const identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[] = [];\n if (jsonApi.data) {\n for (let i = 0; i < jsonApi.data.length; i++) {\n const relatedIdentifier = jsonApi.data[i] as StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n assert(`Expected a stable identifier`, isStableIdentifier(relatedIdentifier));\n if (cache.recordIsLoaded(relatedIdentifier, true)) {\n identifiers.push(relatedIdentifier);\n }\n }\n }\n\n return [identifiers, jsonApi];\n }\n\n getManyArray<T>(key: string, definition?: UpgradedMeta): ManyArray<T> {\n if (this.graph) {\n let manyArray: ManyArray<T> | undefined = this._manyArrayCache[key] as ManyArray<T> | undefined;\n if (!definition) {\n definition = this.graph.get(this.identifier, key).definition;\n }\n\n if (!manyArray) {\n const [identifiers, doc] = this._getCurrentState<T>(this.identifier, key);\n\n manyArray = new ManyArray<T>({\n store: this.store,\n type: definition.type as TypeFromInstanceOrString<T>,\n identifier: this.identifier,\n cache: this.cache,\n field: this.store.schema.fields(this.identifier).get(key) as LegacyHasManyField,\n identifiers,\n key,\n meta: doc.meta || null,\n links: doc.links || null,\n isPolymorphic: definition.isPolymorphic,\n isAsync: definition.isAsync,\n _inverseIsAsync: definition.inverseIsAsync,\n // @ts-expect-error Typescript doesn't have a way for us to thread the generic backwards so it infers unknown instead of T\n manager: this,\n isLoaded: !definition.isAsync,\n allowMutation: true,\n });\n this._manyArrayCache[key] = manyArray;\n }\n\n return manyArray;\n }\n assert('hasMany only works with the @ember-data/json-api package');\n }\n\n fetchAsyncHasMany(\n key: string,\n relationship: CollectionEdge,\n manyArray: ManyArray,\n options?: BaseFinderOptions\n ): Promise<ManyArray> {\n if (this.graph) {\n let loadingPromise = this._relationshipPromisesCache[key] as Promise<ManyArray> | undefined;\n if (loadingPromise) {\n return loadingPromise;\n }\n\n const jsonApi = this.cache.getRelationship(this.identifier, key) as CollectionRelationship;\n const promise = this._findHasManyByJsonApiResource(jsonApi, this.identifier, relationship, options);\n\n if (!promise) {\n manyArray.isLoaded = true;\n return Promise.resolve(manyArray);\n }\n\n loadingPromise = promise.then(\n () => handleCompletedRelationshipRequest(this, key, relationship, manyArray),\n (e: Error) => handleCompletedRelationshipRequest(this, key, relationship, manyArray, e)\n );\n this._relationshipPromisesCache[key] = loadingPromise;\n return loadingPromise;\n }\n assert('hasMany only works with the @ember-data/json-api package');\n }\n\n reloadHasMany<T>(key: string, options?: BaseFinderOptions): Promise<ManyArray<T>> | PromiseManyArray<T> {\n if (this.graph) {\n const loadingPromise = this._relationshipPromisesCache[key];\n if (loadingPromise) {\n return loadingPromise as Promise<ManyArray<T>>;\n }\n const relationship = this.graph.get(this.identifier, key) as CollectionEdge;\n const { definition, state } = relationship;\n\n state.hasFailedLoadAttempt = false;\n state.shouldForceReload = true;\n const manyArray = this.getManyArray(key, definition);\n const promise = this.fetchAsyncHasMany(key, relationship, manyArray, options);\n\n if (this._relationshipProxyCache[key]) {\n return this._updatePromiseProxyFor('hasMany', key, { promise }) as PromiseManyArray<T>;\n }\n\n return promise as Promise<ManyArray<T>>;\n }\n assert(`hasMany only works with the @ember-data/json-api package`);\n }\n\n getHasMany(key: string, options?: BaseFinderOptions): PromiseManyArray | ManyArray {\n if (this.graph) {\n const relationship = this.graph.get(this.identifier, key) as CollectionEdge;\n const { definition, state } = relationship;\n const manyArray = this.getManyArray(key, definition);\n\n if (definition.isAsync) {\n if (state.hasFailedLoadAttempt) {\n return this._relationshipProxyCache[key] as PromiseManyArray;\n }\n\n const promise = this.fetchAsyncHasMany(key, relationship, manyArray, options);\n\n return this._updatePromiseProxyFor('hasMany', key, { promise, content: manyArray });\n } else {\n assert(\n `You looked up the '${key}' relationship on a '${this.identifier.type}' with id ${\n this.identifier.id || 'null'\n } but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async ('hasMany(<type>, { async: true, inverse: <inverse> })')`,\n !anyUnloaded(this.store, relationship)\n );\n\n return manyArray;\n }\n }\n assert(`hasMany only works with the @ember-data/json-api package`);\n }\n\n _updatePromiseProxyFor(kind: 'hasMany', key: string, args: HasManyProxyCreateArgs): PromiseManyArray;\n _updatePromiseProxyFor(kind: 'belongsTo', key: string, args: BelongsToProxyCreateArgs): PromiseBelongsTo;\n _updatePromiseProxyFor(\n kind: 'belongsTo',\n key: string,\n args: { promise: Promise<OpaqueRecordInstance | null> }\n ): PromiseBelongsTo;\n _updatePromiseProxyFor(\n kind: 'hasMany' | 'belongsTo',\n key: string,\n args: BelongsToProxyCreateArgs | HasManyProxyCreateArgs | { promise: Promise<OpaqueRecordInstance | null> }\n ): PromiseBelongsTo | PromiseManyArray {\n let promiseProxy = this._relationshipProxyCache[key];\n if (kind === 'hasMany') {\n const { promise, content } = args as HasManyProxyCreateArgs;\n if (promiseProxy) {\n assert(`Expected a PromiseManyArray`, '_update' in promiseProxy);\n promiseProxy._update(promise, content);\n } else {\n promiseProxy = this._relationshipProxyCache[key] = new PromiseManyArray(promise, content);\n }\n return promiseProxy;\n }\n if (promiseProxy) {\n const { promise, content } = args as BelongsToProxyCreateArgs;\n assert(`Expected a PromiseBelongsTo`, '_belongsToState' in promiseProxy);\n\n if (content !== undefined) {\n promiseProxy.set('content', content);\n }\n void promiseProxy.set('promise', promise);\n } else {\n promiseProxy = (PromiseBelongsTo as unknown as PromiseBelongsToFactory).create(args as BelongsToProxyCreateArgs);\n this._relationshipProxyCache[key] = promiseProxy;\n }\n\n return promiseProxy;\n }\n\n referenceFor(kind: 'belongsTo', name: string): BelongsToReference;\n referenceFor(kind: 'hasMany', name: string): HasManyReference;\n referenceFor(kind: 'belongsTo' | 'hasMany', name: string) {\n let reference = this.references[name];\n\n if (!reference) {\n if (!this.graph) {\n // TODO @runspired while this feels odd, it is not a regression in capability because we do\n // not today support references pulling from RecordDatas other than our own\n // because of the intimate API access involved. This is something we will need to redesign.\n assert(`snapshot.belongsTo only supported for @ember-data/json-api`);\n }\n const { graph, identifier } = this;\n const relationship = graph.get(identifier, name);\n\n if (DEBUG) {\n if (kind) {\n const modelName = identifier.type;\n const actualRelationshipKind = relationship.definition.kind;\n assert(\n `You tried to get the '${name}' relationship on a '${modelName}' via record.${kind}('${name}'), but the relationship is of kind '${actualRelationshipKind}'. Use record.${actualRelationshipKind}('${name}') instead.`,\n actualRelationshipKind === kind\n );\n }\n }\n\n const relationshipKind = relationship.definition.kind;\n\n if (relationshipKind === 'belongsTo') {\n reference = new BelongsToReference(this.store, graph, identifier, relationship as ResourceEdge, name);\n } else if (relationshipKind === 'hasMany') {\n reference = new HasManyReference(this.store, graph, identifier, relationship as CollectionEdge, name);\n }\n\n this.references[name] = reference;\n }\n\n return reference;\n }\n\n _findHasManyByJsonApiResource(\n resource: CollectionResourceRelationship,\n parentIdentifier: StableRecordIdentifier,\n relationship: CollectionEdge,\n options: BaseFinderOptions = {}\n ): Promise<void | unknown[]> | void {\n if (this.graph) {\n if (!resource) {\n return;\n }\n const { definition, state } = relationship;\n upgradeStore(this.store);\n const adapter = this.store.adapterFor?.(definition.type);\n const { isStale, hasDematerializedInverse, hasReceivedData, isEmpty, shouldForceReload } = state;\n const allInverseRecordsAreLoaded = areAllInverseRecordsLoaded(this.store, resource);\n const identifiers = resource.data;\n const shouldFindViaLink =\n resource.links &&\n resource.links.related &&\n (typeof adapter?.findHasMany === 'function' || typeof identifiers === 'undefined') &&\n (shouldForceReload || hasDematerializedInverse || isStale || (!allInverseRecordsAreLoaded && !isEmpty));\n\n const field = this.store.schema.fields({ type: definition.inverseType }).get(definition.key);\n assert(\n `Expected a hasMany field definition for ${definition.inverseType}.${definition.key}`,\n field && field.kind === 'hasMany'\n );\n\n const request = {\n useLink: shouldFindViaLink,\n field,\n links: resource.links,\n meta: resource.meta,\n options,\n record: parentIdentifier,\n };\n\n // fetch via link\n if (shouldFindViaLink) {\n assert(`Expected collection to be an array`, !identifiers || Array.isArray(identifiers));\n assert(`Expected stable identifiers`, !identifiers || identifiers.every(isStableIdentifier));\n\n const req = field.options.linksMode\n ? {\n url: getRelatedLink(resource),\n op: 'findHasMany',\n method: 'GET' as const,\n records: identifiers || [],\n data: request,\n [EnableHydration]: false,\n }\n : {\n op: 'findHasMany',\n records: identifiers || [],\n data: request,\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n };\n return this.store.request(req) as unknown as Promise<void>;\n }\n\n const preferLocalCache = hasReceivedData && !isEmpty;\n const hasLocalPartialData =\n hasDematerializedInverse || (isEmpty && Array.isArray(identifiers) && identifiers.length > 0);\n const attemptLocalCache = !shouldForceReload && !isStale && (preferLocalCache || hasLocalPartialData);\n\n if (attemptLocalCache && allInverseRecordsAreLoaded) {\n return;\n }\n\n const hasData = hasReceivedData && !isEmpty;\n if (attemptLocalCache || hasData || hasLocalPartialData) {\n assert(`Expected collection to be an array`, Array.isArray(identifiers));\n assert(`Expected stable identifiers`, identifiers.every(isStableIdentifier));\n\n options.reload = options.reload || !attemptLocalCache || undefined;\n return this.store.request({\n op: 'findHasMany',\n records: identifiers,\n data: request,\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n }) as unknown as Promise<void>;\n }\n\n // we were explicitly told we have no data and no links.\n // TODO if the relationshipIsStale, should we hit the adapter anyway?\n return;\n }\n assert(`hasMany only works with the @ember-data/json-api package`);\n }\n\n _findBelongsToByJsonApiResource(\n resource: SingleResourceRelationship,\n parentIdentifier: StableRecordIdentifier,\n relationship: ResourceEdge,\n options: BaseFinderOptions = {}\n ): Promise<StableRecordIdentifier | null> {\n if (!resource) {\n return Promise.resolve(null);\n }\n const key = relationship.definition.key;\n\n // interleaved promises mean that we MUST cache this here\n // in order to prevent infinite re-render if the request\n // fails.\n if (this._pending[key]) {\n return this._pending[key];\n }\n\n const identifier = resource.data ? resource.data : null;\n assert(`Expected a stable identifier`, !identifier || isStableIdentifier(identifier));\n\n const { isStale, hasDematerializedInverse, hasReceivedData, isEmpty, shouldForceReload } = relationship.state;\n\n const allInverseRecordsAreLoaded = areAllInverseRecordsLoaded(this.store, resource);\n const shouldFindViaLink =\n resource.links?.related &&\n (shouldForceReload || hasDematerializedInverse || isStale || (!allInverseRecordsAreLoaded && !isEmpty));\n\n const field = this.store.schema.fields(this.identifier).get(relationship.definition.key);\n assert(\n `Attempted to access a belongsTo relationship but no definition exists for it`,\n field && field.kind === 'belongsTo'\n );\n const request = {\n useLink: shouldFindViaLink,\n field,\n links: resource.links,\n meta: resource.meta,\n options,\n record: parentIdentifier,\n };\n\n // fetch via link\n if (shouldFindViaLink) {\n const req = field.options.linksMode\n ? {\n url: getRelatedLink(resource),\n op: 'findBelongsTo',\n method: 'GET' as const,\n records: identifier ? [identifier] : [],\n data: request,\n [EnableHydration]: false,\n }\n : {\n op: 'findBelongsTo',\n records: identifier ? [identifier] : [],\n data: request,\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n };\n const future = this.store.request<StableRecordIdentifier | null>(req);\n this._pending[key] = future\n .then((doc) =>\n field.options.linksMode\n ? (doc.content as unknown as Document<StableRecordIdentifier | null>).data!\n : doc.content\n )\n .finally(() => {\n this._pending[key] = undefined;\n });\n return this._pending[key];\n }\n\n const preferLocalCache = hasReceivedData && allInverseRecordsAreLoaded && !isEmpty;\n const hasLocalPartialData = hasDematerializedInverse || (isEmpty && resource.data);\n // null is explicit empty, undefined is \"we don't know anything\"\n const localDataIsEmpty = !identifier;\n const attemptLocalCache = !shouldForceReload && !isStale && (preferLocalCache || hasLocalPartialData);\n\n // we dont need to fetch and are empty\n if (attemptLocalCache && localDataIsEmpty) {\n return Promise.resolve(null);\n }\n\n // we dont need to fetch because we are local state\n const resourceIsLocal = identifier?.id === null;\n if ((attemptLocalCache && allInverseRecordsAreLoaded) || resourceIsLocal) {\n return Promise.resolve(identifier);\n }\n\n // we may need to fetch\n if (identifier) {\n assert(`Cannot fetch belongs-to relationship with no information`, identifier);\n options.reload = options.reload || !attemptLocalCache || undefined;\n\n this._pending[key] = this.store\n .request<StableRecordIdentifier | null>({\n op: 'findBelongsTo',\n records: [identifier],\n data: request,\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n })\n .then((doc) => doc.content)\n .finally(() => {\n this._pending[key] = undefined;\n });\n return this._pending[key];\n }\n\n // we were explicitly told we have no data and no links.\n // TODO if the relationshipIsStale, should we hit the adapter anyway?\n return Promise.resolve(null);\n }\n\n destroy() {\n this.isDestroying = true;\n\n let cache: Record<string, { destroy(): void } | undefined> = this._manyArrayCache;\n this._manyArrayCache = Object.create(null) as Record<string, ManyArray>;\n Object.keys(cache).forEach((key) => {\n cache[key]!.destroy();\n });\n\n cache = this._relationshipProxyCache;\n this._relationshipProxyCache = Object.create(null) as Record<string, PromiseManyArray | PromiseBelongsTo>;\n Object.keys(cache).forEach((key) => {\n const proxy = cache[key]!;\n if (proxy.destroy) {\n proxy.destroy();\n }\n });\n\n cache = this.references;\n this.references = Object.create(null) as Record<string, BelongsToReference | HasManyReference>;\n Object.keys(cache).forEach((key) => {\n cache[key]!.destroy();\n });\n this.isDestroyed = true;\n }\n}\n\nfunction getRelatedLink(resource: SingleResourceRelationship | CollectionResourceRelationship): string {\n const related = resource.links?.related;\n assert(`Expected a related link`, related);\n\n return typeof related === 'object' ? related.href : related;\n}\n\nfunction handleCompletedRelationshipRequest(\n recordExt: LegacySupport,\n key: string,\n relationship: ResourceEdge,\n value: StableRecordIdentifier | null\n): OpaqueRecordInstance | null;\nfunction handleCompletedRelationshipRequest(\n recordExt: LegacySupport,\n key: string,\n relationship: CollectionEdge,\n value: ManyArray\n): ManyArray;\nfunction handleCompletedRelationshipRequest(\n recordExt: LegacySupport,\n key: string,\n relationship: ResourceEdge,\n value: null,\n error: Error\n): never;\nfunction handleCompletedRelationshipRequest(\n recordExt: LegacySupport,\n key: string,\n relationship: CollectionEdge,\n value: ManyArray,\n error: Error\n): never;\nfunction handleCompletedRelationshipRequest(\n recordExt: LegacySupport,\n key: string,\n relationship: ResourceEdge | CollectionEdge,\n value: ManyArray | StableRecordIdentifier | null,\n error?: Error\n): ManyArray | OpaqueRecordInstance | null {\n delete recordExt._relationshipPromisesCache[key];\n relationship.state.shouldForceReload = false;\n const isHasMany = relationship.definition.kind === 'hasMany';\n\n if (isHasMany) {\n // we don't notify the record property here to avoid refetch\n // only the many array\n notifyInternalSignal((value as ManyArray)[ARRAY_SIGNAL]);\n }\n\n if (error) {\n relationship.state.hasFailedLoadAttempt = true;\n const proxy = recordExt._relationshipProxyCache[key];\n // belongsTo relationships are sometimes unloaded\n // when a load fails, in this case we need\n // to make sure that we aren't proxying\n // to destroyed content\n // for the sync belongsTo reload case there will be no proxy\n // for the async reload case there will be no proxy if the ui\n // has never been accessed\n if (proxy && !isHasMany) {\n // @ts-expect-error unsure why this is not resolving the boolean but async belongsTo is weird\n if (proxy.content && proxy.content.isDestroying) {\n (proxy as PromiseBelongsTo).set('content', null);\n }\n recordExt.store.notifications._flush();\n }\n\n throw error;\n }\n\n if (isHasMany) {\n (value as ManyArray).isLoaded = true;\n } else {\n recordExt.store.notifications._flush();\n }\n\n relationship.state.hasFailedLoadAttempt = false;\n // only set to not stale if no error is thrown\n relationship.state.isStale = false;\n\n return isHasMany || !value ? value : recordExt.store.peekRecord(value as StableRecordIdentifier);\n}\n\ntype PromiseProxyRecord = { then(): void; content: OpaqueRecordInstance | null | undefined };\n\nfunction extractIdentifierFromRecord(record: PromiseProxyRecord | OpaqueRecordInstance | null) {\n if (!record) {\n return null;\n }\n\n return recordIdentifierFor(record);\n}\n\nfunction anyUnloaded(store: Store, relationship: CollectionEdge) {\n const graph = store._graph;\n assert(`Expected a Graph instance to be available`, graph);\n const relationshipData = graph.getData(\n relationship.identifier,\n relationship.definition.key\n ) as CollectionRelationship;\n const state = relationshipData.data;\n const cache = store._instanceCache;\n const unloaded = state?.find((s) => {\n const isLoaded = cache.recordIsLoaded(s, true);\n return !isLoaded;\n });\n\n return unloaded || false;\n}\n\nexport function areAllInverseRecordsLoaded(store: Store, resource: InnerRelationshipDocument): boolean {\n const instanceCache = store._instanceCache;\n const identifiers = resource.data;\n\n if (Array.isArray(identifiers)) {\n assert(`Expected stable identifiers`, identifiers.every(isStableIdentifier));\n // treat as collection\n // check for unloaded records\n return identifiers.every((identifier: StableRecordIdentifier) => instanceCache.recordIsLoaded(identifier));\n }\n\n // treat as single resource\n if (!identifiers) return true;\n\n assert(`Expected stable identifiers`, isStableIdentifier(identifiers));\n return instanceCache.recordIsLoaded(identifiers);\n}\n\nfunction isBelongsTo(relationship: GraphEdge): relationship is ResourceEdge {\n return relationship.definition.kind === 'belongsTo';\n}\n","import { A, type NativeArray } from '@ember/array';\nimport ArrayProxy from '@ember/array/proxy';\nimport { computed, get } from '@ember/object';\nimport { mapBy, not } from '@ember/object/computed';\n\nimport type RecordState from './record-state.ts';\n\ntype ValidationError = {\n attribute: string;\n message: string;\n};\n\ninterface ArrayProxyWithCustomOverrides<T> extends Omit<ArrayProxy<T>, 'clear' | 'content'> {\n // Omit causes `content` to be merged with the class def for ArrayProxy\n // which then causes it to be seen as a property, disallowing defining it\n // as an accessor. This restores our ability to define it as an accessor.\n content: NativeArray<T>;\n clear(): void;\n _has(name: string): boolean;\n}\n\n// we force the type here to our own construct because mixin and extend patterns\n// lose generic signatures. We also do this because we need to Omit `clear` from\n// the type of ArrayProxy as we override it's signature.\nconst ArrayProxyWithCustomOverrides = ArrayProxy as unknown as new <T>() => ArrayProxyWithCustomOverrides<T>;\n\n/**\n Holds validation errors for a given record, organized by attribute names.\n\n This class is not directly instantiable.\n\n Every `Model` has an `errors` property that is an instance of\n `Errors`. This can be used to display validation error\n messages returned from the server when a `record.save()` rejects.\n\n For Example, if you had a `User` model that looked like this:\n\n ```js [app/models/user.js]\n import { Model, attr } from '@warp-drive/legacy/model';\n\n export default class UserModel extends Model {\n @attr('string') username;\n @attr('string') email;\n }\n ```\n And you attempted to save a record that did not validate on the backend:\n\n ```javascript\n let user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n });\n user.save();\n ```\n\n Your backend would be expected to return an error response that described\n the problem, so that error messages can be generated on the app.\n\n API responses will be translated into instances of `Errors` differently,\n depending on the specific combination of adapter and serializer used. You\n may want to check the documentation or the source code of the libraries\n that you are using, to know how they expect errors to be communicated.\n\n Errors can be displayed to the user by accessing their property name\n to get an array of all the error objects for that property. Each\n error object is a JavaScript object 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 ```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\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 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 @class Errors\n @public\n */\nexport class Errors extends ArrayProxyWithCustomOverrides<ValidationError> {\n declare __record: { currentState: RecordState };\n /**\n @property errorsByAttributeName\n @type {MapWithDefault}\n @private\n */\n @computed()\n get errorsByAttributeName(): Map<string, NativeArray<ValidationError>> {\n return new Map();\n }\n\n /**\n Returns errors for a given attribute\n\n ```javascript\n let user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n });\n user.save().catch(function(){\n user.errors.errorsFor('email'); // returns:\n // [{attribute: \"email\", message: \"Doesn't look like a valid email.\"}]\n });\n ```\n\n @public\n @param {String} attribute\n @return {Array}\n */\n errorsFor(attribute: string): NativeArray<ValidationError> {\n const map = this.errorsByAttributeName;\n\n let errors = map.get(attribute);\n\n if (errors === undefined) {\n errors = A<ValidationError>();\n map.set(attribute, errors);\n }\n\n // Errors may be a native array with extensions turned on. Since we access\n // the array via a method, and not a computed or using `Ember.get`, it does\n // not entangle properly with autotracking, so we entangle manually by\n // getting the `[]` property.\n get(errors, '[]');\n\n return errors;\n }\n\n /**\n An array containing all of the error messages for this\n record. This is useful for displaying all errors to the user.\n\n ```handlebars\n {{#each @model.errors.messages as |message|}}\n <div class=\"error\">\n {{message}}\n </div>\n {{/each}}\n ```\n\n @property messages\n @public\n @type {Array}\n */\n @mapBy('content', 'message')\n declare messages: string[];\n\n /**\n @property content\n @type {Array}\n @private\n */\n @computed()\n get content(): NativeArray<ValidationError> {\n return A();\n }\n\n /**\n @private\n */\n unknownProperty(attribute: string) {\n const errors = this.errorsFor(attribute);\n if (errors.length === 0) {\n return undefined;\n }\n return errors;\n }\n\n /**\n Total number of errors.\n\n @property length\n @type {Number}\n @public\n @readonly\n */\n\n /**\n `true` if we have no errors.\n\n @property isEmpty\n @type {Boolean}\n @public\n @readonly\n */\n @not('length')\n declare isEmpty: boolean;\n\n /**\n Manually adds errors to the record. This will trigger the `becameInvalid` event/ lifecycle method on\n the record and transition the record into an `invalid` state.\n\n Example\n ```javascript\n let errors = user.errors;\n\n // add multiple errors\n errors.add('password', [\n 'Must be at least 12 characters',\n 'Must contain at least one symbol',\n 'Cannot contain your name'\n ]);\n\n errors.errorsFor('password');\n // =>\n // [\n // { attribute: 'password', message: 'Must be at least 12 characters' },\n // { attribute: 'password', message: 'Must contain at least one symbol' },\n // { attribute: 'password', message: 'Cannot contain your name' },\n // ]\n\n // add a single error\n errors.add('username', 'This field is required');\n\n errors.errorsFor('username');\n // =>\n // [\n // { attribute: 'username', message: 'This field is required' },\n // ]\n ```\n @public\n @param {String} attribute - the property name of an attribute or relationship\n @param {string[]|string} messages - an error message or array of error messages for the attribute\n */\n add(attribute: string, messages: string[] | string): void {\n const errors = this._findOrCreateMessages(attribute, messages);\n this.addObjects(errors);\n\n this.errorsFor(attribute).addObjects(errors);\n this.__record.currentState.notify('isValid');\n\n this.notifyPropertyChange(attribute);\n }\n\n /**\n @private\n */\n _findOrCreateMessages(attribute: string, messages: string | string[]): ValidationError[] {\n const errors = this.errorsFor(attribute);\n const messagesArray = Array.isArray(messages) ? messages : [messages];\n const _messages: ValidationError[] = new Array(messagesArray.length) as ValidationError[];\n\n for (let i = 0; i < messagesArray.length; i++) {\n const message = messagesArray[i];\n const err = errors.findBy('message', message);\n if (err) {\n _messages[i] = err;\n } else {\n _messages[i] = {\n attribute: attribute,\n message,\n };\n }\n }\n\n return _messages;\n }\n\n /**\n Manually removes all errors for a given member from the record.\n This will transition the record into a `valid` state, and\n triggers the `becameValid` event and lifecycle method.\n\n Example:\n\n ```javascript\n let errors = user.errors;\n errors.add('phone', ['error-1', 'error-2']);\n\n errors.errorsFor('phone');\n // =>\n // [\n // { attribute: 'phone', message: 'error-1' },\n // { attribute: 'phone', message: 'error-2' },\n // ]\n\n errors.remove('phone');\n\n errors.errorsFor('phone');\n // => undefined\n ```\n @public\n @param {String} member - the property name of an attribute or relationship\n */\n remove(attribute: string) {\n if (this.isEmpty) {\n return;\n }\n\n const content = this.rejectBy('attribute', attribute);\n this.content.setObjects(content);\n\n // Although errorsByAttributeName.delete is technically enough to sync errors state, we also\n // must mutate the array as well for autotracking\n const errors = this.errorsFor(attribute);\n for (let i = 0; i < errors.length; i++) {\n if (errors[i].attribute === attribute) {\n // .replace from Ember.NativeArray is necessary. JS splice will not work.\n errors.replace(i, 1);\n }\n }\n this.errorsByAttributeName.delete(attribute);\n\n this.__record.currentState.notify('isValid');\n this.notifyPropertyChange(attribute);\n this.notifyPropertyChange('length');\n }\n\n /**\n Manually clears all errors for the record.\n This will transition the record into a `valid` state, and\n will trigger the `becameValid` event and lifecycle method.\n\n Example:\n\n ```javascript\n let errors = user.errors;\n errors.add('username', ['error-a']);\n errors.add('phone', ['error-1', 'error-2']);\n\n errors.errorsFor('username');\n // =>\n // [\n // { attribute: 'username', message: 'error-a' },\n // ]\n\n errors.errorsFor('phone');\n // =>\n // [\n // { attribute: 'phone', message: 'error-1' },\n // { attribute: 'phone', message: 'error-2' },\n // ]\n\n errors.clear();\n\n errors.errorsFor('username');\n // => undefined\n\n errors.errorsFor('phone');\n // => undefined\n\n errors.messages\n // => []\n ```\n @public\n */\n clear(): void {\n if (this.isEmpty) {\n return;\n }\n\n const errorsByAttributeName = this.errorsByAttributeName;\n const attributes: string[] = [];\n\n errorsByAttributeName.forEach(function (_, attribute) {\n attributes.push(attribute);\n });\n\n errorsByAttributeName.clear();\n attributes.forEach((attribute) => {\n this.notifyPropertyChange(attribute);\n });\n\n this.__record.currentState.notify('isValid');\n super.clear();\n }\n\n /**\n Checks if there are error messages for the given attribute.\n\n ```js [app/controllers/user/edit.js]\n export default class UserEditController extends Controller {\n @action\n save(user) {\n if (user.errors.has('email')) {\n return alert('Please update your email before attempting to save.');\n }\n user.save();\n }\n }\n ```\n\n @public\n @param {String} attribute\n @return {Boolean} true if there some errors on given attribute\n */\n has(attribute: string): boolean {\n return this.errorsFor(attribute).length > 0;\n }\n}\n"],"names":["PromiseObject","ObjectProxy","extend","PromiseProxyMixin","LegacyPromiseProxy","Symbol","for","Extended","PromiseBelongsTo","id","key","legacySupport","_belongsToState","ref","referenceFor","n","prototype","memoized","meta","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","modelName","computed","reload","options","content","undefined","reloadBelongsTo","PromiseManyArray","constructor","promise","_update","isDestroyed","length","deprecations","DEPRECATE_COMPUTED_CHAINS","[]","forEach","cb","then","s","f","catch","finally","destroy","links","tapPromise","create","defineSignal","proxy","isPending","isSettled","isFulfilled","isRejected","Promise","resolve","error","assertPolymorphicType","parentIdentifier","parentDefinition","addedIdentifier","store","inverseIsImplicit","isPolymorphic","schema","fields","get","inverseKey","type","kind","as","isResourceIdentiferWithRelatedLinks","value","Boolean","related","HasManyReference","___token","___identifier","___relatedTokenMap","graph","hasManyRelationship","definition","notifications","subscribe","_","bucket","notifiedKey","_ref","Map","unsubscribe","token","clear","identifiers","ensureRefCanSubscribe","resource","_resource","map","data","resourceIdentifier","identifier","identifierCache","getOrCreateRecordIdentifier","delete","set","cache","getRelationship","remoteType","ids","link","href","push","doc","skipFetch","dataDoc","Array","isArray","isResourceData","isMaybeResource","_push","i","relationshipMeta","added","newData","_join","op","record","field","load","_isLoaded","hasRelationshipDataProperty","state","hasReceivedData","relationship","getData","every","_instanceCache","recordIsLoaded","support","LEGACY_SUPPORT","getManyArray","fetchSyncRel","isAsync","areAllInverseRecordsLoaded","reloadHasMany","getHasMany","defineNonEnumerableSignal","object","keys","Object","filter","k","rel","loaded","edge","accessed","BelongsToReference","belongsToRelationship","___relatedToken","peekRecord","getBelongsTo","getOrSetGlobal","lookupLegacySupport","recordIdentifierFor","isDestroying","LegacySupport","storeFor","peekCache","_graph","_manyArrayCache","_relationshipPromisesCache","_relationshipProxyCache","_pending","references","_syncArray","array","currentState","SOURCE","jsonApi","_getCurrentState","fastPush","mutate","mutation","_findBelongsTo","_findBelongsToByJsonApiResource","handleCompletedRelationshipRequest","e","loadingPromise","isBelongsTo","hasFailedLoadAttempt","shouldForceReload","_updatePromiseProxyFor","relatedIdentifier","isStableIdentifier","isLoaded","getRecord","setDirtyBelongsTo","extractIdentifierFromRecord","manyArray","ManyArray","_inverseIsAsync","inverseIsAsync","manager","allowMutation","fetchAsyncHasMany","_findHasManyByJsonApiResource","anyUnloaded","args","promiseProxy","name","reference","actualRelationshipKind","relationshipKind","upgradeStore","adapter","adapterFor","isStale","hasDematerializedInverse","isEmpty","allInverseRecordsAreLoaded","shouldFindViaLink","findHasMany","inverseType","request","useLink","req","linksMode","url","getRelatedLink","method","records","EnableHydration","cacheOptions","preferLocalCache","hasLocalPartialData","attemptLocalCache","hasData","future","localDataIsEmpty","resourceIsLocal","recordExt","isHasMany","notifyInternalSignal","ARRAY_SIGNAL","_flush","relationshipData","unloaded","find","instanceCache","ArrayProxyWithCustomOverrides","ArrayProxy","Errors","errorsByAttributeName","errorsFor","attribute","errors","A","g","mapBy","void 0","unknownProperty","not","add","messages","_findOrCreateMessages","addObjects","__record","notify","notifyPropertyChange","messagesArray","_messages","message","err","findBy","remove","rejectBy","set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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;AAQEqG,EAAAA,UAAUA,GAAkB;AAC1B,IAAA,MAAMlC,KAAK,GAAG,IAAI,CAACuB,SAAS,EAAE;AAC9B,IAAA,IAAIxB,mCAAmC,CAACC,KAAK,CAAC,EAAE;AAC9C,MAAA,OAAO,MAAM;AACf;AACA,IAAA,OAAO,IAAI;AACb;;AAEA;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;AAgBE,EAAA,MAAMsC,IAAIA,CAACC,GAA2B,EAAEC,SAAmB,EAAkC;IAC3F,MAAM;AAAEnD,MAAAA;AAAM,KAAC,GAAG,IAAI;IACtB,MAAMuD,cAAc,GAAGL,GAAG,CAACd,IAAI,IAAIoB,eAAe,CAACN,GAAG,CAACd,IAAI,CAAC;AAC5D,IAAA,MAAMwB,KAAK,GAAGL,cAAc,GACvBvD,KAAK,CAACyD,KAAK,CAACP,GAAG,EAAE,IAAI,CAAC,GACvBA,GAAG,CAACd,IAAI,GACLpC,KAAK,CAACuC,eAAe,CAACC,2BAA2B,CAACU,GAAG,CAACd,IAAI,CAAC,GAC5D,IAAI;IACV,MAAM;AAAEE,MAAAA;KAAY,GAAG,IAAI,CAACyD,qBAAqB;IAEjD,IAAA9I,cAAA,CAAAC,e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OD,QAAQ,IAAIA,QAAQ,CAACG,IAAI,GAAG,IAAI,CAACpC,KAAK,CAACiG,UAAU,CAAChE,QAAQ,CAACG,IAAI,CAAC,GAAG,IAAI;AAChF;;AAEA;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;EAYE,MAAM8B,IAAIA,CAACvG,OAAiC,EAA2B;IACrE,MAAMiH,OAAsB,GAAIC,cAAc,CAAgDxE,GAAG,CAC/F,IAAI,CAACW,aACP,CAAE;IACF,MAAM+D,YAAY,GAChB,CAAC,IAAI,CAACgB,qBAAqB,CAAC3E,UAAU,CAAC4D,OAAO,IAAI,CAACC,0BAA0B,CAAC,IAAI,CAACjF,KAAK,EAAE,IAAI,CAACkC,SAAS,EAAE,CAAC;IAC7G,OAAO6C,YAAY,GACfH,OAAO,CAAC9G,eAAe,CAAC,IAAI,CAACtB,GAAG,EAAEmB,OAAO,CAAC,CAACe,IAAI,CAAC,MAAM,IAAI,CAACiC,KAAK,EAAE,CAAC;AACnE;AACA;IACCiE,OAAO,CAACsB,YAAY,CAAC,IAAI,CAAC1J,GAAG,EAAEmB,OAAO,CAA6B;AAC1E;;AAEA;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;EAUED,MAAMA,CAACC,OAAiC,EAAE;IACxC,MAAMiH,OAAsB,GAAIC,cAAc,CAAgDxE,GAAG,CAC/F,IAAI,CAACW,aACP,CAAE;AACF,IAAA,OAAO4D,OAAO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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASEhL,EAAAA,KAAKA,GAAS;IACZ,IAAI,IAAI,CAAC8H,OAAO,EAAE;AAChB,MAAA;AACF;AAEA,IAAA,MAAMkC,qBAAqB,GAAG,IAAI,CAACA,qBAAqB;IACxD,MAAM0B,UAAoB,GAAG,EAAE;AAE/B1B,IAAAA,qBAAqB,CAACtN,OAAO,CAAC,UAAU+C,CAAC,EAAEyK,SAAS,EAAE;AACpDwB,MAAAA,UAAU,CAACvK,IAAI,CAAC+I,SAAS,CAAC;AAC5B,KAAC,CAAC;IAEFF,qBAAqB,CAAChK,KAAK,EAAE;AAC7B0L,IAAAA,UAAU,CAAChP,OAAO,CAAEwN,SAAS,IAAK;AAChC,MAAA,IAAI,CAACc,oBAAoB,CAACd,SAAS,CAAC;AACtC,KAAC,CAAC;IAEF,IAAI,CAACY,QAAQ,CAAC1F,YAAY,CAAC2F,MAAM,CAAC,SAAS,CAAC;IAC5C,KAAK,CAAC/K,KAAK,EAAE;AACf;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAGE2L,GAAGA,CAACzB,SAAiB,EAAW;IAC9B,OAAO,IAAI,CAACD,SAAS,CAACC,SAAS,CAAC,CAAC5N,MAAM,GAAG,CAAC;AAC7C;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-DSOlH9A8.js","sources":["../src/serializer/-private/utils.ts","../src/serializer/json.js"],"sourcesContent":["type Coercable = string | number | boolean | null | undefined | symbol;\n\nexport function coerceId(id: Coercable): string | null {\n if (id === null || id === undefined || id === '') {\n return null;\n } else if (typeof id === 'string') {\n return id;\n } else if (typeof id === 'symbol') {\n return id.toString();\n } else {\n return String(id);\n }\n}\n","import { getOwner } from '@ember/application';\nimport { warn } from '@ember/debug';\n\nimport { dasherize, singularize } from '@warp-drive/utilities/string';\nimport { assert } from '@warp-drive/core/build-config/macros';\n\nimport { Serializer } from '../serializer.ts';\nimport { coerceId } from './-private/utils.ts';\n\nconst SOURCE_POINTER_REGEXP = /^\\/?data\\/(attributes|relationships)\\/(.*)/;\nconst SOURCE_POINTER_PRIMARY_REGEXP = /^\\/?data/;\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\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 By default, EmberData uses and recommends the `JSONAPISerializer`.\n\n `JSONSerializer` is useful for simpler or legacy backends that may\n not support the http://jsonapi.org/ spec.\n\n For example, given the following `User` model and JSON payload:\n\n ```js [app/models/user.js]\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\n export default class UserModel extends Model {\n @hasMany('user') friends;\n @belongsTo('location') house;\n\n @attr('string') name;\n }\n ```\n\n ```js\n {\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n }\n ```\n\n `JSONSerializer` will normalize the JSON payload to the JSON API format that the\n Ember Data store expects.\n\n You can customize how JSONSerializer processes its payload by passing options in\n the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\n The `JSONSerializer` normalization process follows these steps:\n\n 1. `normalizeResponse`\n - entry method to the serializer.\n 2. `normalizeCreateRecordResponse`\n - a `normalizeResponse` for a specific operation is called.\n 3. `normalizeSingleResponse`|`normalizeArrayResponse`\n - for methods like `createRecord` we expect a single record back, while for methods like `findAll` we expect multiple records back.\n 4. `normalize`\n - `normalizeArrayResponse` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n 5. `extractId` | `extractAttributes` | `extractRelationships`\n - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.\n\n @class JSONSerializer\n @public\n*/\nconst JSONSerializer = Serializer.extend({\n /**\n The `primaryKey` is used when serializing and deserializing\n data. Ember Data always uses the `id` property to store the id of\n the record. The external source may not always follow this\n convention. In these cases it is useful to override the\n `primaryKey` property to match the `primaryKey` of your external\n store.\n\n Example\n\n ```js [app/serializers/application.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n primaryKey = '_id'\n }\n ```\n\n @property primaryKey\n @type {String}\n @public\n @default 'id'\n */\n primaryKey: 'id',\n\n /**\n The `attrs` object can be used to declare a simple mapping between\n property names on `Model` records and payload keys in the\n serialized JSON object representing the record. An object with the\n property `key` can also be used to designate the attribute's key on\n the response payload.\n\n Example\n\n ```js [app/models/person.js]\n import Model, { attr } from '@ember-data/model';\n\n export default class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('string') occupation;\n @attr('boolean') admin;\n }\n ```\n\n ```js [app/serializers/person.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PersonSerializer extends JSONSerializer {\n attrs = {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n }\n ```\n\n You can also remove attributes and relationships by setting the `serialize`\n key to `false` in your mapping object.\n\n Example\n\n ```js [app/serializers/person.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n attrs = {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n }\n ```\n\n When serialized:\n\n ```javascript\n {\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n }\n ```\n\n Note that the `admin` is now not included in the payload.\n\n Setting `serialize` to `true` enforces serialization for hasMany\n relationships even if it's neither a many-to-many nor many-to-none\n relationship.\n\n @property attrs\n @public\n @type {Object}\n */\n mergedProperties: ['attrs'],\n\n /**\n Given a subclass of `Model` and a JSON object this method will\n iterate through each attribute of the `Model` and invoke the\n `Transform#deserialize` method on the matching property of the\n JSON object. This method is typically called after the\n serializer's `normalize` method.\n\n @private\n @param {Model} typeClass\n @param {Object} data The data to transform\n @return {Object} data The transformed data object\n */\n applyTransforms(typeClass, data) {\n const attributes = typeClass.attributes;\n\n typeClass.eachTransformedAttribute((key, typeClass) => {\n if (data[key] === undefined) {\n return;\n }\n\n const transform = this.transformFor(typeClass);\n const transformMeta = attributes.get(key);\n data[key] = transform.deserialize(data[key], transformMeta.options);\n });\n\n return data;\n },\n\n /**\n The `normalizeResponse` method is used to normalize a payload from the\n server to a JSON-API Document.\n\n http://jsonapi.org/format/#document-structure\n\n This method delegates to a more specific normalize method based on\n the `requestType`.\n\n To override this method with a custom one, make sure to call\n `return super.normalizeResponse(store, primaryModelClass, payload, id, requestType)` with your\n pre-processed data.\n\n Here's an example of using `normalizeResponse` manually:\n\n ```javascript\n socket.on('message', function(message) {\n let data = message.data;\n let modelClass = store.modelFor(data.modelName);\n let serializer = store.serializerFor(data.modelName);\n let normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n store.push(normalized);\n });\n ```\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n switch (requestType) {\n case 'findRecord':\n return this.normalizeFindRecordResponse(...arguments);\n case 'queryRecord':\n return this.normalizeQueryRecordResponse(...arguments);\n case 'findAll':\n return this.normalizeFindAllResponse(...arguments);\n case 'findBelongsTo':\n return this.normalizeFindBelongsToResponse(...arguments);\n case 'findHasMany':\n return this.normalizeFindHasManyResponse(...arguments);\n case 'findMany':\n return this.normalizeFindManyResponse(...arguments);\n case 'query':\n return this.normalizeQueryResponse(...arguments);\n case 'createRecord':\n return this.normalizeCreateRecordResponse(...arguments);\n case 'deleteRecord':\n return this.normalizeDeleteRecordResponse(...arguments);\n case 'updateRecord':\n return this.normalizeUpdateRecordResponse(...arguments);\n }\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `queryRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeQueryRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findAll`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindAllResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findBelongsTo`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindBelongsToResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findHasMany`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindHasManyResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findMany`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindManyResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `query`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeQueryResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `createRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeCreateRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSaveResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `deleteRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeDeleteRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSaveResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `updateRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeUpdateRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSaveResponse(...arguments);\n },\n\n /**\n normalizeUpdateRecordResponse, normalizeCreateRecordResponse and\n normalizeDeleteRecordResponse delegate to this method by default.\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeSaveResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n normalizeQueryResponse and normalizeFindRecordResponse delegate to this\n method by default.\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) {\n return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, true);\n },\n\n /**\n normalizeQueryResponse, normalizeFindManyResponse, and normalizeFindHasManyResponse delegate\n to this method by default.\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, false);\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 documentHash = {\n data: null,\n included: [],\n };\n\n const meta = this.extractMeta(store, primaryModelClass, payload);\n if (meta) {\n assert(\n 'The `meta` returned from `extractMeta` has to be an object, not \"' + typeof meta + '\".',\n typeof meta === 'object'\n );\n documentHash.meta = meta;\n }\n\n if (isSingle) {\n const { data, included } = this.normalize(primaryModelClass, payload);\n documentHash.data = data;\n if (included) {\n documentHash.included = included;\n }\n } else {\n const ret = new Array(payload.length);\n for (let i = 0, l = payload.length; i < l; i++) {\n const item = payload[i];\n const { data, included } = this.normalize(primaryModelClass, item);\n if (included) {\n documentHash.included = documentHash.included.concat(included);\n }\n ret[i] = data;\n }\n\n documentHash.data = ret;\n }\n\n return documentHash;\n },\n\n /**\n Normalizes a part of the JSON payload returned by\n the server. You should override this method, munge the hash\n and call super if you have generic normalization to do.\n\n It takes the type of the record that is being normalized\n (as a Model class), the property where the hash was\n originally found, and the hash to normalize.\n\n You can use this method, for example, to normalize underscored keys to camelized\n or other general-purpose normalizations.\n\n Example\n\n ```js [app/serializers/application.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n import { underscore } from '<app-name>/utils/string-utils';\n import { get } from '@ember/object';\n\n export default class ApplicationSerializer extends JSONSerializer {\n normalize(typeClass, hash) {\n let fields = typeClass.fields;\n\n fields.forEach(function(type, field) {\n let payloadField = underscore(field);\n if (field === payloadField) { return; }\n\n hash[field] = hash[payloadField];\n delete hash[payloadField];\n });\n\n return super.normalize(...arguments);\n }\n }\n ```\n\n @public\n @param {Model} typeClass\n @param {Object} hash\n @return {Object}\n */\n normalize(modelClass, resourceHash) {\n let data = null;\n\n if (resourceHash) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash);\n if (typeof resourceHash.links === 'object') {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.links);\n }\n\n data = {\n id: this.extractId(modelClass, resourceHash),\n type: modelClass.modelName,\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\n return { data };\n },\n\n /**\n Returns the resource's ID.\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {String}\n */\n extractId(modelClass, resourceHash) {\n const primaryKey = this.primaryKey;\n const id = resourceHash[primaryKey];\n return coerceId(id);\n },\n\n /**\n Returns the resource's attributes formatted as a JSON-API \"attributes object\".\n\n http://jsonapi.org/format/#document-resource-object-attributes\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractAttributes(modelClass, resourceHash) {\n let attributeKey;\n const attributes = {};\n\n modelClass.eachAttribute((key) => {\n attributeKey = this.keyForAttribute(key, 'deserialize');\n if (resourceHash[attributeKey] !== undefined) {\n attributes[key] = resourceHash[attributeKey];\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} relationshipModelName\n @param {Object} relationshipHash\n @return {Object}\n */\n extractRelationship(relationshipModelName, relationshipHash) {\n if (!relationshipHash) {\n return null;\n }\n /*\n When `relationshipHash` is an object it usually means that the relationship\n is polymorphic. It could however also be embedded resources that the\n EmbeddedRecordsMixin has be able to process.\n */\n if (relationshipHash && typeof relationshipHash === 'object' && !Array.isArray(relationshipHash)) {\n if (relationshipHash.id) {\n relationshipHash.id = coerceId(relationshipHash.id);\n }\n\n const modelClass = this.store.modelFor(relationshipModelName);\n if (relationshipHash.type && !modelClass.fields.has('type')) {\n relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);\n }\n\n return relationshipHash;\n }\n return { id: coerceId(relationshipHash), type: dasherize(singularize(relationshipModelName)) };\n },\n\n /**\n Returns a polymorphic relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n `relationshipOptions` is a hash which contains more information about the\n polymorphic relationship which should be extracted:\n - `resourceHash` complete hash of the resource the relationship should be\n extracted from\n - `relationshipKey` key under which the value for the relationship is\n extracted from the resourceHash\n - `relationshipMeta` meta information about the relationship\n\n @public\n @param {Object} relationshipModelName\n @param {Object} relationshipHash\n @param {Object} relationshipOptions\n @return {Object}\n */\n extractPolymorphicRelationship(relationshipModelName, relationshipHash, relationshipOptions) {\n return this.extractRelationship(relationshipModelName, 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 modelClass.eachRelationship((key, relationshipMeta) => {\n let relationship = null;\n const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');\n if (resourceHash[relationshipKey] !== undefined) {\n let data = null;\n const relationshipHash = resourceHash[relationshipKey];\n if (relationshipMeta.kind === 'belongsTo') {\n if (relationshipMeta.options.polymorphic) {\n // extracting a polymorphic belongsTo may need more information\n // than the type and the hash (which might only be an id) for the\n // relationship, hence we pass the key, resource and\n // relationshipMeta too\n data = this.extractPolymorphicRelationship(relationshipMeta.type, relationshipHash, {\n key,\n resourceHash,\n relationshipMeta,\n });\n } else {\n data = this.extractRelationship(relationshipMeta.type, relationshipHash);\n }\n } else if (relationshipMeta.kind === 'hasMany') {\n if (relationshipHash) {\n data = new Array(relationshipHash.length);\n if (relationshipMeta.options.polymorphic) {\n for (let i = 0, l = relationshipHash.length; i < l; i++) {\n const item = relationshipHash[i];\n data[i] = this.extractPolymorphicRelationship(relationshipMeta.type, item, {\n key,\n resourceHash,\n relationshipMeta,\n });\n }\n } else {\n for (let i = 0, l = relationshipHash.length; i < l; i++) {\n const item = relationshipHash[i];\n data[i] = this.extractRelationship(relationshipMeta.type, item);\n }\n }\n }\n }\n relationship = { data };\n }\n\n const linkKey = this.keyForLink(key, relationshipMeta.kind);\n if (resourceHash.links && resourceHash.links[linkKey] !== undefined) {\n const related = resourceHash.links[linkKey];\n relationship = relationship || {};\n relationship.links = { related };\n }\n\n if (relationship) {\n relationships[key] = relationship;\n }\n });\n\n return relationships;\n },\n\n /**\n Dasherizes the model name in the payload\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 @private\n */\n normalizeRelationships(typeClass, hash) {\n let payloadKey;\n\n if (this.keyForRelationship) {\n typeClass.eachRelationship((key, relationship) => {\n payloadKey = this.keyForRelationship(key, relationship.kind, 'deserialize');\n if (key === payloadKey) {\n return;\n }\n if (hash[payloadKey] === undefined) {\n return;\n }\n\n hash[key] = hash[payloadKey];\n delete hash[payloadKey];\n });\n }\n },\n\n /**\n @private\n */\n normalizeUsingDeclaredMapping(modelClass, hash) {\n const attrs = this.attrs;\n let normalizedKey;\n let payloadKey;\n\n if (attrs) {\n for (const key in attrs) {\n normalizedKey = payloadKey = this._getMappedKey(key, modelClass);\n\n if (hash[payloadKey] === undefined) {\n continue;\n }\n\n if (modelClass.attributes.has(key)) {\n normalizedKey = this.keyForAttribute(key, 'deserialize');\n }\n\n if (modelClass.relationshipsByName.has(key)) {\n normalizedKey = this.keyForRelationship(key, modelClass, 'deserialize');\n }\n\n if (payloadKey !== normalizedKey) {\n hash[normalizedKey] = hash[payloadKey];\n delete hash[payloadKey];\n }\n }\n }\n },\n\n /**\n Looks up the property key that was set by the custom `attr` mapping\n passed to the serializer.\n\n @private\n @param {String} key\n @return {String} key\n */\n _getMappedKey(key, modelClass) {\n warn(\n 'There is no attribute or relationship with the name `' +\n key +\n '` on `' +\n modelClass.modelName +\n '`. Check your serializers attrs hash.',\n modelClass.attributes.has(key) || modelClass.relationshipsByName.has(key),\n {\n id: 'ds.serializer.no-mapped-attrs-key',\n }\n );\n\n const attrs = this.attrs;\n let mappedKey;\n if (attrs && attrs[key]) {\n mappedKey = attrs[key];\n //We need to account for both the { title: 'post_title' } and\n //{ title: { key: 'post_title' }} forms\n if (mappedKey.key) {\n mappedKey = mappedKey.key;\n }\n if (typeof mappedKey === 'string') {\n key = mappedKey;\n }\n }\n\n return key;\n },\n\n /**\n Check attrs.key.serialize property to inform if the `key`\n can be serialized\n\n @private\n @param {String} key\n @return {Boolean} true if the key can be serialized\n */\n _canSerialize(key) {\n const attrs = this.attrs;\n\n return !attrs || !attrs[key] || attrs[key].serialize !== false;\n },\n\n /**\n When attrs.key.serialize is set to true then\n it takes priority over the other checks and the related\n attribute/relationship will be serialized\n\n @private\n @param {String} key\n @return {Boolean} true if the key must be serialized\n */\n _mustSerialize(key) {\n const attrs = this.attrs;\n\n return attrs && attrs[key] && attrs[key].serialize === true;\n },\n\n /**\n Check if the given hasMany relationship should be serialized\n\n By default only many-to-many and many-to-none relationships are serialized.\n This could be configured per relationship by Serializer's `attrs` object.\n\n @public\n @param {Snapshot} snapshot\n @param {String} key\n @param {RelationshipSchema} relationship\n @return {Boolean} true if the hasMany relationship should be serialized\n */\n shouldSerializeHasMany(snapshot, key, relationship) {\n const schema = this.store.modelFor(snapshot.modelName);\n const relationshipType = schema.determineRelationshipType(relationship, this.store);\n if (this._mustSerialize(key)) {\n return true;\n }\n return this._canSerialize(key) && (relationshipType === 'manyToNone' || relationshipType === 'manyToMany');\n },\n\n // SERIALIZE\n /**\n Called when a record is saved in order to convert the\n record into JSON.\n\n By default, it creates a JSON object with a key for\n each attribute and belongsTo relationship.\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') author;\n }\n ```\n\n The default serialization would create a JSON object like:\n\n ```javascript\n {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\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 JSON hash.\n\n By default, belongs-to relationships are converted into\n IDs when inserted into the JSON hash.\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 adapter passes in `includeId: true` when serializing\n a record for `createRecord`, but not for `updateRecord`.\n\n ## Customization\n\n Your server may expect a different JSON format than the\n built-in serialization format.\n\n In that case, you can implement `serialize` yourself and\n return a JSON hash of your choosing.\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\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 { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n import { singularize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONSerializer {\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 attribute.underscore().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 JSON\n\n If you just want to do some small tweaks on the default JSON,\n you can call `super.serialize` first and make the tweaks on\n the returned JSON.\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.subject = json.title;\n delete json.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 json = {};\n\n if (options && options.includeId) {\n const id = snapshot.id;\n if (id) {\n json[this.primaryKey] = id;\n }\n }\n\n snapshot.eachAttribute((key, attribute) => {\n this.serializeAttribute(snapshot, json, key, attribute);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n this.serializeBelongsTo(snapshot, json, relationship);\n } else if (relationship.kind === 'hasMany') {\n this.serializeHasMany(snapshot, json, relationship);\n }\n });\n\n return json;\n },\n\n /**\n You can use this method to customize how a serialized record is added to the complete\n JSON hash to be sent to the server. By default the JSON Serializer does not namespace\n the payload and just sends the raw serialized JSON object.\n If your server expects namespaced keys, you should consider using the RESTSerializer.\n Otherwise you can override this method to customize how the record is added to the hash.\n The hash property should be modified by reference.\n\n For example, your server may expect underscored root objects.\n\n ```js [app/serializers/application.js]\n import RESTSerializer from '@ember-data/serializer/rest';\n import { underscoren} from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends RESTSerializer {\n serializeIntoHash(data, type, snapshot, options) {\n let root = underscore(type.modelName);\n data[root] = this.serialize(snapshot, options);\n }\n }\n ```\n\n @public\n @param {Object} hash\n @param {Model} typeClass\n @param {Snapshot} snapshot\n @param {Object} options\n */\n serializeIntoHash(hash, typeClass, snapshot, options) {\n Object.assign(hash, this.serialize(snapshot, options));\n },\n\n /**\n `serializeAttribute` can be used to customize how `attr`\n properties are serialized\n\n For example if you wanted to ensure all your attributes were always\n serialized as properties on an `attributes` object you could\n write:\n\n ```js [app/serializers/application.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n serializeAttribute(snapshot, json, key, attributes) {\n json.attributes = json.attributes || {};\n super.serializeAttribute(snapshot, json.attributes, key, attributes);\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {String} key\n @param {Object} attribute\n */\n serializeAttribute(snapshot, json, key, attribute) {\n if (this._canSerialize(key)) {\n const type = attribute.type;\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 // if provided, use the mapping provided by `attrs` in\n // the serializer\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(key, schema);\n\n if (payloadKey === key && this.keyForAttribute) {\n payloadKey = this.keyForAttribute(key, 'serialize');\n }\n\n json[payloadKey] = value;\n }\n },\n\n /**\n `serializeBelongsTo` can be used to customize how `belongsTo`\n properties are serialized.\n\n Example\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serializeBelongsTo(snapshot, json, relationship) {\n let key = relationship.name;\n let belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForRelationship ? this.keyForRelationship(key, \"belongsTo\", \"serialize\") : key;\n\n json[key] = !belongsTo ? null : belongsTo.record.toJSON();\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializeBelongsTo(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this._canSerialize(name)) {\n const belongsToId = snapshot.belongsTo(name, { id: true });\n\n // if provided, use the mapping provided by `attrs` in\n // the serializer\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, 'belongsTo', 'serialize');\n }\n\n //Need to check whether the id is there for new&async records\n if (!belongsToId) {\n json[payloadKey] = null;\n } else {\n json[payloadKey] = belongsToId;\n }\n\n if (relationship.options.polymorphic) {\n this.serializePolymorphicType(snapshot, json, relationship);\n }\n }\n },\n\n /**\n `serializeHasMany` can be used to customize how `hasMany`\n properties are serialized.\n\n Example\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serializeHasMany(snapshot, json, relationship) {\n let key = relationship.name;\n if (key === 'comments') {\n return;\n } else {\n super.serializeHasMany(...arguments);\n }\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\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, { ids: true });\n if (hasMany !== undefined) {\n // if provided, use the mapping provided by `attrs` in\n // the serializer\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 json[payloadKey] = hasMany;\n // TODO support for polymorphic manyToNone and manyToMany relationships\n }\n }\n },\n\n /**\n You can use this method to customize how polymorphic objects are\n serialized. Objects are considered to be polymorphic if\n `{ polymorphic: true }` is pass as the second argument to the\n `belongsTo` function.\n\n Example\n\n ```js [app/serializers/comment.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class CommentSerializer extends JSONSerializer {\n serializePolymorphicType(snapshot, json, relationship) {\n let key = relationship.name;\n let belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n if (!belongsTo) {\n json[key + '_type'] = null;\n } else {\n json[key + '_type'] = belongsTo.modelName;\n }\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializePolymorphicType() {},\n\n /**\n `extractMeta` is used to deserialize any meta information in the\n adapter payload. By default Ember Data expects meta information to\n be located on the `meta` property of the payload object.\n\n Example\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n extractMeta(store, typeClass, payload) {\n if (payload && payload.hasOwnProperty('_pagination')) {\n let meta = payload._pagination;\n delete payload._pagination;\n return meta;\n }\n }\n }\n ```\n\n @public\n @param {Store} store\n @param {Model} modelClass\n @param {Object} payload\n */\n extractMeta(store, modelClass, payload) {\n if (payload && payload['meta'] !== undefined) {\n const meta = payload.meta;\n delete payload.meta;\n return meta;\n }\n },\n\n /**\n `extractErrors` is used to extract model errors when a call\n to `Model#save` fails with an `InvalidError`. By default\n Ember Data expects error information to be located on the `errors`\n property of the payload object.\n\n This serializer expects this `errors` object to be an Array similar\n to the following, compliant with the https://jsonapi.org/format/#errors specification:\n\n ```js\n {\n \"errors\": [\n {\n \"detail\": \"This username is already taken!\",\n \"source\": {\n \"pointer\": \"data/attributes/username\"\n }\n }, {\n \"detail\": \"Doesn't look like a valid email.\",\n \"source\": {\n \"pointer\": \"data/attributes/email\"\n }\n }\n ]\n }\n ```\n\n The key `detail` provides a textual description of the problem.\n Alternatively, the key `title` can be used for the same purpose.\n\n The nested keys `source.pointer` detail which specific element\n of the request data was invalid.\n\n Note that JSON-API also allows for object-level errors to be placed\n in an object with pointer `data`, signifying that the problem\n cannot be traced to a specific attribute:\n\n ```javascript\n {\n \"errors\": [\n {\n \"detail\": \"Some generic non property error message\",\n \"source\": {\n \"pointer\": \"data\"\n }\n }\n ]\n }\n ```\n\n When turn into a `Errors` object, you can read these errors\n through the property `base`:\n\n ```handlebars\n {{#each @model.errors.base as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n ```\n\n Example of alternative implementation, overriding the default\n behavior to deal with a different format of errors:\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n extractErrors(store, typeClass, payload, id) {\n if (payload && typeof payload === 'object' && payload._problems) {\n payload = payload._problems;\n this.normalizeErrors(typeClass, payload);\n }\n return payload;\n }\n }\n ```\n\n @public\n @param {Store} store\n @param {Model} typeClass\n @param {Object} payload\n @param {(String|Number)} id\n @return {Object} json The deserialized errors\n */\n extractErrors(store, typeClass, payload, id) {\n if (payload && typeof payload === 'object' && payload.errors) {\n // the default assumption is that errors is already in JSON:API format\n const extracted = {};\n\n payload.errors.forEach((error) => {\n if (error.source && error.source.pointer) {\n let key = error.source.pointer.match(SOURCE_POINTER_REGEXP);\n\n if (key) {\n key = key[2];\n } else if (error.source.pointer.search(SOURCE_POINTER_PRIMARY_REGEXP) !== -1) {\n key = PRIMARY_ATTRIBUTE_KEY;\n }\n\n if (key) {\n extracted[key] = extracted[key] || [];\n extracted[key].push(error.detail || error.title);\n }\n }\n });\n\n // if the user has an attrs hash, convert keys using it\n this.normalizeUsingDeclaredMapping(typeClass, extracted);\n\n // for each attr and relationship, make sure that we use\n // the normalized key\n typeClass.eachAttribute((name) => {\n const key = this.keyForAttribute(name, 'deserialize');\n if (key !== name && extracted[key] !== undefined) {\n extracted[name] = extracted[key];\n delete extracted[key];\n }\n });\n\n typeClass.eachRelationship((name) => {\n const key = this.keyForRelationship(name, 'deserialize');\n if (key !== name && extracted[key] !== undefined) {\n extracted[name] = extracted[key];\n delete extracted[key];\n }\n });\n\n return extracted;\n }\n\n return payload;\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\n Example\n\n ```js [app/serializers/application.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONSerializer {\n keyForAttribute(attr, method) {\n return underscore(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 key;\n },\n\n /**\n `keyForRelationship` can be used to define a custom key when\n serializing and deserializing relationship properties. By default\n `JSONSerializer` does not provide an implementation of this method.\n\n Example\n\n ```js [app/serializers/post.js]\n import { JSONSerializer } from '@warp-drive/legacy/serializer/json';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class PostSerializer extends JSONSerializer {\n keyForRelationship(key, relationship, method) {\n return `rel_${underscore(key)}`;\n }\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 key;\n },\n\n /**\n `keyForLink` can be used to define a custom key when deserializing link\n properties.\n\n @public\n @param {String} key\n @param {String} kind `belongsTo` or `hasMany`\n @return {String} normalized key\n */\n keyForLink(key, kind) {\n return key;\n },\n\n // HELPERS\n\n /**\n @private\n @param {String} attributeType\n @param {Boolean} skipAssertion\n @return {Transform} transform\n */\n transformFor(attributeType, skipAssertion) {\n const transform = getOwner(this).lookup('transform:' + attributeType);\n\n assert(`Unable to find the transform for \\`attr('${attributeType}')\\``, skipAssertion || !!transform);\n\n return transform;\n },\n});\n\nexport { JSONSerializer };\n"],"names":["coerceId","id","undefined","toString","String","SOURCE_POINTER_REGEXP","SOURCE_POINTER_PRIMARY_REGEXP","PRIMARY_ATTRIBUTE_KEY","JSONSerializer","Serializer","extend","primaryKey","mergedProperties","applyTransforms","typeClass","data","attributes","eachTransformedAttribute","key","transform","transformFor","transformMeta","get","deserialize","options","normalizeResponse","store","primaryModelClass","payload","requestType","normalizeFindRecordResponse","arguments","normalizeQueryRecordResponse","normalizeFindAllResponse","normalizeFindBelongsToResponse","normalizeFindHasManyResponse","normalizeFindManyResponse","normalizeQueryResponse","normalizeCreateRecordResponse","normalizeDeleteRecordResponse","normalizeUpdateRecordResponse","normalizeSingleResponse","normalizeArrayResponse","normalizeSaveResponse","_normalizeResponse","isSingle","documentHash","included","meta","extractMeta","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","normalize","ret","Array","length","i","l","item","concat","modelClass","resourceHash","normalizeUsingDeclaredMapping","links","extractId","type","modelName","extractAttributes","relationships","extractRelationships","lid","attributeKey","eachAttribute","keyForAttribute","extractRelationship","relationshipModelName","relationshipHash","isArray","modelFor","fields","has","modelNameFromPayloadKey","dasherize","singularize","extractPolymorphicRelationship","relationshipOptions","eachRelationship","relationshipMeta","relationship","relationshipKey","keyForRelationship","kind","polymorphic","linkKey","keyForLink","related","normalizeRelationships","hash","payloadKey","attrs","normalizedKey","_getMappedKey","relationshipsByName","warn","mappedKey","_canSerialize","serialize","_mustSerialize","shouldSerializeHasMany","snapshot","schema","relationshipType","determineRelationshipType","json","includeId","attribute","serializeAttribute","serializeBelongsTo","serializeHasMany","serializeIntoHash","Object","assign","value","attr","name","belongsToId","belongsTo","serializePolymorphicType","hasMany","ids","extractErrors","errors","extracted","forEach","error","source","pointer","match","search","push","detail","title","method","attributeType","skipAssertion","getOwner","lookup"],"mappings":";;;;;;AAEO,SAASA,QAAQA,CAACC,EAAa,EAAiB;EACrD,IAAIA,EAAE,KAAK,IAAI,IAAIA,EAAE,KAAKC,SAAS,IAAID,EAAE,KAAK,EAAE,EAAE;AAChD,IAAA,OAAO,IAAI;AACb,GAAC,MAAM,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;AACjC,IAAA,OAAOA,EAAE;AACX,GAAC,MAAM,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;AACjC,IAAA,OAAOA,EAAE,CAACE,QAAQ,EAAE;AACtB,GAAC,MAAM;IACL,OAAOC,MAAM,CAACH,EAAE,CAAC;AACnB;AACF;;ACHA,MAAMI,qBAAqB,GAAG,4CAA4C;AAC1E,MAAMC,6BAA6B,GAAG,UAAU;AAChD,MAAMC,qBAAqB,GAAG,MAAM;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAMC,cAAc,GAAGC,UAAU,CAACC,MAAM,CAAC;AACvC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEC,EAAAA,UAAU,EAAE,IAAI;AAEhB;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;EAeEC,gBAAgB,EAAE,CAAC,OAAO,CAAC;AAE3B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEEC,EAAAA,eAAeA,CAACC,SAAS,EAAEC,IAAI,EAAE;AAC/B,IAAA,MAAMC,UAAU,GAAGF,SAAS,CAACE,UAAU;AAEvCF,IAAAA,SAAS,CAACG,wBAAwB,CAAC,CAACC,GAAG,EAAEJ,SAAS,KAAK;AACrD,MAAA,IAAIC,IAAI,CAACG,GAAG,CAAC,KAAKhB,SAAS,EAAE;AAC3B,QAAA;AACF;AAEA,MAAA,MAAMiB,SAAS,GAAG,IAAI,CAACC,YAAY,CAACN,SAAS,CAAC;AAC9C,MAAA,MAAMO,aAAa,GAAGL,UAAU,CAACM,GAAG,CAACJ,GAAG,CAAC;AACzCH,MAAAA,IAAI,CAACG,GAAG,CAAC,GAAGC,SAAS,CAACI,WAAW,CAACR,IAAI,CAACG,GAAG,CAAC,EAAEG,aAAa,CAACG,OAAO,CAAC;AACrE,KAAC,CAAC;AAEF,IAAA,OAAOT,IAAI;GACZ;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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,CAACtF,GAAG,CAAC,IAAIsF,KAAK,CAACtF,GAAG,CAAC,CAAC6F,SAAS,KAAK,KAAK;GAC/D;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,cAAcA,CAAC9F,GAAG,EAAE;AAClB,IAAA,MAAMsF,KAAK,GAAG,IAAI,CAACA,KAAK;AAExB,IAAA,OAAOA,KAAK,IAAIA,KAAK,CAACtF,GAAG,CAAC,IAAIsF,KAAK,CAACtF,GAAG,CAAC,CAAC6F,SAAS,KAAK,IAAI;GAC5D;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGEE,EAAAA,sBAAsBA,CAACC,QAAQ,EAAEhG,GAAG,EAAE2E,YAAY,EAAE;IAClD,MAAMsB,MAAM,GAAG,IAAI,CAACzF,KAAK,CAACyD,QAAQ,CAAC+B,QAAQ,CAAC3C,SAAS,CAAC;IACtD,MAAM6C,gBAAgB,GAAGD,MAAM,CAACE,yBAAyB,CAACxB,YAAY,EAAE,IAAI,CAACnE,KAAK,CAAC;AACnF,IAAA,IAAI,IAAI,CAACsF,cAAc,CAAC9F,GAAG,CAAC,EAAE;AAC5B,MAAA,OAAO,IAAI;AACb;AACA,IAAA,OAAO,IAAI,CAAC4F,aAAa,CAAC5F,GAAG,CAAC,KAAKkG,gBAAgB,KAAK,YAAY,IAAIA,gBAAgB,KAAK,YAAY,CAAC;GAC3G;AAED;AACA;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;A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AAG;GACX;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAEEiF,EAAAA,UAAUA,CAACjF,GAAG,EAAE8E,IAAI,EAAE;AACpB,IAAA,OAAO9E,GAAG;GACX;AAED;;AAEA;AACF;AACA;AACA;AACA;AACA;AACEE,EAAAA,YAAYA,CAACgI,aAAa,EAAEC,aAAa,EAAE;AACzC,IAAA,MAAMlI,SAAS,GAAGmI,QAAQ,CAAC,IAAI,CAAC,CAACC,MAAM,CAAC,YAAY,GAAGH,aAAa,CAAC;IAErElG,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,MAAA,IAAA,CAAAA,IAAA,EAAA;AAAA,QAAA,MAAA,IAAAC,KAAA,CAAO,CAA4C4F,yCAAAA,EAAAA,aAAa,CAAM,IAAA,CAAA,CAAA;AAAA;AAAA,KAAA,EAAEC,aAAa,IAAI,CAAC,CAAClI,SAAS,CAAA,GAAA,EAAA;AAEpG,IAAA,OAAOA,SAAS;AAClB;AACF,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|