@ember-data/legacy-compat 5.3.9 → 5.3.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"-private-Dlia0pw1.js","sources":["../src/legacy-network-handler/snapshot-record-array.ts","../src/legacy-network-handler/identifier-has-id.ts","../src/legacy-network-handler/legacy-data-utils.ts","../src/legacy-network-handler/serializer-response.ts","../src/legacy-network-handler/snapshot.ts","../src/legacy-network-handler/fetch-manager.ts","../src/-private.ts"],"sourcesContent":["/**\n @module @ember-data/legacy-compat\n*/\nimport type Store from '@ember-data/store';\nimport type { LiveArray } from '@ember-data/store/-private';\nimport { SOURCE } from '@ember-data/store/-private';\nimport type { FindAllOptions, ModelSchema } from '@ember-data/store/types';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\n\nimport { upgradeStore } from '../-private';\nimport type { Snapshot } from './snapshot';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain `findAll` requests.\n\n @class SnapshotRecordArray\n @public\n*/\nexport class SnapshotRecordArray {\n declare _snapshots: Snapshot[] | null;\n declare _type: ModelSchema | null;\n declare modelName: string;\n declare __store: Store;\n\n declare adapterOptions?: Record<string, unknown>;\n declare include?: string | string[];\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @method constructor\n @private\n @constructor\n @param {Store} store\n @param {string} type\n @param options\n */\n constructor(store: Store, type: string, options: FindAllOptions = {}) {\n this.__store = store;\n /**\n An array of snapshots\n @private\n @property _snapshots\n @type {Array}\n */\n this._snapshots = null;\n\n /**\n The modelName of the underlying records for the snapshots in the array, as a Model\n @property modelName\n @public\n @type {Model}\n */\n this.modelName = type;\n\n /**\n A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```app/adapters/post.js\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @property adapterOptions\n @public\n @type {Object}\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n The relationships to include for this request.\n\n Example\n\n ```app/adapters/application.js\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n\n @property include\n @public\n @type {String|Array}\n */\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @property _recordArray\n @private\n @type {Array}\n */\n get _recordArray(): LiveArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```app/adapters/post.js\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n\n @property length\n @public\n @type {Number}\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```app/adapters/post.js\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @method snapshots\n @public\n @return {Array} Array of snapshots\n */\n snapshots() {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n this._snapshots = this._recordArray[SOURCE].map((identifier: StableRecordIdentifier) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@warp-drive/build-config/macros';\nimport type { StableExistingRecordIdentifier } from '@warp-drive/core-types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is StableExistingRecordIdentifier {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as StableExistingRecordIdentifier).id !== null\n );\n}\n","import type { AdapterPayload } from './minimum-adapter-interface';\n\ntype IteratorCB<T> = ((o: T, index: number) => T) | ((o: T) => T);\n\nexport function iterateData<T>(data: T[] | T, fn: IteratorCB<T>) {\n if (Array.isArray(data)) {\n return data.map(fn);\n } else {\n return fn(data, 0);\n }\n}\n\nexport function payloadIsNotBlank<T>(adapterPayload: T | AdapterPayload): adapterPayload is AdapterPayload {\n if (Array.isArray(adapterPayload)) {\n return true;\n } else {\n return Object.keys(adapterPayload || {}).length !== 0;\n }\n}\n","import type Store from '@ember-data/store';\nimport type { ModelSchema } from '@ember-data/store/types';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { JsonApiDocument } from '@warp-drive/core-types/spec/json-api-raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","/**\n @module @ember-data/store\n*/\nimport { dependencySatisfies, importSync } from '@embroider/macros';\n\nimport type { CollectionEdge, ResourceEdge } from '@ember-data/graph/-private';\nimport type Store from '@ember-data/store';\nimport type { FindRecordOptions } 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 { ChangedAttributesHash } from '@warp-drive/core-types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';\nimport type { Value } from '@warp-drive/core-types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport type { LegacyAttributeField, LegacyRelationshipSchema } from '@warp-drive/core-types/schema/fields';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n @class Snapshot\n @public\n*/\nexport class Snapshot<R = unknown> {\n declare __attributes: Record<keyof R & string, unknown> | null;\n declare _belongsToRelationships: Record<string, Snapshot>;\n declare _belongsToIds: Record<string, RecordId>;\n declare _hasManyRelationships: Record<string, Snapshot[]>;\n declare _hasManyIds: Record<string, RecordId[]>;\n declare _changedAttributes: ChangedAttributesHash;\n\n declare identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;\n declare modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;\n declare id: string | null;\n declare include?: string | string[];\n declare adapterOptions?: Record<string, unknown>;\n declare _store: Store;\n\n /**\n * @method constructor\n * @constructor\n * @private\n * @param options\n * @param identifier\n * @param _store\n */\n constructor(\n options: FindRecordOptions,\n identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>,\n store: Store\n ) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n\n /**\n The unique RecordIdentifier associated with this Snapshot.\n\n @property identifier\n @public\n @type {StableRecordIdentifier}\n */\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._attributes;\n }\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @property id\n @type {String}\n @public\n */\n this.id = identifier.id;\n\n /**\n A hash of adapter options\n @property adapterOptions\n @type {Object}\n @public\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n If `include` was passed to the options hash for the request, the value\n would be available here.\n\n @property include\n @type {String|Array}\n @public\n */\n this.include = options.include;\n\n /**\n The name of the type of the underlying record for this snapshot, as a string.\n\n @property modelName\n @type {String}\n @public\n */\n this.modelName = identifier.type;\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n Example\n\n ```javascript\n let json = snapshot.record.toJSON();\n ```\n\n @property record\n @type {Model}\n @public\n */\n get record(): R | null {\n const record = this._store.peekRecord<R>(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n get _attributes(): Record<keyof R & string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const attrs = this._store.schema.fields(identifier);\n const cache = this._store.cache;\n\n attrs.forEach((field, keyName) => {\n if (field.kind === 'attribute') {\n attributes[keyName] = cache.getAttr(identifier, keyName);\n }\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @method attr\n @param {String} keyName\n @return {Object} The attribute value or undefined\n @public\n */\n attr(keyName: keyof R & string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @method attributes\n @return {Object} All attributes of the current snapshot\n @public\n */\n attributes(): Record<keyof R & string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @method changedAttributes\n @return {Object} All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @method belongsTo\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Snapshot|String|null|undefined)} A snapshot or ID of a known\n relationship or null if the relationship is known but unset. undefined\n will be returned if the contents of the relationship is unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n assert(\n `snapshot.belongsTo only supported when using the package @ember-data/graph`,\n dependencySatisfies('@ember-data/graph', '*')\n );\n\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private')).graphFor;\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = graphFor(this._store).get(identifier, keyName) as ResourceEdge;\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.definition.kind === 'belongsTo'\n );\n }\n\n const value = graphFor(this._store).getData(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.identifierCache.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @method hasMany\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Array|undefined)} An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n assert(\n `snapshot.hasMany only supported when using the package @ember-data/graph`,\n dependencySatisfies('@ember-data/graph', '*')\n );\n\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private')).graphFor;\n const { identifier } = this;\n if (DEBUG) {\n const relationship = graphFor(this._store).get(identifier, keyName) as CollectionEdge;\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.definition.kind === 'hasMany'\n );\n }\n\n const value = graphFor(this._store).getData(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.identifierCache.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @method eachAttribute\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'attribute') {\n callback.call(binding, key, field);\n }\n });\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @method eachRelationship\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: LegacyRelationshipSchema) => void, binding?: unknown): void {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'belongsTo' || field.kind === 'hasMany') {\n callback.call(binding, key, field);\n }\n });\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```app/adapters/application.js\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @method serialize\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { warn } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport { createDeferred } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type {\n FindRecordQuery,\n InstanceCache,\n Request,\n RequestStateService,\n SaveRecordMutation,\n} from '@ember-data/store/-private';\nimport { coerceId } from '@ember-data/store/-private';\nimport type { FindRecordOptions, ModelSchema } from '@ember-data/store/types';\nimport { DEBUG, TESTING } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { TypeFromInstance } from '@warp-drive/core-types/record';\nimport type { ImmutableRequestInfo } from '@warp-drive/core-types/request';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core-types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private';\nimport { assertIdentifierHasId } from './identifier-has-id';\nimport { payloadIsNotBlank } from './legacy-data-utils';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface';\nimport { normalizeResponseHelper } from './serializer-response';\nimport { Snapshot } from './snapshot';\n\ntype Deferred<T> = ReturnType<typeof createDeferred<T>>;\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp = getOrSetGlobal('SaveOp', Symbol('SaveOp'));\n\nexport type FetchMutationOptions = FindRecordOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: StableExistingRecordIdentifier;\n queryRequest: Request;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n options: FindRecordOptions;\n trace?: unknown;\n promise: Promise<StableExistingRecordIdentifier>;\n}\n\ninterface PendingSaveItem {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: StableRecordIdentifier;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\nexport class FetchManager {\n declare isDestroyed: boolean;\n declare requestCache: RequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n declare _pendingFetch: Map<string, Map<StableExistingRecordIdentifier, PendingFetchItem[]>>;\n declare _store: Store;\n\n constructor(store: Store) {\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot<T>(identifier: StableRecordIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;\n createSnapshot(identifier: StableRecordIdentifier, options?: FindRecordOptions): Snapshot;\n createSnapshot(identifier: StableRecordIdentifier, options: FindRecordOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @internal\n */\n scheduleSave(\n identifier: StableRecordIdentifier,\n options: FetchMutationOptions\n ): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: StableExistingRecordIdentifier,\n options: FindRecordOptions,\n request: ImmutableRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (macroCondition(dependencySatisfies('@ember-data/graph', '*'))) {\n if (!cache) {\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private'))\n .graphFor;\n const graph = graphFor(store);\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <T>(promise: Promise<T>) => Promise<T>;\n };\n promise = waitForPromise(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions) {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches() {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: StableExistingRecordIdentifier,\n options: FindRecordOptions = {},\n request: ImmutableRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<StableExistingRecordIdentifier>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy() {\n this.isDestroyed = true;\n }\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n const arrCurrent = (Array.isArray(current) ? current : current.split(',')).sort();\n const arrExisting = (Array.isArray(existing) ? existing : existing.split(',')).sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindRecordOptions = {}, existingOptions: FindRecordOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // eslint-disable-next-line @typescript-eslint/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n }) as Promise<AdapterPayload>;\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<StableExistingRecordIdentifier, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type Store from '@ember-data/store';\n\nimport type { CompatStore } from '.';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of EmberData.\n *\n @module @ember-data/legacy-compat\n @main @ember-data/legacy-compat\n*/\nexport { SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array';\nexport { SaveOp } from './legacy-network-handler/fetch-manager';\nexport { FetchManager } from './legacy-network-handler/fetch-manager';\nexport { Snapshot } from './legacy-network-handler/snapshot';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"names":["SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","upgradeStore","_fetchManager","SOURCE","map","identifier","createSnapshot","assertIdentifierHasId","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","id","iterateData","data","fn","Array","isArray","payloadIsNotBlank","adapterPayload","Object","keys","validateDocumentStructure","doc","errors","push","meta","links","jsonapi","included","join","normalizeResponseHelper","serializer","modelClass","payload","requestType","normalizedResponse","normalizeResponse","Snapshot","_store","__attributes","_belongsToRelationships","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","_attributes","cache","_changedAttributes","changedAttrs","record","peekRecord","lid","attributes","attrs","schema","fields","forEach","field","keyName","kind","getAttr","isNew","attr","changedAttributes","changedAttributeKeys","i","key","slice","belongsTo","returnModeIsId","result","relationshipMeta","get","dependencySatisfies","graphFor","importSync","relationship","definition","value","getData","inverseIdentifier","identifierCache","getOrCreateRecordIdentifier","undefined","isDeleted","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","member","eachAttribute","callback","binding","call","eachRelationship","serialize","serializerFor","SaveOp","getOrSetGlobal","Symbol","FetchManager","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","scheduleSave","resolver","createDeferred","query","op","recordIdentifier","queryRequest","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","pendingFetchItem","resolverPromise","isInitialLoad","recordIsLoaded","then","potentiallyNewIm","_push","reload","error","isEmpty","isReleasable","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","set","requestsForIdentifier","TESTING","disableTestWaiter","waitForPromise","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","assign","destroy","instanceCache","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","arrCurrent","split","sort","arrExisting","includes","optionsSatisfies","existingOptions","_findMany","adapter","modelFor","s","every","v","findMany","ret","rejectFetchedItems","fetchMap","l","pair","reject","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","resources","resource","delete","rejected","snapshotArray","warn","values","_fetchRecord","findRecord","klass","isDestroying","coerceId","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation"],"mappings":";;;;;;AAAA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;AAS/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,WAAWA,CAACC,KAAY,EAAEC,IAAY,EAAEC,OAAuB,GAAG,EAAE,EAAE;IACpE,IAAI,CAACC,OAAO,GAAGH,KAAK,CAAA;AACpB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACI,UAAU,GAAG,IAAI,CAAA;;AAEtB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,SAAS,GAAGJ,IAAI,CAAA;;AAErB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKI,IAAA,IAAI,CAACK,cAAc,GAAGJ,OAAO,CAACI,cAAc,CAAA;;AAE5C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMI,IAAA,IAAI,CAACC,OAAO,GAAGL,OAAO,CAACK,OAAO,CAAA;AAChC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EAEE,IAAIC,YAAYA,GAAc;IAC5B,OAAO,IAAI,CAACL,OAAO,CAACM,OAAO,CAAC,IAAI,CAACJ,SAAS,CAAC,CAAA;AAC7C,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAKE,IAAIK,MAAMA,GAAW;AACnB,IAAA,OAAO,IAAI,CAACF,YAAY,CAACE,MAAM,CAAA;AACjC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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pH,EAAA,MAAMvF,UAA4C,GAAG9C,KAAK,CAACoH,aAAa,CAAC/G,SAAS,CAAC,CAAA;EAEnFc,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,IAAA,IAAA,CAAAA,IAAA,EAAA;AAAA,MAAA,MAAA,IAAAC,KAAA,CACG,CAAkByN,gBAAAA,EAAAA,SAAU,CAA0D,yDAAA,CAAA,CAAA,CAAA;AAAA,KAAA;GACvFzG,EAAAA,OAAO,KAAKpC,SAAS,CAAA,GAAA,EAAA,CAAA;AAGvBoC,EAAAA,OAAO,GAAGA,OAAO,CAACU,IAAI,CAAElH,cAAc,IAAK;AACzC,IAAA,IAAIA,cAAc,EAAE;AAClB,MAAA,OAAOY,uBAAuB,CAACC,UAAU,EAAE9C,KAAK,EAAE+C,UAAU,EAAEd,cAAc,EAAEoG,QAAQ,CAAC3G,EAAE,EAAEwN,SAAS,CAAC,CAAA;AACvG,KAAA;AACF,GAAC,CAA4B,CAAA;AAE7BnH,EAAAA,QAAQ,CAACiC,OAAO,CAACvB,OAAO,CAAC,CAAA;AAC3B;;ACvnBA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAAS7H,YAAYA,CAACZ,KAAY,EAAgC;;;;"}
1
+ {"version":3,"file":"-private-Dlia0pw1.js","sources":["../src/legacy-network-handler/snapshot-record-array.ts","../src/legacy-network-handler/identifier-has-id.ts","../src/legacy-network-handler/legacy-data-utils.ts","../src/legacy-network-handler/serializer-response.ts","../src/legacy-network-handler/snapshot.ts","../src/legacy-network-handler/fetch-manager.ts","../src/-private.ts"],"sourcesContent":["/**\n @module @ember-data/legacy-compat\n*/\nimport type Store from '@ember-data/store';\nimport type { LiveArray } from '@ember-data/store/-private';\nimport { SOURCE } from '@ember-data/store/-private';\nimport type { FindAllOptions, ModelSchema } from '@ember-data/store/types';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\n\nimport { upgradeStore } from '../-private';\nimport type { Snapshot } from './snapshot';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain `findAll` requests.\n\n @class SnapshotRecordArray\n @public\n*/\nexport class SnapshotRecordArray {\n declare _snapshots: Snapshot[] | null;\n declare _type: ModelSchema | null;\n declare modelName: string;\n declare __store: Store;\n\n declare adapterOptions?: Record<string, unknown>;\n declare include?: string | string[];\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @method constructor\n @private\n @constructor\n @param {Store} store\n @param {string} type\n @param options\n */\n constructor(store: Store, type: string, options: FindAllOptions = {}) {\n this.__store = store;\n /**\n An array of snapshots\n @private\n @property _snapshots\n @type {Array}\n */\n this._snapshots = null;\n\n /**\n The modelName of the underlying records for the snapshots in the array, as a Model\n @property modelName\n @public\n @type {Model}\n */\n this.modelName = type;\n\n /**\n A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```app/adapters/post.js\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @property adapterOptions\n @public\n @type {Object}\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n The relationships to include for this request.\n\n Example\n\n ```app/adapters/application.js\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n\n @property include\n @public\n @type {String|Array}\n */\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @property _recordArray\n @private\n @type {Array}\n */\n get _recordArray(): LiveArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```app/adapters/post.js\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n\n @property length\n @public\n @type {Number}\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```app/adapters/post.js\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @method snapshots\n @public\n @return {Array} Array of snapshots\n */\n snapshots() {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n this._snapshots = this._recordArray[SOURCE].map((identifier: StableRecordIdentifier) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@warp-drive/build-config/macros';\nimport type { StableExistingRecordIdentifier } from '@warp-drive/core-types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is StableExistingRecordIdentifier {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as StableExistingRecordIdentifier).id !== null\n );\n}\n","import type { AdapterPayload } from './minimum-adapter-interface';\n\ntype IteratorCB<T> = ((o: T, index: number) => T) | ((o: T) => T);\n\nexport function iterateData<T>(data: T[] | T, fn: IteratorCB<T>) {\n if (Array.isArray(data)) {\n return data.map(fn);\n } else {\n return fn(data, 0);\n }\n}\n\nexport function payloadIsNotBlank<T>(adapterPayload: T | AdapterPayload): adapterPayload is AdapterPayload {\n if (Array.isArray(adapterPayload)) {\n return true;\n } else {\n return Object.keys(adapterPayload || {}).length !== 0;\n }\n}\n","import type Store from '@ember-data/store';\nimport type { ModelSchema } from '@ember-data/store/types';\nimport { DEBUG } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { JsonApiDocument } from '@warp-drive/core-types/spec/json-api-raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","/**\n @module @ember-data/store\n*/\nimport { dependencySatisfies, importSync } from '@embroider/macros';\n\nimport type { CollectionEdge, ResourceEdge } from '@ember-data/graph/-private';\nimport type Store from '@ember-data/store';\nimport type { FindRecordOptions } 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 { ChangedAttributesHash } from '@warp-drive/core-types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';\nimport type { Value } from '@warp-drive/core-types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport type { LegacyAttributeField, LegacyRelationshipSchema } from '@warp-drive/core-types/schema/fields';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n @class Snapshot\n @public\n*/\nexport class Snapshot<R = unknown> {\n declare __attributes: Record<keyof R & string, unknown> | null;\n declare _belongsToRelationships: Record<string, Snapshot>;\n declare _belongsToIds: Record<string, RecordId>;\n declare _hasManyRelationships: Record<string, Snapshot[]>;\n declare _hasManyIds: Record<string, RecordId[]>;\n declare _changedAttributes: ChangedAttributesHash;\n\n declare identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;\n declare modelName: R extends TypedRecordInstance ? TypeFromInstance<R> : string;\n declare id: string | null;\n declare include?: string | string[];\n declare adapterOptions?: Record<string, unknown>;\n declare _store: Store;\n\n /**\n * @method constructor\n * @constructor\n * @private\n * @param options\n * @param identifier\n * @param _store\n */\n constructor(\n options: FindRecordOptions,\n identifier: StableRecordIdentifier<R extends TypedRecordInstance ? TypeFromInstance<R> : string>,\n store: Store\n ) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n\n /**\n The unique RecordIdentifier associated with this Snapshot.\n\n @property identifier\n @public\n @type {StableRecordIdentifier}\n */\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._attributes;\n }\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @property id\n @type {String}\n @public\n */\n this.id = identifier.id;\n\n /**\n A hash of adapter options\n @property adapterOptions\n @type {Object}\n @public\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n If `include` was passed to the options hash for the request, the value\n would be available here.\n\n @property include\n @type {String|Array}\n @public\n */\n this.include = options.include;\n\n /**\n The name of the type of the underlying record for this snapshot, as a string.\n\n @property modelName\n @type {String}\n @public\n */\n this.modelName = identifier.type;\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n Example\n\n ```javascript\n let json = snapshot.record.toJSON();\n ```\n\n @property record\n @type {Model}\n @public\n */\n get record(): R | null {\n const record = this._store.peekRecord<R>(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n get _attributes(): Record<keyof R & string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const attrs = this._store.schema.fields(identifier);\n const cache = this._store.cache;\n\n attrs.forEach((field, keyName) => {\n if (field.kind === 'attribute') {\n attributes[keyName] = cache.getAttr(identifier, keyName);\n }\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @method attr\n @param {String} keyName\n @return {Object} The attribute value or undefined\n @public\n */\n attr(keyName: keyof R & string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @method attributes\n @return {Object} All attributes of the current snapshot\n @public\n */\n attributes(): Record<keyof R & string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @method changedAttributes\n @return {Object} All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @method belongsTo\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Snapshot|String|null|undefined)} A snapshot or ID of a known\n relationship or null if the relationship is known but unset. undefined\n will be returned if the contents of the relationship is unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n assert(\n `snapshot.belongsTo only supported when using the package @ember-data/graph`,\n dependencySatisfies('@ember-data/graph', '*')\n );\n\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private')).graphFor;\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = graphFor(this._store).get(identifier, keyName) as ResourceEdge;\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.definition.kind === 'belongsTo'\n );\n }\n\n const value = graphFor(this._store).getData(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.identifierCache.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @method hasMany\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Array|undefined)} An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.schema.fields({ type: this.modelName }).get(keyName);\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n assert(\n `snapshot.hasMany only supported when using the package @ember-data/graph`,\n dependencySatisfies('@ember-data/graph', '*')\n );\n\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private')).graphFor;\n const { identifier } = this;\n if (DEBUG) {\n const relationship = graphFor(this._store).get(identifier, keyName) as CollectionEdge;\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.definition.kind === 'hasMany'\n );\n }\n\n const value = graphFor(this._store).getData(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.identifierCache.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @method eachAttribute\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: LegacyAttributeField) => void, binding?: unknown): void {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'attribute') {\n callback.call(binding, key, field);\n }\n });\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @method eachRelationship\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: LegacyRelationshipSchema) => void, binding?: unknown): void {\n const fields = this._store.schema.fields(this.identifier);\n fields.forEach((field, key) => {\n if (field.kind === 'belongsTo' || field.kind === 'hasMany') {\n callback.call(binding, key, field);\n }\n });\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```app/adapters/application.js\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @method serialize\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { warn } from '@ember/debug';\n\nimport { dependencySatisfies, importSync, macroCondition } from '@embroider/macros';\n\nimport { createDeferred } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type {\n FindRecordQuery,\n InstanceCache,\n Request,\n RequestStateService,\n SaveRecordMutation,\n} from '@ember-data/store/-private';\nimport { coerceId } from '@ember-data/store/-private';\nimport type { FindRecordOptions, ModelSchema } from '@ember-data/store/types';\nimport { DEBUG, TESTING } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { TypeFromInstance } from '@warp-drive/core-types/record';\nimport type { ImmutableRequestInfo } from '@warp-drive/core-types/request';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core-types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private';\nimport { assertIdentifierHasId } from './identifier-has-id';\nimport { payloadIsNotBlank } from './legacy-data-utils';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface';\nimport { normalizeResponseHelper } from './serializer-response';\nimport { Snapshot } from './snapshot';\n\ntype Deferred<T> = ReturnType<typeof createDeferred<T>>;\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp = getOrSetGlobal('SaveOp', Symbol('SaveOp'));\n\nexport type FetchMutationOptions = FindRecordOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: StableExistingRecordIdentifier;\n queryRequest: Request;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n options: FindRecordOptions;\n trace?: unknown;\n promise: Promise<StableExistingRecordIdentifier>;\n}\n\ninterface PendingSaveItem {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: StableRecordIdentifier;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\nexport class FetchManager {\n declare isDestroyed: boolean;\n declare requestCache: RequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n declare _pendingFetch: Map<string, Map<StableExistingRecordIdentifier, PendingFetchItem[]>>;\n declare _store: Store;\n\n constructor(store: Store) {\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot<T>(identifier: StableRecordIdentifier<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;\n createSnapshot(identifier: StableRecordIdentifier, options?: FindRecordOptions): Snapshot;\n createSnapshot(identifier: StableRecordIdentifier, options: FindRecordOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @internal\n */\n scheduleSave(\n identifier: StableRecordIdentifier,\n options: FetchMutationOptions\n ): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: StableExistingRecordIdentifier,\n options: FindRecordOptions,\n request: ImmutableRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (macroCondition(dependencySatisfies('@ember-data/graph', '*'))) {\n if (!cache) {\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private'))\n .graphFor;\n const graph = graphFor(store);\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <T>(promise: Promise<T>) => Promise<T>;\n };\n promise = waitForPromise(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions) {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches() {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: StableExistingRecordIdentifier,\n options: FindRecordOptions = {},\n request: ImmutableRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<StableExistingRecordIdentifier>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy() {\n this.isDestroyed = true;\n }\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n const arrCurrent = (Array.isArray(current) ? current : current.split(',')).sort();\n const arrExisting = (Array.isArray(existing) ? existing : existing.split(',')).sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindRecordOptions = {}, existingOptions: FindRecordOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // eslint-disable-next-line @typescript-eslint/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n }) as Promise<AdapterPayload>;\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<StableExistingRecordIdentifier, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type Store from '@ember-data/store';\n\nimport type { CompatStore } from '.';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of EmberData.\n *\n @module @ember-data/legacy-compat\n @main @ember-data/legacy-compat\n*/\nexport { SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array';\nexport { SaveOp } from './legacy-network-handler/fetch-manager';\nexport { FetchManager } from './legacy-network-handler/fetch-manager';\nexport { Snapshot } from './legacy-network-handler/snapshot';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"names":["SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","upgradeStore","_fetchManager","SOURCE","map","identifier","createSnapshot","assertIdentifierHasId","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","id","iterateData","data","fn","Array","isArray","payloadIsNotBlank","adapterPayload","Object","keys","validateDocumentStructure","doc","errors","push","meta","links","jsonapi","included","join","normalizeResponseHelper","serializer","modelClass","payload","requestType","normalizedResponse","normalizeResponse","Snapshot","_store","__attributes","_belongsToRelationships","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","_attributes","cache","_changedAttributes","changedAttrs","record","peekRecord","lid","attributes","attrs","schema","fields","forEach","field","keyName","kind","getAttr","isNew","attr","changedAttributes","changedAttributeKeys","i","key","slice","belongsTo","returnModeIsId","result","relationshipMeta","get","dependencySatisfies","graphFor","importSync","relationship","definition","value","getData","inverseIdentifier","identifierCache","getOrCreateRecordIdentifier","undefined","isDeleted","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","member","eachAttribute","callback","binding","call","eachRelationship","serialize","serializerFor","SaveOp","getOrSetGlobal","Symbol","FetchManager","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","scheduleSave","resolver","createDeferred","query","op","recordIdentifier","queryRequest","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","pendingFetchItem","resolverPromise","isInitialLoad","recordIsLoaded","then","potentiallyNewIm","_push","reload","error","isEmpty","isReleasable","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","set","requestsForIdentifier","TESTING","disableTestWaiter","waitForPromise","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","assign","destroy","instanceCache","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","arrCurrent","split","sort","arrExisting","includes","optionsSatisfies","existingOptions","_findMany","adapter","modelFor","s","every","v","findMany","ret","rejectFetchedItems","fetchMap","l","pair","reject","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","resources","resource","delete","rejected","snapshotArray","warn","values","_fetchRecord","findRecord","klass","isDestroying","coerceId","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation"],"mappings":";;;;;;AAAA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;AAS/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,WAAWA,CAACC,KAAY,EAAEC,IAAY,EAAEC,OAAuB,GAAG,EAAE,EAAE;IACpE,IAAI,CAACC,OAAO,GAAGH,KAAK,CAAA;AACpB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACI,UAAU,GAAG,IAAI,CAAA;;AAEtB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,SAAS,GAAGJ,IAAI,CAAA;;AAErB;AACJ;AACA;AACA;AACA;AACA;A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,UAAU,EAAEd,cAAc,EAAEoG,QAAQ,CAAC3G,EAAE,EAAEwN,SAAS,CAAC,CAAA;AACvG,KAAA;AACF,GAAC,CAA4B,CAAA;AAE7BnH,EAAAA,QAAQ,CAACiC,OAAO,CAACvB,OAAO,CAAC,CAAA;AAC3B;;ACvnBA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAAS7H,YAAYA,CAACZ,KAAY,EAAgC;;;;"}
package/dist/builders.js CHANGED
@@ -15,7 +15,7 @@ function normalizeModelName(type) {
15
15
  until: '6.0',
16
16
  for: 'ember-data',
17
17
  since: {
18
- available: '5.3',
18
+ available: '4.13',
19
19
  enabled: '5.3'
20
20
  }
21
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"builders.js","sources":["../src/builders/utils.ts","../src/builders/find-all.ts","../src/builders/find-record.ts","../src/builders/query.ts","../src/builders/save-record.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';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\n\nexport function isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\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: '5.3',\n enabled: '5.3',\n },\n }\n );\n\n return result;\n }\n\n return type;\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { FindAllOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'findAll';\n data: {\n type: T;\n options: FindAllBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindAllBuilderOptions<T = unknown> = FindAllOptions<T>;\n\n/**\n This function builds a request config to perform a `findAll` request for the given type.\n When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.\n Additionally, it takes the same options as `store.findAll`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findAll\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {FindAllBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.findAll\n @return {FindAllRequestInput} request config\n*/\nexport function findAllBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n options?: FindAllBuilderOptions<T>\n): FindAllRequestInput<TypeFromInstance<T>, T[]>;\nexport function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;\nexport function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput {\n assert(`You need to pass a model name to the findAll builder`, type);\n assert(\n `Model name passed to the findAll builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport { constructResource, ensureStringId } from '@ember-data/store/-private';\nimport type { BaseFinderOptions, FindRecordOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { isMaybeIdentifier, normalizeModelName } from './utils';\n\ntype FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'findRecord';\n data: {\n record: ResourceIdentifierObject<T>;\n options: FindRecordBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;\n\n/**\n This function builds a request config to find the record for a given identifier or type and id combination.\n When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.\n Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).\n\n **Example 1**\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));\n ```\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return {FindRecordRequestInput} request config\n*/\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: ResourceIdentifierObject<TypeFromInstance<T>>,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: ResourceIdentifierObject,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder(\n resource: string | ResourceIdentifierObject,\n idOrOptions?: string | FindRecordBuilderOptions,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = idOrOptions as BaseFinderOptions | undefined;\n } else {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder (passed ${resource})`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(idOrOptions as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n options = options || {};\n\n assert('findRecord builder does not support options.preload', !(options as FindRecordOptions).preload);\n\n return {\n op: 'findRecord' as const,\n data: {\n record: resource,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { LegacyResourceQuery, QueryOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'query';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype QueryBuilderOptions = QueryOptions;\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.query` request.\n Additionally, it takes the same options as `store.query`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method query\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRequestInput} request config\n*/\nexport function queryBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery<T>,\n options?: QueryBuilderOptions\n): QueryRequestInput<TypeFromInstance<T>, T[]>;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options: QueryBuilderOptions = {}\n): QueryRequestInput {\n assert(`You need to pass a model name to the query builder`, type);\n assert(`You need to pass a query hash to the query builder`, query);\n assert(\n `Model name passed to the query builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'query' as const,\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n\ntype QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'queryRecord';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.\n Additionally, it takes the same options as `store.queryRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method queryRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRecordRequestInput} request config\n*/\nexport function queryRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery<T>,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput {\n assert(`You need to pass a model name to the queryRecord builder`, type);\n assert(`You need to pass a query hash to the queryRecord builder`, query);\n assert(\n `Model name passed to the queryRecord builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport { recordIdentifierFor, storeFor, type StoreRequestInput } from '@ember-data/store';\nimport type { InstanceCache } 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';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\ntype SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'createRecord' | 'deleteRecord' | 'updateRecord';\n data: {\n record: StableRecordIdentifier<T>;\n options: SaveRecordBuilderOptions;\n };\n records: [StableRecordIdentifier<T>];\n [RequestSignature]?: RT;\n};\n\ntype SaveRecordBuilderOptions = Record<string, unknown>;\n\nfunction _resourceIsFullDeleted(identifier: StableRecordIdentifier, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nfunction resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).\n When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.\n Additionally, it takes the same options as `store.saveRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method saveRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {object} record a record to save\n @param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord\n @return {SaveRecordRequestInput} request config\n*/\nexport function saveRecordBuilder<T extends TypedRecordInstance>(\n record: T,\n options: Record<string, unknown> = {}\n): SaveRecordRequestInput<TypeFromInstance<T>, T> {\n const store = storeFor(record);\n assert(`Unable to initiate save for a record in a disconnected state`, store);\n const identifier = recordIdentifierFor<T>(record);\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we throw here to prevent bad things.\n throw new Error(`Record Is Disconnected`);\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n store._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(store._instanceCache, identifier)) {\n throw new Error('cannot build saveRecord request for deleted record');\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n const cache = store.cache;\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n return {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n}\n"],"names":["isMaybeIdentifier","maybeIdentifier","Boolean","id","type","lid","normalizeModelName","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","until","for","since","available","enabled","findAllBuilder","options","env","DEBUG","test","Error","op","data","cacheOptions","SkipCache","findRecordBuilder","resource","idOrOptions","normalizedId","ensureStringId","constructResource","preload","record","queryBuilder","query","queryRecordBuilder","_resourceIsFullDeleted","identifier","cache","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","saveRecordBuilder","store","storeFor","recordIdentifierFor","_instanceCache","recordIsLoaded","operation","records"],"mappings":";;;;;;;AAMO,SAASA,iBAAiBA,CAC/BC,eAAkD,EACL;AAC7C,EAAA,OAAOC,OAAO,CACZD,eAAe,KAAK,IAAI,IACtB,OAAOA,eAAe,KAAK,QAAQ,KACjC,IAAI,IAAIA,eAAe,IAAI,MAAM,IAAIA,eAAe,IAAIA,eAAe,CAACE,EAAE,IAAIF,eAAe,CAACG,IAAI,IAClGH,eAAe,CAACI,GAAG,CACzB,CAAC,CAAA;AACH,CAAA;AAEO,SAASC,kBAAkBA,CAACF,IAAY,EAAU;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1E6C,KAAK,CAACG,cAAc,CAACC,cAAc,CAACZ,UAAU,CAAC,CAAA,GAAA,EAAA,CAAA;EAEjD,IAAIK,sBAAsB,CAACG,KAAK,CAACG,cAAc,EAAEX,UAAU,CAAC,EAAE;AAC5D,IAAA,MAAM,IAAIjB,KAAK,CAAC,oDAAoD,CAAC,CAAA;AACvE,GAAA;EAEA,IAAI,CAACJ,OAAO,EAAE;IACZA,OAAO,GAAG,EAAE,CAAA;AACd,GAAA;EACA,IAAIkC,SAA2D,GAAG,cAAc,CAAA;AAEhF,EAAA,MAAMZ,KAAK,GAAGO,KAAK,CAACP,KAAK,CAAA;AACzB,EAAA,IAAIA,KAAK,CAACE,KAAK,CAACH,UAAU,CAAC,EAAE;AAC3Ba,IAAAA,SAAS,GAAG,cAAc,CAAA;GAC3B,MAAM,IAAIZ,KAAK,CAACG,SAAS,CAACJ,UAAU,CAAC,EAAE;AACtCa,IAAAA,SAAS,GAAG,cAAc,CAAA;AAC5B,GAAA;EAEA,OAAO;AACL7B,IAAAA,EAAE,EAAE6B,SAAS;AACb5B,IAAAA,IAAI,EAAE;MACJN,OAAO;AACPgB,MAAAA,MAAM,EAAEK,UAAAA;KACT;IACDc,OAAO,EAAE,CAACd,UAAU,CAAC;AACrBd,IAAAA,YAAY,EAAE;AAAE,MAAA,CAACC,SAAS,GAAG,IAAA;AAAK,KAAA;GACnC,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"builders.js","sources":["../src/builders/utils.ts","../src/builders/find-all.ts","../src/builders/find-record.ts","../src/builders/query.ts","../src/builders/save-record.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';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\n\nexport function isMaybeIdentifier(\n maybeIdentifier: string | ResourceIdentifierObject\n): maybeIdentifier is ResourceIdentifierObject {\n return Boolean(\n maybeIdentifier !== null &&\n typeof maybeIdentifier === 'object' &&\n (('id' in maybeIdentifier && 'type' in maybeIdentifier && maybeIdentifier.id && maybeIdentifier.type) ||\n maybeIdentifier.lid)\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","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { FindAllOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype FindAllRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'findAll';\n data: {\n type: T;\n options: FindAllBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindAllBuilderOptions<T = unknown> = FindAllOptions<T>;\n\n/**\n This function builds a request config to perform a `findAll` request for the given type.\n When passed to `store.request`, this config will result in the same behavior as a `store.findAll` request.\n Additionally, it takes the same options as `store.findAll`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findAll\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {FindAllBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.findAll\n @return {FindAllRequestInput} request config\n*/\nexport function findAllBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n options?: FindAllBuilderOptions<T>\n): FindAllRequestInput<TypeFromInstance<T>, T[]>;\nexport function findAllBuilder(type: string, options?: FindAllBuilderOptions): FindAllRequestInput;\nexport function findAllBuilder(type: string, options: FindAllBuilderOptions = {}): FindAllRequestInput {\n assert(`You need to pass a model name to the findAll builder`, type);\n assert(\n `Model name passed to the findAll builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'findAll',\n data: {\n type: normalizeModelName(type),\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport { constructResource, ensureStringId } from '@ember-data/store/-private';\nimport type { BaseFinderOptions, FindRecordOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { ResourceIdentifierObject } from '@warp-drive/core-types/spec/json-api-raw';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { isMaybeIdentifier, normalizeModelName } from './utils';\n\ntype FindRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'findRecord';\n data: {\n record: ResourceIdentifierObject<T>;\n options: FindRecordBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype FindRecordBuilderOptions = Omit<FindRecordOptions, 'preload'>;\n\n/**\n This function builds a request config to find the record for a given identifier or type and id combination.\n When passed to `store.request`, this config will result in the same behavior as a `store.findRecord` request.\n Additionally, it takes the same options as `store.findRecord`, with the exception of `preload` (which is unsupported).\n\n **Example 1**\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>('post', '1'));\n ```\n\n **Example 2**\n\n `findRecord` can be called with a single identifier argument instead of the combination\n of `type` (modelName) and `id` as separate arguments. You may recognize this combo as\n the typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n ```ts\n import { findRecord } from '@ember-data/legacy-compat/builders';\n const { content: post } = await store.request<Post>(findRecord<Post>({ type: 'post', id }));\n ```\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method findRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string|object} resource - either a string representing the name of the resource or a ResourceIdentifier object containing both the type (a string) and the id (a string) for the record or an lid (a string) of an existing record\n @param {string|number|object} id - optional object with options for the request only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved\n @param {FindRecordBuilderOptions} [options] - if the first param is a string this will be the optional options for the request. See examples for available options.\n @return {FindRecordRequestInput} request config\n*/\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n id: string,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(type: string, id: string, options?: FindRecordBuilderOptions): FindRecordRequestInput;\nexport function findRecordBuilder<T extends TypedRecordInstance>(\n resource: ResourceIdentifierObject<TypeFromInstance<T>>,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput<TypeFromInstance<T>, T>;\nexport function findRecordBuilder(\n resource: ResourceIdentifierObject,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput;\nexport function findRecordBuilder(\n resource: string | ResourceIdentifierObject,\n idOrOptions?: string | FindRecordBuilderOptions,\n options?: FindRecordBuilderOptions\n): FindRecordRequestInput {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder`,\n resource\n );\n if (isMaybeIdentifier(resource)) {\n options = idOrOptions as BaseFinderOptions | undefined;\n } else {\n assert(\n `You need to pass a modelName or resource identifier as the first argument to the findRecord builder (passed ${resource})`,\n typeof resource === 'string'\n );\n const type = normalizeModelName(resource);\n const normalizedId = ensureStringId(idOrOptions as string | number);\n resource = constructResource(type, normalizedId);\n }\n\n options = options || {};\n\n assert('findRecord builder does not support options.preload', !(options as FindRecordOptions).preload);\n\n return {\n op: 'findRecord' as const,\n data: {\n record: resource,\n options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport type { StoreRequestInput } from '@ember-data/store';\nimport type { LegacyResourceQuery, QueryOptions } from '@ember-data/store/types';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\nimport { normalizeModelName } from './utils';\n\ntype QueryRequestInput<T extends string = string, RT = unknown[]> = StoreRequestInput & {\n op: 'query';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\ntype QueryBuilderOptions = QueryOptions;\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.query` request.\n Additionally, it takes the same options as `store.query`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method query\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRequestInput} request config\n*/\nexport function queryBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery<T>,\n options?: QueryBuilderOptions\n): QueryRequestInput<TypeFromInstance<T>, T[]>;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRequestInput;\nexport function queryBuilder(\n type: string,\n query: LegacyResourceQuery,\n options: QueryBuilderOptions = {}\n): QueryRequestInput {\n assert(`You need to pass a model name to the query builder`, type);\n assert(`You need to pass a query hash to the query builder`, query);\n assert(\n `Model name passed to the query builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'query' as const,\n data: {\n type: normalizeModelName(type),\n query,\n options: options,\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n\ntype QueryRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'queryRecord';\n data: {\n type: T;\n query: LegacyResourceQuery;\n options: QueryBuilderOptions;\n };\n [RequestSignature]?: RT;\n};\n\n/**\n This function builds a request config for a given type and query object.\n When passed to `store.request`, this config will result in the same behavior as a `store.queryRecord` request.\n Additionally, it takes the same options as `store.queryRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method queryRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {string} type the name of the resource\n @param {object} query a query to be used by the adapter\n @param {QueryBuilderOptions} [options] optional, may include `adapterOptions` hash which will be passed to adapter.query\n @return {QueryRecordRequestInput} request config\n*/\nexport function queryRecordBuilder<T extends TypedRecordInstance>(\n type: TypeFromInstance<T>,\n query: LegacyResourceQuery<T>,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput<TypeFromInstance<T>, T | null>;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput;\nexport function queryRecordBuilder(\n type: string,\n query: LegacyResourceQuery,\n options?: QueryBuilderOptions\n): QueryRecordRequestInput {\n assert(`You need to pass a model name to the queryRecord builder`, type);\n assert(`You need to pass a query hash to the queryRecord builder`, query);\n assert(\n `Model name passed to the queryRecord builder must be a dasherized string instead of ${type}`,\n typeof type === 'string'\n );\n\n return {\n op: 'queryRecord',\n data: {\n type: normalizeModelName(type),\n query,\n options: options || {},\n },\n cacheOptions: { [SkipCache]: true },\n };\n}\n","/**\n * @module @ember-data/legacy-compat/builders\n */\nimport { recordIdentifierFor, storeFor, type StoreRequestInput } from '@ember-data/store';\nimport type { InstanceCache } 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';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\nimport { SkipCache } from '@warp-drive/core-types/request';\nimport type { RequestSignature } from '@warp-drive/core-types/symbols';\n\ntype SaveRecordRequestInput<T extends string = string, RT = unknown> = StoreRequestInput & {\n op: 'createRecord' | 'deleteRecord' | 'updateRecord';\n data: {\n record: StableRecordIdentifier<T>;\n options: SaveRecordBuilderOptions;\n };\n records: [StableRecordIdentifier<T>];\n [RequestSignature]?: RT;\n};\n\ntype SaveRecordBuilderOptions = Record<string, unknown>;\n\nfunction _resourceIsFullDeleted(identifier: StableRecordIdentifier, cache: Cache): boolean {\n return cache.isDeletionCommitted(identifier) || (cache.isNew(identifier) && cache.isDeleted(identifier));\n}\n\nfunction resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n return !cache || _resourceIsFullDeleted(identifier, cache);\n}\n\n/**\n This function builds a request config for saving the given record (e.g. creating, updating, or deleting the record).\n When passed to `store.request`, this config will result in the same behavior as a legacy `store.saveRecord` request.\n Additionally, it takes the same options as `store.saveRecord`.\n\n All `@ember-data/legacy-compat` builders exist to enable you to migrate your codebase to using the correct syntax for `store.request` while temporarily preserving legacy behaviors.\n This is useful for quickly upgrading an entire app to a unified syntax while a longer incremental migration is made to shift off of adapters and serializers.\n To that end, these builders are deprecated and will be removed in a future version of Ember Data.\n\n @method saveRecord\n @deprecated\n @public\n @static\n @for @ember-data/legacy-compat/builders\n @param {object} record a record to save\n @param {SaveRecordBuilderOptions} options optional, may include `adapterOptions` hash which will be passed to adapter.saveRecord\n @return {SaveRecordRequestInput} request config\n*/\nexport function saveRecordBuilder<T extends TypedRecordInstance>(\n record: T,\n options: Record<string, unknown> = {}\n): SaveRecordRequestInput<TypeFromInstance<T>, T> {\n const store = storeFor(record);\n assert(`Unable to initiate save for a record in a disconnected state`, store);\n const identifier = recordIdentifierFor<T>(record);\n\n if (!identifier) {\n // this commonly means we're disconnected\n // but just in case we throw here to prevent bad things.\n throw new Error(`Record Is Disconnected`);\n }\n assert(\n `Cannot initiate a save request for an unloaded record: ${identifier.lid}`,\n store._instanceCache.recordIsLoaded(identifier)\n );\n if (resourceIsFullyDeleted(store._instanceCache, identifier)) {\n throw new Error('cannot build saveRecord request for deleted record');\n }\n\n if (!options) {\n options = {};\n }\n let operation: 'createRecord' | 'deleteRecord' | 'updateRecord' = 'updateRecord';\n\n const cache = store.cache;\n if (cache.isNew(identifier)) {\n operation = 'createRecord';\n } else if (cache.isDeleted(identifier)) {\n operation = 'deleteRecord';\n }\n\n return {\n op: operation,\n data: {\n options,\n record: identifier,\n },\n records: [identifier],\n cacheOptions: { [SkipCache]: true },\n };\n}\n"],"names":["isMaybeIdentifier","maybeIdentifier","Boolean","id","type","lid","normalizeModelName","macroCondition","getGlobalConfig","WarpDrive","deprecations","DEPRECATE_NON_STRICT_TYPES","result","dasherize","deprecate","until","for","since","available","enabled","findAllBuilder","options","env","DEBUG","test","Error","op","data","cacheOptions","SkipCache","findRecordBuilder","resource","idOrOptions","normalizedId","ensureStringId","constructResource","preload","record","queryBuilder","query","queryRecordBuilder","_resourceIsFullDeleted","identifier","cache","isDeletionCommitted","isNew","isDeleted","resourceIsFullyDeleted","instanceCache","saveRecordBuilder","store","storeFor","recordIdentifierFor","_instanceCache","recordIsLoaded","operation","records"],"mappings":";;;;;;;AAMO,SAASA,iBAAiBA,CAC/BC,eAAkD,EACL;AAC7C,EAAA,OAAOC,OAAO,CACZD,eAAe,KAAK,IAAI,IACtB,OAAOA,eAAe,KAAK,QAAQ,KACjC,IAAI,IAAIA,eAAe,IAAI,MAAM,IAAIA,eAAe,IAAIA,eAAe,CAACE,EAAE,IAAIF,eAAe,CAACG,IAAI,IAClGH,eAAe,CAACI,GAAG,CACzB,CAAC,CAAA;AACH,CAAA;AAEO,SAASC,kBAAkBA,CAACF,IAAY,EAAU;EACvD,IAAAG,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,YAAA,CAAAC,0BAAA,CAAgC,EAAA;AAC9B,IAAA,MAAMC,MAAM,GAAGC,SAAS,CAACT,IAAI,CAAC,CAAA;AAE9BU,IAAAA,SAAS,CACP,CAAA,mBAAA,EAAsBV,IAAI,CAAA,0DAAA,EAA6DQ,MAAM,CAAA,cAAA,EAAiBR,IAAI,CAAA,EAAA,CAAI,EACtHQ,MAAM,KAAKR,IAAI,EACf;AACED,MAAAA,EAAE,EAAE,uCAAuC;AAC3CY,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,GAAG,EAAE,YAAY;AACjBC,MAAAA,KAAK,EAAE;AACLC,QAAAA,SAAS,EAAE,MAAM;AACjBC,QAAAA,OAAO,EAAE,KAAA;AACX,OAAA;AACF,KACF,CAAC,CAAA;AAED,IAAA,OAAOP,MAAM,CAAA;AACf,GAAA;AAEA,EAAA,OAAOR,IAAI,CAAA;AACb;;ACvCA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAASgB,cAAcA,CAAChB,IAAY,EAAEiB,OAA8B,GAAG,EAAE,EAAuB;EACrGd,c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A,CAACC,SAAS,GAAG,IAAA;AAAK,KAAA;GACnC,CAAA;AACH;;;;"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/legacy-network-handler/legacy-data-fetch.ts","../src/legacy-network-handler/legacy-network-handler.ts","../src/index.ts"],"sourcesContent":["import type Store from '@ember-data/store';\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 { LegacyRelationshipSchema as RelationshipSchema } from '@warp-drive/core-types/schema/fields';\nimport type { ExistingResourceObject, JsonApiDocument } from '@warp-drive/core-types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private';\nimport { iterateData, payloadIsNotBlank } from './legacy-data-utils';\nimport type { MinimumAdapterInterface } from './minimum-adapter-interface';\nimport { normalizeResponseHelper } from './serializer-response';\n\nexport function _findHasMany(\n adapter: MinimumAdapterInterface,\n store: Store,\n identifier: StableRecordIdentifier,\n link: string | null | { href: string },\n relationship: RelationshipSchema,\n options: BaseFinderOptions\n) {\n upgradeStore(store);\n const promise = Promise.resolve().then(() => {\n const snapshot = store._fetchManager.createSnapshot(identifier, options);\n const useLink = !link || typeof link === 'string';\n const relatedLink = useLink ? link : link.href;\n assert(\n `Attempted to load a hasMany relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findHasMany'`,\n relatedLink\n );\n assert(\n `Expected the adapter to implement 'findHasMany' but it does not`,\n typeof adapter.findHasMany === 'function'\n );\n return adapter.findHasMany(store, snapshot, relatedLink, relationship);\n });\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findHasMany' request for a ${identifier.type}'s '${\n relationship.name\n }' relationship, using link '${JSON.stringify(link)}' , but the adapter's response did not have any data`,\n payloadIsNotBlank(adapterPayload)\n );\n const modelClass = store.modelFor(relationship.type);\n\n const serializer = store.serializerFor(relationship.type);\n let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findHasMany');\n\n assert(\n `fetched the hasMany relationship '${relationship.name}' for ${identifier.type}:${\n identifier.id\n } with link '${JSON.stringify(\n link\n )}', but no data member is present in the response. If no data exists, the response should set { data: [] }`,\n 'data' in payload && Array.isArray(payload.data)\n );\n\n payload = syncRelationshipDataFromLink(store, payload, identifier as ResourceIdentity, relationship);\n return store._push(payload, true);\n }, null);\n}\n\nexport function _findBelongsTo(\n store: Store,\n identifier: StableRecordIdentifier,\n link: string | null | { href: string },\n relationship: RelationshipSchema,\n options: BaseFinderOptions\n) {\n upgradeStore(store);\n const promise = Promise.resolve().then(() => {\n const adapter = store.adapterFor(identifier.type);\n assert(`You tried to load a belongsTo relationship but you have no adapter (for ${identifier.type})`, adapter);\n assert(\n `You tried to load a belongsTo relationship from a specified 'link' in the original payload but your adapter does not implement 'findBelongsTo'`,\n typeof adapter.findBelongsTo === 'function'\n );\n const snapshot = store._fetchManager.createSnapshot(identifier, options);\n const useLink = !link || typeof link === 'string';\n const relatedLink = useLink ? link : link.href;\n assert(\n `Attempted to load a belongsTo relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findBelongsTo'`,\n relatedLink\n );\n return adapter.findBelongsTo(store, snapshot, relatedLink, relationship);\n });\n\n return promise.then((adapterPayload) => {\n const modelClass = store.modelFor(relationship.type);\n const serializer = store.serializerFor(relationship.type);\n let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findBelongsTo');\n\n assert(\n `fetched the belongsTo relationship '${relationship.name}' for ${identifier.type}:${\n identifier.id\n } with link '${JSON.stringify(\n link\n )}', but no data member is present in the response. If no data exists, the response should set { data: null }`,\n 'data' in payload && (payload.data === null || (typeof payload.data === 'object' && !Array.isArray(payload.data)))\n );\n\n if (!payload.data && !payload.links && !payload.meta) {\n return null;\n }\n\n payload = syncRelationshipDataFromLink(store, payload, identifier as ResourceIdentity, relationship);\n\n return store._push(payload, true);\n }, null);\n}\n\n// sync\n// iterate over records in payload.data\n// for each record\n// assert that record.relationships[inverse] is either undefined (so we can fix it)\n// or provide a data: {id, type} that matches the record that requested it\n// return the relationship data for the parent\nfunction syncRelationshipDataFromLink(\n store: Store,\n payload: JsonApiDocument,\n parentIdentifier: ResourceIdentity,\n relationship: RelationshipSchema\n) {\n // ensure the right hand side (incoming payload) points to the parent record that\n // requested this relationship\n const relationshipData = payload.data\n ? iterateData(payload.data, (data, index) => {\n const { id, type } = data;\n ensureRelationshipIsSetToParent(data, parentIdentifier, store, relationship, index);\n return { id, type };\n })\n : null;\n\n const relatedDataHash = {} as JsonApiDocument;\n\n if ('meta' in payload) {\n relatedDataHash.meta = payload.meta;\n }\n if ('links' in payload) {\n relatedDataHash.links = payload.links;\n }\n if ('data' in payload) {\n relatedDataHash.data = relationshipData;\n }\n\n // now, push the left hand side (the parent record) to ensure things are in sync, since\n // the payload will be pushed with store._push\n const parentPayload = {\n id: parentIdentifier.id,\n type: parentIdentifier.type,\n relationships: {\n [relationship.name]: relatedDataHash,\n },\n };\n\n if (!Array.isArray(payload.included)) {\n payload.included = [];\n }\n payload.included.push(parentPayload);\n\n return payload;\n}\n\ntype ResourceIdentity = { id: string; type: string };\ntype RelationshipData = ResourceIdentity | ResourceIdentity[] | null;\n\nfunction ensureRelationshipIsSetToParent(\n payload: ExistingResourceObject,\n parentIdentifier: ResourceIdentity,\n store: Store,\n parentRelationship: RelationshipSchema,\n index: number\n) {\n const { id, type } = payload;\n\n if (!payload.relationships) {\n payload.relationships = {};\n }\n const { relationships } = payload;\n\n const inverse = getInverse(store, parentIdentifier, parentRelationship, type);\n if (inverse) {\n const { inverseKey, kind } = inverse;\n\n const relationshipData = relationships[inverseKey]?.data as RelationshipData | undefined;\n\n if (DEBUG) {\n if (\n typeof relationshipData !== 'undefined' &&\n !relationshipDataPointsToParent(relationshipData, parentIdentifier)\n ) {\n const inspect = function inspect(thing: unknown) {\n return `'${JSON.stringify(thing)}'`;\n };\n const quotedType = inspect(type);\n const quotedInverse = inspect(inverseKey);\n const expected = inspect({\n id: parentIdentifier.id,\n type: parentIdentifier.type,\n });\n const expectedModel = `${parentIdentifier.type}:${parentIdentifier.id}`;\n const got = inspect(relationshipData);\n const prefix = typeof index === 'number' ? `data[${index}]` : `data`;\n const path = `${prefix}.relationships.${inverseKey}.data`;\n const data = Array.isArray(relationshipData) ? relationshipData[0] : relationshipData;\n const other = data ? `<${data.type}:${data.id}>` : null;\n const relationshipFetched = `${expectedModel}.${parentRelationship.kind}(\"${parentRelationship.name}\")`;\n const includedRecord = `<${type}:${id}>`;\n const message = [\n `Encountered mismatched relationship: Ember Data expected ${path} in the payload from ${relationshipFetched} to include ${expected} but got ${got} instead.\\n`,\n `The ${includedRecord} record loaded at ${prefix} in the payload specified ${other} as its ${quotedInverse}, but should have specified ${expectedModel} (the record the relationship is being loaded from) as its ${quotedInverse} instead.`,\n `This could mean that the response for ${relationshipFetched} may have accidentally returned ${quotedType} records that aren't related to ${expectedModel} and could be related to a different ${parentIdentifier.type} record instead.`,\n `Ember Data has corrected the ${includedRecord} record's ${quotedInverse} relationship to ${expectedModel} so that ${relationshipFetched} will include ${includedRecord}.`,\n `Please update the response from the server or change your serializer to either ensure that the response for only includes ${quotedType} records that specify ${expectedModel} as their ${quotedInverse}, or omit the ${quotedInverse} relationship from the response.`,\n ].join('\\n');\n\n assert(message);\n }\n }\n\n if (kind !== 'hasMany' || typeof relationshipData !== 'undefined') {\n relationships[inverseKey] = relationships[inverseKey] || {};\n relationships[inverseKey].data = fixRelationshipData(relationshipData ?? null, kind, parentIdentifier);\n }\n }\n}\n\nfunction inverseForRelationship(store: Store, identifier: { type: string; id?: string }, key: string) {\n const definition = store.schema.fields(identifier).get(key);\n if (!definition) {\n return null;\n }\n assert(\n `Expected the field definition to be a relationship`,\n definition.kind === 'hasMany' || definition.kind === 'belongsTo'\n );\n assert(\n `Expected the relationship defintion to specify the inverse type or null.`,\n definition.options?.inverse === null ||\n (typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0)\n );\n return definition.options.inverse;\n}\n\nfunction getInverse(\n store: Store,\n parentIdentifier: ResourceIdentity,\n parentRelationship: RelationshipSchema,\n type: string\n) {\n const { name: lhs_relationshipName } = parentRelationship;\n const { type: parentType } = parentIdentifier;\n const inverseKey = inverseForRelationship(store, { type: parentType }, lhs_relationshipName);\n\n if (inverseKey) {\n const definition = store.schema.fields({ type }).get(inverseKey);\n assert(\n `Expected the field definition to be a relationship`,\n definition && (definition.kind === 'hasMany' || definition.kind === 'belongsTo')\n );\n return {\n inverseKey,\n kind: definition.kind,\n };\n }\n}\n\nfunction relationshipDataPointsToParent(relationshipData: RelationshipData, identifier: ResourceIdentity): boolean {\n if (relationshipData === null) {\n return false;\n }\n\n if (Array.isArray(relationshipData)) {\n if (relationshipData.length === 0) {\n return false;\n }\n for (let i = 0; i < relationshipData.length; i++) {\n const entry = relationshipData[i];\n if (validateRelationshipEntry(entry, identifier)) {\n return true;\n }\n }\n } else {\n return validateRelationshipEntry(relationshipData, identifier);\n }\n\n return false;\n}\n\nfunction fixRelationshipData(\n relationshipData: RelationshipData,\n relationshipKind: 'hasMany' | 'belongsTo',\n { id, type }: ResourceIdentity\n) {\n const parentRelationshipData = {\n id,\n type,\n };\n\n let payload: { type: string; id: string } | { type: string; id: string }[] | null = null;\n\n if (relationshipKind === 'hasMany') {\n const relData = (relationshipData as { type: string; id: string }[]) || [];\n if (relationshipData) {\n assert('expected the relationship data to be an array', Array.isArray(relationshipData));\n // these arrays could be massive so this is better than filter\n // Note: this is potentially problematic if type/id are not in the\n // same state of normalization.\n const found = relationshipData.find((v) => {\n return v.type === parentRelationshipData.type && v.id === parentRelationshipData.id;\n });\n if (!found) {\n relData.push(parentRelationshipData);\n }\n } else {\n relData.push(parentRelationshipData);\n }\n payload = relData;\n } else {\n const relData = (relationshipData as { type: string; id: string }) || {};\n Object.assign(relData, parentRelationshipData);\n payload = relData;\n }\n\n return payload;\n}\n\nfunction validateRelationshipEntry({ id }: ResourceIdentity, { id: parentModelID }: ResourceIdentity): boolean {\n return !!id && id.toString() === parentModelID;\n}\n","import { importSync } from '@embroider/macros';\n\nimport type { Future, Handler, NextFn, StructuredDataDocument } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type { StoreRequestContext } from '@ember-data/store';\nimport type { CollectionRecordArray } from '@ember-data/store/-private';\nimport type { ModelSchema } from '@ember-data/store/types';\nimport { LOG_PAYLOADS } from '@warp-drive/build-config/debugging';\nimport { DEBUG, TESTING } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { ImmutableRequestInfo } from '@warp-drive/core-types/request';\nimport type { LegacyRelationshipSchema as RelationshipSchema } from '@warp-drive/core-types/schema/fields';\nimport type { SingleResourceDataDocument } from '@warp-drive/core-types/spec/document';\nimport type { ApiError } from '@warp-drive/core-types/spec/error';\nimport type {\n CollectionResourceDocument,\n JsonApiDocument,\n Links,\n PaginationLinks,\n SingleResourceDocument,\n} from '@warp-drive/core-types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private';\nimport { FetchManager, SaveOp } from './fetch-manager';\nimport { assertIdentifierHasId } from './identifier-has-id';\nimport { _findBelongsTo, _findHasMany } from './legacy-data-fetch';\nimport { payloadIsNotBlank } from './legacy-data-utils';\nimport type { MinimumAdapterInterface } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface';\nimport { normalizeResponseHelper } from './serializer-response';\nimport type { Snapshot } from './snapshot';\nimport { SnapshotRecordArray } from './snapshot-record-array';\n\ntype AdapterErrors = Error & { errors?: unknown[]; isAdapterError?: true; code?: string };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nconst PotentialLegacyOperations = new Set([\n 'findRecord',\n 'findAll',\n 'query',\n 'queryRecord',\n 'findBelongsTo',\n 'findHasMany',\n 'updateRecord',\n 'createRecord',\n 'deleteRecord',\n]);\n\nexport const LegacyNetworkHandler: Handler = {\n request<T>(context: StoreRequestContext, next: NextFn<T>): Future<T> | Promise<StructuredDataDocument<T>> {\n // if we are not a legacy request, move on\n if (context.request.url || !context.request.op || !PotentialLegacyOperations.has(context.request.op)) {\n return next(context.request);\n }\n\n const { store } = context.request;\n upgradeStore(store);\n if (!store._fetchManager) {\n store._fetchManager = new FetchManager(store);\n }\n\n switch (context.request.op) {\n case 'findRecord':\n return findRecord(context);\n case 'findAll':\n return findAll(context);\n case 'query':\n return query(context);\n case 'queryRecord':\n return queryRecord(context);\n case 'findBelongsTo':\n return findBelongsTo(context);\n case 'findHasMany':\n return findHasMany(context);\n case 'updateRecord':\n return saveRecord(context);\n case 'createRecord':\n return saveRecord(context);\n case 'deleteRecord':\n return saveRecord(context);\n default:\n return next(context.request);\n }\n },\n};\n\nfunction findBelongsTo<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, records: identifiers } = context.request;\n const { options, record, links, useLink, field } = data as {\n record: StableRecordIdentifier;\n options: Record<string, unknown>;\n links?: Links;\n useLink: boolean;\n field: RelationshipSchema;\n };\n const identifier = identifiers?.[0];\n upgradeStore(store);\n\n // short circuit if we are already loading\n const pendingRequest =\n identifier && store._fetchManager.getPendingFetch(identifier as StableExistingRecordIdentifier, options);\n if (pendingRequest) {\n return pendingRequest as Promise<T>;\n }\n\n if (useLink) {\n assert(`Expected a related link when calling store.findBelongsTo, found ${String(links)}`, links && links.related);\n return _findBelongsTo(store, record, links.related, field, options) as Promise<T>;\n }\n\n assert(`Expected an identifier`, Array.isArray(identifiers) && identifiers.length === 1);\n\n const manager = store._fetchManager;\n assertIdentifierHasId(identifier);\n\n return options.reload\n ? (manager.scheduleFetch(identifier, options, context.request) as Promise<T>)\n : (manager.fetchDataIfNeededForIdentifier(identifier, options, context.request) as Promise<T>);\n}\n\nfunction findHasMany<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, records: identifiers } = context.request;\n const { options, record, links, useLink, field } = data as {\n record: StableRecordIdentifier;\n options: Record<string, unknown>;\n links?: PaginationLinks | Links;\n useLink: boolean;\n field: RelationshipSchema;\n };\n upgradeStore(store);\n\n // link case\n if (useLink) {\n const adapter = store.adapterFor(record.type);\n /*\n If a relationship was originally populated by the adapter as a link\n (as opposed to a list of IDs), this method is called when the\n relationship is fetched.\n\n The link (which is usually a URL) is passed through unchanged, so the\n adapter can make whatever request it wants.\n\n The usual use-case is for the server to register a URL as a link, and\n then use that URL in the future to make a request for the relationship.\n */\n assert(`You tried to load a hasMany relationship but you have no adapter (for ${record.type})`, adapter);\n assert(\n `You tried to load a hasMany relationship from a specified 'link' in the original payload but your adapter does not implement 'findHasMany'`,\n typeof adapter.findHasMany === 'function'\n );\n assert(`Expected a related link when calling store.findHasMany, found ${String(links)}`, links && links.related);\n\n return _findHasMany(adapter, store, record, links.related, field, options) as Promise<T>;\n }\n\n // identifiers case\n assert(`Expected an array of identifiers to fetch`, Array.isArray(identifiers));\n const fetches = new Array<globalThis.Promise<StableRecordIdentifier>>(identifiers.length);\n const manager = store._fetchManager;\n\n for (let i = 0; i < identifiers.length; i++) {\n const identifier = identifiers[i];\n // TODO we probably can be lenient here and return from cache for the isNew case\n assertIdentifierHasId(identifier);\n fetches[i] = options.reload\n ? manager.scheduleFetch(identifier, options, context.request)\n : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);\n }\n\n return Promise.all(fetches) as Promise<T>;\n}\n\nfunction saveRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, op: operation } = context.request;\n const { options, record: identifier } = data as { record: StableRecordIdentifier; options: Record<string, unknown> };\n\n upgradeStore(store);\n\n store.cache.willCommit(identifier, context);\n\n const saveOptions = Object.assign(\n { [SaveOp]: operation as 'updateRecord' | 'deleteRecord' | 'createRecord' },\n options\n );\n const fetchManagerPromise = store._fetchManager.scheduleSave(identifier, saveOptions);\n\n return fetchManagerPromise\n .then((payload) => {\n if (LOG_PAYLOADS) {\n try {\n const payloadCopy: unknown = payload ? JSON.parse(JSON.stringify(payload)) : payload;\n // eslint-disable-next-line no-console\n console.log(`EmberData | Payload - ${operation}`, payloadCopy);\n } catch {\n // eslint-disable-next-line no-console\n console.log(`EmberData | Payload - ${operation}`, payload);\n }\n }\n let result: SingleResourceDataDocument;\n store._join(() => {\n // @ts-expect-error we don't have access to a response in legacy\n result = store.cache.didCommit(identifier, { request: context.request, content: payload });\n });\n\n // blatantly lie if we were a createRecord request\n // to give some semblance of cache-control to the\n // CachePolicy while legacy is still around\n if (store.lifetimes?.didRequest && operation === 'createRecord') {\n store.lifetimes.didRequest(context.request, { status: 201 } as Response, null, store);\n }\n return store.peekRecord(result!.data!);\n })\n .catch((e: unknown) => {\n let err = e;\n if (!e) {\n err = new Error(`Unknown Error Occurred During Request`);\n } else if (typeof e === 'string') {\n err = new Error(e);\n }\n adapterDidInvalidate(store, identifier, err as Error);\n throw err;\n }) as Promise<T>;\n}\n\nfunction adapterDidInvalidate(\n store: Store,\n identifier: StableRecordIdentifier,\n error: Error & { errors?: ApiError[]; isAdapterError?: true; code?: string }\n) {\n upgradeStore(store);\n if (error && error.isAdapterError === true && error.code === 'InvalidError') {\n const serializer = store.serializerFor(identifier.type) as SerializerWithParseErrors;\n\n // TODO @deprecate extractErrors being called\n // TODO remove extractErrors from the default serializers.\n if (serializer && typeof serializer.extractErrors === 'function') {\n const errorsHash = serializer.extractErrors(\n store,\n store.modelFor(identifier.type),\n error,\n identifier.id\n ) as Record<string, string | string[]>;\n error.errors = errorsHashToArray(errorsHash);\n }\n }\n const cache = store.cache;\n\n if (error.errors) {\n assert(\n `Expected the cache in use by resource ${String(\n identifier\n )} to have a getErrors(identifier) method for retrieving errors.`,\n typeof cache.getErrors === 'function'\n );\n\n let jsonApiErrors: ApiError[] = error.errors;\n if (jsonApiErrors.length === 0) {\n jsonApiErrors = [{ title: 'Invalid Error', detail: '', source: { pointer: '/data' } }];\n }\n cache.commitWasRejected(identifier, jsonApiErrors);\n } else {\n cache.commitWasRejected(identifier);\n }\n}\n\nfunction makeArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\nfunction errorsHashToArray(errors: Record<string, string | string[]>): ApiError[] {\n const out: ApiError[] = [];\n\n if (errors) {\n Object.keys(errors).forEach((key) => {\n const messages = makeArray(errors[key]);\n for (let i = 0; i < messages.length; i++) {\n let title = 'Invalid Attribute';\n let pointer = `/data/attributes/${key}`;\n if (key === PRIMARY_ATTRIBUTE_KEY) {\n title = 'Invalid Document';\n pointer = `/data`;\n }\n out.push({\n title: title,\n detail: messages[i],\n source: {\n pointer: pointer,\n },\n });\n }\n });\n }\n\n return out;\n}\n\nfunction findRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n const { record: identifier, options } = data as {\n record: StableExistingRecordIdentifier;\n options: { reload?: boolean; backgroundReload?: boolean };\n };\n upgradeStore(store);\n let promise: Promise<StableRecordIdentifier>;\n\n // if not loaded start loading\n if (!store._instanceCache.recordIsLoaded(identifier)) {\n promise = store._fetchManager.fetchDataIfNeededForIdentifier(identifier, options, context.request);\n\n // Refetch if the reload option is passed\n } else if (options.reload) {\n assertIdentifierHasId(identifier);\n\n promise = store._fetchManager.scheduleFetch(identifier, options, context.request);\n } else {\n let snapshot: Snapshot | null = null;\n const adapter = store.adapterFor(identifier.type);\n\n // Refetch the record if the adapter thinks the record is stale\n if (\n typeof options.reload === 'undefined' &&\n adapter.shouldReloadRecord &&\n adapter.shouldReloadRecord(store, (snapshot = store._fetchManager.createSnapshot(identifier, options)))\n ) {\n assertIdentifierHasId(identifier);\n if (DEBUG) {\n promise = store._fetchManager.scheduleFetch(\n identifier,\n Object.assign({}, options, { reload: true }),\n context.request\n );\n } else {\n options.reload = true;\n promise = store._fetchManager.scheduleFetch(identifier, options, context.request);\n }\n } else {\n // Trigger the background refetch if backgroundReload option is passed\n if (\n options.backgroundReload !== false &&\n (options.backgroundReload ||\n !adapter.shouldBackgroundReloadRecord ||\n adapter.shouldBackgroundReloadRecord(\n store,\n (snapshot = snapshot || store._fetchManager.createSnapshot(identifier, options))\n ))\n ) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n void store._fetchManager.scheduleFetch(\n identifier,\n Object.assign({}, options, { backgroundReload: true }),\n context.request\n );\n } else {\n options.backgroundReload = true;\n void store._fetchManager.scheduleFetch(identifier, options, context.request);\n }\n }\n\n // Return the cached record\n promise = Promise.resolve(identifier) as Promise<StableRecordIdentifier>;\n }\n }\n\n return promise.then((i: StableRecordIdentifier) => store.peekRecord(i)) as Promise<T>;\n}\n\nfunction findAll<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n const { type, options } = data as {\n type: string;\n options: { reload?: boolean; backgroundReload?: boolean };\n };\n upgradeStore(store);\n const adapter = store.adapterFor(type);\n\n assert(`You tried to load all records but you have no adapter (for ${type})`, adapter);\n assert(\n `You tried to load all records but your adapter does not implement 'findAll'`,\n typeof adapter.findAll === 'function'\n );\n\n // avoid initializing the liveArray just to set `isUpdating`\n const maybeRecordArray = store.recordArrayManager._live.get(type);\n const snapshotArray = new SnapshotRecordArray(store, type, options);\n\n const shouldReload =\n options.reload ||\n (options.reload !== false &&\n ((adapter.shouldReloadAll && adapter.shouldReloadAll(store, snapshotArray)) ||\n (!adapter.shouldReloadAll && snapshotArray.length === 0)));\n\n let fetch: Promise<T> | undefined;\n if (shouldReload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n maybeRecordArray && (maybeRecordArray.isUpdating = true);\n fetch = _findAll(adapter, store, type, snapshotArray, context.request, true);\n } else {\n fetch = Promise.resolve(store.peekAll(type)) as Promise<T>;\n\n if (\n options.backgroundReload ||\n (options.backgroundReload !== false &&\n (!adapter.shouldBackgroundReloadAll || adapter.shouldBackgroundReloadAll(store, snapshotArray)))\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n maybeRecordArray && (maybeRecordArray.isUpdating = true);\n void _findAll(adapter, store, type, snapshotArray, context.request, false);\n }\n }\n\n return fetch;\n}\n\nfunction _findAll<T>(\n adapter: MinimumAdapterInterface,\n store: Store,\n type: string,\n snapshotArray: SnapshotRecordArray,\n request: ImmutableRequestInfo,\n isAsyncFlush: boolean\n): Promise<T> {\n const schema = store.modelFor(type);\n let promise: Promise<T> = Promise.resolve().then(() =>\n adapter.findAll(store, schema, null, snapshotArray)\n ) as Promise<T>;\n\n promise = promise.then((adapterPayload: T) => {\n assert(\n `You made a 'findAll' request for '${type}' records, but the adapter's response did not have any data`,\n payloadIsNotBlank(adapterPayload)\n );\n upgradeStore(store);\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'findAll');\n\n store._push(payload, isAsyncFlush);\n snapshotArray._recordArray.isUpdating = false;\n\n if (LOG_PAYLOADS) {\n // eslint-disable-next-line no-console\n console.log(`request: findAll<${type}> background reload complete`);\n }\n return snapshotArray._recordArray;\n }) as Promise<T>;\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <PT>(promise: Promise<PT>) => Promise<PT>;\n };\n promise = waitForPromise(promise);\n }\n }\n\n return promise;\n}\n\nfunction query<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n upgradeStore(store);\n let { options } = data as {\n options: { _recordArray?: CollectionRecordArray; adapterOptions?: Record<string, unknown> };\n };\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { type, query } = data as {\n type: string;\n query: Record<string, unknown>;\n options: { _recordArray?: CollectionRecordArray; adapterOptions?: Record<string, unknown> };\n };\n const adapter = store.adapterFor(type);\n\n assert(`You tried to make a query but you have no adapter (for ${type})`, adapter);\n assert(`You tried to make a query but your adapter does not implement 'query'`, typeof adapter.query === 'function');\n\n const recordArray =\n options._recordArray ||\n store.recordArrayManager.createArray({\n type,\n query,\n });\n\n if (DEBUG) {\n options = Object.assign({}, options);\n delete options._recordArray;\n } else {\n delete options._recordArray;\n }\n const schema = store.modelFor(type);\n const promise = Promise.resolve().then(() => adapter.query(store, schema, query, recordArray, options));\n\n return promise.then((adapterPayload) => {\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(\n serializer,\n store,\n schema,\n adapterPayload as Record<string, unknown>,\n null,\n 'query'\n );\n const identifiers = store._push(payload, true);\n\n assert(\n 'The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.',\n Array.isArray(identifiers)\n );\n\n store.recordArrayManager.populateManagedArray(recordArray, identifiers, payload as CollectionResourceDocument);\n\n return recordArray;\n }) as Promise<T>;\n}\n\nfunction assertSingleResourceDocument(payload: JsonApiDocument): asserts payload is SingleResourceDocument {\n assert(\n `Expected the primary data returned by the serializer for a 'queryRecord' response to be a single object or null but instead it was an array.`,\n !Array.isArray(payload.data)\n );\n}\n\nfunction queryRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { type, query, options } = data as { type: string; query: Record<string, unknown>; options: object };\n upgradeStore(store);\n const adapter = store.adapterFor(type);\n\n assert(`You tried to make a query but you have no adapter (for ${type})`, adapter);\n assert(\n `You tried to make a query but your adapter does not implement 'queryRecord'`,\n typeof adapter.queryRecord === 'function'\n );\n\n const schema = store.modelFor(type);\n const promise = Promise.resolve().then(() => adapter.queryRecord(store, schema, query, options)) as Promise<T>;\n\n return promise.then((adapterPayload: T) => {\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(\n serializer,\n store,\n schema,\n adapterPayload as Record<string, unknown>,\n null,\n 'queryRecord'\n );\n\n assertSingleResourceDocument(payload);\n\n const identifier = store._push(payload, true) as StableRecordIdentifier;\n return identifier ? store.peekRecord(identifier) : null;\n }) as Promise<T>;\n}\n","import { getOwner } from '@ember/application';\n\nimport type Store from '@ember-data/store';\nimport { recordIdentifierFor } from '@ember-data/store';\nimport { _deprecatingNormalize } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\n\nimport { FetchManager, upgradeStore } from './-private';\nimport type { AdapterPayload, MinimumAdapterInterface } from './legacy-network-handler/minimum-adapter-interface';\nimport type {\n MinimumSerializerInterface,\n SerializerOptions,\n} from './legacy-network-handler/minimum-serializer-interface';\n\nexport { LegacyNetworkHandler } from './legacy-network-handler/legacy-network-handler';\n\nexport type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };\n\n/**\n * @module @ember-data/store\n * @class Store\n */\nexport type LegacyStoreCompat = {\n _fetchManager: FetchManager;\n adapterFor(this: Store, modelName: string): MinimumAdapterInterface;\n adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;\n\n serializerFor<K extends string>(modelName: K, _allowMissing?: boolean): MinimumSerializerInterface | null;\n\n normalize(modelName: string, payload: ObjectValue): ObjectValue;\n pushPayload(modelName: string, payload: ObjectValue): void;\n serializeRecord(record: unknown, options?: SerializerOptions): unknown;\n\n _adapterCache: Record<string, MinimumAdapterInterface & { store: Store }>;\n _serializerCache: Record<string, MinimumSerializerInterface & { store: Store }>;\n};\n\nexport type CompatStore = Store & LegacyStoreCompat;\n\n/**\n Returns an instance of the adapter for a given type. For\n example, `adapterFor('person')` will return an instance of\n the adapter located at `app/adapters/person.js`\n\n If no `person` adapter is found, this method will look\n for an `application` adapter (the default adapter for\n your entire application).\n\n @method adapterFor\n @public\n @param {String} modelName\n @return Adapter\n */\nexport function adapterFor(this: Store, modelName: string): MinimumAdapterInterface;\nexport function adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;\nexport function adapterFor(this: Store, modelName: string, _allowMissing?: true): MinimumAdapterInterface | undefined {\n assert(\n `Attempted to call store.adapterFor(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's adapterFor method`, modelName);\n assert(\n `Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ${modelName}`,\n typeof modelName === 'string'\n );\n upgradeStore(this);\n this._adapterCache =\n this._adapterCache || (Object.create(null) as Record<string, MinimumAdapterInterface & { store: Store }>);\n\n const normalizedModelName = _deprecatingNormalize(modelName);\n\n const { _adapterCache } = this;\n let adapter: (MinimumAdapterInterface & { store: Store }) | undefined = _adapterCache[normalizedModelName];\n if (adapter) {\n return adapter;\n }\n\n const owner = getOwner(this)!;\n\n // name specific adapter\n adapter = owner.lookup(`adapter:${normalizedModelName}`) as (MinimumAdapterInterface & { store: Store }) | undefined;\n if (adapter !== undefined) {\n _adapterCache[normalizedModelName] = adapter;\n return adapter;\n }\n\n // no adapter found for the specific name, fallback and check for application adapter\n adapter = _adapterCache.application || owner.lookup('adapter:application');\n if (adapter !== undefined) {\n _adapterCache[normalizedModelName] = adapter;\n _adapterCache.application = adapter;\n return adapter;\n }\n\n assert(\n `No adapter was found for '${modelName}' and no 'application' adapter was found as a fallback.`,\n _allowMissing\n );\n}\n\n/**\n Returns an instance of the serializer for a given type. For\n example, `serializerFor('person')` will return an instance of\n `App.PersonSerializer`.\n\n If no `App.PersonSerializer` is found, this method will look\n for an `App.ApplicationSerializer` (the default serializer for\n your entire application).\n\n If a serializer cannot be found on the adapter, it will fall back\n to an instance of `JSONSerializer`.\n\n @method serializerFor\n @public\n @param {String} modelName the record to serialize\n @return {Serializer}\n */\nexport function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null {\n assert(\n `Attempted to call store.serializerFor(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's serializerFor method`, modelName);\n assert(\n `Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ${modelName}`,\n typeof modelName === 'string'\n );\n upgradeStore(this);\n this._serializerCache =\n this._serializerCache || (Object.create(null) as Record<string, MinimumSerializerInterface & { store: Store }>);\n const normalizedModelName = _deprecatingNormalize(modelName);\n\n const { _serializerCache } = this;\n let serializer: (MinimumSerializerInterface & { store: Store }) | undefined = _serializerCache[normalizedModelName];\n if (serializer) {\n return serializer;\n }\n\n // by name\n const owner = getOwner(this)!;\n serializer = owner.lookup(`serializer:${normalizedModelName}`) as\n | (MinimumSerializerInterface & { store: Store })\n | undefined;\n if (serializer !== undefined) {\n _serializerCache[normalizedModelName] = serializer;\n return serializer;\n }\n\n // no serializer found for the specific model, fallback and check for application serializer\n serializer = _serializerCache.application || owner.lookup('serializer:application');\n if (serializer !== undefined) {\n _serializerCache[normalizedModelName] = serializer;\n _serializerCache.application = serializer;\n return serializer;\n }\n\n return null;\n}\n\n/**\n `normalize` converts a json payload into the normalized form that\n [push](../methods/push?anchor=push) expects.\n\n Example\n\n ```js\n socket.on('message', function(message) {\n let modelName = message.model;\n let data = message.data;\n store.push(store.normalize(modelName, data));\n });\n ```\n\n @method normalize\n @public\n @param {String} modelName The name of the model type for this payload\n @param {Object} payload\n @return {Object} The normalized payload\n */\n// TODO @runspired @deprecate users should call normalize on the associated serializer directly\nexport function normalize(this: Store, modelName: string, payload: ObjectValue) {\n upgradeStore(this);\n assert(\n `Attempted to call store.normalize(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's normalize method`, modelName);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${typeof modelName}`,\n typeof modelName === 'string'\n );\n const normalizedModelName = _deprecatingNormalize(modelName);\n const serializer = this.serializerFor(normalizedModelName);\n const schema = this.modelFor(normalizedModelName);\n assert(\n `You must define a normalize method in your serializer in order to call store.normalize`,\n typeof serializer?.normalize === 'function'\n );\n return serializer.normalize(schema, payload);\n}\n\n/**\n Push some raw data into the store.\n\n This method can be used both to push in brand new\n records, as well as to update existing records. You\n can push in more than one type of object at once.\n All objects should be in the format expected by the\n serializer.\n\n ```app/serializers/application.js\n import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n ```\n\n ```js\n let pushData = {\n posts: [\n { id: 1, postTitle: \"Great post\", commentIds: [2] }\n ],\n comments: [\n { id: 2, commentBody: \"Insightful comment\" }\n ]\n }\n\n store.pushPayload(pushData);\n ```\n\n By default, the data will be deserialized using a default\n serializer (the application serializer if it exists).\n\n Alternatively, `pushPayload` will accept a model type which\n will determine which serializer will process the payload.\n\n ```app/serializers/application.js\n import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n ```\n\n ```app/serializers/post.js\n import JSONSerializer from '@ember-data/serializer/json';\n\n export default JSONSerializer;\n ```\n\n ```js\n store.pushPayload(pushData); // Will use the application serializer\n store.pushPayload('post', pushData); // Will use the post serializer\n ```\n\n @method pushPayload\n @public\n @param {String} modelName Optionally, a model type used to determine which serializer will be used\n @param {Object} inputPayload\n */\n// TODO @runspired @deprecate pushPayload in favor of looking up the serializer\nexport function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void {\n upgradeStore(this);\n assert(\n `Attempted to call store.pushPayload(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n const payload: ObjectValue = inputPayload || (modelName as unknown as ObjectValue);\n const normalizedModelName = inputPayload ? _deprecatingNormalize(modelName) : 'application';\n const serializer = this.serializerFor(normalizedModelName);\n\n assert(\n `You cannot use 'store.pushPayload(<type>, <payload>)' unless the serializer for '${normalizedModelName}' defines 'pushPayload'`,\n serializer && typeof serializer.pushPayload === 'function'\n );\n serializer.pushPayload(this, payload);\n}\n\n// TODO @runspired @deprecate records should implement their own serialization if desired\nexport function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown {\n upgradeStore(this);\n // TODO we used to check if the record was destroyed here\n if (!this._fetchManager) {\n this._fetchManager = new FetchManager(this);\n }\n\n return this._fetchManager.createSnapshot(recordIdentifierFor(record)).serialize(options);\n}\n\nexport function cleanup(this: Store) {\n upgradeStore(this);\n // enqueue destruction of any adapters/serializers we have created\n for (const adapterName in this._adapterCache) {\n const adapter = this._adapterCache[adapterName];\n if (typeof adapter.destroy === 'function') {\n adapter.destroy();\n }\n }\n\n for (const serializerName in this._serializerCache) {\n const serializer = this._serializerCache[serializerName];\n if (typeof serializer.destroy === 'function') {\n serializer.destroy();\n }\n }\n}\n"],"names":["_findHasMany","adapter","store","identifier","link","relationship","options","promise","Promise","resolve","then","snapshot","_fetchManager","createSnapshot","useLink","relatedLink","href","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","findHasMany","adapterPayload","type","name","JSON","stringify","payloadIsNotBlank","modelClass","modelFor","serializer","serializerFor","payload","normalizeResponseHelper","id","Array","isArray","data","syncRelationshipDataFromLink","_push","_findBelongsTo","adapterFor","findBelongsTo","links","meta","parentIdentifier","relationshipData","iterateData","index","ensureRelationshipIsSetToParent","relatedDataHash","parentPayload","relationships","included","push","parentRelationship","inverse","getInverse","inverseKey","kind","relationshipDataPointsToParent","inspect","thing","quotedType","quotedInverse","expected","expectedModel","got","prefix","path","other","relationshipFetched","includedRecord","message","join","fixRelationshipData","inverseForRelationship","key","definition","schema","fields","get","length","lhs_relationshipName","parentType","i","entry","validateRelationshipEntry","relationshipKind","parentRelationshipData","relData","found","find","v","Object","assign","parentModelID","toString","PotentialLegacyOperations","Set","LegacyNetworkHandler","request","context","next","url","op","has","FetchManager","findRecord","findAll","query","queryRecord","saveRecord","records","identifiers","record","field","pendingRequest","getPendingFetch","String","related","manager","assertIdentifierHasId","reload","scheduleFetch","fetchDataIfNeededForIdentifier","fetches","all","operation","cache","willCommit","saveOptions","SaveOp","fetchManagerPromise","scheduleSave","debug","LOG_PAYLOADS","payloadCopy","parse","console","log","result","_join","didCommit","content","lifetimes","didRequest","status","peekRecord","catch","e","err","adapterDidInvalidate","error","isAdapterError","code","extractErrors","errorsHash","errors","errorsHashToArray","getErrors","jsonApiErrors","title","detail","source","pointer","commitWasRejected","makeArray","value","PRIMARY_ATTRIBUTE_KEY","out","keys","forEach","messages","_instanceCache","recordIsLoaded","shouldReloadRecord","backgroundReload","shouldBackgroundReloadRecord","maybeRecordArray","recordArrayManager","_live","snapshotArray","SnapshotRecordArray","shouldReload","shouldReloadAll","fetch","isUpdating","_findAll","peekAll","shouldBackgroundReloadAll","isAsyncFlush","_recordArray","TESTING","disableTestWaiter","waitForPromise","importSync","recordArray","createArray","populateManagedArray","assertSingleResourceDocument","modelName","_allowMissing","isDestroying","isDestroyed","_adapterCache","create","normalizedModelName","_deprecatingNormalize","owner","getOwner","lookup","undefined","application","_serializerCache","normalize","pushPayload","inputPayload","serializeRecord","recordIdentifierFor","serialize","cleanup","adapterName","destroy","serializerName"],"mappings":";;;;;;AAaO,SAASA,YAAYA,CAC1BC,OAAgC,EAChCC,KAAY,EACZC,UAAkC,EAClCC,IAAsC,EACtCC,YAAgC,EAChCC,OAA0B,EAC1B;EAEA,MAAMC,OAAO,GAAGC,OAAO,CAACC,OAAO,EAAE,CAACC,IAAI,CAAC,MAAM;IAC3C,MAAMC,QAAQ,GAAGT,KAAK,CAACU,aAAa,CAACC,cAAc,CAACV,UAAU,EAAEG,OAAO,CAAC,CAAA;IACxE,MAAMQ,OAAO,GAAG,CAACV,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,CAAA;IACjD,MAAMW,WAAW,GAAGD,OAAO,GAAGV,IAAI,GAAGA,IAAI,CAACY,IAAI,CAAA;IAC9CC,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,MAAA,IAAA,CAAAA,IAAA,EAAA;QAAA,MAAAC,IAAAA,KAAA,CACG,CAAwM,uMAAA,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAAA,EACzMR,WAAW,CAAA,GAAA,EAAA,CAAA;IAEbE,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;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E;AAClD,IAAA,MAAMxL,UAAU,GAAG,IAAI,CAACwL,gBAAgB,CAACU,cAAc,CAAC,CAAA;AACxD,IAAA,IAAI,OAAOlM,UAAU,CAACiM,OAAO,KAAK,UAAU,EAAE;MAC5CjM,UAAU,CAACiM,OAAO,EAAE,CAAA;AACtB,KAAA;AACF,GAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/legacy-network-handler/legacy-data-fetch.ts","../src/legacy-network-handler/legacy-network-handler.ts","../src/index.ts"],"sourcesContent":["import type Store from '@ember-data/store';\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 { LegacyRelationshipSchema as RelationshipSchema } from '@warp-drive/core-types/schema/fields';\nimport type { ExistingResourceObject, JsonApiDocument } from '@warp-drive/core-types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private';\nimport { iterateData, payloadIsNotBlank } from './legacy-data-utils';\nimport type { MinimumAdapterInterface } from './minimum-adapter-interface';\nimport { normalizeResponseHelper } from './serializer-response';\n\nexport function _findHasMany(\n adapter: MinimumAdapterInterface,\n store: Store,\n identifier: StableRecordIdentifier,\n link: string | null | { href: string },\n relationship: RelationshipSchema,\n options: BaseFinderOptions\n) {\n upgradeStore(store);\n const promise = Promise.resolve().then(() => {\n const snapshot = store._fetchManager.createSnapshot(identifier, options);\n const useLink = !link || typeof link === 'string';\n const relatedLink = useLink ? link : link.href;\n assert(\n `Attempted to load a hasMany relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findHasMany'`,\n relatedLink\n );\n assert(\n `Expected the adapter to implement 'findHasMany' but it does not`,\n typeof adapter.findHasMany === 'function'\n );\n return adapter.findHasMany(store, snapshot, relatedLink, relationship);\n });\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findHasMany' request for a ${identifier.type}'s '${\n relationship.name\n }' relationship, using link '${JSON.stringify(link)}' , but the adapter's response did not have any data`,\n payloadIsNotBlank(adapterPayload)\n );\n const modelClass = store.modelFor(relationship.type);\n\n const serializer = store.serializerFor(relationship.type);\n let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findHasMany');\n\n assert(\n `fetched the hasMany relationship '${relationship.name}' for ${identifier.type}:${\n identifier.id\n } with link '${JSON.stringify(\n link\n )}', but no data member is present in the response. If no data exists, the response should set { data: [] }`,\n 'data' in payload && Array.isArray(payload.data)\n );\n\n payload = syncRelationshipDataFromLink(store, payload, identifier as ResourceIdentity, relationship);\n return store._push(payload, true);\n }, null);\n}\n\nexport function _findBelongsTo(\n store: Store,\n identifier: StableRecordIdentifier,\n link: string | null | { href: string },\n relationship: RelationshipSchema,\n options: BaseFinderOptions\n) {\n upgradeStore(store);\n const promise = Promise.resolve().then(() => {\n const adapter = store.adapterFor(identifier.type);\n assert(`You tried to load a belongsTo relationship but you have no adapter (for ${identifier.type})`, adapter);\n assert(\n `You tried to load a belongsTo relationship from a specified 'link' in the original payload but your adapter does not implement 'findBelongsTo'`,\n typeof adapter.findBelongsTo === 'function'\n );\n const snapshot = store._fetchManager.createSnapshot(identifier, options);\n const useLink = !link || typeof link === 'string';\n const relatedLink = useLink ? link : link.href;\n assert(\n `Attempted to load a belongsTo relationship from a specified 'link' in the original payload, but the specified link is empty. You must provide a valid 'link' in the original payload to use 'findBelongsTo'`,\n relatedLink\n );\n return adapter.findBelongsTo(store, snapshot, relatedLink, relationship);\n });\n\n return promise.then((adapterPayload) => {\n const modelClass = store.modelFor(relationship.type);\n const serializer = store.serializerFor(relationship.type);\n let payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findBelongsTo');\n\n assert(\n `fetched the belongsTo relationship '${relationship.name}' for ${identifier.type}:${\n identifier.id\n } with link '${JSON.stringify(\n link\n )}', but no data member is present in the response. If no data exists, the response should set { data: null }`,\n 'data' in payload && (payload.data === null || (typeof payload.data === 'object' && !Array.isArray(payload.data)))\n );\n\n if (!payload.data && !payload.links && !payload.meta) {\n return null;\n }\n\n payload = syncRelationshipDataFromLink(store, payload, identifier as ResourceIdentity, relationship);\n\n return store._push(payload, true);\n }, null);\n}\n\n// sync\n// iterate over records in payload.data\n// for each record\n// assert that record.relationships[inverse] is either undefined (so we can fix it)\n// or provide a data: {id, type} that matches the record that requested it\n// return the relationship data for the parent\nfunction syncRelationshipDataFromLink(\n store: Store,\n payload: JsonApiDocument,\n parentIdentifier: ResourceIdentity,\n relationship: RelationshipSchema\n) {\n // ensure the right hand side (incoming payload) points to the parent record that\n // requested this relationship\n const relationshipData = payload.data\n ? iterateData(payload.data, (data, index) => {\n const { id, type } = data;\n ensureRelationshipIsSetToParent(data, parentIdentifier, store, relationship, index);\n return { id, type };\n })\n : null;\n\n const relatedDataHash = {} as JsonApiDocument;\n\n if ('meta' in payload) {\n relatedDataHash.meta = payload.meta;\n }\n if ('links' in payload) {\n relatedDataHash.links = payload.links;\n }\n if ('data' in payload) {\n relatedDataHash.data = relationshipData;\n }\n\n // now, push the left hand side (the parent record) to ensure things are in sync, since\n // the payload will be pushed with store._push\n const parentPayload = {\n id: parentIdentifier.id,\n type: parentIdentifier.type,\n relationships: {\n [relationship.name]: relatedDataHash,\n },\n };\n\n if (!Array.isArray(payload.included)) {\n payload.included = [];\n }\n payload.included.push(parentPayload);\n\n return payload;\n}\n\ntype ResourceIdentity = { id: string; type: string };\ntype RelationshipData = ResourceIdentity | ResourceIdentity[] | null;\n\nfunction ensureRelationshipIsSetToParent(\n payload: ExistingResourceObject,\n parentIdentifier: ResourceIdentity,\n store: Store,\n parentRelationship: RelationshipSchema,\n index: number\n) {\n const { id, type } = payload;\n\n if (!payload.relationships) {\n payload.relationships = {};\n }\n const { relationships } = payload;\n\n const inverse = getInverse(store, parentIdentifier, parentRelationship, type);\n if (inverse) {\n const { inverseKey, kind } = inverse;\n\n const relationshipData = relationships[inverseKey]?.data as RelationshipData | undefined;\n\n if (DEBUG) {\n if (\n typeof relationshipData !== 'undefined' &&\n !relationshipDataPointsToParent(relationshipData, parentIdentifier)\n ) {\n const inspect = function inspect(thing: unknown) {\n return `'${JSON.stringify(thing)}'`;\n };\n const quotedType = inspect(type);\n const quotedInverse = inspect(inverseKey);\n const expected = inspect({\n id: parentIdentifier.id,\n type: parentIdentifier.type,\n });\n const expectedModel = `${parentIdentifier.type}:${parentIdentifier.id}`;\n const got = inspect(relationshipData);\n const prefix = typeof index === 'number' ? `data[${index}]` : `data`;\n const path = `${prefix}.relationships.${inverseKey}.data`;\n const data = Array.isArray(relationshipData) ? relationshipData[0] : relationshipData;\n const other = data ? `<${data.type}:${data.id}>` : null;\n const relationshipFetched = `${expectedModel}.${parentRelationship.kind}(\"${parentRelationship.name}\")`;\n const includedRecord = `<${type}:${id}>`;\n const message = [\n `Encountered mismatched relationship: Ember Data expected ${path} in the payload from ${relationshipFetched} to include ${expected} but got ${got} instead.\\n`,\n `The ${includedRecord} record loaded at ${prefix} in the payload specified ${other} as its ${quotedInverse}, but should have specified ${expectedModel} (the record the relationship is being loaded from) as its ${quotedInverse} instead.`,\n `This could mean that the response for ${relationshipFetched} may have accidentally returned ${quotedType} records that aren't related to ${expectedModel} and could be related to a different ${parentIdentifier.type} record instead.`,\n `Ember Data has corrected the ${includedRecord} record's ${quotedInverse} relationship to ${expectedModel} so that ${relationshipFetched} will include ${includedRecord}.`,\n `Please update the response from the server or change your serializer to either ensure that the response for only includes ${quotedType} records that specify ${expectedModel} as their ${quotedInverse}, or omit the ${quotedInverse} relationship from the response.`,\n ].join('\\n');\n\n assert(message);\n }\n }\n\n if (kind !== 'hasMany' || typeof relationshipData !== 'undefined') {\n relationships[inverseKey] = relationships[inverseKey] || {};\n relationships[inverseKey].data = fixRelationshipData(relationshipData ?? null, kind, parentIdentifier);\n }\n }\n}\n\nfunction inverseForRelationship(store: Store, identifier: { type: string; id?: string }, key: string) {\n const definition = store.schema.fields(identifier).get(key);\n if (!definition) {\n return null;\n }\n assert(\n `Expected the field definition to be a relationship`,\n definition.kind === 'hasMany' || definition.kind === 'belongsTo'\n );\n assert(\n `Expected the relationship defintion to specify the inverse type or null.`,\n definition.options?.inverse === null ||\n (typeof definition.options?.inverse === 'string' && definition.options.inverse.length > 0)\n );\n return definition.options.inverse;\n}\n\nfunction getInverse(\n store: Store,\n parentIdentifier: ResourceIdentity,\n parentRelationship: RelationshipSchema,\n type: string\n) {\n const { name: lhs_relationshipName } = parentRelationship;\n const { type: parentType } = parentIdentifier;\n const inverseKey = inverseForRelationship(store, { type: parentType }, lhs_relationshipName);\n\n if (inverseKey) {\n const definition = store.schema.fields({ type }).get(inverseKey);\n assert(\n `Expected the field definition to be a relationship`,\n definition && (definition.kind === 'hasMany' || definition.kind === 'belongsTo')\n );\n return {\n inverseKey,\n kind: definition.kind,\n };\n }\n}\n\nfunction relationshipDataPointsToParent(relationshipData: RelationshipData, identifier: ResourceIdentity): boolean {\n if (relationshipData === null) {\n return false;\n }\n\n if (Array.isArray(relationshipData)) {\n if (relationshipData.length === 0) {\n return false;\n }\n for (let i = 0; i < relationshipData.length; i++) {\n const entry = relationshipData[i];\n if (validateRelationshipEntry(entry, identifier)) {\n return true;\n }\n }\n } else {\n return validateRelationshipEntry(relationshipData, identifier);\n }\n\n return false;\n}\n\nfunction fixRelationshipData(\n relationshipData: RelationshipData,\n relationshipKind: 'hasMany' | 'belongsTo',\n { id, type }: ResourceIdentity\n) {\n const parentRelationshipData = {\n id,\n type,\n };\n\n let payload: { type: string; id: string } | { type: string; id: string }[] | null = null;\n\n if (relationshipKind === 'hasMany') {\n const relData = (relationshipData as { type: string; id: string }[]) || [];\n if (relationshipData) {\n assert('expected the relationship data to be an array', Array.isArray(relationshipData));\n // these arrays could be massive so this is better than filter\n // Note: this is potentially problematic if type/id are not in the\n // same state of normalization.\n const found = relationshipData.find((v) => {\n return v.type === parentRelationshipData.type && v.id === parentRelationshipData.id;\n });\n if (!found) {\n relData.push(parentRelationshipData);\n }\n } else {\n relData.push(parentRelationshipData);\n }\n payload = relData;\n } else {\n const relData = (relationshipData as { type: string; id: string }) || {};\n Object.assign(relData, parentRelationshipData);\n payload = relData;\n }\n\n return payload;\n}\n\nfunction validateRelationshipEntry({ id }: ResourceIdentity, { id: parentModelID }: ResourceIdentity): boolean {\n return !!id && id.toString() === parentModelID;\n}\n","import { importSync } from '@embroider/macros';\n\nimport type { Future, Handler, NextFn, StructuredDataDocument } from '@ember-data/request';\nimport type Store from '@ember-data/store';\nimport type { StoreRequestContext } from '@ember-data/store';\nimport type { CollectionRecordArray } from '@ember-data/store/-private';\nimport type { ModelSchema } from '@ember-data/store/types';\nimport { LOG_PAYLOADS } from '@warp-drive/build-config/debugging';\nimport { DEBUG, TESTING } from '@warp-drive/build-config/env';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { ImmutableRequestInfo } from '@warp-drive/core-types/request';\nimport type { LegacyRelationshipSchema as RelationshipSchema } from '@warp-drive/core-types/schema/fields';\nimport type { SingleResourceDataDocument } from '@warp-drive/core-types/spec/document';\nimport type { ApiError } from '@warp-drive/core-types/spec/error';\nimport type {\n CollectionResourceDocument,\n JsonApiDocument,\n Links,\n PaginationLinks,\n SingleResourceDocument,\n} from '@warp-drive/core-types/spec/json-api-raw';\n\nimport { upgradeStore } from '../-private';\nimport { FetchManager, SaveOp } from './fetch-manager';\nimport { assertIdentifierHasId } from './identifier-has-id';\nimport { _findBelongsTo, _findHasMany } from './legacy-data-fetch';\nimport { payloadIsNotBlank } from './legacy-data-utils';\nimport type { MinimumAdapterInterface } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface';\nimport { normalizeResponseHelper } from './serializer-response';\nimport type { Snapshot } from './snapshot';\nimport { SnapshotRecordArray } from './snapshot-record-array';\n\ntype AdapterErrors = Error & { errors?: unknown[]; isAdapterError?: true; code?: string };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nconst PotentialLegacyOperations = new Set([\n 'findRecord',\n 'findAll',\n 'query',\n 'queryRecord',\n 'findBelongsTo',\n 'findHasMany',\n 'updateRecord',\n 'createRecord',\n 'deleteRecord',\n]);\n\nexport const LegacyNetworkHandler: Handler = {\n request<T>(context: StoreRequestContext, next: NextFn<T>): Future<T> | Promise<StructuredDataDocument<T>> {\n // if we are not a legacy request, move on\n if (context.request.url || !context.request.op || !PotentialLegacyOperations.has(context.request.op)) {\n return next(context.request);\n }\n\n const { store } = context.request;\n upgradeStore(store);\n if (!store._fetchManager) {\n store._fetchManager = new FetchManager(store);\n }\n\n switch (context.request.op) {\n case 'findRecord':\n return findRecord(context);\n case 'findAll':\n return findAll(context);\n case 'query':\n return query(context);\n case 'queryRecord':\n return queryRecord(context);\n case 'findBelongsTo':\n return findBelongsTo(context);\n case 'findHasMany':\n return findHasMany(context);\n case 'updateRecord':\n return saveRecord(context);\n case 'createRecord':\n return saveRecord(context);\n case 'deleteRecord':\n return saveRecord(context);\n default:\n return next(context.request);\n }\n },\n};\n\nfunction findBelongsTo<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, records: identifiers } = context.request;\n const { options, record, links, useLink, field } = data as {\n record: StableRecordIdentifier;\n options: Record<string, unknown>;\n links?: Links;\n useLink: boolean;\n field: RelationshipSchema;\n };\n const identifier = identifiers?.[0];\n upgradeStore(store);\n\n // short circuit if we are already loading\n const pendingRequest =\n identifier && store._fetchManager.getPendingFetch(identifier as StableExistingRecordIdentifier, options);\n if (pendingRequest) {\n return pendingRequest as Promise<T>;\n }\n\n if (useLink) {\n assert(`Expected a related link when calling store.findBelongsTo, found ${String(links)}`, links && links.related);\n return _findBelongsTo(store, record, links.related, field, options) as Promise<T>;\n }\n\n assert(`Expected an identifier`, Array.isArray(identifiers) && identifiers.length === 1);\n\n const manager = store._fetchManager;\n assertIdentifierHasId(identifier);\n\n return options.reload\n ? (manager.scheduleFetch(identifier, options, context.request) as Promise<T>)\n : (manager.fetchDataIfNeededForIdentifier(identifier, options, context.request) as Promise<T>);\n}\n\nfunction findHasMany<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, records: identifiers } = context.request;\n const { options, record, links, useLink, field } = data as {\n record: StableRecordIdentifier;\n options: Record<string, unknown>;\n links?: PaginationLinks | Links;\n useLink: boolean;\n field: RelationshipSchema;\n };\n upgradeStore(store);\n\n // link case\n if (useLink) {\n const adapter = store.adapterFor(record.type);\n /*\n If a relationship was originally populated by the adapter as a link\n (as opposed to a list of IDs), this method is called when the\n relationship is fetched.\n\n The link (which is usually a URL) is passed through unchanged, so the\n adapter can make whatever request it wants.\n\n The usual use-case is for the server to register a URL as a link, and\n then use that URL in the future to make a request for the relationship.\n */\n assert(`You tried to load a hasMany relationship but you have no adapter (for ${record.type})`, adapter);\n assert(\n `You tried to load a hasMany relationship from a specified 'link' in the original payload but your adapter does not implement 'findHasMany'`,\n typeof adapter.findHasMany === 'function'\n );\n assert(`Expected a related link when calling store.findHasMany, found ${String(links)}`, links && links.related);\n\n return _findHasMany(adapter, store, record, links.related, field, options) as Promise<T>;\n }\n\n // identifiers case\n assert(`Expected an array of identifiers to fetch`, Array.isArray(identifiers));\n const fetches = new Array<globalThis.Promise<StableRecordIdentifier>>(identifiers.length);\n const manager = store._fetchManager;\n\n for (let i = 0; i < identifiers.length; i++) {\n const identifier = identifiers[i];\n // TODO we probably can be lenient here and return from cache for the isNew case\n assertIdentifierHasId(identifier);\n fetches[i] = options.reload\n ? manager.scheduleFetch(identifier, options, context.request)\n : manager.fetchDataIfNeededForIdentifier(identifier, options, context.request);\n }\n\n return Promise.all(fetches) as Promise<T>;\n}\n\nfunction saveRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data, op: operation } = context.request;\n const { options, record: identifier } = data as { record: StableRecordIdentifier; options: Record<string, unknown> };\n\n upgradeStore(store);\n\n store.cache.willCommit(identifier, context);\n\n const saveOptions = Object.assign(\n { [SaveOp]: operation as 'updateRecord' | 'deleteRecord' | 'createRecord' },\n options\n );\n const fetchManagerPromise = store._fetchManager.scheduleSave(identifier, saveOptions);\n\n return fetchManagerPromise\n .then((payload) => {\n if (LOG_PAYLOADS) {\n try {\n const payloadCopy: unknown = payload ? JSON.parse(JSON.stringify(payload)) : payload;\n // eslint-disable-next-line no-console\n console.log(`EmberData | Payload - ${operation}`, payloadCopy);\n } catch {\n // eslint-disable-next-line no-console\n console.log(`EmberData | Payload - ${operation}`, payload);\n }\n }\n let result: SingleResourceDataDocument;\n store._join(() => {\n // @ts-expect-error we don't have access to a response in legacy\n result = store.cache.didCommit(identifier, { request: context.request, content: payload });\n });\n\n // blatantly lie if we were a createRecord request\n // to give some semblance of cache-control to the\n // CachePolicy while legacy is still around\n if (store.lifetimes?.didRequest && operation === 'createRecord') {\n store.lifetimes.didRequest(context.request, { status: 201 } as Response, null, store);\n }\n return store.peekRecord(result!.data!);\n })\n .catch((e: unknown) => {\n let err = e;\n if (!e) {\n err = new Error(`Unknown Error Occurred During Request`);\n } else if (typeof e === 'string') {\n err = new Error(e);\n }\n adapterDidInvalidate(store, identifier, err as Error);\n throw err;\n }) as Promise<T>;\n}\n\nfunction adapterDidInvalidate(\n store: Store,\n identifier: StableRecordIdentifier,\n error: Error & { errors?: ApiError[]; isAdapterError?: true; code?: string }\n) {\n upgradeStore(store);\n if (error && error.isAdapterError === true && error.code === 'InvalidError') {\n const serializer = store.serializerFor(identifier.type) as SerializerWithParseErrors;\n\n // TODO @deprecate extractErrors being called\n // TODO remove extractErrors from the default serializers.\n if (serializer && typeof serializer.extractErrors === 'function') {\n const errorsHash = serializer.extractErrors(\n store,\n store.modelFor(identifier.type),\n error,\n identifier.id\n ) as Record<string, string | string[]>;\n error.errors = errorsHashToArray(errorsHash);\n }\n }\n const cache = store.cache;\n\n if (error.errors) {\n assert(\n `Expected the cache in use by resource ${String(\n identifier\n )} to have a getErrors(identifier) method for retrieving errors.`,\n typeof cache.getErrors === 'function'\n );\n\n let jsonApiErrors: ApiError[] = error.errors;\n if (jsonApiErrors.length === 0) {\n jsonApiErrors = [{ title: 'Invalid Error', detail: '', source: { pointer: '/data' } }];\n }\n cache.commitWasRejected(identifier, jsonApiErrors);\n } else {\n cache.commitWasRejected(identifier);\n }\n}\n\nfunction makeArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\nfunction errorsHashToArray(errors: Record<string, string | string[]>): ApiError[] {\n const out: ApiError[] = [];\n\n if (errors) {\n Object.keys(errors).forEach((key) => {\n const messages = makeArray(errors[key]);\n for (let i = 0; i < messages.length; i++) {\n let title = 'Invalid Attribute';\n let pointer = `/data/attributes/${key}`;\n if (key === PRIMARY_ATTRIBUTE_KEY) {\n title = 'Invalid Document';\n pointer = `/data`;\n }\n out.push({\n title: title,\n detail: messages[i],\n source: {\n pointer: pointer,\n },\n });\n }\n });\n }\n\n return out;\n}\n\nfunction findRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n const { record: identifier, options } = data as {\n record: StableExistingRecordIdentifier;\n options: { reload?: boolean; backgroundReload?: boolean };\n };\n upgradeStore(store);\n let promise: Promise<StableRecordIdentifier>;\n\n // if not loaded start loading\n if (!store._instanceCache.recordIsLoaded(identifier)) {\n promise = store._fetchManager.fetchDataIfNeededForIdentifier(identifier, options, context.request);\n\n // Refetch if the reload option is passed\n } else if (options.reload) {\n assertIdentifierHasId(identifier);\n\n promise = store._fetchManager.scheduleFetch(identifier, options, context.request);\n } else {\n let snapshot: Snapshot | null = null;\n const adapter = store.adapterFor(identifier.type);\n\n // Refetch the record if the adapter thinks the record is stale\n if (\n typeof options.reload === 'undefined' &&\n adapter.shouldReloadRecord &&\n adapter.shouldReloadRecord(store, (snapshot = store._fetchManager.createSnapshot(identifier, options)))\n ) {\n assertIdentifierHasId(identifier);\n if (DEBUG) {\n promise = store._fetchManager.scheduleFetch(\n identifier,\n Object.assign({}, options, { reload: true }),\n context.request\n );\n } else {\n options.reload = true;\n promise = store._fetchManager.scheduleFetch(identifier, options, context.request);\n }\n } else {\n // Trigger the background refetch if backgroundReload option is passed\n if (\n options.backgroundReload !== false &&\n (options.backgroundReload ||\n !adapter.shouldBackgroundReloadRecord ||\n adapter.shouldBackgroundReloadRecord(\n store,\n (snapshot = snapshot || store._fetchManager.createSnapshot(identifier, options))\n ))\n ) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n void store._fetchManager.scheduleFetch(\n identifier,\n Object.assign({}, options, { backgroundReload: true }),\n context.request\n );\n } else {\n options.backgroundReload = true;\n void store._fetchManager.scheduleFetch(identifier, options, context.request);\n }\n }\n\n // Return the cached record\n promise = Promise.resolve(identifier) as Promise<StableRecordIdentifier>;\n }\n }\n\n return promise.then((i: StableRecordIdentifier) => store.peekRecord(i)) as Promise<T>;\n}\n\nfunction findAll<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n const { type, options } = data as {\n type: string;\n options: { reload?: boolean; backgroundReload?: boolean };\n };\n upgradeStore(store);\n const adapter = store.adapterFor(type);\n\n assert(`You tried to load all records but you have no adapter (for ${type})`, adapter);\n assert(\n `You tried to load all records but your adapter does not implement 'findAll'`,\n typeof adapter.findAll === 'function'\n );\n\n // avoid initializing the liveArray just to set `isUpdating`\n const maybeRecordArray = store.recordArrayManager._live.get(type);\n const snapshotArray = new SnapshotRecordArray(store, type, options);\n\n const shouldReload =\n options.reload ||\n (options.reload !== false &&\n ((adapter.shouldReloadAll && adapter.shouldReloadAll(store, snapshotArray)) ||\n (!adapter.shouldReloadAll && snapshotArray.length === 0)));\n\n let fetch: Promise<T> | undefined;\n if (shouldReload) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n maybeRecordArray && (maybeRecordArray.isUpdating = true);\n fetch = _findAll(adapter, store, type, snapshotArray, context.request, true);\n } else {\n fetch = Promise.resolve(store.peekAll(type)) as Promise<T>;\n\n if (\n options.backgroundReload ||\n (options.backgroundReload !== false &&\n (!adapter.shouldBackgroundReloadAll || adapter.shouldBackgroundReloadAll(store, snapshotArray)))\n ) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n maybeRecordArray && (maybeRecordArray.isUpdating = true);\n void _findAll(adapter, store, type, snapshotArray, context.request, false);\n }\n }\n\n return fetch;\n}\n\nfunction _findAll<T>(\n adapter: MinimumAdapterInterface,\n store: Store,\n type: string,\n snapshotArray: SnapshotRecordArray,\n request: ImmutableRequestInfo,\n isAsyncFlush: boolean\n): Promise<T> {\n const schema = store.modelFor(type);\n let promise: Promise<T> = Promise.resolve().then(() =>\n adapter.findAll(store, schema, null, snapshotArray)\n ) as Promise<T>;\n\n promise = promise.then((adapterPayload: T) => {\n assert(\n `You made a 'findAll' request for '${type}' records, but the adapter's response did not have any data`,\n payloadIsNotBlank(adapterPayload)\n );\n upgradeStore(store);\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(serializer, store, schema, adapterPayload, null, 'findAll');\n\n store._push(payload, isAsyncFlush);\n snapshotArray._recordArray.isUpdating = false;\n\n if (LOG_PAYLOADS) {\n // eslint-disable-next-line no-console\n console.log(`request: findAll<${type}> background reload complete`);\n }\n return snapshotArray._recordArray;\n }) as Promise<T>;\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <PT>(promise: Promise<PT>) => Promise<PT>;\n };\n promise = waitForPromise(promise);\n }\n }\n\n return promise;\n}\n\nfunction query<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n upgradeStore(store);\n let { options } = data as {\n options: { _recordArray?: CollectionRecordArray; adapterOptions?: Record<string, unknown> };\n };\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { type, query } = data as {\n type: string;\n query: Record<string, unknown>;\n options: { _recordArray?: CollectionRecordArray; adapterOptions?: Record<string, unknown> };\n };\n const adapter = store.adapterFor(type);\n\n assert(`You tried to make a query but you have no adapter (for ${type})`, adapter);\n assert(`You tried to make a query but your adapter does not implement 'query'`, typeof adapter.query === 'function');\n\n const recordArray =\n options._recordArray ||\n store.recordArrayManager.createArray({\n type,\n query,\n });\n\n if (DEBUG) {\n options = Object.assign({}, options);\n delete options._recordArray;\n } else {\n delete options._recordArray;\n }\n const schema = store.modelFor(type);\n const promise = Promise.resolve().then(() => adapter.query(store, schema, query, recordArray, options));\n\n return promise.then((adapterPayload) => {\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(\n serializer,\n store,\n schema,\n adapterPayload as Record<string, unknown>,\n null,\n 'query'\n );\n const identifiers = store._push(payload, true);\n\n assert(\n 'The response to store.query is expected to be an array but it was a single record. Please wrap your response in an array or use `store.queryRecord` to query for a single record.',\n Array.isArray(identifiers)\n );\n\n store.recordArrayManager.populateManagedArray(recordArray, identifiers, payload as CollectionResourceDocument);\n\n return recordArray;\n }) as Promise<T>;\n}\n\nfunction assertSingleResourceDocument(payload: JsonApiDocument): asserts payload is SingleResourceDocument {\n assert(\n `Expected the primary data returned by the serializer for a 'queryRecord' response to be a single object or null but instead it was an array.`,\n !Array.isArray(payload.data)\n );\n}\n\nfunction queryRecord<T>(context: StoreRequestContext): Promise<T> {\n const { store, data } = context.request;\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { type, query, options } = data as { type: string; query: Record<string, unknown>; options: object };\n upgradeStore(store);\n const adapter = store.adapterFor(type);\n\n assert(`You tried to make a query but you have no adapter (for ${type})`, adapter);\n assert(\n `You tried to make a query but your adapter does not implement 'queryRecord'`,\n typeof adapter.queryRecord === 'function'\n );\n\n const schema = store.modelFor(type);\n const promise = Promise.resolve().then(() => adapter.queryRecord(store, schema, query, options)) as Promise<T>;\n\n return promise.then((adapterPayload: T) => {\n const serializer = store.serializerFor(type);\n const payload = normalizeResponseHelper(\n serializer,\n store,\n schema,\n adapterPayload as Record<string, unknown>,\n null,\n 'queryRecord'\n );\n\n assertSingleResourceDocument(payload);\n\n const identifier = store._push(payload, true) as StableRecordIdentifier;\n return identifier ? store.peekRecord(identifier) : null;\n }) as Promise<T>;\n}\n","import { getOwner } from '@ember/application';\n\nimport type Store from '@ember-data/store';\nimport { recordIdentifierFor } from '@ember-data/store';\nimport { _deprecatingNormalize } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\n\nimport { FetchManager, upgradeStore } from './-private';\nimport type { AdapterPayload, MinimumAdapterInterface } from './legacy-network-handler/minimum-adapter-interface';\nimport type {\n MinimumSerializerInterface,\n SerializerOptions,\n} from './legacy-network-handler/minimum-serializer-interface';\n\nexport { LegacyNetworkHandler } from './legacy-network-handler/legacy-network-handler';\n\nexport type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };\n\n/**\n * @module @ember-data/store\n * @class Store\n */\nexport type LegacyStoreCompat = {\n _fetchManager: FetchManager;\n adapterFor(this: Store, modelName: string): MinimumAdapterInterface;\n adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;\n\n serializerFor<K extends string>(modelName: K, _allowMissing?: boolean): MinimumSerializerInterface | null;\n\n normalize(modelName: string, payload: ObjectValue): ObjectValue;\n pushPayload(modelName: string, payload: ObjectValue): void;\n serializeRecord(record: unknown, options?: SerializerOptions): unknown;\n\n _adapterCache: Record<string, MinimumAdapterInterface & { store: Store }>;\n _serializerCache: Record<string, MinimumSerializerInterface & { store: Store }>;\n};\n\nexport type CompatStore = Store & LegacyStoreCompat;\n\n/**\n Returns an instance of the adapter for a given type. For\n example, `adapterFor('person')` will return an instance of\n the adapter located at `app/adapters/person.js`\n\n If no `person` adapter is found, this method will look\n for an `application` adapter (the default adapter for\n your entire application).\n\n @method adapterFor\n @public\n @param {String} modelName\n @return Adapter\n */\nexport function adapterFor(this: Store, modelName: string): MinimumAdapterInterface;\nexport function adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;\nexport function adapterFor(this: Store, modelName: string, _allowMissing?: true): MinimumAdapterInterface | undefined {\n assert(\n `Attempted to call store.adapterFor(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's adapterFor method`, modelName);\n assert(\n `Passing classes to store.adapterFor has been removed. Please pass a dasherized string instead of ${modelName}`,\n typeof modelName === 'string'\n );\n upgradeStore(this);\n this._adapterCache =\n this._adapterCache || (Object.create(null) as Record<string, MinimumAdapterInterface & { store: Store }>);\n\n const normalizedModelName = _deprecatingNormalize(modelName);\n\n const { _adapterCache } = this;\n let adapter: (MinimumAdapterInterface & { store: Store }) | undefined = _adapterCache[normalizedModelName];\n if (adapter) {\n return adapter;\n }\n\n const owner = getOwner(this)!;\n\n // name specific adapter\n adapter = owner.lookup(`adapter:${normalizedModelName}`) as (MinimumAdapterInterface & { store: Store }) | undefined;\n if (adapter !== undefined) {\n _adapterCache[normalizedModelName] = adapter;\n return adapter;\n }\n\n // no adapter found for the specific name, fallback and check for application adapter\n adapter = _adapterCache.application || owner.lookup('adapter:application');\n if (adapter !== undefined) {\n _adapterCache[normalizedModelName] = adapter;\n _adapterCache.application = adapter;\n return adapter;\n }\n\n assert(\n `No adapter was found for '${modelName}' and no 'application' adapter was found as a fallback.`,\n _allowMissing\n );\n}\n\n/**\n Returns an instance of the serializer for a given type. For\n example, `serializerFor('person')` will return an instance of\n `App.PersonSerializer`.\n\n If no `App.PersonSerializer` is found, this method will look\n for an `App.ApplicationSerializer` (the default serializer for\n your entire application).\n\n If a serializer cannot be found on the adapter, it will fall back\n to an instance of `JSONSerializer`.\n\n @method serializerFor\n @public\n @param {String} modelName the record to serialize\n @return {Serializer}\n */\nexport function serializerFor(this: Store, modelName: string): MinimumSerializerInterface | null {\n assert(\n `Attempted to call store.serializerFor(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's serializerFor method`, modelName);\n assert(\n `Passing classes to store.serializerFor has been removed. Please pass a dasherized string instead of ${modelName}`,\n typeof modelName === 'string'\n );\n upgradeStore(this);\n this._serializerCache =\n this._serializerCache || (Object.create(null) as Record<string, MinimumSerializerInterface & { store: Store }>);\n const normalizedModelName = _deprecatingNormalize(modelName);\n\n const { _serializerCache } = this;\n let serializer: (MinimumSerializerInterface & { store: Store }) | undefined = _serializerCache[normalizedModelName];\n if (serializer) {\n return serializer;\n }\n\n // by name\n const owner = getOwner(this)!;\n serializer = owner.lookup(`serializer:${normalizedModelName}`) as\n | (MinimumSerializerInterface & { store: Store })\n | undefined;\n if (serializer !== undefined) {\n _serializerCache[normalizedModelName] = serializer;\n return serializer;\n }\n\n // no serializer found for the specific model, fallback and check for application serializer\n serializer = _serializerCache.application || owner.lookup('serializer:application');\n if (serializer !== undefined) {\n _serializerCache[normalizedModelName] = serializer;\n _serializerCache.application = serializer;\n return serializer;\n }\n\n return null;\n}\n\n/**\n `normalize` converts a json payload into the normalized form that\n [push](../methods/push?anchor=push) expects.\n\n Example\n\n ```js\n socket.on('message', function(message) {\n let modelName = message.model;\n let data = message.data;\n store.push(store.normalize(modelName, data));\n });\n ```\n\n @method normalize\n @public\n @param {String} modelName The name of the model type for this payload\n @param {Object} payload\n @return {Object} The normalized payload\n */\n// TODO @runspired @deprecate users should call normalize on the associated serializer directly\nexport function normalize(this: Store, modelName: string, payload: ObjectValue) {\n upgradeStore(this);\n assert(\n `Attempted to call store.normalize(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n assert(`You need to pass a model name to the store's normalize method`, modelName);\n assert(\n `Passing classes to store methods has been removed. Please pass a dasherized string instead of ${typeof modelName}`,\n typeof modelName === 'string'\n );\n const normalizedModelName = _deprecatingNormalize(modelName);\n const serializer = this.serializerFor(normalizedModelName);\n const schema = this.modelFor(normalizedModelName);\n assert(\n `You must define a normalize method in your serializer in order to call store.normalize`,\n typeof serializer?.normalize === 'function'\n );\n return serializer.normalize(schema, payload);\n}\n\n/**\n Push some raw data into the store.\n\n This method can be used both to push in brand new\n records, as well as to update existing records. You\n can push in more than one type of object at once.\n All objects should be in the format expected by the\n serializer.\n\n ```app/serializers/application.js\n import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n ```\n\n ```js\n let pushData = {\n posts: [\n { id: 1, postTitle: \"Great post\", commentIds: [2] }\n ],\n comments: [\n { id: 2, commentBody: \"Insightful comment\" }\n ]\n }\n\n store.pushPayload(pushData);\n ```\n\n By default, the data will be deserialized using a default\n serializer (the application serializer if it exists).\n\n Alternatively, `pushPayload` will accept a model type which\n will determine which serializer will process the payload.\n\n ```app/serializers/application.js\n import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n ```\n\n ```app/serializers/post.js\n import JSONSerializer from '@ember-data/serializer/json';\n\n export default JSONSerializer;\n ```\n\n ```js\n store.pushPayload(pushData); // Will use the application serializer\n store.pushPayload('post', pushData); // Will use the post serializer\n ```\n\n @method pushPayload\n @public\n @param {String} modelName Optionally, a model type used to determine which serializer will be used\n @param {Object} inputPayload\n */\n// TODO @runspired @deprecate pushPayload in favor of looking up the serializer\nexport function pushPayload(this: Store, modelName: string, inputPayload: ObjectValue): void {\n upgradeStore(this);\n assert(\n `Attempted to call store.pushPayload(), but the store instance has already been destroyed.`,\n !(this.isDestroying || this.isDestroyed)\n );\n\n const payload: ObjectValue = inputPayload || (modelName as unknown as ObjectValue);\n const normalizedModelName = inputPayload ? _deprecatingNormalize(modelName) : 'application';\n const serializer = this.serializerFor(normalizedModelName);\n\n assert(\n `You cannot use 'store.pushPayload(<type>, <payload>)' unless the serializer for '${normalizedModelName}' defines 'pushPayload'`,\n serializer && typeof serializer.pushPayload === 'function'\n );\n serializer.pushPayload(this, payload);\n}\n\n// TODO @runspired @deprecate records should implement their own serialization if desired\nexport function serializeRecord(this: Store, record: unknown, options?: SerializerOptions): unknown {\n upgradeStore(this);\n // TODO we used to check if the record was destroyed here\n if (!this._fetchManager) {\n this._fetchManager = new FetchManager(this);\n }\n\n return this._fetchManager.createSnapshot(recordIdentifierFor(record)).serialize(options);\n}\n\nexport function cleanup(this: Store) {\n upgradeStore(this);\n // enqueue destruction of any adapters/serializers we have created\n for (const adapterName in this._adapterCache) {\n const adapter = this._adapterCache[adapterName];\n if (typeof adapter.destroy === 'function') {\n adapter.destroy();\n }\n }\n\n for (const serializerName in this._serializerCache) {\n const serializer = this._serializerCache[serializerName];\n if (typeof serializer.destroy === 'function') {\n serializer.destroy();\n }\n }\n}\n"],"names":["_findHasMany","adapter","store","identifier","link","relationship","options","promise","Promise","resolve","then","snapshot","_fetchManager","createSnapshot","useLink","relatedLink","href","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","findHasMany","adapterPayload","type","name","JSON","stringify","payloadIsNotBlank","modelClass","modelFor","serializer","serializerFor","payload","normalizeResponseHelper","id","Array","isArray","data","syncRelationshipDataFromLink","_push","_findBelongsTo","adapterFor","findBelongsTo","links","meta","parentIdentifier","relationshipData","iterateData","index","ensureRelationshipIsSetToParent","relatedDataHash","parentPayload","relationships","included","push","parentRelationship","inverse","getInverse","inverseKey","kind","relationshipDataPointsToParent","inspect","thing","quotedType","quotedInverse","expected","expectedModel","got","prefix","path","other","relationshipFetched","includedRecord","message","join","fixRelationshipData","inverseForRelationship","key","definition","schema","fields","get","length","lhs_relationshipName","parentType","i","entry","validateRelationshipEntry","relationshipKind","parentRelationshipData","relData","found","find","v","Object","assign","parentModelID","toString","PotentialLegacyOperations","Set","LegacyNetworkHandler","request","context","next","url","op","has","FetchManager","findRecord","findAll","query","queryRecord","saveRecord","records","identifiers","record","field","pendingRequest","getPendingFetch","String","related","manager","assertIdentifierHasId","reload","scheduleFetch","fetchDataIfNeededForIdentifier","fetches","all","operation","cache","willCommit","saveOptions","SaveOp","fetchManagerPromise","scheduleSave","debug","LOG_PAYLOADS","payloadCopy","parse","console","log","result","_join","didCommit","content","lifetimes","didRequest","status","peekRecord","catch","e","err","adapterDidInvalidate","error","isAdapterError","code","extractErrors","errorsHash","errors","errorsHashToArray","getErrors","jsonApiErrors","title","detail","source","pointer","commitWasRejected","makeArray","value","PRIMARY_ATTRIBUTE_KEY","out","keys","forEach","messages","_instanceCache","recordIsLoaded","shouldReloadRecord","backgroundReload","shouldBackgroundReloadRecord","maybeRecordArray","recordArrayManager","_live","snapshotArray","SnapshotRecordArray","shouldReload","shouldReloadAll","fetch","isUpdating","_findAll","peekAll","shouldBackgroundReloadAll","isAsyncFlush","_recordArray","TESTING","disableTestWaiter","waitForPromise","importSync","recordArray","createArray","populateManagedArray","assertSingleResourceDocument","modelName","_allowMissing","isDestroying","isDestroyed","_adapterCache","create","normalizedModelName","_deprecatingNormalize","owner","getOwner","lookup","undefined","application","_serializerCache","normalize","pushPayload","inputPayload","serializeRecord","recordIdentifierFor","serialize","cleanup","adapterName","destroy","serializerName"],"mappings":";;;;;;AAaO,SAASA,YAAYA,CAC1BC,OAAgC,EAChCC,KAAY,EACZC,UAAkC,EAClCC,IAAsC,EACtCC,YAAgC,EAChCC,OAA0B,EAC1B;EAEA,MAAMC,OAAO,GAAGC,OAAO,CAACC,OAAO,EAAE,CAACC,IAAI,CAAC,MAAM;IAC3C,MAAMC,QAAQ,GAAGT,KAAK,CAACU,aAAa,CAACC,cAAc,CAACV,UAAU,EAAEG,OAAO,CAAC,CAAA;IACxE,MAAMQ,OAAO,GAAG,CAACV,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,CAAA;IACjD,MAAMW,WAAW,GAAGD,OAAO,GAAGV,IAAI,GAAGA,IAAI,CAACY,IAAI,CAAA;IAC9CC,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,MAAA,IAAA,CAAAA,IAAA,EAAA;QAAA,MAAAC,IAAAA,KAAA,CACE,CAAyM,uMAAA,CAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAAA,EACzMR,WAAW,CAA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AACiO,OAAO,EAAE,CAAA;AACnB,KAAA;AACF,GAAA;AAEA,EAAA,KAAK,MAAMC,cAAc,IAAI,IAAI,CAACV,gBAAgB,EAAE;AAClD,IAAA,MAAMxL,UAAU,GAAG,IAAI,CAACwL,gBAAgB,CAACU,cAAc,CAAC,CAAA;AACxD,IAAA,IAAI,OAAOlM,UAAU,CAACiM,OAAO,KAAK,UAAU,EAAE;MAC5CjM,UAAU,CAACiM,OAAO,EAAE,CAAA;AACtB,KAAA;AACF,GAAA;AACF;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-data/legacy-compat",
3
3
  "description": "Compatibility Shims for Older EmberData",
4
- "version": "5.3.9",
4
+ "version": "5.3.10",
5
5
  "license": "MIT",
6
6
  "author": "Chris Thoburn <runspired@users.noreply.github.com>",
7
7
  "repository": {
@@ -35,13 +35,11 @@
35
35
  },
36
36
  "./*": {
37
37
  "default": "./dist/*.js"
38
+ },
39
+ "./unstable-preview-types": {
40
+ "types": "./unstable-preview-types/index.d.ts"
38
41
  }
39
42
  },
40
- "scripts": {
41
- "lint": "eslint . --quiet --cache --cache-strategy=content --report-unused-disable-directives",
42
- "build:pkg": "vite build;",
43
- "sync-hardlinks": "bun run sync-dependencies-meta-injected"
44
- },
45
43
  "ember-addon": {
46
44
  "main": "addon-main.cjs",
47
45
  "type": "addon",
@@ -83,38 +81,51 @@
83
81
  },
84
82
  "dependencies": {
85
83
  "@embroider/macros": "^1.16.6",
86
- "@warp-drive/build-config": "0.0.0-beta.7"
84
+ "@warp-drive/build-config": "0.0.0"
87
85
  },
88
86
  "peerDependencies": {
89
- "@ember-data/graph": "5.3.9",
90
- "@ember-data/json-api": "5.3.9",
91
- "@ember-data/request": "5.3.9",
92
- "@ember-data/request-utils": "5.3.9",
93
- "@ember-data/store": "5.3.9",
94
- "@ember/test-waiters": "^3.1.0",
95
- "@warp-drive/core-types": "0.0.0-beta.12"
87
+ "ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
88
+ "@ember-data/graph": "5.3.10",
89
+ "@ember-data/json-api": "5.3.10",
90
+ "@ember-data/request": "5.3.10",
91
+ "@ember-data/request-utils": "5.3.10",
92
+ "@ember-data/store": "5.3.10",
93
+ "@ember/test-waiters": "^3.1.0 || >= 4.0.0",
94
+ "@warp-drive/core-types": "0.0.0"
96
95
  },
97
96
  "devDependencies": {
98
97
  "@babel/core": "^7.24.5",
99
98
  "@babel/plugin-transform-typescript": "^7.24.5",
100
99
  "@babel/preset-env": "^7.24.5",
101
100
  "@babel/preset-typescript": "^7.24.1",
102
- "@ember-data/graph": "5.3.9",
103
- "@ember-data/json-api": "5.3.9",
104
- "@ember-data/request": "5.3.9",
105
- "@ember-data/request-utils": "5.3.9",
106
- "@ember-data/store": "5.3.9",
107
- "@ember-data/tracking": "5.3.9",
101
+ "@ember-data/graph": "5.3.10",
102
+ "@ember-data/json-api": "5.3.10",
103
+ "@ember-data/request": "5.3.10",
104
+ "@ember-data/request-utils": "5.3.10",
105
+ "@ember-data/store": "5.3.10",
106
+ "@ember-data/tracking": "5.3.10",
108
107
  "@ember/test-waiters": "^3.1.0",
109
108
  "@glimmer/component": "^1.1.2",
110
- "@warp-drive/core-types": "0.0.0-beta.12",
111
- "@warp-drive/internal-config": "5.3.9",
109
+ "@warp-drive/core-types": "0.0.0",
110
+ "@warp-drive/internal-config": "5.3.10",
112
111
  "ember-source": "~5.12.0",
113
112
  "pnpm-sync-dependencies-meta-injected": "0.0.14",
114
- "typescript": "^5.4.5",
113
+ "typescript": "^5.7.2",
115
114
  "vite": "^5.2.11"
116
115
  },
117
116
  "ember": {
118
117
  "edition": "octane"
118
+ },
119
+ "typesVersions": {
120
+ "*": {
121
+ "unstable-preview-types": [
122
+ "./unstable-preview-types"
123
+ ]
124
+ }
125
+ },
126
+ "scripts": {
127
+ "lint": "eslint . --quiet --cache --cache-strategy=content",
128
+ "build:pkg": "vite build;",
129
+ "sync-hardlinks": "bun run sync-dependencies-meta-injected"
119
130
  }
120
- }
131
+ }
@@ -1,21 +1,21 @@
1
- /// <reference path="./builders.d.ts" />
2
1
  /// <reference path="./utils.d.ts" />
2
+ /// <reference path="./builders.d.ts" />
3
3
  /// <reference path="./-private.d.ts" />
4
- /// <reference path="./builders/find-record.d.ts" />
5
- /// <reference path="./builders/query.d.ts" />
6
4
  /// <reference path="./builders/utils.d.ts" />
7
- /// <reference path="./builders/save-record.d.ts" />
8
5
  /// <reference path="./builders/find-all.d.ts" />
9
- /// <reference path="./legacy-network-handler/legacy-data-fetch.d.ts" />
10
- /// <reference path="./legacy-network-handler/fetch-manager.d.ts" />
6
+ /// <reference path="./builders/query.d.ts" />
7
+ /// <reference path="./builders/save-record.d.ts" />
8
+ /// <reference path="./builders/find-record.d.ts" />
11
9
  /// <reference path="./legacy-network-handler/minimum-adapter-interface.d.ts" />
12
- /// <reference path="./legacy-network-handler/minimum-serializer-interface.d.ts" />
13
- /// <reference path="./legacy-network-handler/snapshot.d.ts" />
14
- /// <reference path="./legacy-network-handler/legacy-network-handler.d.ts" />
15
10
  /// <reference path="./legacy-network-handler/serializer-response.d.ts" />
11
+ /// <reference path="./legacy-network-handler/legacy-data-utils.d.ts" />
12
+ /// <reference path="./legacy-network-handler/legacy-network-handler.d.ts" />
16
13
  /// <reference path="./legacy-network-handler/snapshot-record-array.d.ts" />
14
+ /// <reference path="./legacy-network-handler/legacy-data-fetch.d.ts" />
15
+ /// <reference path="./legacy-network-handler/fetch-manager.d.ts" />
17
16
  /// <reference path="./legacy-network-handler/identifier-has-id.d.ts" />
18
- /// <reference path="./legacy-network-handler/legacy-data-utils.d.ts" />
17
+ /// <reference path="./legacy-network-handler/snapshot.d.ts" />
18
+ /// <reference path="./legacy-network-handler/minimum-serializer-interface.d.ts" />
19
19
  declare module '@ember-data/legacy-compat' {
20
20
  import type Store from '@ember-data/store';
21
21
  import type { ObjectValue } from '@warp-drive/core-types/json/raw';
@@ -41,7 +41,7 @@ declare module '@ember-data/legacy-compat/legacy-network-handler/fetch-manager'
41
41
  scheduleFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions, request: ImmutableRequestInfo): Promise<StableExistingRecordIdentifier>;
42
42
  getPendingFetch(identifier: StableExistingRecordIdentifier, options: FindRecordOptions): Promise<StableExistingRecordIdentifier<string>> | undefined;
43
43
  flushAllPendingFetches(): void;
44
- fetchDataIfNeededForIdentifier(identifier: StableExistingRecordIdentifier, options: FindRecordOptions<unknown> | undefined, request: ImmutableRequestInfo): Promise<StableExistingRecordIdentifier>;
44
+ fetchDataIfNeededForIdentifier(identifier: StableExistingRecordIdentifier, options: FindRecordOptions | undefined, request: ImmutableRequestInfo): Promise<StableExistingRecordIdentifier>;
45
45
  destroy(): void;
46
46
  }
47
47
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-manager.d.ts","sourceRoot":"","sources":["../../src/legacy-network-handler/fetch-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAGV,OAAO,EACP,mBAAmB,EAEpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,iBAAiB,EAAe,MAAM,yBAAyB,CAAC;AAI9E,OAAO,KAAK,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,KAAK,EAA8B,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAQnH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,QAAQ,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAMxD,eAAO,MAAM,MAAM,8BAA6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