@ember-data/model 5.4.1-beta.1 → 5.4.1-beta.2
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/README.md +1 -1
- package/dist/-private.js +2 -2
- package/dist/{has-many-DT3JBYYG.js → has-many-BXU96bZ9.js} +13 -5
- package/dist/has-many-BXU96bZ9.js.map +1 -0
- package/dist/{hooks-CNY5g4Ab.js → hooks-o1U_cEA3.js} +2 -2
- package/dist/{hooks-CNY5g4Ab.js.map → hooks-o1U_cEA3.js.map} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index.js +4 -4
- package/dist/migration-support.js +177 -2
- package/dist/migration-support.js.map +1 -1
- package/dist/{model-rk3atPqV.js → model-Dkk-TZlL.js} +82 -88
- package/dist/model-Dkk-TZlL.js.map +1 -0
- package/dist/{schema-provider-Bvogtzx9.js → schema-provider-DyG6fJXt.js} +1 -1
- package/dist/{schema-provider-Bvogtzx9.js.map → schema-provider-DyG6fJXt.js.map} +1 -1
- package/package.json +16 -18
- package/unstable-preview-types/-private/belongs-to.d.ts +2 -2
- package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/errors.d.ts +2 -2
- package/unstable-preview-types/-private/has-many.d.ts +2 -2
- package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -1
- package/unstable-preview-types/-private/model.d.ts.map +1 -1
- package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -1
- package/unstable-preview-types/-private/promise-many-array.d.ts +9 -4
- package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -1
- package/unstable-preview-types/-private/record-state.d.ts +3 -3
- package/unstable-preview-types/-private/record-state.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/belongs-to.d.ts +6 -3
- package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -1
- package/unstable-preview-types/-private/references/has-many.d.ts +6 -3
- package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +18 -17
- package/unstable-preview-types/migration-support.d.ts +210 -3
- package/unstable-preview-types/migration-support.d.ts.map +1 -1
- package/unstable-preview-types/migration-support.type-test.d.ts +4 -0
- package/unstable-preview-types/migration-support.type-test.d.ts.map +1 -0
- package/dist/has-many-DT3JBYYG.js.map +0 -1
- package/dist/model-rk3atPqV.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-Dkk-TZlL.js","sources":["../src/-private/util.ts","../src/-private/promise-proxy-base.js","../../../node_modules/.pnpm/decorat_bfe8edbefc8aced6f61ce140cd72ecf2/node_modules/decorator-transforms/dist/runtime-BPCpkOf1.js","../src/-private/promise-belongs-to.ts","../src/-private/promise-many-array.ts","../src/-private/debug/assert-polymorphic-type.ts","../src/-private/references/has-many.ts","../src/-private/references/belongs-to.ts","../src/-private/legacy-relationships-support.ts","../src/-private/errors.ts","../src/-private/model-methods.ts","../src/-private/notify-changes.ts","../src/-private/record-state.ts","../src/-private/model.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { dasherize } from '@ember-data/request-utils/string';\nimport { DEPRECATE_NON_STRICT_TYPES } from '@warp-drive/build-config/deprecations';\n\nexport type DecoratorPropertyDescriptor = (PropertyDescriptor & { initializer?: () => unknown }) | undefined;\n\nexport function isElementDescriptor(args: unknown[]): args is [object, string, DecoratorPropertyDescriptor] {\n const [maybeTarget, maybeKey, maybeDesc] = args;\n\n return (\n // Ensure we have the right number of args\n args.length === 3 &&\n // Make sure the target is a class or object (prototype)\n (typeof maybeTarget === 'function' || (typeof maybeTarget === 'object' && maybeTarget !== null)) &&\n // Make sure the key is a string\n typeof maybeKey === 'string' &&\n // Make sure the descriptor is the right shape\n ((typeof maybeDesc === 'object' &&\n maybeDesc !== null &&\n 'enumerable' in maybeDesc &&\n 'configurable' in maybeDesc) ||\n // TS compatibility\n maybeDesc === undefined)\n );\n}\n\nexport function normalizeModelName(type: string): string {\n if (DEPRECATE_NON_STRICT_TYPES) {\n const result = dasherize(type);\n\n deprecate(\n `The resource type '${type}' is not normalized. Update your application code to use '${result}' instead of '${type}'.`,\n result === type,\n {\n id: 'ember-data:deprecate-non-strict-types',\n until: '6.0',\n for: 'ember-data',\n since: {\n available: '4.13',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n","import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';\nimport ObjectProxy from '@ember/object/proxy';\n\nexport const PromiseObject = ObjectProxy.extend(PromiseProxyMixin);\n","const deferred = /* @__PURE__ */ new WeakMap();\nfunction deferDecorator(proto, prop, desc) {\n let map = deferred.get(proto);\n if (!map) {\n map = /* @__PURE__ */ new Map();\n deferred.set(proto, map);\n }\n map.set(prop, desc);\n}\nfunction findDeferredDecorator(target, prop) {\n var _a;\n let cursor = target.prototype;\n while (cursor) {\n let desc = (_a = deferred.get(cursor)) == null ? void 0 : _a.get(prop);\n if (desc) {\n return desc;\n }\n cursor = cursor.prototype;\n }\n}\nfunction decorateFieldV1(target, prop, decorators, initializer) {\n return decorateFieldV2(target.prototype, prop, decorators, initializer);\n}\nfunction decorateFieldV2(prototype, prop, decorators, initializer) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n };\n if (initializer) {\n desc.initializer = initializer;\n }\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(prototype, prop, desc);\n } else {\n deferDecorator(prototype, prop, desc);\n }\n}\nfunction decorateMethodV1({ prototype }, prop, decorators) {\n return decorateMethodV2(prototype, prop, decorators);\n}\nfunction decorateMethodV2(prototype, prop, decorators) {\n const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);\n let desc = { ...origDesc };\n for (let decorator of decorators) {\n desc = decorator(prototype, prop, desc) || desc;\n }\n if (desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;\n desc.initializer = void 0;\n }\n Object.defineProperty(prototype, prop, desc);\n}\nfunction initializeDeferredDecorator(target, prop) {\n let desc = findDeferredDecorator(target.constructor, prop);\n if (desc) {\n Object.defineProperty(target, prop, {\n enumerable: desc.enumerable,\n configurable: desc.configurable,\n writable: desc.writable,\n value: desc.initializer ? desc.initializer.call(target) : void 0\n });\n }\n}\nfunction decorateClass(target, decorators) {\n return decorators.reduce(\n (accum, decorator) => decorator(accum) || accum,\n target\n );\n}\nfunction decoratePOJO(pojo, decorated) {\n for (let [type, prop, decorators] of decorated) {\n if (type === \"field\") {\n decoratePojoField(pojo, prop, decorators);\n } else {\n decorateMethodV2(pojo, prop, decorators);\n }\n }\n return pojo;\n}\nfunction decoratePojoField(pojo, prop, decorators) {\n let desc = {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: () => {\n var _a;\n return (_a = Object.getOwnPropertyDescriptor(pojo, prop)) == null ? void 0 : _a.value;\n }\n };\n for (let decorator of decorators) {\n desc = decorator(pojo, prop, desc) || desc;\n }\n if (desc.initializer) {\n desc.value = desc.initializer.call(pojo);\n delete desc.initializer;\n }\n Object.defineProperty(pojo, prop, desc);\n}\nconst runtime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n c: decorateClass,\n f: decorateFieldV1,\n g: decorateFieldV2,\n i: initializeDeferredDecorator,\n m: decorateMethodV1,\n n: decorateMethodV2,\n p: decoratePOJO\n}, Symbol.toStringTag, { value: \"Module\" }));\nexport {\n decorateFieldV2 as a,\n decorateMethodV1 as b,\n decorateMethodV2 as c,\n decorateFieldV1 as d,\n decorateClass as e,\n decoratePOJO as f,\n initializeDeferredDecorator as i,\n runtime as r\n};\n//# sourceMappingURL=runtime-BPCpkOf1.js.map\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 '@ember-data/store';\nimport { memoized } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { OpaqueRecordInstance, TypeFromInstanceOrString } from '@warp-drive/core-types/record';\n\nimport type { LegacySupport } from './legacy-relationships-support';\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 @module @ember-data/model\n */\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 @extends PromiseObject\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 type { RelatedCollection as ManyArray } from '@ember-data/store/-private';\nimport { defineSignal, memoized } from '@ember-data/store/-private';\nimport type { BaseFinderOptions } from '@ember-data/store/types';\nimport { DEPRECATE_COMPUTED_CHAINS } from '@warp-drive/build-config/deprecations';\nimport { assert } from '@warp-drive/build-config/macros';\n\nimport { LegacyPromiseProxy } from './promise-belongs-to';\n\nexport interface HasManyProxyCreateArgs<T = unknown> {\n promise: Promise<ManyArray<T>>;\n content?: ManyArray<T>;\n}\n\n/**\n @module @ember-data/model\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 * @method forEach\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 * @method reload\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 * @method then\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 * @method catch\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 * @method finally\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 { UpgradedMeta } from '@ember-data/graph/-private';\nimport type Store from '@ember-data/store';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\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 { CollectionEdge, Graph } from '@ember-data/graph/-private';\nimport type Store from '@ember-data/store';\nimport type { NotificationType } from '@ember-data/store';\nimport type { RelatedCollection as ManyArray } from '@ember-data/store/-private';\nimport { defineNonEnumerableSignal, memoized } from '@ember-data/store/-private';\nimport type { BaseFinderOptions } from '@ember-data/store/types';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';\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';\nimport { assertPolymorphicType } from '../debug/assert-polymorphic-type';\nimport type { LegacySupport } from '../legacy-relationships-support';\nimport { areAllInverseRecordsLoaded, LEGACY_SUPPORT } from '../legacy-relationships-support';\nimport type { MaybeHasManyFields } from '../type-utils';\n\n/**\n @module @ember-data/model\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 ```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 @method remoteType\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 ```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 commentsRef.ids(); // ['1']\n ```\n\n @method ids\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 '@ember-data/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 @method link\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 * @method links\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 '@ember-data/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 @method meta\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 ```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 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 @method push\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 ```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 post.comments.then(function(comments) {\n commentsRef.value() === comments\n })\n ```\n\n @method value\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 ```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 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 ```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 @method load\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 ```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 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 @method reload\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 { Graph, ResourceEdge } from '@ember-data/graph/-private';\nimport type Store from '@ember-data/store';\nimport type { NotificationType } from '@ember-data/store';\nimport { defineNonEnumerableSignal, memoized } from '@ember-data/store/-private';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { StableExistingRecordIdentifier } 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';\nimport { assertPolymorphicType } from '../debug/assert-polymorphic-type';\nimport type { LegacySupport } from '../legacy-relationships-support';\nimport { areAllInverseRecordsLoaded, LEGACY_SUPPORT } from '../legacy-relationships-support';\nimport type { MaybeBelongsToFields } from '../type-utils';\nimport { isMaybeResource } from './has-many';\n\n/**\n @module @ember-data/model\n*/\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 '@ember-data/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 @method id\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 '@ember-data/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 @method link\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 * @method links\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 '@ember-data/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 @method meta\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 ```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 @method remoteType\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 ```app/models/blog.js\n import Model, { belongsTo } from '@ember-data/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 @method push\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 '@ember-data/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 @method value\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 '@ember-data/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 ```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 @method load\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 '@ember-data/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 @method reload\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 { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport type { CollectionEdge, Graph, GraphEdge, ResourceEdge, UpgradedMeta } from '@ember-data/graph/-private';\nimport { upgradeStore } from '@ember-data/legacy-compat/-private';\nimport type Store from '@ember-data/store';\nimport type { Document } from '@ember-data/store';\nimport type { LiveArray } from '@ember-data/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 '@ember-data/store/-private';\nimport type { BaseFinderOptions } from '@ember-data/store/types';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { 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 {\n CollectionResourceRelationship,\n InnerRelationshipDocument,\n SingleResourceRelationship,\n} from '@warp-drive/core-types/spec/json-api-raw';\n\nimport type { MinimalLegacyRecord } from './model-methods';\nimport type { BelongsToProxyCreateArgs, BelongsToProxyMeta } from './promise-belongs-to';\nimport { PromiseBelongsTo } from './promise-belongs-to';\nimport type { HasManyProxyCreateArgs } from './promise-many-array';\nimport { PromiseManyArray } from './promise-many-array';\nimport BelongsToReference from './references/belongs-to';\nimport HasManyReference from './references/has-many';\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 (macroCondition(dependencySatisfies('@ember-data/graph', '*'))) {\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private'))\n .graphFor;\n\n this.graph = graphFor(this.store);\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 (macroCondition(dependencySatisfies('@ember-data/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 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 (macroCondition(dependencySatisfies('@ember-data/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 (macroCondition(dependencySatisfies('@ember-data/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 (macroCondition(dependencySatisfies('@ember-data/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 (macroCondition(!dependencySatisfies('@ember-data/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 (macroCondition(dependencySatisfies('@ember-data/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';\n\ntype ValidationError = {\n attribute: string;\n message: string;\n};\n/**\n @module @ember-data/model\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 ```app/models/user.js\n import Model, { attr } from '@ember-data/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 @extends Ember.ArrayProxy\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 @method errorsFor\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 @method unknownProperty\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 @method add\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 @method _findOrCreateMessages\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 @method remove\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 @method clear\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 ```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 @method has\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","import { importSync } from '@embroider/macros';\n\nimport type { Snapshot } from '@ember-data/legacy-compat/-private';\nimport { upgradeStore } from '@ember-data/legacy-compat/-private';\nimport type Store from '@ember-data/store';\nimport { recordIdentifierFor } from '@ember-data/store';\nimport { peekCache } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { ChangedAttributesHash } from '@warp-drive/core-types/cache';\nimport { RecordStore } from '@warp-drive/core-types/symbols';\n\nimport type { Errors } from './errors';\nimport { lookupLegacySupport } from './legacy-relationships-support';\nimport type RecordState from './record-state';\nimport type BelongsToReference from './references/belongs-to';\nimport type HasManyReference from './references/has-many';\nimport type { MaybeBelongsToFields, MaybeHasManyFields } from './type-utils';\n\nexport interface MinimalLegacyRecord {\n errors: Errors;\n ___recordState: RecordState;\n currentState: RecordState;\n isDestroyed: boolean;\n isDestroying: boolean;\n isReloading: boolean;\n isValid: boolean;\n [RecordStore]: Store;\n\n deleteRecord(): void;\n unloadRecord(): void;\n save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n}\n\nexport function rollbackAttributes<T extends MinimalLegacyRecord>(this: T) {\n const { currentState } = this;\n const { isNew } = currentState;\n\n this[RecordStore]._join(() => {\n peekCache(this).rollbackAttrs(recordIdentifierFor(this));\n this.errors.clear();\n currentState.cleanErrorRequests();\n if (isNew) {\n this.unloadRecord();\n }\n });\n}\n\nexport function unloadRecord<T extends MinimalLegacyRecord>(this: T) {\n if (this.currentState.isNew && (this.isDestroyed || this.isDestroying)) {\n return;\n }\n this[RecordStore].unloadRecord(this);\n}\n\nexport function belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(\n this: T,\n prop: K\n): BelongsToReference<T, K> {\n return lookupLegacySupport(this).referenceFor('belongsTo', prop) as BelongsToReference<T, K>;\n}\n\nexport function hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(\n this: T,\n prop: K\n): HasManyReference<T, K> {\n return lookupLegacySupport(this).referenceFor('hasMany', prop) as HasManyReference<T, K>;\n}\n\nexport function reload<T extends MinimalLegacyRecord>(this: T, options: Record<string, unknown> = {}): Promise<T> {\n options.isReloading = true;\n options.reload = true;\n\n const identifier = recordIdentifierFor(this);\n assert(`You cannot reload a record without an ID`, identifier.id);\n\n this.isReloading = true;\n const promise = this[RecordStore].request({\n op: 'findRecord',\n data: {\n options,\n record: identifier,\n },\n cacheOptions: { [Symbol.for('wd:skip-cache')]: true },\n })\n .then(() => this)\n .finally(() => {\n this.isReloading = false;\n });\n\n return promise;\n}\n\nexport function changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash {\n return peekCache(this).changedAttrs(recordIdentifierFor(this));\n}\n\nexport function serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown {\n upgradeStore(this[RecordStore]);\n return this[RecordStore].serializeRecord(this, options);\n}\n\nexport function deleteRecord<T extends MinimalLegacyRecord>(this: T): void {\n // ensure we've populated currentState prior to deleting a new record\n if (this.currentState) {\n this[RecordStore].deleteRecord(this);\n }\n}\n\nexport function save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n let promise: Promise<T>;\n\n if (this.currentState.isNew && this.currentState.isDeleted) {\n promise = Promise.resolve(this);\n } else {\n this.errors.clear();\n promise = this[RecordStore].saveRecord(this, options);\n }\n\n return promise;\n}\n\nexport function destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T> {\n const { isNew } = this.currentState;\n this.deleteRecord();\n if (isNew) {\n return Promise.resolve(this);\n }\n return this.save(options).then((_) => {\n this.unloadRecord();\n return this;\n });\n}\n\nexport function createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T> {\n const store = this[RecordStore];\n\n upgradeStore(store);\n if (!store._fetchManager) {\n const FetchManager = (\n importSync('@ember-data/legacy-compat/-private') as typeof import('@ember-data/legacy-compat/-private')\n ).FetchManager;\n store._fetchManager = new FetchManager(store);\n }\n\n // @ts-expect-error Typescript isn't able to curry narrowed args that are divorced from each other.\n return store._fetchManager.createSnapshot<T>(recordIdentifierFor(this));\n}\n","import { cacheFor } from '@ember/object/internals';\n\nimport type Store from '@ember-data/store';\nimport type { NotificationType } from '@ember-data/store';\nimport { ARRAY_SIGNAL, notifyInternalSignal, peekInternalSignal, withSignalStore } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { LegacyRelationshipField as RelationshipSchema } from '@warp-drive/core-types/schema/fields';\n\nimport { LEGACY_SUPPORT } from './legacy-relationships-support';\nimport type { Model } from './model';\n\nexport default function notifyChanges(\n identifier: StableRecordIdentifier,\n value: NotificationType,\n key: string | undefined,\n record: Model,\n store: Store\n) {\n switch (value) {\n case 'added':\n case 'attributes':\n if (key) {\n notifyAttribute(store, identifier, key, record);\n } else {\n record.eachAttribute((name) => {\n notifyAttribute(store, identifier, name, record);\n });\n }\n break;\n\n case 'relationships':\n if (key) {\n const meta = (record.constructor as typeof Model).relationshipsByName.get(key);\n assert(`Expected to find a relationship for ${key} on ${identifier.type}`, meta);\n notifyRelationship(identifier, key, record, meta);\n } else {\n record.eachRelationship((name, meta) => {\n notifyRelationship(identifier, name, record, meta);\n });\n }\n break;\n\n case 'identity':\n notifyInternalSignal(peekInternalSignal(withSignalStore(record), 'id'));\n break;\n }\n}\n\nfunction notifyRelationship(identifier: StableRecordIdentifier, key: string, record: Model, meta: RelationshipSchema) {\n if (meta.kind === 'belongsTo') {\n record.notifyPropertyChange(key);\n } else if (meta.kind === 'hasMany') {\n const support = LEGACY_SUPPORT.get(identifier);\n const manyArray = support && support._manyArrayCache[key];\n const hasPromise = support && support._relationshipPromisesCache[key];\n\n if (manyArray && hasPromise) {\n // do nothing, we will notify the ManyArray directly\n // once the fetch has completed.\n return;\n }\n\n if (manyArray) {\n notifyInternalSignal(manyArray[ARRAY_SIGNAL]);\n\n //We need to notifyPropertyChange in the adding case because we need to make sure\n //we fetch the newly added record in case it is unloaded\n //TODO(Igor): Consider whether we could do this only if the record state is unloaded\n assert(`Expected options to exist on relationship meta`, meta.options);\n assert(`Expected async to exist on relationship meta options`, 'async' in meta.options);\n if (meta.options.async) {\n record.notifyPropertyChange(key);\n }\n }\n }\n}\n\nfunction notifyAttribute(store: Store, identifier: StableRecordIdentifier, key: string, record: Model) {\n const currentValue = cacheFor(record, key);\n const cache = store.cache;\n if (currentValue !== cache.getAttr(identifier, key)) {\n record.notifyPropertyChange(key);\n }\n}\n","import type Store from '@ember-data/store';\nimport type { NotificationType } from '@ember-data/store';\nimport { storeFor } from '@ember-data/store';\nimport type { RequestCacheRequestState, RequestStateService } from '@ember-data/store/-private';\nimport {\n defineSignal,\n gate,\n memoized,\n notifyInternalSignal,\n peekInternalSignal,\n recordIdentifierFor,\n withSignalStore,\n} from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\n\nimport type { Errors } from './errors';\nimport type { MinimalLegacyRecord } from './model-methods';\n\nconst SOURCE_POINTER_REGEXP = /^\\/?data\\/(attributes|relationships)\\/(.*)/;\nconst SOURCE_POINTER_PRIMARY_REGEXP = /^\\/?data/;\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\nfunction isInvalidError(error: unknown): error is Error & { isAdapterError: true; code: 'InvalidError' } {\n return (\n !!error &&\n error instanceof Error &&\n 'isAdapterError' in error &&\n error.isAdapterError === true &&\n 'code' in error &&\n error.code === 'InvalidError'\n );\n}\n\n/**\nHistorically EmberData managed a state machine\nfor each record, the localState for which\nwas reflected onto Model.\n\nThis implements the flags and stateName for backwards compat\nwith the state tree that used to be possible (listed below).\n\nstateName and dirtyType are candidates for deprecation.\n\nroot\n empty\n deleted // hidden from stateName\n preloaded // hidden from stateName\n\n loading\n empty // hidden from stateName\n preloaded // hidden from stateName\n\n loaded\n saved\n updated\n uncommitted\n invalid\n inFlight\n created\n uncommitted\n invalid\n inFlight\n\n deleted\n saved\n new // hidden from stateName\n uncommitted\n invalid\n inFlight\n\n @internal\n*/\nexport default class RecordState {\n declare store: Store;\n declare identifier: StableRecordIdentifier;\n declare record: MinimalLegacyRecord;\n declare rs: RequestStateService;\n\n declare pendingCount: number;\n declare fulfilledCount: number;\n declare rejectedCount: number;\n declare cache: Cache;\n declare _errorRequests: RequestCacheRequestState[];\n declare _lastError: RequestCacheRequestState | null;\n declare handler: object;\n\n constructor(record: MinimalLegacyRecord) {\n const store = storeFor(record)!;\n const identity = recordIdentifierFor(record);\n\n this.identifier = identity;\n this.record = record;\n this.cache = store.cache;\n\n this.pendingCount = 0;\n this.fulfilledCount = 0;\n this.rejectedCount = 0;\n this._errorRequests = [];\n this._lastError = null;\n\n const requests = store.getRequestStateService();\n const notifications = store.notifications;\n\n const handleRequest = (req: RequestCacheRequestState) => {\n if (req.type === 'mutation') {\n switch (req.state) {\n case 'pending':\n this.isSaving = true;\n break;\n case 'rejected':\n this.isSaving = false;\n this._lastError = req;\n if (!(req.response && isInvalidError(req.response.data))) {\n this._errorRequests.push(req);\n }\n\n notifyErrorsStateChanged(this);\n break;\n case 'fulfilled':\n this._errorRequests = [];\n this._lastError = null;\n this.isSaving = false;\n this.notify('isDirty');\n notifyErrorsStateChanged(this);\n break;\n }\n } else {\n switch (req.state) {\n case 'pending':\n this.pendingCount++;\n this.notify('isLoading');\n break;\n case 'rejected':\n this.pendingCount--;\n this._lastError = req;\n if (!(req.response && isInvalidError(req.response.data))) {\n this._errorRequests.push(req);\n }\n this.notify('isLoading');\n notifyErrorsStateChanged(this);\n break;\n case 'fulfilled':\n this.pendingCount--;\n this.fulfilledCount++;\n this.notify('isLoading');\n this.notify('isDirty');\n notifyErrorsStateChanged(this);\n this._errorRequests = [];\n this._lastError = null;\n break;\n }\n }\n };\n\n requests.subscribeForRecord(identity, handleRequest);\n\n // we instantiate lazily\n // so we grab anything we don't have yet\n const lastRequest = requests.getLastRequestForRecord(identity);\n if (lastRequest) {\n handleRequest(lastRequest);\n }\n\n this.handler = notifications.subscribe(\n identity,\n (identifier: StableRecordIdentifier, type: NotificationType, key?: string) => {\n switch (type) {\n case 'state':\n this.notify('isSaved');\n this.notify('isNew');\n this.notify('isDeleted');\n this.notify('isDirty');\n break;\n case 'attributes':\n this.notify('isEmpty');\n this.notify('isDirty');\n break;\n case 'errors':\n this.updateInvalidErrors(this.record.errors);\n this.notify('isValid');\n break;\n }\n }\n );\n }\n\n destroy() {\n storeFor(this.record)!.notifications.unsubscribe(this.handler);\n }\n\n notify(key: keyof this & string) {\n const signals = withSignalStore(this);\n const signal = peekInternalSignal(signals, key);\n if (signal) {\n notifyInternalSignal(signal);\n }\n }\n\n updateInvalidErrors(errors: Errors) {\n assert(\n `Expected the Cache instance for ${this.identifier.lid} to implement getErrors(identifier)`,\n typeof this.cache.getErrors === 'function'\n );\n const jsonApiErrors = this.cache.getErrors(this.identifier);\n\n errors.clear();\n\n for (let i = 0; i < jsonApiErrors.length; i++) {\n const error = jsonApiErrors[i];\n\n if (error.source && error.source.pointer) {\n const keyMatch = error.source.pointer.match(SOURCE_POINTER_REGEXP);\n let key: string | undefined;\n\n if (keyMatch) {\n key = keyMatch[2];\n } else if (error.source.pointer.search(SOURCE_POINTER_PRIMARY_REGEXP) !== -1) {\n key = PRIMARY_ATTRIBUTE_KEY;\n }\n\n if (key) {\n const errMsg = error.detail || error.title;\n assert(`Expected field error to have a detail or title to use as the message`, errMsg);\n errors.add(key, errMsg);\n }\n }\n }\n }\n\n cleanErrorRequests() {\n this.notify('isValid');\n this.notify('isError');\n this.notify('adapterError');\n this._errorRequests = [];\n this._lastError = null;\n }\n\n declare isSaving: boolean;\n\n @gate\n get isLoading() {\n return !this.isLoaded && this.pendingCount > 0 && this.fulfilledCount === 0;\n }\n\n @gate\n get isLoaded() {\n if (this.isNew) {\n return true;\n }\n return this.fulfilledCount > 0 || !this.isEmpty;\n }\n\n @gate\n get isSaved() {\n const rd = this.cache;\n if (this.isDeleted) {\n assert(`Expected Cache to implement isDeletionCommitted()`, typeof rd.isDeletionCommitted === 'function');\n return rd.isDeletionCommitted(this.identifier);\n }\n if (this.isNew || this.isEmpty || !this.isValid || this.isDirty || this.isLoading) {\n return false;\n }\n return true;\n }\n\n @gate\n get isEmpty() {\n const rd = this.cache;\n // TODO this is not actually an RFC'd concept. Determine the\n // correct heuristic to replace this with.\n assert(`Expected Cache to implement isEmpty()`, typeof rd.isEmpty === 'function');\n return !this.isNew && rd.isEmpty(this.identifier);\n }\n\n @gate\n get isNew() {\n const rd = this.cache;\n assert(`Expected Cache to implement isNew()`, typeof rd.isNew === 'function');\n return rd.isNew(this.identifier);\n }\n\n @gate\n get isDeleted() {\n const rd = this.cache;\n assert(`Expected Cache to implement isDeleted()`, typeof rd.isDeleted === 'function');\n return rd.isDeleted(this.identifier);\n }\n\n @gate\n get isValid() {\n return this.record.errors.length === 0;\n }\n\n @gate\n get isDirty() {\n const rd = this.cache;\n if (this.isEmpty || rd.isDeletionCommitted(this.identifier) || (this.isDeleted && this.isNew)) {\n return false;\n }\n return this.isDeleted || this.isNew || rd.hasChangedAttrs(this.identifier);\n }\n\n @gate\n get isError() {\n const errorReq = this._errorRequests[this._errorRequests.length - 1];\n if (!errorReq) {\n return false;\n } else {\n return true;\n }\n }\n\n @gate\n get adapterError() {\n const request = this._lastError;\n if (!request) {\n return null;\n }\n return request.state === 'rejected' && request.response!.data;\n }\n\n @memoized\n get isPreloaded() {\n return !this.isEmpty && this.isLoading;\n }\n\n @memoized\n get stateName() {\n // we might be empty while loading so check this first\n if (this.isLoading) {\n return 'root.loading';\n\n // got nothing yet or were unloaded\n } else if (this.isEmpty) {\n return 'root.empty';\n\n // deleted substates\n } else if (this.isDeleted) {\n if (this.isSaving) {\n return 'root.deleted.inFlight';\n } else if (this.isSaved) {\n // TODO ensure isSaved isn't true from previous requests\n return 'root.deleted.saved';\n } else if (!this.isValid) {\n return 'root.deleted.invalid';\n } else {\n return 'root.deleted.uncommitted';\n }\n\n // loaded.created substates\n } else if (this.isNew) {\n if (this.isSaving) {\n return 'root.loaded.created.inFlight';\n } else if (!this.isValid) {\n return 'root.loaded.created.invalid';\n }\n return 'root.loaded.created.uncommitted';\n\n // loaded.updated substates\n } else if (this.isSaving) {\n return 'root.loaded.updated.inFlight';\n } else if (!this.isValid) {\n return 'root.loaded.updated.invalid';\n } else if (this.isDirty) {\n return 'root.loaded.updated.uncommitted';\n\n // if nothing remains, we are loaded saved!\n } else {\n return 'root.loaded.saved';\n }\n }\n\n @memoized\n get dirtyType() {\n // we might be empty while loading so check this first\n if (this.isLoading || this.isEmpty) {\n return '';\n\n // deleted substates\n } else if (this.isDirty && this.isDeleted) {\n return 'deleted';\n\n // loaded.created substates\n } else if (this.isNew) {\n return 'created';\n\n // loaded.updated substates\n } else if (this.isSaving || !this.isValid || this.isDirty) {\n return 'updated';\n\n // if nothing remains, we are loaded saved!\n } else {\n return '';\n }\n }\n}\ndefineSignal(RecordState.prototype, 'isSaving', false);\n\nfunction notifyErrorsStateChanged(state: RecordState) {\n state.notify('isValid');\n state.notify('isError');\n state.notify('adapterError');\n}\n","/**\n @module @ember-data/model\n */\n\nimport EmberObject from '@ember/object';\n\nimport type { Snapshot } from '@ember-data/legacy-compat/-private';\nimport type Store from '@ember-data/store';\nimport type { NotificationType } from '@ember-data/store';\nimport { recordIdentifierFor, storeFor } from '@ember-data/store';\nimport { coerceId, defineSignal, entangleSignal, gate, memoized, withSignalStore } from '@ember-data/store/-private';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache, ChangedAttributesHash } from '@warp-drive/core-types/cache';\nimport type { LegacyAttributeField, LegacyRelationshipField } from '@warp-drive/core-types/schema/fields';\nimport { RecordStore } from '@warp-drive/core-types/symbols';\n\nimport { Errors } from './errors';\nimport { LEGACY_SUPPORT } from './legacy-relationships-support';\nimport type { MinimalLegacyRecord } from './model-methods';\nimport {\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './model-methods';\nimport notifyChanges from './notify-changes';\nimport RecordState from './record-state';\nimport type BelongsToReference from './references/belongs-to';\nimport type HasManyReference from './references/has-many';\nimport type {\n _MaybeBelongsToFields,\n isSubClass,\n MaybeAttrFields,\n MaybeHasManyFields,\n MaybeRelationshipFields,\n} from './type-utils';\n\nexport type ModelCreateArgs = {\n _createProps: Record<string, unknown>;\n // TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for\n _secretInit: {\n identifier: StableRecordIdentifier;\n cache: Cache;\n store: Store;\n cb: (record: Model, cache: Cache, identifier: StableRecordIdentifier, store: Store) => void;\n };\n};\n\nexport type StaticModel = typeof Model & { create(options: ModelCreateArgs): Model };\nexport type ModelFactory = { class: StaticModel };\nexport type FactoryCache = Record<string, ModelFactory>;\n// we put this on the store for interop because it's used by modelFor and\n// instantiateRecord as well.\nexport type ModelStore = Store & { _modelFactoryCache: FactoryCache };\n\n/*\n * This decorator allows us to lazily compute\n * an expensive getter on first-access and thereafter\n * never recompute it.\n */\nfunction computeOnce(target: object, propertyName: string, desc: PropertyDescriptor) {\n const cache = new WeakMap<object, { hasComputed: boolean; value: unknown }>();\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const getter = desc.get;\n desc.get = function () {\n let meta = cache.get(this);\n\n if (!meta) {\n meta = { hasComputed: false, value: undefined };\n cache.set(this, meta);\n }\n\n if (!meta.hasComputed) {\n meta.value = (getter as () => unknown).call(this);\n meta.hasComputed = true;\n }\n\n return meta.value;\n };\n return desc;\n}\n\n/**\n Base class from which Models can be defined.\n\n ```js\n import Model, { attr } from '@ember-data/model';\n\n export default class User extends Model {\n @attr name;\n }\n ```\n\n Models are used both to define the static schema for a\n particular resource type as well as the class to instantiate\n to present that data from cache.\n\n @class Model\n @public\n @extends Ember.EmberObject\n*/\n\ninterface Model {\n serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown;\n destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n unloadRecord<T extends MinimalLegacyRecord>(this: T): void;\n changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash;\n rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;\n _createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T>;\n save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;\n reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;\n\n // belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(\n // this: T,\n // prop: K\n // ): BelongsToReference<T, K>;\n belongsTo<T extends Model, K extends keyof T & string>(\n this: T,\n prop: K & (K extends _MaybeBelongsToFields<T> ? K : never)\n ): BelongsToReference<T, K>;\n hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(this: T, prop: K): HasManyReference<T, K>;\n deleteRecord<T extends MinimalLegacyRecord>(this: T): void;\n}\nclass Model extends EmberObject implements MinimalLegacyRecord {\n // set during create by the store\n declare store: Store;\n declare ___recordState: RecordState;\n declare ___private_notifications: object;\n declare [RecordStore]: Store;\n\n init(options: ModelCreateArgs) {\n if (DEBUG) {\n if (!options?._secretInit && !options?._createProps) {\n throw new Error(\n 'You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.'\n );\n }\n }\n const createProps = options._createProps;\n const _secretInit = options._secretInit;\n (options as Record<string, unknown>)._createProps = null;\n (options as Record<string, unknown>)._secretInit = null;\n\n const store = (this.store = _secretInit.store);\n super.init(options);\n\n this[RecordStore] = store;\n\n const identity = _secretInit.identifier;\n _secretInit.cb(this, _secretInit.cache, identity, _secretInit.store);\n\n this.___recordState = DEBUG\n ? new RecordState(this as unknown as MinimalLegacyRecord)\n : (null as unknown as RecordState);\n\n this.setProperties(createProps);\n\n const notifications = store.notifications;\n this.___private_notifications = notifications.subscribe(\n identity,\n (identifier: StableRecordIdentifier, type: NotificationType, field?: string): void => {\n notifyChanges(identifier, type, field, this, store);\n }\n );\n }\n\n // @ts-expect-error destroy should not return a value, but ember's types force it to\n destroy(): this {\n const identifier = recordIdentifierFor(this);\n this.___recordState?.destroy();\n const store = storeFor(this)!;\n store.notifications.unsubscribe(this.___private_notifications);\n\n LEGACY_SUPPORT.get(this as unknown as MinimalLegacyRecord)?.destroy();\n LEGACY_SUPPORT.delete(this as unknown as MinimalLegacyRecord);\n LEGACY_SUPPORT.delete(identifier);\n\n super.destroy();\n }\n\n /**\n If this property is `true` the record is in the `empty`\n state. Empty is the first state all records enter after they have\n been created. Most records created by the store will quickly\n transition to the `loading` state if data needs to be fetched from\n the server or the `created` state if the record is created on the\n client. A record can also enter the empty state if the adapter is\n unable to locate the record.\n\n @property isEmpty\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isEmpty(): boolean {\n return this.currentState.isEmpty;\n }\n\n /**\n If this property is `true` the record is in the `loading` state. A\n record enters this state when the store asks the adapter for its\n data. It remains in this state until the adapter provides the\n requested data.\n\n @property isLoading\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isLoading(): boolean {\n return this.currentState.isLoading;\n }\n\n /**\n If this property is `true` the record is in the `loaded` state. A\n record enters this state when its data is populated. Most of a\n record's lifecycle is spent inside substates of the `loaded`\n state.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isLoaded; // true\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n model.isLoaded;\n ```\n\n @property isLoaded\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isLoaded(): boolean {\n return this.currentState.isLoaded;\n }\n\n /**\n If this property is `true` the record is in the `dirty` state. The\n record has local changes that have not yet been saved by the\n adapter. This includes records that have been created (but not yet\n saved) or deleted.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.hasDirtyAttributes; // true\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n\n model.hasDirtyAttributes; // false\n model.foo = 'some value';\n model.hasDirtyAttributes; // true\n ```\n\n @since 1.13.0\n @property hasDirtyAttributes\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get hasDirtyAttributes(): boolean {\n return this.currentState.isDirty;\n }\n\n /**\n If this property is `true` the record is in the `saving` state. A\n record enters the saving state when `save` is called, but the\n adapter has not yet acknowledged that the changes have been\n persisted to the backend.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isSaving; // false\n let promise = record.save();\n record.isSaving; // true\n promise.then(function() {\n record.isSaving; // false\n });\n ```\n\n @property isSaving\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isSaving(): boolean {\n return this.currentState.isSaving;\n }\n\n /**\n If this property is `true` the record is in the `deleted` state\n and has been marked for deletion. When `isDeleted` is true and\n `hasDirtyAttributes` is true, the record is deleted locally but the deletion\n was not yet persisted. When `isSaving` is true, the change is\n in-flight. When both `hasDirtyAttributes` and `isSaving` are false, the\n change has persisted.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isDeleted; // false\n record.deleteRecord();\n\n // Locally deleted\n record.isDeleted; // true\n record.hasDirtyAttributes; // true\n record.isSaving; // false\n\n // Persisting the deletion\n let promise = record.save();\n record.isDeleted; // true\n record.isSaving; // true\n\n // Deletion Persisted\n promise.then(function() {\n record.isDeleted; // true\n record.isSaving; // false\n record.hasDirtyAttributes; // false\n });\n ```\n\n @property isDeleted\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isDeleted(): boolean {\n return this.currentState.isDeleted;\n }\n\n /**\n If this property is `true` the record is in the `new` state. A\n record will be in the `new` state when it has been created on the\n client and the adapter has not yet report that it was successfully\n saved.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.isNew; // true\n\n record.save().then(function(model) {\n model.isNew; // false\n });\n ```\n\n @property isNew\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isNew(): boolean {\n return this.currentState.isNew;\n }\n\n /**\n If this property is `true` the record is in the `valid` state.\n\n A record will be in the `valid` state when the adapter did not report any\n server-side validation failures.\n\n @property isValid\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isValid(): boolean {\n return this.currentState.isValid;\n }\n\n /**\n If the record is in the dirty state this property will report what\n kind of change has caused it to move into the dirty\n state. Possible values are:\n\n - `created` The record has been created by the client and not yet saved to the adapter.\n - `updated` The record has been updated by the client and not yet saved to the adapter.\n - `deleted` The record has been deleted by the client and not yet saved to the adapter.\n\n Example\n\n ```javascript\n let record = store.createRecord('model');\n record.dirtyType; // 'created'\n ```\n\n @property dirtyType\n @public\n @type {String}\n @readOnly\n */\n @memoized\n get dirtyType(): 'created' | 'updated' | 'deleted' | '' {\n return this.currentState.dirtyType;\n }\n\n /**\n If `true` the adapter reported that it was unable to save local\n changes to the backend for any reason other than a server-side\n validation error.\n\n Example\n\n ```javascript\n record.isError; // false\n record.set('foo', 'valid value');\n record.save().then(null, function() {\n record.isError; // true\n });\n ```\n\n @property isError\n @public\n @type {Boolean}\n @readOnly\n */\n @memoized\n get isError(): boolean {\n return this.currentState.isError;\n }\n set isError(v) {\n if (DEBUG) {\n throw new Error(`isError is not directly settable`);\n }\n }\n\n /**\n If `true` the store is attempting to reload the record from the adapter.\n\n Example\n\n ```javascript\n record.isReloading; // false\n record.reload();\n record.isReloading; // true\n ```\n\n @property isReloading\n @public\n @type {Boolean}\n @readOnly\n */\n declare isReloading: boolean;\n\n /**\n All ember models have an id property. This is an identifier\n managed by an external source. These are always coerced to be\n strings before being used internally. Note when declaring the\n attributes for a model it is an error to declare an id\n attribute.\n\n ```javascript\n let record = store.createRecord('model');\n record.id; // null\n\n const { content: { data: model } } = await store.request(findRecord({ type: 'model', id: '1' }));\n model.id; // '1'\n ```\n\n @property id\n @public\n @type {String}\n */\n @gate\n get id(): string | null {\n // this guard exists, because some dev-only deprecation code\n // (addListener via validatePropertyInjections) invokes toString before the\n // object is real.\n if (DEBUG) {\n try {\n return recordIdentifierFor(this).id;\n } catch {\n return null;\n }\n }\n return recordIdentifierFor(this).id;\n }\n set id(id) {\n const normalizedId = coerceId(id);\n const identifier = recordIdentifierFor(this);\n const didChange = normalizedId !== identifier.id;\n assert(\n `Cannot set ${identifier.type} record's id to ${id}, because id is already ${identifier.id}`,\n !didChange || identifier.id === null\n );\n\n if (normalizedId !== null && didChange) {\n this.store._instanceCache.setRecordId(identifier, normalizedId);\n this.store.notifications.notify(identifier, 'identity');\n }\n }\n\n toString() {\n return `<model::${(this.constructor as unknown as { modelName: string }).modelName}:${this.id}>`;\n }\n\n /**\n @property currentState\n @private\n @type {Object}\n */\n // TODO we can probably make this a computeOnce\n // we likely do not need to notify the currentState root anymore\n @gate\n get currentState() {\n // descriptors are called with the wrong `this` context during mergeMixins\n // when using legacy/classic ember classes. Basically: lazy in prod and eager in dev.\n // so we do this to try to steer folks to the nicer \"dont user currentState\"\n // error.\n if (!DEBUG) {\n if (!this.___recordState) {\n this.___recordState = new RecordState(this as unknown as MinimalLegacyRecord);\n }\n }\n return this.___recordState;\n }\n set currentState(_v) {\n throw new Error('cannot set currentState');\n }\n\n /**\n The store service instance which created this record instance\n\n @property store\n @public\n */\n\n /**\n When the record is in the `invalid` state this object will contain\n any errors returned by the adapter. When present the errors hash\n contains keys corresponding to the invalid property names\n and values which are arrays of Javascript objects with two keys:\n\n - `message` A string containing the error message from the backend\n - `attribute` The name of the property associated with this error message\n\n ```javascript\n record.errors.length; // 0\n record.set('foo', 'invalid value');\n record.save().catch(function() {\n record.errors.foo;\n // [{message: 'foo should be a number.', attribute: 'foo'}]\n });\n ```\n\n The `errors` property is useful for displaying error messages to\n the user.\n\n ```handlebars\n <label>Username: <Input @value={{@model.username}} /> </label>\n {{#each @model.errors.username as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n <label>Email: <Input @value={{@model.email}} /> </label>\n {{#each @model.errors.email as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n ```\n\n\n You can also access the special `messages` property on the error\n object to get an array of all the error strings.\n\n ```handlebars\n {{#each @model.errors.messages as |message|}}\n <div class=\"error\">\n {{message}}\n </div>\n {{/each}}\n ```\n\n @property errors\n @public\n @type {Errors}\n */\n @computeOnce\n get errors(): Errors {\n const errors = (Errors as unknown as { create(obj: object): Errors }).create({ __record: this });\n this.currentState.updateInvalidErrors(errors);\n return errors;\n }\n\n /**\n This property holds the `AdapterError` object with which\n last adapter operation was rejected.\n\n @property adapterError\n @public\n @type {AdapterError}\n */\n @memoized\n get adapterError() {\n return this.currentState.adapterError;\n }\n set adapterError(v) {\n throw new Error(`adapterError is not directly settable`);\n }\n\n /**\n Create a JSON representation of the record, using the serialization\n strategy of the store's adapter.\n\n `serialize` takes an optional hash as a parameter, currently\n supported options are:\n\n - `includeId`: `true` if the record's ID should be included in the\n JSON representation.\n\n @method serialize\n @public\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n */\n /*\n We hook the default implementation to ensure\n our tagged properties are properly notified\n as well. We still super for everything because\n sync observers require a direct call occuring\n to trigger their flush. We wouldn't need to\n super in 4.0+ where sync observers are removed.\n */\n // @ts-expect-error no return is necessary, but Ember's types are forcing it\n notifyPropertyChange(prop: string): this {\n const signals = withSignalStore(this);\n entangleSignal(signals, this, prop, undefined);\n super.notifyPropertyChange(prop);\n }\n\n /**\n Marks the record as deleted but does not save it. You must call\n `save` afterwards if you want to persist it. You might use this\n method if you want to allow the user to still `rollbackAttributes()`\n after a delete was made.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n softDelete = () => {\n this.args.model.deleteRecord();\n }\n\n confirm = () => {\n this.args.model.save();\n }\n\n undo = () => {\n this.args.model.rollbackAttributes();\n }\n }\n ```\n\n @method deleteRecord\n @public\n */\n\n /**\n Same as `deleteRecord`, but saves the record immediately.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n delete = () => {\n this.args.model.destroyRecord().then(function() {\n this.transitionToRoute('model.index');\n });\n }\n }\n ```\n\n If you pass an object on the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot\n\n ```js\n record.destroyRecord({ adapterOptions: { subscribe: false } });\n ```\n\n ```app/adapters/post.js\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n deleteRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @method destroyRecord\n @public\n @param {Object} options\n @return {Promise} a promise that will be resolved when the adapter returns\n successfully or rejected if the adapter returns with an error.\n */\n\n /**\n Unloads the record from the store. This will not send a delete request\n to your server, it just unloads the record from memory.\n\n @method unloadRecord\n @public\n */\n\n /**\n Returns an object, whose keys are changed properties, and value is\n an [oldProp, newProp] array.\n\n The array represents the diff of the canonical state with the local state\n of the model. Note: if the model is created locally, the canonical state is\n empty since the adapter hasn't acknowledged the attributes yet:\n\n Example\n\n ```app/models/mascot.js\n import Model, { attr } from '@ember-data/model';\n\n export default class MascotModel extends Model {\n @attr('string') name;\n @attr('boolean', {\n defaultValue: false\n })\n isAdmin;\n }\n ```\n\n ```javascript\n let mascot = store.createRecord('mascot');\n\n mascot.changedAttributes(); // {}\n\n mascot.set('name', 'Tomster');\n mascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\n mascot.set('isAdmin', true);\n mascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\n mascot.save().then(function() {\n mascot.changedAttributes(); // {}\n\n mascot.set('isAdmin', false);\n mascot.changedAttributes(); // { isAdmin: [true, false] }\n });\n ```\n\n @method changedAttributes\n @public\n @return {Object} an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.\n */\n\n /**\n If the model `hasDirtyAttributes` this function will discard any unsaved\n changes. If the model `isNew` it will be removed from the store.\n\n Example\n\n ```javascript\n record.name; // 'Untitled Document'\n record.set('name', 'Doc 1');\n record.name; // 'Doc 1'\n record.rollbackAttributes();\n record.name; // 'Untitled Document'\n ```\n\n @since 1.13.0\n @method rollbackAttributes\n @public\n */\n\n /**\n @method _createSnapshot\n @private\n */\n // TODO @deprecate in favor of a public API or examples of how to test successfully\n\n /**\n Save the record and persist any changes to the record to an\n external source via the adapter.\n\n Example\n\n ```javascript\n record.set('name', 'Tomster');\n record.save().then(function() {\n // Success callback\n }, function() {\n // Error callback\n });\n ```\n\n If you pass an object using the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot.\n\n ```js\n record.save({ adapterOptions: { subscribe: false } });\n ```\n\n ```app/adapters/post.js\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n updateRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @method save\n @public\n @param {Object} options\n @return {Promise} a promise that will be resolved when the adapter returns\n successfully or rejected if the adapter returns with an error.\n */\n\n /**\n Reload the record from the adapter.\n\n This will only work if the record has already finished loading.\n\n Example\n\n ```js\n import Component from '@glimmer/component';\n\n export default class extends Component {\n async reload = () => {\n await this.args.model.reload();\n // do something with the reloaded model\n }\n }\n ```\n\n @method reload\n @public\n @param {Object} options optional, may include `adapterOptions` hash which will be passed to adapter request\n\n @return {Promise} a promise that will be resolved with the record when the\n adapter returns successfully or rejected if the adapter returns\n with an error.\n */\n\n attr() {\n assert(\n 'The `attr` method is not available on Model, a Snapshot was probably expected. Are you passing a Model instead of a Snapshot to your serializer?',\n false\n );\n }\n\n /**\n Get the reference for the specified belongsTo relationship.\n\n For instance, given the following model\n\n ```app/models/blog-post.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class BlogPost extends Model {\n @belongsTo('user', { async: true, inverse: null }) author;\n }\n ```\n\n Then the reference for the author relationship would be\n retrieved from a record instance like so:\n\n ```js\n blogPost.belongsTo('author');\n ```\n\n A `BelongsToReference` is a low-level API that allows access\n and manipulation of a belongsTo relationship.\n\n It is especially useful when you're dealing with `async` relationships\n as it allows synchronous access to the relationship data if loaded, as\n well as APIs for loading, reloading the data or accessing available\n information without triggering a load.\n\n It may also be useful when using `sync` relationships that need to be\n loaded/reloaded with more precise timing than marking the\n relationship as `async` and relying on autofetch would have allowed.\n\n However,keep in mind that marking a relationship as `async: false` will introduce\n bugs into your application if the data is not always guaranteed to be available\n by the time the relationship is accessed. Ergo, it is recommended when using this\n approach to utilize `links` for unloaded relationship state instead of identifiers.\n\n Reference APIs are entangled with the relationship's underlying state,\n thus any getters or cached properties that utilize these will properly\n invalidate if the relationship state changes.\n\n References are \"stable\", meaning that multiple calls to retrieve the reference\n for a given relationship will always return the same HasManyReference.\n\n @method belongsTo\n @public\n @param {String} name of the relationship\n @since 2.5.0\n @return {BelongsToReference} reference for this relationship\n */\n\n /**\n Get the reference for the specified hasMany relationship.\n\n For instance, given the following model\n\n ```app/models/blog-post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class BlogPost extends Model {\n @hasMany('comment', { async: true, inverse: null }) comments;\n }\n ```\n\n Then the reference for the comments relationship would be\n retrieved from a record instance like so:\n\n ```js\n blogPost.hasMany('comments');\n ```\n\n A `HasManyReference` is a low-level API that allows access\n and manipulation of a hasMany relationship.\n\n It is especially useful when you are dealing with `async` relationships\n as it allows synchronous access to the relationship data if loaded, as\n well as APIs for loading, reloading the data or accessing available\n information without triggering a load.\n\n It may also be useful when using `sync` relationships with `@ember-data/model`\n that need to be loaded/reloaded with more precise timing than marking the\n relationship as `async` and relying on autofetch would have allowed.\n\n However,keep in mind that marking a relationship as `async: false` will introduce\n bugs into your application if the data is not always guaranteed to be available\n by the time the relationship is accessed. Ergo, it is recommended when using this\n approach to utilize `links` for unloaded relationship state instead of identifiers.\n\n Reference APIs are entangled with the relationship's underlying state,\n thus any getters or cached properties that utilize these will properly\n invalidate if the relationship state changes.\n\n References are \"stable\", meaning that multiple calls to retrieve the reference\n for a given relationship will always return the same HasManyReference.\n\n @method hasMany\n @public\n @param {String} name of the relationship\n @since 2.5.0\n @return {HasManyReference} reference for this relationship\n */\n\n /**\n Given a callback, iterates over each of the relationships in the model,\n invoking the callback with the name of each relationship and its relationship\n descriptor.\n\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, descriptor);\n ```\n\n - `name` the name of the current property in the iteration\n - `descriptor` the meta object that describes this relationship\n\n The relationship descriptor argument is an object with the following properties.\n\n - **name** <span class=\"type\">String</span> the name of this relationship on the Model\n - **kind** <span class=\"type\">String</span> \"hasMany\" or \"belongsTo\"\n - **options** <span class=\"type\">Object</span> the original options hash passed when the relationship was declared\n - **parentType** <span class=\"type\">Model</span> the type of the Model that owns this relationship\n - **type** <span class=\"type\">String</span> the type name of the related Model\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```app/serializers/application.js\n import JSONSerializer from '@ember-data/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n serialize(record, options) {\n let json = {};\n\n record.eachRelationship(function(name, descriptor) {\n if (descriptor.kind === 'hasMany') {\n let serializedHasManyName = name.toUpperCase() + '_IDS';\n json[serializedHasManyName] = record.get(name).map(r => r.id);\n }\n });\n\n return json;\n }\n }\n ```\n\n @method eachRelationship\n @public\n @param {Function} callback the callback to invoke\n @param {any} binding the value to which the callback's `this` should be bound\n */\n eachRelationship<T>(\n callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void,\n binding?: T\n ): void {\n (this.constructor as typeof Model).eachRelationship<T, this>(callback, binding);\n }\n\n relationshipFor(name: string): LegacyRelationshipField | undefined {\n return (this.constructor as typeof Model).relationshipsByName.get(name);\n }\n\n inverseFor(name: string) {\n return (this.constructor as typeof Model).inverseFor(name, storeFor(this)!);\n }\n\n eachAttribute<T>(\n callback: (\n this: NoInfer<T> | undefined,\n key: isSubClass<this> extends true ? MaybeAttrFields<this> : string,\n meta: LegacyAttributeField\n ) => void,\n binding?: T\n ): void {\n (this.constructor as typeof Model).eachAttribute<T, this>(callback, binding);\n }\n\n static isModel = true;\n\n /**\n Create should only ever be called by the store. To create an instance of a\n `Model` in a dirty state use `store.createRecord`.\n\n To create instances of `Model` in a clean state, use `store.push`\n\n @method create\n @private\n @static\n */\n\n /**\n Represents the model's class name as a string. This can be used to look up the model's class name through\n `Store`'s modelFor method.\n\n `modelName` is generated for you by EmberData. It will be a lowercased, dasherized string.\n For example:\n\n ```javascript\n store.modelFor('post').modelName; // 'post'\n store.modelFor('blog-post').modelName; // 'blog-post'\n ```\n\n The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload\n keys to underscore (instead of dasherized), you might use the following code:\n\n ```javascript\n import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default const PostSerializer = RESTSerializer.extend({\n payloadKeyFromModelName(modelName) {\n return underscore(modelName);\n }\n });\n ```\n @property modelName\n @public\n @type String\n @readonly\n @static\n */\n static modelName: string = null as unknown as string;\n\n /*\n These class methods below provide relationship\n introspection abilities about relationships.\n\n A note about the computed properties contained here:\n\n **These properties are effectively sealed once called for the first time.**\n To avoid repeatedly doing expensive iteration over a model's fields, these\n values are computed once and then cached for the remainder of the runtime of\n your application.\n\n If your application needs to modify a class after its initial definition\n (for example, using `reopen()` to add additional attributes), make sure you\n do it before using your model with the store, which uses these properties\n extensively.\n */\n\n /**\n For a given relationship name, returns the model type of the relationship.\n\n For example, if you define a model like this:\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('comment') comments;\n }\n ```\n\n Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.\n\n @method typeForRelationship\n @public\n @static\n @param {String} name the name of the relationship\n @param {store} store an instance of Store\n @return {Model} the type of the relationship, or undefined\n */\n static typeForRelationship(name: string, store: Store) {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationship = this.relationshipsByName.get(name);\n return relationship && store.modelFor(relationship.type);\n }\n\n @computeOnce\n static get inverseMap(): Record<string, LegacyRelationshipField | null> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n return Object.create(null) as Record<string, LegacyRelationshipField | null>;\n }\n\n /**\n Find the relationship which is the inverse of the one asked for.\n\n For example, if you define models like this:\n\n ```app/models/post.js\n import Model, { hasMany } from '@ember-data/model';\n\n export default class PostModel extends Model {\n @hasMany('message') comments;\n }\n ```\n\n ```app/models/message.js\n import Model, { belongsTo } from '@ember-data/model';\n\n export default class MessageModel extends Model {\n @belongsTo('post') owner;\n }\n ```\n\n ``` js\n store.modelFor('post').inverseFor('comments', store) // { type: 'message', name: 'owner', kind: 'belongsTo' }\n store.modelFor('message').inverseFor('owner', store) // { type: 'post', name: 'comments', kind: 'hasMany' }\n ```\n\n @method inverseFor\n @public\n @static\n @param {String} name the name of the relationship\n @param {Store} store\n @return {Object} the inverse relationship, or null\n */\n static inverseFor(name: string, store: Store): LegacyRelationshipField | null {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const inverseMap = this.inverseMap;\n if (inverseMap[name]) {\n return inverseMap[name];\n } else {\n const inverse = this._findInverseFor(name, store);\n inverseMap[name] = inverse;\n return inverse;\n }\n }\n\n //Calculate the inverse, ignoring the cache\n static _findInverseFor(name: string, store: Store): LegacyRelationshipField | null {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationship = this.relationshipsByName.get(name)!;\n assert(`No relationship named '${name}' on '${this.modelName}' exists.`, relationship);\n\n if (!relationship) {\n return null;\n }\n\n const { options } = relationship;\n assert(\n `Expected the relationship ${name} on ${this.modelName} to define an inverse.`,\n options.inverse === null || (typeof options.inverse === 'string' && options.inverse.length > 0)\n );\n\n if (options.inverse === null) {\n return null;\n }\n\n const schemaExists = store.schema.hasResource(relationship);\n\n assert(\n `No associated schema found for '${relationship.type}' while calculating the inverse of ${name} on ${this.modelName}`,\n schemaExists\n );\n\n if (!schemaExists) {\n return null;\n }\n\n const inverseField = store.schema.fields(relationship).get(options.inverse);\n assert(\n `No inverse relationship found for '${name}' on '${this.modelName}'`,\n inverseField && (inverseField.kind === 'belongsTo' || inverseField.kind === 'hasMany')\n );\n\n return inverseField || null;\n }\n\n /**\n The model's relationships as a map, keyed on the type of the\n relationship. The value of each entry is an array containing a descriptor\n for each relationship with that type, describing the name of the relationship\n as well as the type.\n\n For example, given the following model definition:\n\n ```app/models/blog.js\n import Model, { belongsTo, hasMany } from '@ember-data/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n @hasMany('post') posts;\n }\n ```\n\n This computed property would return a map describing these\n relationships, like this:\n\n ```javascript\n import Blog from 'app/models/blog';\n import User from 'app/models/user';\n import Post from 'app/models/post';\n\n let relationships = Blog.relationships;\n relationships.user;\n //=> [ { name: 'users', kind: 'hasMany' },\n // { name: 'owner', kind: 'belongsTo' } ]\n relationships.post;\n //=> [ { name: 'posts', kind: 'hasMany' } ]\n ```\n\n @property relationships\n @public\n @static\n @type Map\n @readOnly\n */\n\n @computeOnce\n static get relationships(): Map<string, LegacyRelationshipField[]> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, LegacyRelationshipField[]>();\n const relationshipsByName = this.relationshipsByName;\n\n // Loop through each computed property on the class\n relationshipsByName.forEach((desc) => {\n const { type } = desc;\n\n if (!map.has(type)) {\n map.set(type, []);\n }\n\n map.get(type)!.push(desc);\n });\n\n return map;\n }\n\n /**\n A hash containing lists of the model's relationships, grouped\n by the relationship kind. For example, given a model with this\n definition:\n\n ```app/models/blog.js\n import Model, { belongsTo, hasMany } from '@ember-data/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relationshipNames = Blog.relationshipNames;\n relationshipNames.hasMany;\n //=> ['users', 'posts']\n relationshipNames.belongsTo;\n //=> ['owner']\n ```\n\n @property relationshipNames\n @public\n @static\n @type Object\n @readOnly\n */\n @computeOnce\n static get relationshipNames() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const names: { hasMany: string[]; belongsTo: string[] } = {\n hasMany: [],\n belongsTo: [],\n };\n\n this.eachComputedProperty((name, meta) => {\n if (isRelationshipSchema(meta)) {\n names[meta.kind].push(name);\n }\n });\n\n return names;\n }\n\n /**\n An array of types directly related to a model. Each type will be\n included once, regardless of the number of relationships it has with\n the model.\n\n For example, given a model with this definition:\n\n ```app/models/blog.js\n import Model, { belongsTo, hasMany } from '@ember-data/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relatedTypes = Blog.relatedTypes');\n //=> ['user', 'post']\n ```\n\n @property relatedTypes\n @public\n @static\n @type Array\n @readOnly\n */\n @computeOnce\n static get relatedTypes(): string[] {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const types: string[] = [];\n\n const rels = this.relationshipsObject;\n const relationships = Object.keys(rels);\n\n // create an array of the unique types involved\n // in relationships\n for (let i = 0; i < relationships.length; i++) {\n const name = relationships[i];\n const meta = rels[name];\n const modelName = meta.type;\n\n if (!types.includes(modelName)) {\n types.push(modelName);\n }\n }\n\n return types;\n }\n\n /**\n A map whose keys are the relationships of a model and whose values are\n relationship descriptors.\n\n For example, given a model with this\n definition:\n\n ```app/models/blog.js\n import Model, { belongsTo, hasMany } from '@ember-data/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n }\n ```\n\n This property would contain the following:\n\n ```javascript\n import Blog from 'app/models/blog';\n\n let relationshipsByName = Blog.relationshipsByName;\n relationshipsByName.users;\n //=> { name: 'users', kind: 'hasMany', type: 'user', options: Object }\n relationshipsByName.owner;\n //=> { name: 'owner', kind: 'belongsTo', type: 'user', options: Object }\n ```\n\n @property relationshipsByName\n @public\n @static\n @type Map\n @readOnly\n */\n @computeOnce\n static get relationshipsByName(): Map<string, LegacyRelationshipField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const map = new Map();\n const rels = this.relationshipsObject;\n const relationships = Object.keys(rels);\n\n for (let i = 0; i < relationships.length; i++) {\n const name = relationships[i];\n const value = rels[name];\n\n map.set(value.name, value);\n }\n\n return map;\n }\n\n @computeOnce\n static get relationshipsObject(): Record<string, LegacyRelationshipField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationships = Object.create(null) as Record<string, LegacyRelationshipField>;\n const modelName = this.modelName;\n this.eachComputedProperty((name: string, meta: unknown) => {\n if (!isRelationshipSchema(meta)) {\n return;\n }\n // TODO deprecate key being here\n (meta as unknown as { key: string }).key = name;\n meta.name = name;\n relationships[name] = meta;\n\n assert(`Expected options in meta`, meta.options && typeof meta.options === 'object');\n assert(\n `You should not specify both options.as and options.inverse as null on ${modelName}.${meta.name}, as if there is no inverse field there is no abstract type to conform to. You may have intended for this relationship to be polymorphic, or you may have mistakenly set inverse to null.`,\n !(meta.options.inverse === null && meta.options.as?.length)\n );\n });\n return relationships;\n }\n\n /**\n A map whose keys are the fields of the model and whose values are strings\n describing the kind of the field. A model's fields are the union of all of its\n attributes and relationships.\n\n For example:\n\n ```app/models/blog.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\n export default class BlogModel extends Model {\n @hasMany('user') users;\n @belongsTo('user') owner;\n\n @hasMany('post') posts;\n\n @attr('string') title;\n }\n ```\n\n ```js\n import Blog from 'app/models/blog'\n\n let fields = Blog.fields;\n fields.forEach(function(kind, field) {\n // do thing\n });\n\n // prints:\n // users, hasMany\n // owner, belongsTo\n // posts, hasMany\n // title, attribute\n ```\n\n @property fields\n @public\n @static\n @type Map\n @readOnly\n */\n @computeOnce\n static get fields(): Map<string, 'attribute' | 'belongsTo' | 'hasMany'> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n const map = new Map();\n\n this.eachComputedProperty((name, meta) => {\n if (isRelationshipSchema(meta)) {\n map.set(name, meta.kind);\n } else if (isAttributeSchema(meta)) {\n map.set(name, 'attribute');\n }\n });\n\n return map;\n }\n\n /**\n Given a callback, iterates over each of the relationships in the model,\n invoking the callback with the name of each relationship and its relationship\n descriptor.\n\n @method eachRelationship\n @public\n @static\n @param {Function} callback the callback to invoke\n @param {any} binding the value to which the callback's `this` should be bound\n */\n static eachRelationship<T, Schema extends Model>(\n callback: (\n this: T | undefined,\n key: MaybeRelationshipFields<Schema>,\n relationship: LegacyRelationshipField\n ) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.relationshipsByName.forEach((relationship, name) => {\n callback.call(binding, name as MaybeRelationshipFields<Schema>, relationship);\n });\n }\n\n /**\n Given a callback, iterates over each of the types related to a model,\n invoking the callback with the related type's class. Each type will be\n returned just once, regardless of how many different relationships it has\n with a model.\n\n @method eachRelatedType\n @public\n @static\n @param {Function} callback the callback to invoke\n @param {any} binding the value to which the callback's `this` should be bound\n */\n static eachRelatedType<T>(callback: (this: T | undefined, type: string) => void, binding?: T) {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const relationshipTypes = this.relatedTypes;\n\n for (let i = 0; i < relationshipTypes.length; i++) {\n const type = relationshipTypes[i];\n callback.call(binding, type);\n }\n }\n\n /**\n *\n * @method determineRelationshipType\n * @private\n * @deprecated\n */\n static determineRelationshipType(\n knownSide: LegacyRelationshipField,\n store: Store\n ): 'oneToOne' | 'oneToMany' | 'manyToOne' | 'manyToMany' | 'oneToNone' | 'manyToNone' {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const knownKey = knownSide.name;\n const knownKind = knownSide.kind;\n const inverse = this.inverseFor(knownKey, store);\n // let key;\n\n if (!inverse) {\n return knownKind === 'belongsTo' ? 'oneToNone' : 'manyToNone';\n }\n\n // key = inverse.name;\n const otherKind = inverse.kind;\n\n if (otherKind === 'belongsTo') {\n return knownKind === 'belongsTo' ? 'oneToOne' : 'manyToOne';\n } else {\n return knownKind === 'belongsTo' ? 'oneToMany' : 'manyToMany';\n }\n }\n\n /**\n A map whose keys are the attributes of the model (properties\n described by attr) and whose values are the meta object for the\n property.\n\n Example\n\n ```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('date') birthday;\n }\n ```\n\n ```javascript\n import Person from 'app/models/person'\n\n let attributes = Person.attributes\n\n attributes.forEach(function(meta, name) {\n // do thing\n });\n\n // prints:\n // firstName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"firstName\"}\n // lastName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"lastName\"}\n // birthday {type: \"date\", kind: 'attribute', options: Object, parentType: function, name: \"birthday\"}\n ```\n\n @property attributes\n @public\n @static\n @type {Map}\n @readOnly\n */\n @computeOnce\n static get attributes(): Map<string, LegacyAttributeField> {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, LegacyAttributeField>();\n\n this.eachComputedProperty((name, meta) => {\n if (isAttributeSchema(meta)) {\n assert(\n \"You may not set 'id' as an attribute on your model. Please remove any lines that look like: `id: attr('<type>')` from \" +\n this.toString(),\n name !== 'id'\n );\n\n // TODO deprecate key being here\n (meta as unknown as { key: string }).key = name;\n meta.name = name;\n map.set(name, meta);\n }\n });\n\n return map;\n }\n\n /**\n A map whose keys are the attributes of the model (properties\n described by attr) and whose values are type of transformation\n applied to each attribute. This map does not include any\n attributes that do not have an transformation type.\n\n Example\n\n ```app/models/person.js\n import Model, { attr } from '@ember-data/model';\n\n export default class PersonModel extends Model {\n @attr firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n ```\n\n ```javascript\n import Person from 'app/models/person';\n\n let transformedAttributes = Person.transformedAttributes\n\n transformedAttributes.forEach(function(field, type) {\n // do thing\n });\n\n // prints:\n // lastName string\n // birthday date\n ```\n\n @property transformedAttributes\n @public\n @static\n @type {Map}\n @readOnly\n */\n @computeOnce\n static get transformedAttributes() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n const map = new Map<string, string>();\n\n this.eachAttribute((name: string, meta: LegacyAttributeField) => {\n if (meta.type) {\n map.set(name, meta.type);\n }\n });\n\n return map;\n }\n\n /**\n Iterates through the attributes of the model, calling the passed function on each\n attribute.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, meta);\n ```\n\n - `name` the name of the current property in the iteration\n - `meta` the meta object for the attribute property in the iteration\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```javascript\n import Model, { attr } from '@ember-data/model';\n\n class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('date') birthday;\n }\n\n PersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n // prints:\n // firstName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"firstName\"}\n // lastName {type: \"string\", kind: 'attribute', options: Object, parentType: function, name: \"lastName\"}\n // birthday {type: \"date\", kind: 'attribute', options: Object, parentType: function, name: \"birthday\"}\n ```\n\n @method eachAttribute\n @public\n @param {Function} callback The callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @static\n */\n static eachAttribute<T, Schema extends Model>(\n callback: (this: T | undefined, key: MaybeAttrFields<Schema>, attribute: LegacyAttributeField) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.attributes.forEach((meta, name) => {\n callback.call(binding, name as MaybeAttrFields<Schema>, meta);\n });\n }\n\n /**\n Iterates through the transformedAttributes of the model, calling\n the passed function on each attribute. Note the callback will not be\n called for any attributes that do not have an transformation type.\n\n The callback method you provide should have the following signature (all\n parameters are optional):\n\n ```javascript\n function(name, type);\n ```\n\n - `name` the name of the current property in the iteration\n - `type` a string containing the name of the type of transformed\n applied to the attribute\n\n Note that in addition to a callback, you can also pass an optional target\n object that will be set as `this` on the context.\n\n Example\n\n ```javascript\n import Model, { attr } from '@ember-data/model';\n\n let Person = Model.extend({\n firstName: attr(),\n lastName: attr('string'),\n birthday: attr('date')\n });\n\n Person.eachTransformedAttribute(function(name, type) {\n // do thing\n });\n\n // prints:\n // lastName string\n // birthday date\n ```\n\n @method eachTransformedAttribute\n @public\n @param {Function} callback The callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @static\n */\n static eachTransformedAttribute<T, Schema extends Model>(\n callback: (this: T | undefined, key: Exclude<keyof Schema & string, keyof Model & string>, type: string) => void,\n binding?: T\n ): void {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n this.transformedAttributes.forEach((type: string, name) => {\n callback.call(binding, name as Exclude<keyof Schema & string, keyof Model & string>, type);\n });\n }\n\n /**\n Returns the name of the model class.\n\n @method toString\n @public\n @static\n */\n static toString() {\n assert(\n `Accessing schema information on Models without looking up the model via the store is disallowed.`,\n this.modelName\n );\n\n return `model:${this.modelName}`;\n }\n}\n\n// @ts-expect-error TS doesn't know how to do `this` function overloads\nModel.prototype.save = save;\n// @ts-expect-error TS doesn't know how to do `this` function overloads\nModel.prototype.destroyRecord = destroyRecord;\nModel.prototype.unloadRecord = unloadRecord;\nModel.prototype.hasMany = hasMany;\nModel.prototype.belongsTo = belongsTo;\nModel.prototype.serialize = serialize;\nModel.prototype._createSnapshot = createSnapshot;\nModel.prototype.deleteRecord = deleteRecord;\nModel.prototype.changedAttributes = changedAttributes;\nModel.prototype.rollbackAttributes = rollbackAttributes;\nModel.prototype.reload = reload;\n\ndefineSignal(Model.prototype, 'isReloading', false);\n\n// this is required to prevent `init` from passing\n// the values initialized during create to `setUnknownProperty`\n(Model.prototype as unknown as { _createProps: null })._createProps = null;\n(Model.prototype as unknown as { _secretInit: null })._secretInit = null;\n\nif (DEBUG) {\n const lookupDescriptor = function lookupDescriptor(obj: object, keyName: string) {\n let current: object = obj;\n do {\n const descriptor = Object.getOwnPropertyDescriptor(current, keyName);\n if (descriptor !== undefined) {\n return descriptor;\n }\n current = Object.getPrototypeOf(current) as object;\n } while (current !== null);\n return null;\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const init = Model.prototype.init;\n Model.prototype.init = function (createArgs: ModelCreateArgs) {\n init.call(this, createArgs);\n\n const ourDescriptor = lookupDescriptor(Model.prototype, 'currentState');\n const theirDescriptor = lookupDescriptor(this, 'currentState');\n\n if (!ourDescriptor || !theirDescriptor) {\n throw new Error(\n `Unable to determine if 'currentState' is a reserved property name on instances of classes extending Model. Please ensure that 'currentState' is not defined as a property on ${this.constructor.toString()}`\n );\n }\n\n const realState = this.___recordState;\n if (ourDescriptor.get !== theirDescriptor.get || realState !== this.currentState) {\n throw new Error(\n `'currentState' is a reserved property name on instances of classes extending Model. Please choose a different property name for ${this.constructor.toString()}`\n );\n }\n\n const ID_DESCRIPTOR = lookupDescriptor(Model.prototype, 'id');\n const idDesc = lookupDescriptor(this, 'id');\n\n if (!ID_DESCRIPTOR || !idDesc) {\n throw new Error(\n `Unable to determine if 'id' is a reserved property name on instances of classes extending Model. Please ensure that 'id' is not defined as a property on ${this.constructor.toString()}`\n );\n }\n\n if (idDesc.get !== ID_DESCRIPTOR.get) {\n throw new Error(\n `You may not set 'id' as an attribute on your model. Please remove any lines that look like: \\`id: attr('<type>')\\` from ${this.constructor.toString()}`\n );\n }\n };\n\n delete (Model as unknown as { reopen: unknown }).reopen;\n delete (Model as unknown as { reopenClass: unknown }).reopenClass;\n}\n\nexport { Model };\n\nfunction isRelationshipSchema(meta: unknown): meta is LegacyRelationshipField {\n const hasKind = typeof meta === 'object' && meta !== null && 'kind' in meta && 'options' in meta;\n return hasKind && (meta.kind === 'hasMany' || meta.kind === 'belongsTo');\n}\n\nfunction isAttributeSchema(meta: unknown): meta is LegacyAttributeField {\n return typeof meta === 'object' && meta !== null && 'kind' in meta && meta.kind === 'attribute';\n}\n"],"names":["isElementDescriptor","args","maybeTarget","maybeKey","maybeDesc","length","undefined","normalizeModelName","type","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","id","until","for","since","available","enabled","PromiseObject","ObjectProxy","extend","PromiseProxyMixin","deferred","WeakMap","deferDecorator","proto","prop","desc","map","get","Map","set","findDeferredDecorator","target","_a","cursor","prototype","decorateFieldV2","decorators","initializer","configurable","enumerable","writable","decorator","Object","defineProperty","decorateMethodV2","origDesc","getOwnPropertyDescriptor","value","call","initializeDeferredDecorator","constructor","LegacyPromiseProxy","Symbol","Extended","PromiseBelongsTo","key","legacySupport","_belongsToState","ref","referenceFor","n","memoized","meta","env","DEBUG","test","Error","modelName","computed","reload","options","content","reloadBelongsTo","PromiseManyArray","promise","_update","isDestroyed","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","inverseKey","kind","as","isResourceIdentiferWithRelatedLinks","Boolean","related","HasManyReference","___token","___identifier","___relatedTokenMap","graph","hasManyRelationship","definition","notifications","subscribe","_","bucket","notifiedKey","_ref","unsubscribe","token","clear","identifiers","ensureRefCanSubscribe","resource","_resource","data","resourceIdentifier","identifier","identifierCache","getOrCreateRecordIdentifier","delete","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","filter","k","rel","loaded","edge","accessed","BelongsToReference","belongsToRelationship","___relatedToken","peekRecord","getBelongsTo","getOrSetGlobal","lookupLegacySupport","recordIdentifierFor","isDestroying","LegacySupport","storeFor","peekCache","dependencySatisfies","graphFor","importSync","_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","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","_graph","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","setObjects","replace","attributes","has","rollbackAttributes","isNew","RecordStore","rollbackAttrs","cleanErrorRequests","unloadRecord","belongsTo","hasMany","isReloading","changedAttributes","changedAttrs","serialize","serializeRecord","deleteRecord","save","isDeleted","saveRecord","destroyRecord","createSnapshot","_fetchManager","FetchManager","notifyChanges","notifyAttribute","eachAttribute","relationshipsByName","notifyRelationship","eachRelationship","peekInternalSignal","withSignalStore","hasPromise","async","currentValue","cacheFor","getAttr","SOURCE_POINTER_REGEXP","SOURCE_POINTER_PRIMARY_REGEXP","PRIMARY_ATTRIBUTE_KEY","isInvalidError","isAdapterError","code","RecordState","identity","pendingCount","fulfilledCount","rejectedCount","_errorRequests","_lastError","requests","getRequestStateService","handleRequest","isSaving","response","notifyErrorsStateChanged","subscribeForRecord","lastRequest","getLastRequestForRecord","handler","updateInvalidErrors","signals","signal","lid","getErrors","jsonApiErrors","source","pointer","keyMatch","match","search","errMsg","detail","title","isLoading","gate","isSaved","rd","isDeletionCommitted","isValid","isDirty","hasChangedAttrs","isError","errorReq","adapterError","isPreloaded","stateName","dirtyType","computeOnce","propertyName","getter","hasComputed","Model","EmberObject","init","_secretInit","_createProps","createProps","___recordState","setProperties","___private_notifications","hasDirtyAttributes","v","normalizedId","coerceId","didChange","setRecordId","toString","_v","entangleSignal","attr","callback","binding","relationshipFor","inverseFor","isModel","typeForRelationship","modelFor","inverseMap","inverse","_findInverseFor","schemaExists","hasResource","inverseField","relationships","relationshipNames","names","eachComputedProperty","isRelationshipSchema","relatedTypes","types","rels","relationshipsObject","includes","isAttributeSchema","eachRelatedType","relationshipTypes","determineRelationshipType","knownSide","knownKey","knownKind","otherKind","transformedAttributes","eachTransformedAttribute","_createSnapshot","lookupDescriptor","obj","keyName","current","descriptor","getPrototypeOf","createArgs","ourDescriptor","theirDescriptor","realState","ID_DESCRIPTOR","idDesc","reopen","reopenClass","hasKind"],"mappings":";;;;;;;;;;;;;;;;;AAOO,SAASA,mBAAmBA,CAACC,IAAe,EAAyD;EAC1G,MAAM,CAACC,WAAW,EAAEC,QAAQ,EAAEC,SAAS,CAAC,GAAGH,IAAI;AAE/C,EAAA;AACE;IACAA,IAAI,CAACI,MAAM,KAAK,CAAC;AACjB;AACC,IAAA,OAAOH,WAAW,KAAK,UAAU,IAAK,OAAOA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQEuF,EAAAA,UAAUA,GAAkB;AAC1B,IAAA,MAAM/F,KAAK,GAAG,IAAI,CAACsF,SAAS,EAAE;AAC9B,IAAA,IAAItB,mCAAmC,CAAChE,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;AACA;AAgBE,EAAA,MAAMmG,IAAIA,CAACC,GAA2B,EAAEC,SAAmB,EAAkC;IAC3F,MAAM;AAAE7C,MAAAA;AAAM,KAAC,GAAG,IAAI;IACtB,MAAMiD,cAAc,GAAGL,GAAG,CAACb,IAAI,IAAImB,eAAe,CAACN,GAAG,CAACb,IAAI,CAAC;AAC5D,IAAA,MAAMuB,KAAK,GAAGL,cAAc,GACvBjD,KAAK,CAACmD,KAAK,CAACP,GAAG,EAAE,IAAI,CAAC,GACvBA,GAAG,CAACb,IAAI,GACL/B,KAAK,CAACkC,eAAe,CAACC,2BAA2B,CAACS,GAAG,CAACb,IAAI,CAAC,GAC5D,IAAI;IACV,MAAM;AAAEE,MAAAA;KAAY,GAAG,IAAI,CAACuD,qBAAqB;IAEjD,IAAA7L,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAA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AACE,IAAI,GAAG,IAAI,CAAC/B,KAAK,CAAC0F,UAAU,CAAC7D,QAAQ,CAACE,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;AACA;EAYE,MAAM6B,IAAIA,CAAC7F,OAAiC,EAA2B;IACrE,MAAMuG,OAAsB,GAAIC,cAAc,CAAgDnJ,GAAG,CAC/F,IAAI,CAACyF,aACP,CAAE;IACF,MAAM4D,YAAY,GAChB,CAAC,IAAI,CAACe,qBAAqB,CAACvE,UAAU,CAACyD,OAAO,IAAI,CAACC,0BAA0B,CAAC,IAAI,CAAC3E,KAAK,EAAE,IAAI,CAAC8B,SAAS,EAAE,CAAC;IAC7G,OAAO2C,YAAY,GACfH,OAAO,CAACrG,eAAe,CAAC,IAAI,CAACjB,GAAG,EAAEe,OAAO,CAAC,CAACW,IAAI,CAAC,MAAM,IAAI,CAAClC,KAAK,EAAE,CAAC;AACnE;AACA;IACC8H,OAAO,CAACqB,YAAY,CAAC,IAAI,CAAC3I,GAAG,EAAEe,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;AACA;EAUED,MAAMA,CAACC,OAAiC,EAAE;IACxC,MAAMuG,OAAsB,GAAIC,cAAc,CAAgDnJ,GAAG,CAC/F,IAAI,CAACyF,aACP,CAAE;AACF,IAAA,OAAOyD,OAAO,CAACrG,eAA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AE,IAAI,EAAE9V,IAAI,EAAEzB,SAAS,CAAC;AAC9C,IAAA,KAAK,CAACiT,oBAAoB,CAACxR,IAAI,CAAC;AAClC;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQE;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;;AAUE;AACF;AACA;AACA;AACA;AACA;;AAGE;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;;AAaE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKE;AACF;AACA;AACA;AACE;;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;;AASE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQE+Y,EAAAA,IAAIA,GAAG;IACLra,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAA2D,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,MAAA;QAAA,MAAAC,IAAAA,KAAA,CACE,kJAAkJ,CAAA;AAAA;AAAA,KAAA,EAC7I,CAAA,GAAA,EAAA;AAET;;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;;AAcE;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;;AAcE;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;AAcEoR,EAAAA,gBAAgBA,CACdkF,QAAmH,EACnHC,OAAW,EACL;IACL,IAAI,CAACvX,WAAW,CAAkBoS,gBAAgB,CAAUkF,QAAQ,EAAEC,OAAO,CAAC;AACjF;EAEAC,eAAeA,CAACtL,IAAY,EAAuC;IACjE,OAAQ,IAAI,CAAClM,WAAW,CAAkBkS,mBAAmB,CAACzT,GAAG,CAACyN,IAAI,CAAC;AACzE;EAEAuL,UAAUA,CAACvL,IAAY,EAAE;AACvB,IAAA,OAAQ,IAAI,CAAClM,WAAW,CAAkByX,UAAU,CAACvL,IAAI,EAAE5C,UAAQ,CAAC,IAAI,CAAE,CAAC;AAC7E;AAEA2I,EAAAA,aAAaA,CACXqF,QAIS,EACTC,OAAW,EACL;IACL,IAAI,CAACvX,WAAW,CAAkBiS,aAAa,CAAUqF,QAAQ,EAAEC,OAAO,CAAC;AAC9E;EAEA,OAAOG,OAAO,GAAG,IAAI;;AAErB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;AAIE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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