diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Adapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Adapter.json deleted file mode 100644 index b23a3e36a..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Adapter.json +++ /dev/null @@ -1,600 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5- Adapter", - "type": "class", - "attributes": { - "name": " Adapter", - "shortname": " Adapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/experimental-preview-types", - "namespace": "", - "file": "../../ember-data-types/q/minimum-adapter-interface.ts", - "line": 19, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

The following documentation describes the methods an\n adapter should implement with descriptions around when an\n application might expect these methods to be called.

\n

Methods that are not required are marked as optional.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 38, - "description": "

adapter.findRecord takes a request for a resource of a given type and id combination\nand should return a Promise which fulfills with data for a single resource matching that\ntype and id.

\n

The response will be fed to the associated serializer's normalizeResponse method with the\nrequestType set to findRecord, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data for the record.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

adapter.findRecord is called whenever the store needs to load, reload, or backgroundReload\nthe resource data for a given type and id.

\n", - "itemtype": "method", - "name": "findRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 67, - "description": "

adapter.findAll takes a request for resources of a given type and should return\n a Promise which fulfills with a collection of resource data matching that type.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to findAll, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing records for type. Existing records for the type will not be removed.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

adapter.findAll is called whenever store.findAll is asked to reload or backgroundReload.\nThe records in the response are merged with the contents of the store. Existing records for\nthe type will not be removed.

\n

See also shouldReloadAll and shouldBackgroundReloadAll

\n", - "itemtype": "method", - "name": "findAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "sinceToken", - "description": "This parameter is no longer used and will always be null.", - "type": "Null" - }, - { - "name": "snapshotRecordArray", - "description": "an object containing any passed in options,\n adapterOptions, and the ability to access a snapshot for each existing record of the type.", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 104, - "description": "

adapter.query takes a request for resources of a given type and should return\n a Promise which fulfills with a collection of resource data matching that type.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to query, which should return a JSON:API document.

\n

As with findAll, the final result after normalization to JSON:API will be added to\nstore via store.push where it will merge with any existing records for type.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

adapter.query is called whenever store.query is called or a previous query result is\nasked to reload.

\n

Existing records for the type will not be removed. The key difference is in the result\nreturned by the store. For findAll the result is all known records of the type,\nwhile for query it will only be the records returned from adapter.query.

\n", - "itemtype": "method", - "name": "query", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 143, - "description": "

adapter.queryRecord takes a request for resource of a given type and should return\n a Promise which fulfills with data for a single resource matching that type.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to queryRecord, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data for the returned record.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n", - "itemtype": "method", - "name": "queryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "query", - "description": "" - }, - { - "name": "options", - "description": "" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 173, - "description": "

adapter.createRecord takes a request to create a resource of a given type and should\nreturn a Promise which fulfills with data for the newly created resource.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to createRecord, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data for the record.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

If the adapter rejects or throws an error the record will enter an error state and the attributes\nthat had attempted to be saved will still be considered dirty.

\n

InvalidErrors

\n

When rejecting a createRecord request due to validation issues during save (typically a 422 status code),\nyou may throw an InvalidError.

\n

Throwing an InvalidError makes per-attribute errors available for records to use in the UI as needed.\nRecords can also use this information to mark themselves as being in an invalid state.\nFor more reading see the RecordData Errors RFC

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
let error = new Error(errorMessage);\n\n// these two properties combined\n// alert EmberData to this error being for\n// invalid properties on the record during\n// the request\nerror.isAdapterError = true;\nerror.code = 'InvalidError';\n\n// A JSON:API formatted array of errors\n// See https://jsonapi.org/format/#errors\nerror.errors = [];\n\nthrow error;
\n
\n
\n \n", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 226, - "description": "

adapter.updateRecord takes a request to update a resource of a given type and should\nreturn a Promise which fulfills with the updated data for the resource.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to updateRecord, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data for the record.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

If the adapter rejects or throws an error the record will enter an error state and the attributes\nthat had attempted to be saved will still be considered dirty.

\n

InvalidErrors

\n

When rejecting a createRecord request due to validation issues during save (typically a 422 status code),\nyou may throw an InvalidError.

\n

Throwing an InvalidError makes per-attribute errors available for records to use in the UI as needed.\nRecords can also use this information to mark themselves as being in an invalid state.\nFor more reading see the RecordData Errors RFC

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
let error = new Error(errorMessage);\n\n// these two properties combined\n// alert EmberData to this error being for\n// invalid properties on the record during\n// the request\nerror.isAdapterError = true;\nerror.code = 'InvalidError';\n\n// A JSON:API formatted array of errors\n// See https://jsonapi.org/format/#errors\nerror.errors = [];\n\nthrow error;
\n
\n
\n \n", - "itemtype": "method", - "name": "updateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 278, - "description": "

adapter.deleteRecord takes a request to delete a resource of a given type and\nshould return a Promise which resolves when that deletion is complete.

\n

Usually the response will be empty, but you may include additional updates in the\nresponse. The response will be fed to the associated serializer's normalizeResponse method\nwith the requestType set to deleteRecord, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

If the adapter rejects or errors the record will need to be saved again once the reason\nfor the error is addressed in order to persist the deleted state.

\n", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the record's current data", - "type": "Snapshot" - } - ], - "return": { - "description": "" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 306, - "description": "

adapter.findBelongsTo takes a request to fetch a related resource located at a\nrelatedLink and should return a Promise which fulfills with data for a single\n resource.

\n

⚠️ This method is only called if the store previously received relationship information for a resource\ncontaining a related link.

\n

If the cache does not have a link for the relationship then findRecord will be used if a type and id\nfor the related resource is known.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to findBelongsTo, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n", - "itemtype": "method", - "name": "findBelongsTo [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the parent record's current data", - "type": "Snapshot" - }, - { - "name": "relatedLink", - "description": "The link at which the associated resource might be found", - "type": "String" - }, - { - "name": "relationship", - "description": "", - "type": "RelationshipSchema" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 343, - "description": "

adapter.findHasMany takes a request to fetch a related resource collection located\n at a relatedLink and should return a Promise which fulfills with data for that\n collection.

\n

⚠️ This method is only called if the store previously received relationship information for a resource\ncontaining a related link.

\n

If the cache does not have a link for the relationship but the type and id of\nrelated resources are known then findRecord will be used for each individual related\nresource.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to findHasMany, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n", - "itemtype": "method", - "name": "findhasMany [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the parent record's current data", - "type": "Snapshot" - }, - { - "name": "relatedLink", - "description": "The link at which the associated resource collection might be found", - "type": "String" - }, - { - "name": "relationship", - "description": "", - "type": "RelationshipSchema" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 381, - "description": "

⚠️ This Method is only called if coalesceFindRequests is true. The array passed to it is determined\nby the adapter's groupRecordsForFindMany method, and will be called once per group returned.

\n

adapter.findMany takes a request to fetch a collection of resources and should return a\nPromise which fulfills with data for that collection.

\n

The response will be fed to the associated serializer's normalizeResponse method\n with the requestType set to findMany, which should return a JSON:API document.

\n

The final result after normalization to JSON:API will be added to store via store.push where\nit will merge with any existing data.

\n

⚠️ If the adapter's response resolves to a false-y value, the associated serializer.normalizeResponse\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.

\n

See also groupRecordsForFindMany and coalesceFindRequests

\n", - "itemtype": "method", - "name": "findMany [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "ids", - "description": "An array of the ids of the resources to fetch", - "type": "Array" - }, - { - "name": "snapshots", - "description": "An array of snapshots of the available data for the resources to fetch", - "type": "Array" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 412, - "description": "

This method provides the ability to generate an ID to assign to a new record whenever store.createRecord\nis called if no id was provided.

\n

Alternatively you can pass an id into the call to store.createRecord directly.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
let id = generateNewId(type);\nlet newRecord = store.createRecord(type, { id });
\n
\n
\n \n", - "itemtype": "method", - "name": "generateIdForRecord [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "type", - "description": "The type (or modelName) of record being created", - "type": "String" - }, - { - "name": "properties", - "description": "the properties passed as the second arg to `store.createRecord`" - } - ], - "return": { - "description": "a string ID that should be unique (no other models of `type` in the cache should have this `id`)", - "type": "String" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 452, - "description": "

⚠️ This Method is only called if coalesceFindRequests is true.

\n

This method allows for you to split pending requests for records into multiple findMany\nrequests. It receives an array of snapshots where each snapshot represents a unique record\nrequested via store.findRecord during the most recent runloop that was not found in the\ncache or needs to be reloaded. It should return an array of groups.

\n

A group is an array of snapshots meant to be fetched together by a single findMany request.

\n

By default if this method is not implemented EmberData will call findMany once with all\nrequested records as a single group when coalesceFindRequests is true.

\n

See also findMany and coalesceFindRequests

\n", - "itemtype": "method", - "name": "groupRecordsForFindMany [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshots", - "description": "An array of snapshots", - "type": "Array" - } - ], - "return": { - "description": "An array of Snapshot arrays", - "type": "Array>" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 476, - "description": "

When a record is already available in the store and is requested again via store.findRecord,\nand reload is not specified as an option in the request, this method is called to determine\nwhether the record should be reloaded prior to returning the result.

\n

If reload is specified as an option in the request (true or false) this method will not\nbe called.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.findRecord('user', '1', { reload: false })
\n
\n
\n \n

The default behavior if this method is not implemented and the option is not specified is to\nnot reload, the same as a return of false.

\n

See also the documentation for shouldBackgroundReloadRecord which defaults to true.

\n", - "itemtype": "method", - "name": "shouldReloadRecord [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the record's current data", - "type": "Snapshot" - } - ], - "return": { - "description": "true if the record should be reloaded immediately, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 502, - "description": "

When store.findAll(<type>) is called without a reload option, the adapter\nis presented the opportunity to trigger a new request for records of that type.

\n

If reload is specified as an option in the request (true or false) this method will not\nbe called.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.findAll('user', { reload: false })
\n
\n
\n \n

The default behavior if this method is not implemented and the option is not specified is to\nnot reload, the same as a return of false.

\n

Note: the Promise returned by store.findAll resolves to the same RecordArray instance\nreturned by store.peekAll for that type, and will include all records in the store for\nthe given type, including any previously existing records not returned by the reload request.

\n", - "itemtype": "method", - "name": "shouldReloadAll [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshotArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "true if the a new request for all records of the type in SnapshotRecordArray should be made immediately, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 529, - "description": "

When a record is already available in the store and is requested again via store.findRecord,\nand the record does not need to be reloaded prior to return, this method provides the ability\nto specify whether a refresh of the data for the reload should be scheduled to occur in the background.

\n

Users may explicitly declare a record should/should not be background reloaded by passing\nbackgroundReload: true or backgroundReload: false as an option to the request respectively.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.findRecord('user', '1', { backgroundReload: false })
\n
\n
\n \n

If the backgroundReload option is not present, this method will be called to determine whether\na backgroundReload should be performed.

\n

The default behavior if this method is not implemented and the option was not specified is to\nbackground reload, the same as a return of true.

\n", - "itemtype": "method", - "name": "shouldBackgroundReloadRecord [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the record's current data", - "type": "Snapshot" - } - ], - "return": { - "description": "true if the record should be reloaded in the background, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 556, - "description": "

When store.findAll(<type>) is called and a reload is not initiated, the adapter\nis presented the opportunity to trigger a new non-blocking (background) request for\nrecords of that type

\n

Users may explicitly declare that this background request should/should not occur by passing\nbackgroundReload: true or backgroundReload: false as an option to the request respectively.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.findAll('user', { backgroundReload: false })
\n
\n
\n \n

The default behavior if this method is not implemented and the option is not specified is to\nperform a reload, the same as a return of true.

\n", - "itemtype": "method", - "name": "shouldBackgroundReloadAll [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshotArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "true if the a new request for all records of the type in SnapshotRecordArray should be made in the background, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 580, - "description": "

In some situations the adapter may need to perform cleanup when destroyed,\nthat cleanup can be done in destroy.

\n

If not implemented, the store does not inform the adapter of destruction.

\n", - "itemtype": "method", - "name": "destroy [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - } - ], - "events": [], - "properties": [ - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 433, - "description": "

If your adapter implements findMany, setting this to true will cause findRecord\nrequests triggered within the same runloop to be coalesced into one or more calls\nto adapter.findMany. The number of calls made and the records contained in each call\ncan be tuned by your adapter's groupRecordsForHasMany method.

\n

Implementing coalescing using this flag and the associated methods does not always offer\nthe right level of correctness, timing control or granularity. If your application would\nbe better suited coalescing across multiple types, coalescing for longer than a single runloop,\nor with a more custom request structure, coalescing within your application adapter may prove\nmore effective.

\n", - "itemtype": "property", - "name": "coalesceFindRequests [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "type": "{boolean} true if the requests to find individual records should be coalesced, false otherwise", - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/experimental-preview-types", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Cache.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Cache.json deleted file mode 100644 index 0498085b1..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Cache.json +++ /dev/null @@ -1,646 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5- Cache", - "type": "class", - "attributes": { - "name": " Cache", - "shortname": " Cache", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/experimental-preview-types", - "namespace": "", - "file": "../../ember-data-types/cache/cache.ts", - "line": 16, - "description": "

The interface for EmberData Caches.

\n

A Cache handles in-memory storage of Document and Resource\ndata.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../ember-data-types/cache/cache.ts", - "line": 38, - "description": "

Cache the response to a request

\n

Unlike store.push which has UPSERT\nsemantics, put has replace semantics similar to\nthe http method PUT

\n

the individually cacheable resource data it may contain\nshould upsert, but the document data surrounding it should\nfully replace any existing information

\n

Note that in order to support inserting arbitrary data\nto the cache that did not originate from a request put\nshould expect to sometimes encounter a document with only\na content member and therefor must not assume the existence\nof request and response on the document.

\n", - "itemtype": "method", - "name": "put", - "params": [ - { - "name": "doc", - "description": "", - "type": "StructuredDocument" - } - ], - "return": { - "description": "", - "type": "ResourceDocument" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 62, - "description": "

Update the "remote" or "canonical" (persisted) state of the Cache\nby merging new information into the existing state.

\n

Note: currently the only valid resource operation is a MergeOperation\nwhich occurs when a collision of identifiers is detected.

\n", - "itemtype": "method", - "name": "patch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "op", - "description": "the operation to perform", - "type": "Operation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 76, - "description": "

Update the "local" or "current" (unpersisted) state of the Cache

\n", - "itemtype": "method", - "name": "mutate", - "params": [ - { - "name": "mutation", - "description": "", - "type": "Mutation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 86, - "description": "

Peek resource data from the Cache.

\n

In development, if the return value\nis JSON the return value\nwill be deep-cloned and deep-frozen\nto prevent mutation thereby enforcing cache\nImmutability.

\n

This form of peek is useful for implementations\nthat want to feed raw-data from cache to the UI\nor which want to interact with a blob of data\ndirectly from the presentation cache.

\n

An implementation might want to do this because\nde-referencing records which read from their own\nblob is generally safer because the record does\nnot require retainining connections to the Store\nand Cache to present data on a per-field basis.

\n

This generally takes the place of getAttr as\nan API and may even take the place of getRelationship\ndepending on implementation specifics, though this\nlatter usage is less recommended due to the advantages\nof the Graph handling necessary entanglements and\nnotifications for relational data.

\n", - "itemtype": "method", - "name": "peek", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier | StableDocumentIdentifier" - } - ], - "return": { - "description": "the known resource data", - "type": "ResourceDocument | ResourceBlob | null" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 121, - "description": "

Peek the Cache for the existing request data associated with\na cacheable request

\n", - "itemtype": "method", - "name": "peekRequest", - "params": [ - { - "name": "UNKNOWN", - "description": "", - "type": "StableDocumentIdentifier" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 132, - "description": "

Push resource data from a remote source into the cache for this identifier

\n", - "itemtype": "method", - "name": "upsert", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - }, - { - "name": "hasRecord", - "description": "" - } - ], - "return": { - "description": "if `hasRecord` is true then calculated key changes should be returned", - "type": "Void | string[]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 147, - "description": "

Create a fork of the cache from the current state.

\n

Applications should typically not call this method themselves,\npreferring instead to fork at the Store level, which will\nutilize this method to fork the cache.

\n", - "itemtype": "method", - "name": "fork", - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 160, - "description": "

Merge a fork back into a parent Cache.

\n

Applications should typically not call this method themselves,\npreferring instead to merge at the Store level, which will\nutilize this method to merge the caches.

\n", - "itemtype": "method", - "name": "merge", - "params": [ - { - "name": "cache", - "description": "", - "type": "Cache" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 174, - "description": "

Generate the list of changes applied to all\nrecord in the store.

\n

Each individual resource or document that has\nbeen mutated should be described as an individual\nChange entry in the returned array.

\n

A Change is described by an object containing up to\nthree properties: (1) the identifier of the entity that\nchanged; (2) the op code of that change being one of\nupsert or remove, and if the op is upsert a patch\ncontaining the data to merge into the cache for the given\nentity.

\n

This patch is opaque to the Store but should be understood\nby the Cache and may expect to be utilized by an Adapter\nwhen generating data during a save operation.

\n

It is generally recommended that the patch contain only\nthe updated state, ignoring fields that are unchanged

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
interface Change {\n identifier: StableRecordIdentifier | StableDocumentIdentifier;\n op: 'upsert' | 'remove';\n patch?: unknown;\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "diff", - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 212, - "description": "

Serialize the entire contents of the Cache into a Stream\nwhich may be fed back into a new instance of the same Cache\nvia cache.hydrate.

\n", - "itemtype": "method", - "name": "dump", - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 223, - "description": "

hydrate a Cache from a Stream with content previously serialized\nfrom another instance of the same Cache, resolving when hydration\nis complete.

\n

This method should expect to be called both in the context of restoring\nthe Cache during application rehydration after SSR AND at unknown\ntimes during the lifetime of an already booted application when it is\ndesired to bulk-load additional information into the cache. This latter\nbehavior supports optimizing pre/fetching of data for route transitions\nvia data-only SSR modes.

\n", - "itemtype": "method", - "name": "hydrate", - "params": [ - { - "name": "stream", - "description": "", - "type": "ReadableStream" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 245, - "description": "

[LIFECYCLE] Signal to the cache that a new record has been instantiated on the client

\n

It returns properties from options that should be set on the record during the create\nprocess. This return value behavior is deprecated.

\n", - "itemtype": "method", - "name": "clientDidCreate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "createArgs", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 258, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwill be part of a save transaction.

\n", - "itemtype": "method", - "name": "willCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 268, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwas successfully updated as part of a save transaction.

\n", - "itemtype": "method", - "name": "didCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "- the primary identifier that was operated on" - }, - { - "name": "data", - "description": "- a document in the cache format containing any updated data" - } - ], - "return": { - "description": "", - "type": "SingleResourceDataDocument" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 280, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwas update via a save transaction failed.

\n", - "itemtype": "method", - "name": "commitWasRejected", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "errors", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 291, - "description": "

[LIFECYCLE] Signals to the cache that all data for a resource\nshould be cleared.

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 306, - "description": "

Retrieve the data for an attribute from the cache

\n", - "itemtype": "method", - "name": "getAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "", - "type": "Unknown" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 317, - "description": "

Mutate the data for an attribute in the cache

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "setAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - }, - { - "name": "value", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 330, - "description": "

Query the cache for the changed attributes of a resource.

\n", - "itemtype": "method", - "name": "changedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": ": [, ]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 340, - "description": "

Query the cache for whether any mutated attributes exist

\n", - "itemtype": "method", - "name": "hasChangedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 350, - "description": "

Tell the cache to discard any uncommitted mutations to attributes

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "rollbackAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "the names of fields that were restored", - "type": "String[]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 362, - "description": "

Query the cache for the current state of a relationship property

\n", - "itemtype": "method", - "name": "getRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "resource relationship object" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 380, - "description": "

Update the cache state for the given resource to be marked\nas locally deleted, or remove such a mark.

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "setIsDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "isDeleted", - "description": "", - "type": "Boolean" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 393, - "description": "

Query the cache for any validation errors applicable to the given resource.

\n", - "itemtype": "method", - "name": "getErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "JsonApiError[]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 403, - "description": "

Query the cache for whether a given resource has any available data

\n", - "itemtype": "method", - "name": "isEmpty", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 413, - "description": "

Query the cache for whether a given resource was created locally and not\nyet persisted.

\n", - "itemtype": "method", - "name": "isNew", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 424, - "description": "

Query the cache for whether a given resource is marked as deleted (but not\nnecessarily persisted yet).

\n", - "itemtype": "method", - "name": "isDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 435, - "description": "

Query the cache for whether a given resource has been deleted and that deletion\nhas also been persisted.

\n", - "itemtype": "method", - "name": "isDeletionCommitted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - } - ], - "events": [], - "properties": [ - { - "file": "../ember-data-types/cache/cache.ts", - "line": 26, - "description": "

The Cache Version that this implementation implements.

\n", - "type": "{'2'}", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "version", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/experimental-preview-types", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Handler.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Handler.json deleted file mode 100644 index cf95cf8e9..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Handler.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5- Handler", - "type": "class", - "attributes": { - "name": " Handler", - "shortname": " Handler", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request", - "namespace": "", - "file": "../request/src/-private/types.ts", - "line": 202, - "description": "

Requests are fulfilled by handlers. A handler receives the request context\nas well as a next function with which to pass along a request to the next\nhandler if it so chooses.

\n

A handler may be any object with a request method. This allows both stateful and non-stateful\nhandlers to be utilized.

\n

If a handler calls next, it receives a Future which resolves to a StructuredDocument\nthat it can then compose how it sees fit with its own response.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
type NextFn<P> = (req: RequestInfo) => Future<P>;\n\ninterface Handler {\n async request<T>(context: RequestContext, next: NextFn<P>): T;\n}
\n
\n
\n \n

RequestContext contains a readonly version of the RequestInfo as well as a few methods for building up the StructuredDocument and Future that will be part of the response.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
interface RequestContext<T> {\n readonly request: RequestInfo;\n\n setStream(stream: ReadableStream | Promise<ReadableStream>): void;\n setResponse(response: Response | ResponseInfo): void;\n}
\n
\n
\n \n

A basic fetch handler with support for streaming content updates while\nthe download is still underway might look like the following, where we use\nresponse.clone() to tee the ReadableStream into two streams.

\n

A more efficient handler might read from the response stream, building up the\nresponse content before passing along the chunk downstream.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
const FetchHandler = {\n async request(context) {\n   const response = await fetch(context.request);\n   context.setResponse(reponse);\n   context.setStream(response.clone().body);\n\n   return response.json();\n }\n}
\n
\n
\n \n

Stream Currying

\n

RequestManager.request and next differ from fetch in one crucial detail in that the outer Promise resolves only once the response stream has been processed.

\n

For context, it helps to understand a few of the use-cases that RequestManager\nis intended to allow.

\n
    \n
  • to manage and return streaming content (such as video files)
  • \n
  • to fulfill a request from multiple sources or by splitting one request into multiple requests
      \n
    • for instance one API call for a user and another for the user's friends
    • \n
    • or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB etc.) and the rest from another source (a different API, a WebWorker, etc.)
    • \n
    \n
  • \n
  • to coalesce multiple requests
  • \n
  • to decorate a request with additional info
      \n
    • e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.
    • \n
    \n
  • \n
\n
\n

await fetch(<req>) resolves at the moment headers are received. This allows for the body of the request to be processed as a stream by application\ncode while chunks are still being received by the browser.

\n

When an app chooses to await response.json() what occurs is the browser reads the stream to completion and then returns the result. Additionally, this stream may only be read once.

\n

The RequestManager preserves this ability to subscribe to and utilize the stream by either the application or the handler – thereby delivering the full power and flexibility of native APIs – without restricting developers in ways that lead to complicated workarounds.

\n

Each handler may call setStream only once, but may do so at any time until the promise that the handler returns has resolved. The associated promise returned by calling future.getStream will resolve with the stream set by setStream if that method is called, or null if that method\nhas not been called by the time that the handler's request method has resolved.

\n

Handlers that do not create a stream of their own, but which call next, should defensively pipe the stream forward. While this is not required (see automatic currying below) it is better to do so in most cases as otherwise the stream may not become available to downstream handlers or the application until the upstream handler has fully read it.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
context.setStream(future.getStream());
\n
\n
\n \n

Handlers that either call next multiple times or otherwise have reason to create multiple fetch requests should either choose to return no stream, meaningfully combine the streams, or select a single prioritized stream.

\n

Of course, any handler may choose to read and handle the stream, and return either no stream or a different stream in the process.

\n

Automatic Currying of Stream and Response

\n

In order to simplify the common case for handlers which decorate a request, if next is called only a single time and setResponse was never called by the handler, the response set by the next handler in the chain will be applied to that handler's outcome. For instance, this makes the following pattern possible return (await next(<req>)).content;.

\n

Similarly, if next is called only a single time and neither setStream nor getStream was called, we automatically curry the stream from the future returned by next onto the future returned by the handler.

\n

Finally, if the return value of a handler is a Future, we curry content and errors as well, thus enabling the simplest form return next(<req>).

\n

In the case of the Future being returned, Stream proxying is automatic and immediate and does not wait for the Future to resolve.

\n

Handler Order

\n

Request handlers are registered by configuring the manager via use

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
const manager = new RequestManager();\n\nmanager.use([Handler1, Handler2]);
\n
\n
\n \n

Handlers will be invoked in the order they are registered ("fifo", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/request/src/-private/types.ts", - "line": 315, - "description": "

Method to implement to handle requests. Receives the request\ncontext and a nextFn to call to pass-along the request to\nother handlers.

\n", - "itemtype": "method", - "name": "request", - "access": "public", - "tagname": "", - "params": [ - { - "name": "context", - "description": "" - }, - { - "name": "next", - "description": "" - } - ], - "class": " Handler", - "module": "@ember-data/request" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/request", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Serializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Serializer.json deleted file mode 100644 index eb7936744..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5- Serializer.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5- Serializer", - "type": "class", - "attributes": { - "name": " Serializer", - "shortname": " Serializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/experimental-preview-types", - "namespace": "", - "file": "../../ember-data-types/q/minimum-serializer-interface.ts", - "line": 26, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

The following documentation describes the methods an application\n serializer should implement with descriptions around when an\n application might expect these methods to be called.

\n

Methods that are not required are marked as optional.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 45, - "description": "

This method is responsible for normalizing the value resolved from the promise returned\nby an Adapter request into the format expected by the Store.

\n

The output should be a JSON:API Document\nwith the following additional restrictions:

\n
    \n
  • type should be formatted in the singular dasherized lowercase form
  • \n
  • members (the property names of attributes and relationships) should be formatted\n to match their definition in the corresponding Model definition. Typically this\n will be camelCase.
  • \n
  • lid is\n a valid optional sibling to id and type in both Resources\n and Resource Identifier Objects
  • \n
\n", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "rawPayload", - "description": "The raw JSON response data returned from an API request.\n This correlates to the value the promise returned by the adapter method that performed\n the request resolved to.", - "type": "JSONObject" - }, - { - "name": "id", - "description": "For a findRecord request, this is the id initially provided\n in the call to store.findRecord. Else this value is null.", - "type": "String|null" - }, - { - "name": "requestType", - "description": "The\n type of request the Adapter had been asked to perform.", - "type": "'findRecord' | 'queryRecord' | 'findAll' | 'findBelongsTo' | 'findHasMany' | 'findMany' | 'query' | 'createRecord' | 'deleteRecord' | 'updateRecord'" - } - ], - "return": { - "description": "a document following the structure of a JSON:API Document.", - "type": "JsonApiDocument" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 93, - "description": "

This method is responsible for serializing an individual record\nvia a Snapshot into the format expected by the API.

\n

This method is called by snapshot.serialize().

\n

When using Model, this method is called by record.serialize().

\n

When using JSONAPIAdapter or RESTAdapter this method is called\nby updateRecord and createRecord if Serializer.serializeIntoHash\nis not implemented.

\n", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "A Snapshot for the record to serialize", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 112, - "description": "

This method is intended to normalize data into a JSON:API Document\nwith a data member containing a single Resource.

\n
    \n
  • type should be formatted in the singular, dasherized and lowercase form
  • \n
  • members (the property names of attributes and relationships) should be formatted\n to match their definition in the corresponding Model definition. Typically this\n will be camelCase.
  • \n
  • lid is\n a valid optional sibling to id and type in both Resources\n and Resource Identifier Objects
  • \n
\n

This method is called by the Store when store.normalize(modelName, payload) is\ncalled. It is recommended to use store.serializerFor(modelName).normalizeResponse\nover store.normalize.

\n

This method may be called when also using the RESTSerializer\nwhen serializer.pushPayload is called by store.pushPayload.\nHowever, it is recommended to use store.push over store.pushPayload after normalizing\nthe payload directly.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
function pushPayload(store, modelName, rawPayload) {\n  const ModelClass = store.modelFor(modelName);\n  const serializer = store.serializerFor(modelName);\n  const jsonApiPayload = serializer.normalizeResponse(store, ModelClass, rawPayload, null, 'query');\n\n  return store.push(jsonApiPayload);\n}
\n
\n
\n \n

This method may be called when also using the JSONAPISerializer\nwhen normalizing included records. If mixing serializer usage in this way\nwe recommend implementing this method, but caution that it may lead\nto unexpected mixing of formats.

\n

This method may also be called when normalizing embedded relationships when\nusing the EmbeddedRecordsMixin. If using this mixin in a serializer in\nyour application we recommend implementing this method, but caution that\nit may lead to unexpected mixing of formats.

\n", - "itemtype": "method", - "name": "normalize [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "rawPayload", - "description": "Some raw JSON data to be normalized into a JSON:API Resource.", - "type": "JSONObject" - }, - { - "name": "prop", - "description": "When called by the EmbeddedRecordsMixin this param will be the\n property at which the object provided as rawPayload was found.", - "type": "String", - "optional": true - } - ], - "return": { - "description": "A JSON:API Document\n containing a single JSON:API Resource\n as its primary data.", - "type": "SingleResourceDocument" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 168, - "description": "

When using JSONAPIAdapter or RESTAdapter this method is called\nby adapter.updateRecord and adapter.createRecord if serializer.serializeIntoHash\nis implemented. If this method is not implemented, serializer.serialize\nwill be called in this case.

\n

You can use this method to customize the root keys serialized into the payload.\nThe hash property should be modified by reference.

\n

For instance, your API may expect resources to be keyed by underscored type in the payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  _user: {\n    type: 'user',\n    id: '1'\n  }\n}
\n
\n
\n \n

Which when using these adapters can be achieved by implementing this method similar\nto the following:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
serializeIntoHash(hash, ModelClass, snapshot, options) {\n  hash[`_${snapshot.modelName}`] = this.serialize(snapshot, options).data;\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeIntoHash [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "hash", - "description": "A top most object of the request payload onto\n which to append the serialized record" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "A Snapshot for the record to serialize", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "optional": true - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 210, - "description": "

This method allows for normalization of data when store.pushPayload is called\nand should be implemented if you want to use that method.

\n

The method is responsible for pushing new data to the store using store.push\nonce any necessary normalization has occurred, and no data in the store will be\nupdated unless it does so.

\n

The normalized form pushed to the store should be a JSON:API Document\nwith the following additional restrictions:

\n
    \n
  • type should be formatted in the singular, dasherized and lowercase form
  • \n
  • members (the property names of attributes and relationships) should be formatted\n to match their definition in the corresponding Model definition. Typically this\n will be camelCase.
  • \n
  • lid is\n a valid optional sibling to id and type in both Resources\n and Resource Identifier Objects
  • \n
\n

If you need better control over normalization or want access to the records being added or updated\nin the store, we recommended using store.push over store.pushPayload after normalizing\nthe payload directly. This can even take advantage of an existing serializer for the format\nthe data is in, for example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
function pushPayload(store, modelName, rawPayload) {\n  const ModelClass = store.modelFor(modelName);\n  const serializer = store.serializerFor(modelName);\n  const jsonApiPayload = serializer.normalizeResponse(store, ModelClass, rawPayload, null, 'query');\n\n  return store.push(jsonApiPayload);\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "pushPayload [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "rawPayload", - "description": "The raw JSON response data returned from an API request.\n This JSON should be in the API format expected by the serializer.", - "type": "JSONObject" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 254, - "description": "

In some situations the serializer may need to perform cleanup when destroyed,\nthat cleanup can be done in destroy.

\n

If not implemented, the store does not inform the serializer of destruction.

\n", - "itemtype": "method", - "name": "destroy [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/experimental-preview-types", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/adapter/rest.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/adapter/rest.json deleted file mode 100644 index a26562417..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/adapter/rest.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/rest", - "type": "class", - "attributes": { - "name": "@ember-data/adapter/rest", - "shortname": "@ember-data/adapter/rest", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/rest", - "namespace": "", - "methods": [ - { - "file": "../packages/adapter/src/rest.ts", - "line": 1497, - "description": "

Helper function that translates the options passed to jQuery.ajax into a format that fetch expects.

\n", - "itemtype": "method", - "name": "fetchOptions", - "params": [ - { - "name": "_options", - "description": "", - "type": "Object" - }, - { - "name": "adapter", - "description": "", - "type": "Adapter" - } - ], - "access": "private", - "tagname": "", - "return": { - "description": "", - "type": "Object" - }, - "class": "@ember-data/adapter/rest", - "module": "@ember-data/adapter/rest" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/rest", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/model.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/model.json deleted file mode 100644 index 928c7402e..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/model.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "class", - "attributes": { - "name": "@ember-data/model", - "shortname": "@ember-data/model", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "methods": [ - { - "file": "../packages/model/src/-private/attr.js", - "line": 14, - "description": "

attr defines an attribute on a Model.\nBy default, attributes are passed through as-is, however you can specify an\noptional type to have the value automatically transformed.\nEmber Data ships with four basic transform types: string, number,\nboolean and date. You can define your own transforms by subclassing\nTransform.

\n

Note that you cannot use attr to define an attribute of id.

\n

attr takes an optional hash as a second parameter, currently\nsupported options are:

\n
    \n
  • defaultValue: Pass a string or a function to be called to set the attribute\nto a default value if and only if the key is absent from the payload response.
  • \n
\n

Example

\n

```app/models/user.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "attr": "('text', {\n uppercase: true\n })\n text;\n}\n```\n\n```app/transforms/text.js\nexport default class TextTransform {\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n }\n\n deserialize(value) {\n return value;\n }\n\n static create() {\n return new this();\n }\n}\n```", - "itemtype": "method", - "name": "attr", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "the attribute type", - "type": "String|Object" - }, - { - "name": "options", - "description": "a hash of options", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Attribute" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/belongs-to.js", - "line": 17, - "description": "

belongsTo is used to define One-To-One and One-To-Many\nrelationships on a Model.

\n

belongsTo takes an optional hash as a second parameter, currently\nsupported options are:

\n
    \n
  • async: A boolean value used to explicitly declare this to be an async relationship. The default is true.
  • \n
  • inverse: A string used to identify the inverse property on a\nrelated model in a One-To-Many relationship. See Explicit Inverses
  • \n
  • polymorphic A boolean value to mark the relationship as polymorphic
  • \n
\n

One-To-One

\n

To declare a one-to-one relationship between two models, use\nbelongsTo:

\n

```app/models/user.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "belongsto": "('post', {\n async: false,\n inverse: null\n })\n post;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return the record (Model instance) for the existing\nlocal resource, or null. But it will error on access when\na related resource is known to exist and it has not been loaded.\n\n```\nlet post = comment.post;\n\n```", - "hasmany": "('comment', { async: false, inverse: 'post' }) comments;\n}\n```\n\n```app/models/comment.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "itemtype": "method", - "name": "belongsTo", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "modelName", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/has-many.js", - "line": 20, - "description": "

hasMany is used to define One-To-Many and Many-To-Many\nrelationships on a Model.

\n

hasMany takes an optional hash as a second parameter, currently\nsupported options are:

\n
    \n
  • async: A boolean value used to explicitly declare this to be an async relationship. The default is true.
  • \n
  • inverse: A string used to identify the inverse property on a related model.
  • \n
  • polymorphic A boolean value to mark the relationship as polymorphic
  • \n
\n

One-To-Many

\n

To declare a one-to-many relationship between two models, use\nbelongsTo in combination with hasMany, like this:

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', {\n async: false\n })\n comments;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return a [ManyArray](/ember-data/release/classes/ManyArray) instance\ncontaining the existing local resources. But it will error on access\nwhen any of the known related resources have not been loaded.\n\n```\npost.comments.forEach((comment) => {\n\n});\n\n```\n\nIf you are using `links` with sync relationships, you have to use\n`ref.reload` to fetch the resources.", - "belongsto": "('post') bluePost;\n}\n```\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "itemtype": "method", - "name": "hasMany", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/store.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/store.json deleted file mode 100644 index 4dcf08b72..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/store.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "class", - "attributes": { - "name": "@ember-data/store", - "shortname": "@ember-data/store", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "methods": [ - { - "file": "../ember-data-types/q/identifier.ts", - "line": 117, - "description": "

Configures how unique identifier lid strings are generated by @ember-data/store.

\n

This configuration MUST occur prior to the store instance being created.

\n

Takes a method which can expect to receive various data as its first argument\nand the name of a bucket as its second argument.

\n

Currently there are two buckets, 'record' and 'document'.

\n

Resource (Record) Identity

\n

If the bucket is record the method must return a unique (to at-least\nthe given bucket) string identifier for the given data as a string to be\nused as the lid of an Identifier token.

\n

This method will only be called by either getOrCreateRecordIdentifier or\ncreateIdentifierForNewRecord when an identifier for the supplied data\nis not already known via lid or type + id combo and one needs to be\ngenerated or retrieved from a proprietary cache.

\n

data will be the same data argument provided to getOrCreateRecordIdentifier\nand in the createIdentifierForNewRecord case will be an object with\nonly type as a key.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import { setIdentifierGenerationMethod } from '@ember-data/store';\n\nexport function initialize(applicationInstance) {\n  // note how `count` here is now scoped to the application instance\n  // for our generation method by being inside the closure provided\n  // by the initialize function\n  let count = 0;\n\n  setIdentifierGenerationMethod((resource, bucket) => {\n    return resource.lid || `my-key-${count++}`;\n  });\n}\n\nexport default {\n  name: 'configure-ember-data-identifiers',\n  initialize\n};
\n
\n
\n \n

Document Identity

\n

If the bucket is document the method will receive the associated\nimmutable request passed to store.request as its first argument\nand should return a unique string for the given request if the document\nshould be cached, and null if it should not be cached.

\n

Note, the request result will still be passed to the cache via Cache.put,\nbut caches should take this as a signal that the document should not itself\nbe cached, while its contents may still be used to update other cache state.

\n

The presence of cacheOptions.key on the request will take precedence\nfor the document cache key, and this method will not be called if it is\npresent.

\n

The default method implementation for this bucket is to return null\nfor all requests whose method is not GET, and to return the url for\nthose where it is.

\n

This means that queries via POST MUST provide cacheOptions.key or\nimplement this hook.

\n

⚠️ Caution: Requests that do not have a method assigned are assumed to be GET

\n", - "itemtype": "method", - "name": "setIdentifierGenerationMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 198, - "description": "

Configure a callback for when the identifier cache encounters new resource\ndata for an existing resource.

\n

This configuration MUST occur prior to the store instance being created.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
import { setIdentifierUpdateMethod } from '@ember-data/store';
\n
\n
\n \n

Takes a method which can expect to receive an existing Identifier alongside\nsome new data to consider as a second argument. This is an opportunity\nfor secondary lookup tables and caches associated with the identifier\nto be amended.

\n

This method is called everytime updateRecordIdentifier is called and\n with the same arguments. It provides the opportunity to update secondary\n lookup tables for existing identifiers.

\n

It will always be called after an identifier created with createIdentifierForNewRecord\n has been committed, or after an update to the record a RecordIdentifier\n is assigned to has been committed. Committed here meaning that the server\n has acknowledged the update (for instance after a call to .save())

\n

If id has not previously existed, it will be assigned to the Identifier\n prior to this UpdateMethod being called; however, calls to the parent method\n updateRecordIdentifier that attempt to change the id or calling update\n without providing an id when one is missing will throw an error.

\n", - "itemtype": "method", - "name": "setIdentifierUpdateMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 239, - "description": "

Configure a callback for when the identifier cache is going to release an identifier.

\n

This configuration MUST occur prior to the store instance being created.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
import { setIdentifierForgetMethod } from '@ember-data/store';
\n
\n
\n \n

Takes method which can expect to receive an existing Identifier that should be eliminated\nfrom any secondary lookup tables or caches that the user has populated for it.

\n", - "itemtype": "method", - "name": "setIdentifierForgetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 259, - "description": "

Configure a callback for when the identifier cache is being torn down.

\n

This configuration MUST occur prior to the store instance being created.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
import { setIdentifierResetMethod } from '@ember-data/store';
\n
\n
\n \n

Takes a method which can expect to be called when the parent application is destroyed.

\n

If you have properly used a WeakMap to encapsulate the state of your customization\nto the application instance, you may not need to implement the resetMethod.

\n", - "itemtype": "method", - "name": "setIdentifierResetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/instance-cache.ts", - "line": 48, - "description": "

Retrieves the unique referentially-stable RecordIdentifier\nassigned to the given record instance.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
import { recordIdentifierFor } from "@ember-data/store";\n// ... gain access to a record, for instance with peekRecord or findRecord\nconst record = store.peekRecord("user", "1");\n// get the identifier for the record (see docs for StableRecordIdentifier)\nconst identifier = recordIdentifierFor(record);\n// access the identifier's properties.\nconst { id, type, lid } = identifier;
\n
\n
\n \n", - "itemtype": "method", - "name": "recordIdentifierFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "record", - "description": "a record instance previously obstained from the store.", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "class": "@ember-data/store", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/tracking.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/tracking.json deleted file mode 100644 index 27a9503ff..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-@ember-data/tracking.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/tracking", - "type": "class", - "attributes": { - "name": "@ember-data/tracking", - "shortname": "@ember-data/tracking", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/tracking", - "namespace": "", - "methods": [ - { - "file": "../packages/tracking/src/-private.ts", - "line": 92, - "description": "

Run method without subscribing to any tracked properties\ncontrolled by EmberData.

\n

This should rarely be used except by libraries that really\nknow what they are doing. It is most useful for wrapping\ncertain kinds of fetch/query logic from within a Resource\nhook or other similar pattern.

\n", - "itemtype": "method", - "name": "untracked", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 115, - "description": "

Run the method, subscribing to any tracked properties\nmanaged by EmberData that were accessed or written during\nthe method's execution as per-normal but while allowing\ninterleaving of reads and writes.

\n

This is useful when for instance you want to perform\na mutation based on existing state that must be read first.

\n", - "itemtype": "method", - "name": "transact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 138, - "description": "

A helpful utility for creating a new function that\nalways runs in a transaction. E.G. this "memoizes"\ncalling transact(fn), currying args as necessary.

\n", - "itemtype": "method", - "name": "memoTransact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "a function that will invoke method in a transaction with any provided args and return its result" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/tracking", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-AbortError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-AbortError.json deleted file mode 100644 index d165ee135..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-AbortError.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-AbortError", - "type": "class", - "attributes": { - "name": "AbortError", - "shortname": "AbortError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 217, - "description": "

A AbortError is used by an adapter to signal that a request to\nthe external API was aborted. For example, this can occur if the user\nnavigates away from the current page after a request to the external API\nhas been initiated but before a response has been received.

\n", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Adapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Adapter.json deleted file mode 100644 index 485f3acbf..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Adapter.json +++ /dev/null @@ -1,552 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Adapter", - "type": "class", - "attributes": { - "name": "Adapter", - "shortname": "Adapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter", - "namespace": "", - "file": "../adapter/src/index.ts", - "line": 197, - "description": "

An adapter is an object that receives requests from a store and\ntranslates them into the appropriate action to take against your\npersistence layer. The persistence layer is usually an HTTP API but\nmay be anything, such as the browser's local storage. Typically the\nadapter is not invoked directly instead its functionality is accessed\nthrough the store.

\n
\n

⚠️ CAUTION you likely want the docs for Adapter\nas extending this abstract class is unnecessary.

\n
\n

Creating an Adapter

\n

Create a new subclass of Adapter in the app/adapters folder:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import Adapter from '@ember-data/adapter';\n\nexport default Adapter.extend({\n  // ...your code here\n});
\n
\n
\n \n

Model-specific adapters can be created by putting your adapter\nclass in an app/adapters/ + model-name + .js file of the application.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n
import Adapter from '@ember-data/adapter';\n\nexport default Adapter.extend({\n  // ...Post-specific adapter code goes here\n});
\n
\n
\n \n

Adapter is an abstract base class that you should override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:

\n
    \n
  • findRecord()
  • \n
  • createRecord()
  • \n
  • updateRecord()
  • \n
  • deleteRecord()
  • \n
  • findAll()
  • \n
  • query()
  • \n
\n

To improve the network performance of your application, you can optimize\nyour adapter by overriding these lower-level methods:

\n
    \n
  • findMany()
  • \n
\n

For an example of the implementation, see RESTAdapter, the\nincluded REST adapter.

\n", - "access": "public", - "tagname": "", - "extends": "Ember.EmberObject", - "methods": [ - { - "file": "../packages/adapter/src/index.ts", - "line": 260, - "description": "

The findRecord() method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to findRecord() being called, you\nshould query your persistence layer for a record with the given ID. The findRecord\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.

\n

Here is an example of the findRecord implementation:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findRecord(store, type, id, snapshot) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "findRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 302, - "description": "

The findAll() method is used to retrieve all records for a given type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findAll(store, type) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "findAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 345, - "description": "

This method is called when you call query on the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  query(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "query", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 384, - "description": "

The queryRecord() method is invoked when the store is asked for a single\nrecord through a query object.

\n

In response to queryRecord() being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's push() method\nto push the record into the store.

\n

Here is an example queryRecord implementation:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter, { BuildURLMixin } from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n  queryRecord(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "queryRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Subclass of Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 429, - "description": "

If the globally unique IDs for your records should be generated on the client,\nimplement the generateIdForRecord() method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's primaryKey.

\n

Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls didCreateRecord(). Only implement this method if\nyou intend to generate record IDs on the client-side.

\n

The generateIdForRecord() method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Adapter from '@ember-data/adapter';\nimport { v4 } from 'uuid';\n\nexport default class ApplicationAdapter extends Adapter {\n  generateIdForRecord(store, type, inputProperties) {\n    return v4();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "generateIdForRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "inputProperties", - "description": "a hash of properties to set on the\n newly created record.", - "type": "Object" - } - ], - "return": { - "description": "id", - "type": "(String|Number)" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 463, - "description": "

Proxies to the serializer's serialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import Adapter from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter {\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let url = `/${type.modelName}`;\n\n    // ...\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serialize", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "serialized snapshot", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 491, - "description": "

Implement this method in a subclass to handle the creation of\nnew records.

\n

Serializes the record and sends it to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n\n    return new RSVP.Promise(function (resolve, reject) {\n      $.ajax({\n        type: 'POST',\n        url: `/${type.modelName}`,\n        dataType: 'json',\n        data: data\n      }).then(function (data) {\n        resolve(data);\n      }, function (jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "createRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 539, - "description": "

Implement this method in a subclass to handle the updating of\na record.

\n

Serializes the record update and sends it to the server.

\n

The updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with undefined and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  updateRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'PUT',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "updateRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 596, - "description": "

Implement this method in a subclass to handle the deletion of\na record.

\n

Sends a delete request for the record to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  deleteRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'DELETE',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        resolve(data)\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "deleteRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 667, - "description": "

The store will call findMany instead of multiple findRecord\nrequests to find multiple records at once if coalesceFindRequests\nis true.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findMany(store, type, ids, snapshots) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'GET',\n        url: `/${type.modelName}/`,\n        dataType: 'json',\n        data: { filter: { id: ids.join(',') } }\n      }).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "findMany", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the records", - "type": "Model" - }, - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 705, - "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

For example, if your API has nested URLs that depend on the parent, you will\nwant to group records by their parent.

\n

The default implementation returns the records as a single group.

\n", - "itemtype": "method", - "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", - "type": "Array" - }, - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 725, - "description": "

This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\nstore.findRecord.

\n

If this method returns true, the store will re-fetch a record from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached record.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
shouldReloadRecord(store, ticketSnapshot) {\n  let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n  let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n  if (timeDiff > 20) {\n    return true;\n  } else {\n    return false;\n  }\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findRecord('ticket',\nid) you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, findRecord will not\nresolve until you fetched the latest version.

\n

By default this hook returns false, as most UIs should not block user\ninteractions while waiting on data update.

\n

Note that, with default settings, shouldBackgroundReloadRecord will always\nre-fetch the records in the background even if shouldReloadRecord returns\nfalse. You can override shouldBackgroundReloadRecord if this does not\nsuit your use case.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldReloadRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 776, - "description": "

This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\nstore.findAll.

\n

If this method returns true, the store will re-fetch all records from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached records.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
shouldReloadAll(store, snapshotArray) {\n  let snapshots = snapshotArray.snapshots();\n\n  return snapshots.any((ticketSnapshot) => {\n    let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n    let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n    if (timeDiff > 20) {\n      return true;\n    } else {\n      return false;\n    }\n  });\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findAll('ticket') you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, findAll will not\nresolve until you fetched the latest versions.

\n

By default, this method returns true if the passed snapshotRecordArray\nis empty (meaning that there are no records locally available yet),\notherwise, it returns false.

\n

Note that, with default settings, shouldBackgroundReloadAll will always\nre-fetch all the records in the background even if shouldReloadAll returns\nfalse. You can override shouldBackgroundReloadAll if this does not suit\nyour use case.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldReloadAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 832, - "description": "

This method is used by the store to determine if the store should\nreload a record after the store.findRecord method resolves a\ncached record.

\n

This method is only checked by the store when the store is\nreturning a cached record.

\n

If this method returns true the store will re-fetch a record from\nthe adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadRecord as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
shouldBackgroundReloadRecord(store, snapshot) {\n  let { downlink, effectiveType } = navigator.connection;\n\n  return downlink > 0 && effectiveType === '4g';\n}
\n
\n
\n \n

By default, this hook returns true so the data for the record is updated\nin the background.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldBackgroundReloadRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 869, - "description": "

This method is used by the store to determine if the store should\nreload a record array after the store.findAll method resolves\nwith a cached record array.

\n

This method is only checked by the store when the store is\nreturning a cached record array.

\n

If this method returns true the store will re-fetch all records\nfrom the adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadAll as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
shouldBackgroundReloadAll(store, snapshotArray) {\n  let { downlink, effectiveType } = navigator.connection;\n\n  return downlink > 0 && effectiveType === '4g';\n}
\n
\n
\n \n

By default this method returns true, indicating that a background reload\nshould always be triggered.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldBackgroundReloadAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/adapter/src/index.ts", - "line": 645, - "description": "

By default the store will try to coalesce all findRecord calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.

\n", - "itemtype": "property", - "name": "coalesceFindRequests", - "access": "public", - "tagname": "", - "type": "{boolean}", - "class": "Adapter", - "module": "@ember-data/adapter" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "Ember.EmberObject", - "type": "missing" - } - }, - "descendants": { - "data": [ - { - "type": "class", - "id": "ember-data-2.18.5-RESTAdapter" - } - ] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-AdapterError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-AdapterError.json deleted file mode 100644 index b4553f1f4..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-AdapterError.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class", - "attributes": { - "name": "AdapterError", - "shortname": "AdapterError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 6, - "description": "

Overview

\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

An AdapterError is used by an adapter to signal that an error occurred\nduring a request to an external API. It indicates a generic error, and\nsubclasses are used to indicate specific error states.

\n

To create a custom error to signal a specific error state in communicating\nwith an external API, extend the AdapterError. For example, if the\nexternal API exclusively used HTTP 503 Service Unavailable to indicate\nit was closed for maintenance:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
error.js
1\n2\n3\n
import AdapterError from '@ember-data/adapter/error';\n\nexport default AdapterError.extend({ message: "Down for maintenance." });
\n
\n
\n \n

This error would then be returned by an adapter's handleResponse method:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\nimport MaintenanceError from './maintenance-error';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  handleResponse(status) {\n    if (503 === status) {\n      return new MaintenanceError();\n    }\n\n    return super.handleResponse(...arguments);\n  }\n}
\n
\n
\n \n

And can then be detected in an application and used to send the user to an\nunder-maintenance route:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Route from '@ember/routing/route';\nimport MaintenanceError from '../adapters/maintenance-error';\n\nexport default class ApplicationRoute extends Route {\n  actions: {\n    error(error, transition) {\n      if (error instanceof MaintenanceError) {\n        this.transitionTo('under-maintenance');\n        return;\n      }\n\n      // ...other error handling logic\n    }\n  }\n}
\n
\n
\n \n", - "mainName": "@ember-data/adapter/error", - "tag": "main", - "_main": true, - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [ - { - "type": "class", - "id": "ember-data-2.18.5-InvalidError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-TimeoutError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-AbortError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-UnauthorizedError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-ForbiddenError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-NotFoundError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-ConflictError" - }, - { - "type": "class", - "id": "ember-data-2.18.5-ServerError" - } - ] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BelongsToReference.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BelongsToReference.json deleted file mode 100644 index 34c467c80..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BelongsToReference.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-BelongsToReference", - "type": "class", - "attributes": { - "name": "BelongsToReference", - "shortname": "BelongsToReference", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/references/belongs-to.ts", - "line": 42, - "description": "

A BelongsToReference is a low-level API that allows users and\naddon authors to perform meta-operations on a belongs-to\nrelationship.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 134, - "description": "

The id of the record that this reference refers to. Together, the\ntype() and id() methods form a composite key for the identity\nmap. This can be used to access the id of an async relationship\nwithout triggering a fetch that would normally happen if you\nattempted to use record.relationship.id.

\n

Example

\n

```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n }\n```", - "itemtype": "method", - "name": "id", - "access": "public", - "tagname": "", - "return": { - "description": "The id of the record in this belongsTo relationship.", - "type": "String" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 178, - "description": "

The link Ember Data will use to fetch or reload this belongs-to\nrelationship. By default it uses only the "related" resource linkage.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\nexport default Model.extend({\n   user: belongsTo('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         links: {\n           related: '/articles/1/author'\n         }\n       }\n     }\n   }\n });\nlet userRef = blog.belongsTo('user');\n\n// get the identifier of the reference\nif (userRef.remoteType() === "link") {\n   let link = userRef.link();\n }
\n
\n
\n \n", - "itemtype": "method", - "name": "link", - "access": "public", - "tagname": "", - "return": { - "description": "The link Ember Data will use to fetch or reload this belongs-to relationship.", - "type": "String" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 228, - "description": "

any links that have been received for this relationship

\n", - "itemtype": "method", - "name": "links", - "access": "public", - "tagname": "", - "return": { - "description": "" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 241, - "description": "

The meta data for the belongs-to relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n
// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\nexport default Model.extend({\n   user: belongsTo('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         links: {\n           related: {\n             href: '/articles/1/author'\n           },\n         },\n         meta: {\n           lastUpdated: 1458014400000\n         }\n       }\n     }\n   }\n });\n\nlet userRef = blog.belongsTo('user');\n\nuserRef.meta() // { lastUpdated: 1458014400000 }
\n
\n
\n \n", - "itemtype": "method", - "name": "meta", - "access": "public", - "tagname": "", - "return": { - "description": "The meta information for the belongs-to relationship.", - "type": "Object" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 296, - "description": "

This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the "link" otherwise it defaults to "id".

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n```", - "itemtype": "method", - "name": "remoteType", - "access": "public", - "tagname": "", - "return": { - "description": "The name of the remote type. This should either be `link` or `id`", - "type": "String" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 346, - "description": "

push can be used to update the data in the relationship and Ember\nData will treat the new data as the canonical value of this\nrelationship on the backend.

\n

Example

\n

```app/models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "belongsto": "('user', { async: true, inverse: null }) user;\n }\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\n// provide data for reference\nuserRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n```", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "object", - "description": "a JSONAPI document object describing the new value of this relationship.", - "type": "Object" - } - ], - "return": { - "description": "A promise that resolves with the new value in this belongs-to relationship.", - "type": "Promise" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 419, - "description": "

value() synchronously returns the current value of the belongs-to\nrelationship. Unlike record.relationshipName, calling\nvalue() on a reference does not trigger a fetch if the async\nrelationship is not yet loaded. If the relationship is not loaded\nit will always return null.

\n

Example

\n

```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\nuserRef.value(); // null\n\n// provide data for reference\nuserRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value(); // user\n });\n```", - "itemtype": "method", - "name": "value", - "access": "public", - "tagname": "", - "return": { - "description": "the record in this relationship", - "type": "Model" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 474, - "description": "

Loads a record in a belongs-to relationship if it is not already\nloaded. If the relationship is already loaded this method does not\ntrigger a new load.

\n

Example

\n

```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\nuserRef.value(); // null\n\nuserRef.load().then(function(user) {\n userRef.value() === user\n });\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference.\n\nExample\n\n```javascript\nuserRef.load({ adapterOptions: { isPrivate: true } }).then(function(user) {\n userRef.value() === user;\n});\n```\n```app/adapters/user.js\nimport Adapter from '@ember-data/adapter';\n\nexport default class UserAdapter extends Adapter {\n findRecord(store, type, id, snapshot) {\n // In the adapter you will have access to adapterOptions.\n let adapterOptions = snapshot.adapterOptions;\n }\n});\n```", - "itemtype": "method", - "name": "load", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the record in this belongs-to relationship.", - "type": "Promise" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 547, - "description": "

Triggers a reload of the value in this relationship. If the\nremoteType is "link" Ember Data will use the relationship link to\nreload the relationship. Otherwise it will reload the record by its\nid.

\n

Example

\n

```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\nuserRef.reload().then(function(user) {\n userRef.value() === user\n });\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference. A full example\ncan be found in the `load` method.\n\nExample\n\n```javascript\nuserRef.reload({ adapterOptions: { isPrivate: true } })\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the record in this belongs-to relationship after the reload has completed.", - "type": "Promise" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 101, - "description": "

The identifier of the record that this reference refers to.\nnull if no related record is known.

\n", - "itemtype": "property", - "name": "identifier", - "type": "StableRecordIdentifier | null", - "access": "public", - "tagname": "", - "class": "BelongsToReference", - "module": "@ember-data/model" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BooleanTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BooleanTransform.json deleted file mode 100644 index 000d7f528..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BooleanTransform.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-BooleanTransform", - "type": "class", - "attributes": { - "name": "BooleanTransform", - "shortname": "BooleanTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/boolean.js", - "line": 5, - "description": "

The BooleanTransform class is used to serialize and deserialize\nboolean attributes on Ember Data record objects. This transform is\nused when boolean is passed as the type parameter to the\nattr function.

\n

Usage

\n

```app/models/user.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "attr": "('boolean', { allowNull: true }) wantsWeeklyEmail;\n}\n```", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BuildURLMixin.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BuildURLMixin.json deleted file mode 100644 index b9fd99310..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-BuildURLMixin.json +++ /dev/null @@ -1,464 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-BuildURLMixin", - "type": "class", - "attributes": { - "name": "BuildURLMixin", - "shortname": "BuildURLMixin", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [ - "RESTAdapter" - ], - "module": "@ember-data/adapter", - "namespace": "", - "file": "../adapter/src/-private/build-url-mixin.ts", - "line": 119, - "description": "

Using BuildURLMixin

\n

To use URL building, include the mixin when extending an adapter, and call buildURL where needed.\nThe default behaviour is designed for RESTAdapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Adapter, { BuildURLMixin } from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n  findRecord(store, type, id, snapshot) {\n    var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');\n    return this.ajax(url, 'GET');\n  }\n}
\n
\n
\n \n

Attributes

\n

The host and namespace attributes will be used if defined, and are optional.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 145, - "description": "

Builds a URL for a given type and optional ID.

\n

By default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see pathForType.

\n

If an ID is specified, it adds the ID to the path generated\nfor the type, separated by a /.

\n

When called by RESTAdapter.findMany() the id and snapshot parameters\nwill be arrays of ids and snapshots.

\n", - "itemtype": "method", - "name": "buildURL", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "id", - "description": "single id or array of ids or query", - "type": "(String|Array|Object)" - }, - { - "name": "snapshot", - "description": "single snapshot or array of snapshots", - "type": "(Snapshot|SnapshotRecordArray)" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "object of query parameters to send for query requests.", - "type": "Object" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 294, - "itemtype": "method", - "name": "_buildURL", - "access": "private", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "id", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 329, - "description": "

Builds a URL for a store.findRecord(type, id) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindRecord(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id, snapshot);\n    return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 357, - "description": "

Builds a URL for a store.findAll(type) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindAll(modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName);\n    return `${baseUrl}/data/comments.json`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 383, - "description": "

Builds a URL for a store.query(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  host = 'https://api.github.com';\n  urlForQuery (query, modelName) {\n    switch(modelName) {\n      case 'repo':\n        return `https://api.github.com/orgs/${query.orgId}/repos`;\n      default:\n        return super.urlForQuery(...arguments);\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForQuery", - "access": "public", - "tagname": "", - "params": [ - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 414, - "description": "

Builds a URL for a store.queryRecord(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForQueryRecord({ slug }, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/${encodeURIComponent(slug)}`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForQueryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 440, - "description": "

Builds a URL for coalescing multiple store.findRecord(type, id)\nrecords into 1 request when the adapter's coalesceFindRequests\nproperty is true.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForFindMany(ids, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/coalesce`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 469, - "description": "

Builds a URL for fetching an async hasMany relationship when a URL\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindHasMany(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id);\n    return `${baseUrl}/relationships`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 497, - "description": "

Builds a URL for fetching an async belongsTo relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindBelongsTo(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id);\n    return `${baseUrl}/relationships`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 525, - "description": "

Builds a URL for a record.save() call when the record was created\nlocally using store.createRecord().

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForCreateRecord(modelName, snapshot) {\n    return super.urlForCreateRecord(...arguments) + '/new';\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForCreateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 551, - "description": "

Builds a URL for a record.save() call when the record has been updated locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForUpdateRecord(id, modelName, snapshot) {\n    return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForUpdateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 577, - "description": "

Builds a URL for a record.save() call when the record has been deleted locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForDeleteRecord(id, modelName, snapshot) {\n    return super.urlForDeleteRecord(...arguments) + '/destroy';\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForDeleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 603, - "itemtype": "method", - "name": "urlPrefix", - "access": "private", - "tagname": "", - "params": [ - { - "name": "path", - "description": "", - "type": "String" - }, - { - "name": "parentURL", - "description": "", - "type": "String" - } - ], - "return": { - "description": "urlPrefix", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 643, - "description": "

Determines the pathname for a given type.

\n

By default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').

\n

Pathname customization

\n

For example, if you have an object LineItem with an\nendpoint of /line_items/.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTAdapter from '@ember-data/adapter/rest';\nimport { decamelize, pluralize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  pathForType(modelName) {\n    var decamelized = decamelize(modelName);\n    return pluralize(decamelized);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "pathForType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "path", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Cache.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Cache.json deleted file mode 100644 index 36ecea86d..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Cache.json +++ /dev/null @@ -1,628 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Cache", - "type": "class", - "attributes": { - "name": "Cache", - "shortname": "Cache", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/json-api", - "namespace": "", - "file": "../json-api/src/-private/cache.ts", - "line": 84, - "description": "

A JSON:API Cache implementation.

\n

What cache the store uses is configurable. Using a different\nimplementation can be achieved by implementing the store's\ncreateCache hook.

\n

This is the cache implementation used by ember-data.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Cache from '@ember-data/json-api';\nimport Store from '@ember-data/store';\n\nexport default class extends Store {\n  createCache(wrapper) {\n    return new Cache(wrapper);\n  }\n}
\n
\n
\n \n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 133, - "description": "

Cache the response to a request

\n

Implements Cache.put.

\n

Expects a StructuredDocument whose content member is a JsonApiDocument.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
cache.put({\n  request: { url: 'https://api.example.com/v1/user/1' },\n  content: {\n    data: {\n      type: 'user',\n      id: '1',\n      attributes: {\n        name: 'Chris'\n      }\n    }\n  }\n})
\n
\n
\n \n
\n

Note: The nested content and data members are not a mistake. This is because\nthere are two separate concepts involved here, the StructuredDocument which contains\nthe context of a given Request that has been issued with the returned contents as its\ncontent property, and a JSON:API Document which is the json contents returned by\nthis endpoint and which uses its data property to signify which resources are the\nprimary resources associated with the request.

\n
\n

StructuredDocument's with urls will be cached as full documents with\nassociated resource membership order and contents preserved but linked\ninto the cache.

\n", - "itemtype": "method", - "name": "put", - "params": [ - { - "name": "doc", - "description": "", - "type": "StructuredDocument" - } - ], - "return": { - "description": "", - "type": "ResourceDocument" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 259, - "description": "

Update the "remote" or "canonical" (persisted) state of the Cache\nby merging new information into the existing state.

\n

Note: currently the only valid resource operation is a MergeOperation\nwhich occurs when a collision of identifiers is detected.

\n", - "itemtype": "method", - "name": "patch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "op", - "description": "the operation to perform", - "type": "Operation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 292, - "description": "

Update the "local" or "current" (unpersisted) state of the Cache

\n", - "itemtype": "method", - "name": "mutate", - "params": [ - { - "name": "mutation", - "description": "", - "type": "Mutation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 314, - "description": "

Peek resource data from the Cache.

\n

In development, if the return value\nis JSON the return value\nwill be deep-cloned and deep-frozen\nto prevent mutation thereby enforcing cache\nImmutability.

\n

This form of peek is useful for implementations\nthat want to feed raw-data from cache to the UI\nor which want to interact with a blob of data\ndirectly from the presentation cache.

\n

An implementation might want to do this because\nde-referencing records which read from their own\nblob is generally safer because the record does\nnot require retainining connections to the Store\nand Cache to present data on a per-field basis.

\n

This generally takes the place of getAttr as\nan API and may even take the place of getRelationship\ndepending on implementation specifics, though this\nlatter usage is less recommended due to the advantages\nof the Graph handling necessary entanglements and\nnotifications for relational data.

\n", - "itemtype": "method", - "name": "peek", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier | StableDocumentIdentifier" - } - ], - "return": { - "description": "the known resource data", - "type": "ResourceDocument | ResourceBlob | null" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 388, - "description": "

Peek the Cache for the existing request data associated with\na cacheable request

\n", - "itemtype": "method", - "name": "peekRequest", - "params": [ - { - "name": "UNKNOWN", - "description": "", - "type": "StableDocumentIdentifier" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 401, - "description": "

Push resource data from a remote source into the cache for this identifier

\n", - "itemtype": "method", - "name": "upsert", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - }, - { - "name": "hasRecord", - "description": "" - } - ], - "return": { - "description": "if `hasRecord` is true then calculated key changes should be returned", - "type": "Void | string[]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 489, - "description": "

Merge a fork back into a parent Cache.

\n

Applications should typically not call this method themselves,\npreferring instead to merge at the Store level, which will\nutilize this method to merge the caches.

\n", - "itemtype": "method", - "name": "merge", - "params": [ - { - "name": "cache", - "description": "", - "type": "Cache" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 505, - "description": "

Generate the list of changes applied to all\nrecord in the store.

\n

Each individual resource or document that has\nbeen mutated should be described as an individual\nChange entry in the returned array.

\n

A Change is described by an object containing up to\nthree properties: (1) the identifier of the entity that\nchanged; (2) the op code of that change being one of\nupsert or remove, and if the op is upsert a patch\ncontaining the data to merge into the cache for the given\nentity.

\n

This patch is opaque to the Store but should be understood\nby the Cache and may expect to be utilized by an Adapter\nwhen generating data during a save operation.

\n

It is generally recommended that the patch contain only\nthe updated state, ignoring fields that are unchanged

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
interface Change {\n identifier: StableRecordIdentifier | StableDocumentIdentifier;\n op: 'upsert' | 'remove';\n patch?: unknown;\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "diff", - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 545, - "description": "

Serialize the entire contents of the Cache into a Stream\nwhich may be fed back into a new instance of the same Cache\nvia cache.hydrate.

\n", - "itemtype": "method", - "name": "dump", - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 558, - "description": "

hydrate a Cache from a Stream with content previously serialized\nfrom another instance of the same Cache, resolving when hydration\nis complete.

\n

This method should expect to be called both in the context of restoring\nthe Cache during application rehydration after SSR AND at unknown\ntimes during the lifetime of an already booted application when it is\ndesired to bulk-load additional information into the cache. This latter\nbehavior supports optimizing pre/fetching of data for route transitions\nvia data-only SSR modes.

\n", - "itemtype": "method", - "name": "hydrate", - "params": [ - { - "name": "stream", - "description": "", - "type": "ReadableStream" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 582, - "description": "

[LIFECYCLE] Signal to the cache that a new record has been instantiated on the client

\n

It returns properties from options that should be set on the record during the create\nprocess. This return value behavior is deprecated.

\n", - "itemtype": "method", - "name": "clientDidCreate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "createArgs", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 669, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwill be part of a save transaction.

\n", - "itemtype": "method", - "name": "willCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 683, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwas successfully updated as part of a save transaction.

\n", - "itemtype": "method", - "name": "didCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 787, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwas update via a save transaction failed.

\n", - "itemtype": "method", - "name": "commitWasRejected", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "errors", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 816, - "description": "

[LIFECYCLE] Signals to the cache that all data for a resource\nshould be cleared.

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 891, - "description": "

Retrieve the data for an attribute from the cache

\n", - "itemtype": "method", - "name": "getAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "", - "type": "Unknown" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 914, - "description": "

Mutate the data for an attribute in the cache

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "setAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - }, - { - "name": "value", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 946, - "description": "

Query the cache for the changed attributes of a resource.

\n", - "itemtype": "method", - "name": "changedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": ": [, ]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 959, - "description": "

Query the cache for whether any mutated attributes exist

\n", - "itemtype": "method", - "name": "hasChangedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 976, - "description": "

Tell the cache to discard any uncommitted mutations to attributes

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "rollbackAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "the names of fields that were restored", - "type": "String[]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1023, - "description": "

Query the cache for the current state of a relationship property

\n", - "itemtype": "method", - "name": "getRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "resource relationship object" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1042, - "description": "

Update the cache state for the given resource to be marked\nas locally deleted, or remove such a mark.

\n

This method is a candidate to become a mutation

\n", - "itemtype": "method", - "name": "setIsDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "isDeleted", - "description": "", - "type": "Boolean" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1067, - "description": "

Query the cache for any validation errors applicable to the given resource.

\n", - "itemtype": "method", - "name": "getErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "JsonApiError[]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1079, - "description": "

Query the cache for whether a given resource has any available data

\n", - "itemtype": "method", - "name": "isEmpty", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1092, - "description": "

Query the cache for whether a given resource was created locally and not\nyet persisted.

\n", - "itemtype": "method", - "name": "isNew", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1106, - "description": "

Query the cache for whether a given resource is marked as deleted (but not\nnecessarily persisted yet).

\n", - "itemtype": "method", - "name": "isDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1120, - "description": "

Query the cache for whether a given resource has been deleted and that deletion\nhas also been persisted.

\n", - "itemtype": "method", - "name": "isDeletionCommitted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 109, - "description": "

The Cache Version that this implementation implements.

\n", - "type": "{'2'}", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "version", - "class": "Cache", - "module": "@ember-data/json-api" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/json-api", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CacheManager.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CacheManager.json deleted file mode 100644 index a544c5bea..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CacheManager.json +++ /dev/null @@ -1,619 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-CacheManager", - "type": "class", - "attributes": { - "name": "CacheManager", - "shortname": "CacheManager", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/managers/cache-manager.ts", - "line": 20, - "description": "

The CacheManager wraps a Cache enforcing that only\nthe public API surface area is exposed.

\n

Hence, it is the value of Store.cache, wrapping\nthe cache instance returned by Store.createCache.

\n

It handles translating between cache versions when\nnecessary, for instance when a Store is configured\nto use both a v1 and a v2 cache depending on some\nheuristic.

\n

Starting with the v2 spec, the cache is designed such\nthat it must be implemented as a singleton.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 50, - "description": "

Cache the response to a request

\n

Unlike store.push which has UPSERT\nsemantics, put has replace semantics similar to\nthe http method PUT

\n

the individually cacheabl\ne resource data it may contain\nshould upsert, but the document data surrounding it should\nfully replace any existing information

\n

Note that in order to support inserting arbitrary data\nto the cache that did not originate from a request put\nshould expect to sometimes encounter a document with only\na content member and therefor must not assume the existence\nof request and response on the document.

\n", - "itemtype": "method", - "name": "put", - "params": [ - { - "name": "doc", - "description": "", - "type": "StructuredDocument" - } - ], - "return": { - "description": "", - "type": "ResourceDocument" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 77, - "description": "

Perform an operation on the cache to update the remote state.

\n

Note: currently the only valid operation is a MergeOperation\nwhich occurs when a collision of identifiers is detected.

\n", - "itemtype": "method", - "name": "patch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "op", - "description": "the operation to perform" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 92, - "description": "

Update resource data with a local mutation. Currently supports operations\non relationships only.

\n", - "itemtype": "method", - "name": "mutate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "mutation", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 104, - "description": "

Peek resource data from the Cache.

\n

In development, if the return value\nis JSON the return value\nwill be deep-cloned and deep-frozen\nto prevent mutation thereby enforcing cache\nImmutability.

\n

This form of peek is useful for implementations\nthat want to feed raw-data from cache to the UI\nor which want to interact with a blob of data\ndirectly from the presentation cache.

\n

An implementation might want to do this because\nde-referencing records which read from their own\nblob is generally safer because the record does\nnot require retainining connections to the Store\nand Cache to present data on a per-field basis.

\n

This generally takes the place of getAttr as\nan API and may even take the place of getRelationship\ndepending on implementation specifics, though this\nlatter usage is less recommended due to the advantages\nof the Graph handling necessary entanglements and\nnotifications for relational data.

\n", - "itemtype": "method", - "name": "peek", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier | StableDocumentIdentifier" - } - ], - "return": { - "description": "the known resource data", - "type": "ResourceDocument | ResourceBlob | null" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 142, - "description": "

Peek the Cache for the existing request data associated with\na cacheable request

\n", - "itemtype": "method", - "name": "peekRequest", - "params": [ - { - "name": "UNKNOWN", - "description": "", - "type": "StableDocumentIdentifier" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 155, - "description": "

Push resource data from a remote source into the cache for this identifier

\n", - "itemtype": "method", - "name": "upsert", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - }, - { - "name": "hasRecord", - "description": "" - } - ], - "return": { - "description": "if `hasRecord` is true then calculated key changes should be returned", - "type": "Void | string[]" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 172, - "description": "

Create a fork of the cache from the current state.

\n

Applications should typically not call this method themselves,\npreferring instead to fork at the Store level, which will\nutilize this method to fork the cache.

\n", - "itemtype": "method", - "name": "fork", - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 187, - "description": "

Merge a fork back into a parent Cache.

\n

Applications should typically not call this method themselves,\npreferring instead to merge at the Store level, which will\nutilize this method to merge the caches.

\n", - "itemtype": "method", - "name": "merge", - "params": [ - { - "name": "cache", - "description": "", - "type": "Cache" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 203, - "description": "

Generate the list of changes applied to all\nrecord in the store.

\n

Each individual resource or document that has\nbeen mutated should be described as an individual\nChange entry in the returned array.

\n

A Change is described by an object containing up to\nthree properties: (1) the identifier of the entity that\nchanged; (2) the op code of that change being one of\nupsert or remove, and if the op is upsert a patch\ncontaining the data to merge into the cache for the given\nentity.

\n

This patch is opaque to the Store but should be understood\nby the Cache and may expect to be utilized by an Adapter\nwhen generating data during a save operation.

\n

It is generally recommended that the patch contain only\nthe updated state, ignoring fields that are unchanged

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
interface Change {\n identifier: StableRecordIdentifier | StableDocumentIdentifier;\n op: 'upsert' | 'remove';\n patch?: unknown;\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "diff", - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 243, - "description": "

Serialize the entire contents of the Cache into a Stream\nwhich may be fed back into a new instance of the same Cache\nvia cache.hydrate.

\n", - "itemtype": "method", - "name": "dump", - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 256, - "description": "

hydrate a Cache from a Stream with content previously serialized\nfrom another instance of the same Cache, resolving when hydration\nis complete.

\n

This method should expect to be called both in the context of restoring\nthe Cache during application rehydration after SSR AND at unknown\ntimes during the lifetime of an already booted application when it is\ndesired to bulk-load additional information into the cache. This latter\nbehavior supports optimizing pre/fetching of data for route transitions\nvia data-only SSR modes.

\n", - "itemtype": "method", - "name": "hydrate", - "params": [ - { - "name": "stream", - "description": "", - "type": "ReadableStream" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 283, - "description": "

[LIFECYLCE] Signal to the cache that a new record has been instantiated on the client

\n

It returns properties from options that should be set on the record during the create\nprocess. This return value behavior is deprecated.

\n", - "itemtype": "method", - "name": "clientDidCreate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "options", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 298, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwill be part of a save transaction.

\n", - "itemtype": "method", - "name": "willCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 310, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwas successfully updated as part of a save transaction.

\n", - "itemtype": "method", - "name": "didCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 323, - "description": "

[LIFECYCLE] Signals to the cache that a resource\nwas update via a save transaction failed.

\n", - "itemtype": "method", - "name": "commitWasRejected", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "errors", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 336, - "description": "

[LIFECYCLE] Signals to the cache that all data for a resource\nshould be cleared.

\n", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 351, - "description": "

Retrieve the data for an attribute from the cache

\n", - "itemtype": "method", - "name": "getAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "propertyName", - "description": "" - } - ], - "return": { - "description": "", - "type": "Unknown" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 364, - "description": "

Mutate the data for an attribute in the cache

\n", - "itemtype": "method", - "name": "setAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "propertyName", - "description": "" - }, - { - "name": "value", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 377, - "description": "

Query the cache for the changed attributes of a resource.

\n", - "itemtype": "method", - "name": "changedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 389, - "description": "

Query the cache for whether any mutated attributes exist

\n", - "itemtype": "method", - "name": "hasChangedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 401, - "description": "

Tell the cache to discard any uncommitted mutations to attributes

\n", - "itemtype": "method", - "name": "rollbackAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "the names of attributes that were restored" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 416, - "description": "

Query the cache for the current state of a relationship property

\n", - "itemtype": "method", - "name": "getRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "propertyName", - "description": "" - } - ], - "return": { - "description": "resource relationship object" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 435, - "description": "

Update the cache state for the given resource to be marked as locally deleted,\nor remove such a mark.

\n", - "itemtype": "method", - "name": "setIsDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "isDeleted", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 448, - "description": "

Query the cache for any validation errors applicable to the given resource.

\n", - "itemtype": "method", - "name": "getErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 460, - "description": "

Query the cache for whether a given resource has any available data

\n", - "itemtype": "method", - "name": "isEmpty", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 472, - "description": "

Query the cache for whether a given resource was created locally and not\nyet persisted.

\n", - "itemtype": "method", - "name": "isNew", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 485, - "description": "

Query the cache for whether a given resource is marked as deleted (but not\nnecessarily persisted yet).

\n", - "itemtype": "method", - "name": "isDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 498, - "description": "

Query the cache for whether a given resource has been deleted and that deletion\nhas also been persisted.

\n", - "itemtype": "method", - "name": "isDeletionCommitted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CacheStoreWrapper.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CacheStoreWrapper.json deleted file mode 100644 index a528096ee..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CacheStoreWrapper.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-CacheStoreWrapper", - "type": "class", - "attributes": { - "name": "CacheStoreWrapper", - "shortname": "CacheStoreWrapper", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../../ember-data-types/q/cache-store-wrapper.ts", - "line": 12, - "description": "

CacheStoreWrapper provides encapsulated API access to the minimal\nsubset of the Store's functionality that Cache implementations\nshould interact with. It is provided to the Store's createRecordDataFor\nand createCache hooks.

\n

Cache implementations should not need more than this API provides.

\n

This class cannot be directly instantiated.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 38, - "description": "

Provides access to the SchemaDefinitionService instance\nfor this Store instance.

\n

The SchemaDefinitionService can be used to query for\ninformation about the schema of a resource.

\n", - "itemtype": "method", - "name": "getSchemaDefinitionService", - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 50, - "description": "

Update the id for the record corresponding to the identifier\nThis operation can only be done for records whose id is null.

\n", - "itemtype": "method", - "name": "setRecordId", - "params": [ - { - "name": "identifier;", - "description": "", - "type": "StableRecordIdentifier" - }, - { - "name": "id;", - "description": "", - "type": "String" - } - ], - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 61, - "description": "

Signal to the store that the specified record may be considered fully\nremoved from the cache. Generally this means that not only does no\ndata exist for the identified resource, no known relationships still\npoint to it either.

\n", - "itemtype": "method", - "name": "disconnectRecord", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - } - ], - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 73, - "description": "

Use this method to determine if the Store has an instantiated record associated\nwith an identifier.

\n", - "itemtype": "method", - "name": "hasRecord", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 84, - "description": "

Notify subscribers of the NotificationManager that cache state has changed.

\n

attributes and relationships do not require a key, but if one is specified it\nis assumed to be the name of the attribute or relationship that has been updated.

\n

No other namespaces currently expect the key argument.

\n", - "itemtype": "method", - "name": "notifyChange", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - }, - { - "name": "namespace", - "description": "", - "type": "'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'" - }, - { - "name": "key", - "description": "", - "type": "String|undefined" - } - ], - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [ - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 26, - "description": "

Provides access to the IdentifierCache instance\nfor this Store instance.

\n

The IdentifierCache can be used to peek, generate or\nretrieve a stable unique identifier for any resource.

\n", - "itemtype": "property", - "name": "identifierCache", - "type": "IdentifierCache", - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CanaryFeatureFlags.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CanaryFeatureFlags.json deleted file mode 100644 index 43b194e80..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CanaryFeatureFlags.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-CanaryFeatureFlags", - "type": "class", - "attributes": { - "name": "CanaryFeatureFlags", - "shortname": "CanaryFeatureFlags", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/canary-features", - "namespace": "", - "file": "../private-build-infra/virtual-packages/canary-features.js", - "line": 76, - "description": "

This is the current list of features used at build time for canary releases.\nIf empty there are no features currently gated by feature flags.

\n

The valid values are:

\n
    \n
  • true | The feature is enabled at all times, and cannot be disabled.
  • \n
  • false | The feature is disabled at all times, and cannot be enabled.
  • \n
  • null | The feature is disabled by default, but can be enabled via configuration.
  • \n
\n", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/canary-features", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ConflictError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ConflictError.json deleted file mode 100644 index c90e37898..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ConflictError.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-ConflictError", - "type": "class", - "attributes": { - "name": "ConflictError", - "shortname": "ConflictError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 318, - "description": "

A ConflictError equates to a HTTP 409 Conflict response status.\nIt is used by an adapter to indicate that the request could not be processed\nbecause of a conflict in the request. An example scenario would be when\ncreating a record with a client-generated ID but that ID is already known\nto the external API.

\n", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CurrentDeprecations.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CurrentDeprecations.json deleted file mode 100644 index 5c640f2ef..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-CurrentDeprecations.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-CurrentDeprecations", - "type": "class", - "attributes": { - "name": "CurrentDeprecations", - "shortname": "CurrentDeprecations", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/deprecations", - "namespace": "", - "file": "../private-build-infra/virtual-packages/deprecations.js", - "line": 61, - "description": "

The following list represents deprecations currently active.

\n

Some deprecation flags guard multiple deprecation IDs. All\nassociated IDs are listed.

\n", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [ - { - "file": "../packages/private-build-infra/virtual-packages/deprecations.js", - "line": 73, - "description": "

id:

\n

This is a planned deprecation which will trigger when observer or computed\nchains are used to watch for changes on any EmberData RecordArray, ManyArray\nor PromiseManyArray.

\n

Support for these chains is currently guarded by the inactive deprecation flag\nlisted here.

\n", - "itemtype": "property", - "name": "DEPRECATE_COMPUTED_CHAINS", - "since": "5.0", - "until": "6.0", - "access": "public", - "tagname": "", - "class": "CurrentDeprecations", - "module": "@ember-data/deprecations" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/deprecations", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AbortError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AbortError.json new file mode 100644 index 000000000..9fd2f2a61 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AbortError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.AbortError", + "type": "class", + "attributes": { + "name": "DS.AbortError", + "shortname": "DS.AbortError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 206, + "description": "

A DS.AbortError is used by an adapter to signal that a request to\nthe external API was aborted. For example, this can occur if the user\nnavigates away from the current page after a request to the external API\nhas been initiated but before a response has been received.

\n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Adapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Adapter.json new file mode 100644 index 000000000..e8b58ba6f --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Adapter.json @@ -0,0 +1,535 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.Adapter", + "type": "class", + "attributes": { + "name": "DS.Adapter", + "shortname": "DS.Adapter", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/adapter.js", + "line": 7, + "description": "

An adapter is an object that receives requests from a store and\ntranslates them into the appropriate action to take against your\npersistence layer. The persistence layer is usually an HTTP API, but\nmay be anything, such as the browser's local storage. Typically the\nadapter is not invoked directly instead its functionality is accessed\nthrough the store.

\n

Creating an Adapter

\n

Create a new subclass of DS.Adapter in the app/adapters folder:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  // ...your code here\n});
\n
\n
\n \n

Model-specific adapters can be created by putting your adapter\nclass in an app/adapters/ + model-name + .js file of the application.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  // ...Post-specific adapter code goes here\n});
\n
\n
\n \n

DS.Adapter is an abstract base class that you should override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:

\n
    \n
  • findRecord()
  • \n
  • createRecord()
  • \n
  • updateRecord()
  • \n
  • deleteRecord()
  • \n
  • findAll()
  • \n
  • query()
  • \n
\n

To improve the network performance of your application, you can optimize\nyour adapter by overriding these lower-level methods:

\n
    \n
  • findMany()
  • \n
\n

For an example implementation, see DS.RESTAdapter, the\nincluded REST adapter.

\n", + "extends": "Ember.Object", + "methods": [ + { + "file": "addon/adapter.js", + "line": 87, + "description": "

The findRecord() method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to findRecord() being called, you\nshould query your persistence layer for a record with the given ID. The findRecord\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.

\n

Here is an example findRecord implementation:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findRecord(store, type, id, snapshot) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 123, + "description": "

The findAll() method is used to retrieve all records for a given type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findAll(store, type, sinceToken) {\n    let query = { since: sinceToken };\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "sinceToken", + "description": "", + "type": "String" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 157, + "description": "

This method is called when you call query on the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  query(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "recordArray", + "description": "", + "type": "DS.AdapterPopulatedRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 189, + "description": "

The queryRecord() method is invoked when the store is asked for a single\nrecord through a query object.

\n

In response to queryRecord() being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's push() method\nto push the record into the store.

\n

Here is an example queryRecord implementation:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend(DS.BuildURLMixin, {\n  queryRecord(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "subclass of DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 227, + "description": "

If the globally unique IDs for your records should be generated on the client,\nimplement the generateIdForRecord() method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's primaryKey.

\n

Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls didCreateRecord(). Only implement this method if\nyou intend to generate record IDs on the client-side.

\n

The generateIdForRecord() method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { v4 } from 'uuid';\n\nexport default DS.Adapter.extend({\n  generateIdForRecord(store, inputProperties) {\n    return v4();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "generateIdForRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "inputProperties", + "description": "a hash of properties to set on the\n newly created record.", + "type": "Object" + } + ], + "return": { + "description": "id", + "type": "(String|Number)" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 261, + "description": "

Proxies to the serializer's serialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let url = `/${type.modelName}`;\n\n    // ...\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "serialized snapshot", + "type": "Object" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 288, + "description": "

Implement this method in a subclass to handle the creation of\nnew records.

\n

Serializes the record and sends it to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'POST',\n        url: `/${type.modelName}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 331, + "description": "

Implement this method in a subclass to handle the updating of\na record.

\n

Serializes the record update and sends it to the server.

\n

The updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with undefined and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  updateRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'PUT',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "updateRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 383, + "description": "

Implement this method in a subclass to handle the deletion of\na record.

\n

Sends a delete request for the record to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  deleteRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'DELETE',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 438, + "description": "

The store will call findMany instead of multiple findRecord\nrequests to find multiple records at once if coalesceFindRequests\nis true.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findMany(store, type, ids, snapshots) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'GET',\n        url: `/${type.modelName}/`,\n        dataType: 'json',\n        data: { filter: { id: ids.join(',') } }\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "findMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the records", + "type": "DS.Model" + }, + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 477, + "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

For example, if your api has nested URLs that depend on the parent, you will\nwant to group records by their parent.

\n

The default implementation returns the records as a single group.

\n", + "itemtype": "method", + "name": "groupRecordsForFindMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", + "type": "Array" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 497, + "description": "

This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\nstore.findRecord.

\n

If this method returns true, the store will re-fetch a record from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached record.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
shouldReloadRecord(store, ticketSnapshot) {\n  let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n  let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n  if (timeDiff > 20) {\n    return true;\n  } else {\n    return false;\n  }\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findRecord('ticket',\nid) you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, findRecord will not\nresolve until you fetched the latest version.

\n

By default this hook returns false, as most UIs should not block user\ninteractions while waiting on data update.

\n

Note that, with default settings, shouldBackgroundReloadRecord will always\nre-fetch the records in the background even if shouldReloadRecord returns\nfalse. You can override shouldBackgroundReloadRecord if this does not\nsuit your use case.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldReloadRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 547, + "description": "

This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\nstore.findAll.

\n

If this method returns true, the store will re-fetch all records from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached records.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
shouldReloadAll(store, snapshotArray) {\n  let snapshots = snapshotArray.snapshots();\n\n  return snapshots.any((ticketSnapshot) => {\n    let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n    let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n    if (timeDiff > 20) {\n      return true;\n    } else {\n      return false;\n    }\n  });\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findAll('ticket') you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, findAll will not\nresolve until you fetched the latest versions.

\n

By default this methods returns true if the passed snapshotRecordArray\nis empty (meaning that there are no records locally available yet),\notherwise it returns false.

\n

Note that, with default settings, shouldBackgroundReloadAll will always\nre-fetch all the records in the background even if shouldReloadAll returns\nfalse. You can override shouldBackgroundReloadAll if this does not suit\nyour use case.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldReloadAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 602, + "description": "

This method is used by the store to determine if the store should\nreload a record after the store.findRecord method resolves a\ncached record.

\n

This method is only checked by the store when the store is\nreturning a cached record.

\n

If this method returns true the store will re-fetch a record from\nthe adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadRecord as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
shouldBackgroundReloadRecord(store, snapshot) {\n  let connection = window.navigator.connection;\n\n  if (connection === 'cellular' || connection === 'none') {\n    return false;\n  } else {\n    return true;\n  }\n}
\n
\n
\n \n

By default this hook returns true so the data for the record is updated\nin the background.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldBackgroundReloadRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 642, + "description": "

This method is used by the store to determine if the store should\nreload a record array after the store.findAll method resolves\nwith a cached record array.

\n

This method is only checked by the store when the store is\nreturning a cached record array.

\n

If this method returns true the store will re-fetch all records\nfrom the adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadAll as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
shouldBackgroundReloadAll(store, snapshotArray) {\n  let connection = window.navigator.connection;\n\n  if (connection === 'cellular' || connection === 'none') {\n    return false;\n  } else {\n    return true;\n  }\n}
\n
\n
\n \n

By default this method returns true, indicating that a background reload\nshould always be triggered.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldBackgroundReloadAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [ + { + "file": "addon/adapter.js", + "line": 65, + "description": "

If you would like your adapter to use a custom serializer you can\nset the defaultSerializer property to be the name of the custom\nserializer.

\n

Note the defaultSerializer serializer has a lower priority than\na model specific serializer (i.e. PostSerializer) or the\napplication serializer.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/django.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  defaultSerializer: 'django'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "defaultSerializer", + "type": "{String}", + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 427, + "description": "

By default the store will try to coalesce all fetchRecord calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.

\n", + "itemtype": "property", + "name": "coalesceFindRequests", + "type": "{boolean}", + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.Object", + "type": "missing" + } + }, + "descendants": { + "data": [ + { + "type": "class", + "id": "ember-data-2.18.5-DS.RESTAdapter" + } + ] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AdapterError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AdapterError.json new file mode 100644 index 000000000..84128e61b --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AdapterError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.AdapterError", + "type": "class", + "attributes": { + "name": "DS.AdapterError", + "shortname": "DS.AdapterError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 10, + "description": "

A DS.AdapterError is used by an adapter to signal that an error occurred\nduring a request to an external API. It indicates a generic error, and\nsubclasses are used to indicate specific error states. The following\nsubclasses are provided:

\n
    \n
  • DS.InvalidError
  • \n
  • DS.TimeoutError
  • \n
  • DS.AbortError
  • \n
  • DS.UnauthorizedError
  • \n
  • DS.ForbiddenError
  • \n
  • DS.NotFoundError
  • \n
  • DS.ConflictError
  • \n
  • DS.ServerError
  • \n
\n

To create a custom error to signal a specific error state in communicating\nwith an external API, extend the DS.AdapterError. For example if the\nexternal API exclusively used HTTP 503 Service Unavailable to indicate\nit was closed for maintenance:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
error.js
1\n2\n3\n
import DS from 'ember-data';\n\nexport default DS.AdapterError.extend({ message: "Down for maintenance." });
\n
\n
\n \n

This error would then be returned by an adapter's handleResponse method:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\nimport MaintenanceError from './maintenance-error';\n\nexport default DS.JSONAPIAdapter.extend({\n  handleResponse(status) {\n    if (503 === status) {\n      return new MaintenanceError();\n    }\n\n    return this._super(...arguments);\n  }\n});
\n
\n
\n \n

And can then be detected in an application and used to send the user to an\nunder-maintenance route:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Route from '@ember/routing/route';\nimport MaintenanceError from '../adapters/maintenance-error';\n\nexport default Route.extend({\n  actions: {\n    error(error, transition) {\n      if (error instanceof MaintenanceError) {\n        this.transitionTo('under-maintenance');\n        return;\n      }\n\n      // ...other error handling logic\n    }\n  }\n});
\n
\n
\n \n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AdapterPopulatedRecordArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AdapterPopulatedRecordArray.json new file mode 100644 index 000000000..4de81ca09 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.AdapterPopulatedRecordArray.json @@ -0,0 +1,249 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.AdapterPopulatedRecordArray", + "type": "class", + "attributes": { + "name": "DS.AdapterPopulatedRecordArray", + "shortname": "DS.AdapterPopulatedRecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-arrays/adapter-populated-record-array.js", + "line": 8, + "description": "

Represents an ordered list of records whose order and membership is\ndetermined by the adapter. For example, a query sent to the adapter\nmay trigger a search on the server, whose results would be loaded\ninto an instance of the AdapterPopulatedRecordArray.

\n
\n

If you want to update the array and get the latest records from the\nadapter, you can invoke update():

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
// GET /users?isAdmin=true\nvar admins = store.query('user', { isAdmin: true });\n\nadmins.then(function() {\n  console.log(admins.get("length")); // 42\n});\n\n// somewhere later in the app code, when new admins have been created\n// in the meantime\n//\n// GET /users?isAdmin=true\nadmins.update().then(function() {\n  admins.get('isUpdating'); // false\n  console.log(admins.get("length")); // 123\n});\n\nadmins.get('isUpdating'); // true
\n
\n
\n \n", + "extends": "DS.RecordArray", + "methods": [ + { + "file": "addon/-private/system/record-arrays/adapter-populated-record-array.js", + "line": 66, + "itemtype": "method", + "name": "_setInternalModels", + "params": [ + { + "name": "internalModels", + "description": "", + "type": "Array" + }, + { + "name": "payload", + "description": "normalized payload", + "type": "Object" + } + ], + "access": "private", + "tagname": "", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 101, + "description": "

Retrieves an object from the content by index.

\n", + "itemtype": "method", + "name": "objectAtContent", + "access": "private", + "tagname": "", + "params": [ + { + "name": "index", + "description": "", + "type": "Number" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 114, + "description": "

Used to get the latest version of all of the records in this array\nfrom the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
var people = store.peekAll('person');\npeople.get('isUpdating'); // false\n\npeople.update().then(function() {\n  people.get('isUpdating'); // false\n});\n\npeople.get('isUpdating'); // true
\n
\n
\n \n", + "itemtype": "method", + "name": "update", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 157, + "description": "

Adds an internal model to the RecordArray without duplicates

\n", + "itemtype": "method", + "name": "_pushInternalModels", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 171, + "description": "

Removes an internalModel to the RecordArray.

\n", + "itemtype": "method", + "name": "removeInternalModel", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 182, + "description": "

Saves all of the records in the RecordArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
var messages = store.peekAll('message');\nmessages.forEach(function(message) {\n  message.set('hasBeenSeen', true);\n});\nmessages.save();
\n
\n
\n \n", + "itemtype": "method", + "name": "save", + "return": { + "description": "promise", + "type": "DS.PromiseArray" + }, + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 216, + "itemtype": "method", + "name": "_unregisterFromManager", + "access": "private", + "tagname": "", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 30, + "description": "

The array of client ids backing the record array. When a\nrecord is requested from the record array, the record\nfor the client id at the same index is materialized, if\nnecessary, by the store.

\n", + "itemtype": "property", + "name": "content", + "access": "private", + "tagname": "", + "type": "Ember.Array", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 42, + "description": "

The flag to signal a RecordArray is finished loading data.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
var people = store.peekAll('person');\npeople.get('isLoaded'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isLoaded", + "type": "Boolean", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 56, + "description": "

The flag to signal a RecordArray is currently loading data.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
var people = store.peekAll('person');\npeople.get('isUpdating'); // false\npeople.update();\npeople.get('isUpdating'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isUpdating", + "type": "Boolean", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 73, + "description": "

The store that created this record array.

\n", + "itemtype": "property", + "name": "store", + "access": "private", + "tagname": "", + "type": "DS.Store", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 88, + "description": "

The modelClass represented by this record array.

\n", + "itemtype": "property", + "name": "type", + "type": "DS.Model", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.RecordArray", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BelongsToReference.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BelongsToReference.json new file mode 100644 index 000000000..3665b468a --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BelongsToReference.json @@ -0,0 +1,167 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.BelongsToReference", + "type": "class", + "attributes": { + "name": "DS.BelongsToReference", + "shortname": "DS.BelongsToReference", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/references/belongs-to.js", + "line": 9, + "description": "

A BelongsToReference is a low level API that allows users and\naddon author to perform meta-operations on a belongs-to\nrelationship.

\n", + "extends": "DS.Reference", + "methods": [ + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 31, + "description": "

This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the "link" otherwise it defaults to "id".

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   type: 'blog',\n   id: 1,\n   relationships: {\n     user: {\n       data: { type: 'user', id: 1 }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === "id") {\n   let id = userRef.id();\n } else if (userRef.remoteType() === "link") {\n   let link = userRef.link();\n }
\n
\n
\n \n", + "itemtype": "method", + "name": "remoteType", + "return": { + "description": "The name of the remote type. This should either be \"link\" or \"id\"", + "type": "String" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 74, + "description": "

The id of the record that this reference refers to. Together, the\ntype() and id() methods form a composite key for the identity\nmap. This can be used to access the id of an async relationship\nwithout triggering a fetch that would normally happen if you\nattempted to use record.get('relationship.id').

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         data: { type: 'user', id: 1 }\n       }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === "id") {\n   let id = userRef.id();\n }
\n
\n
\n \n", + "itemtype": "method", + "name": "id", + "return": { + "description": "The id of the record in this belongsTo relationship.", + "type": "String" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 116, + "description": "

The link Ember Data will use to fetch or reload this belongs-to\nrelationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         links: {\n           related: '/articles/1/author'\n         }\n       }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === "link") {\n   let link = userRef.link();\n }
\n
\n
\n \n", + "itemtype": "method", + "name": "link", + "return": { + "description": "The link Ember Data will use to fetch or reload this belongs-to relationship.", + "type": "String" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 156, + "description": "

The meta data for the belongs-to relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         links: {\n           related: {\n             href: '/articles/1/author',\n             meta: {\n               lastUpdated: 1458014400000\n             }\n           }\n         }\n       }\n     }\n   }\n });\n\n let userRef = blog.belongsTo('user');\n\n userRef.meta() // { lastUpdated: 1458014400000 }
\n
\n
\n \n", + "itemtype": "method", + "name": "meta", + "return": { + "description": "The meta information for the belongs-to relationship.", + "type": "Object" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 198, + "description": "

push can be used to update the data in the relationship and Ember\nData will treat the new data as the conanical value of this\nrelationship on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         data: { type: 'user', id: 1 }\n       }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n // provide data for reference\n userRef.push({\n   data: {\n     type: 'user',\n     id: 1,\n     attributes: {\n       username: "@user"\n     }\n   }\n }).then(function(user) {\n   userRef.value() === user;\n });
\n
\n
\n \n", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "objectOrPromise", + "description": "a promise that resolves to a JSONAPI document object describing the new value of this relationship.", + "type": "Object|Promise" + } + ], + "return": { + "description": "A promise that resolves with the new value in this belongs-to relationship.", + "type": "Promise" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 266, + "description": "

value() synchronously returns the current value of the belongs-to\nrelationship. Unlike record.get('relationshipName'), calling\nvalue() on a reference does not trigger a fetch if the async\nrelationship is not yet loaded. If the relationship is not loaded\nit will always return null.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         data: { type: 'user', id: 1 }\n       }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.value(); // null\n\n // provide data for reference\n userRef.push({\n   data: {\n     type: 'user',\n     id: 1,\n     attributes: {\n       username: "@user"\n     }\n   }\n }).then(function(user) {\n   userRef.value(); // user\n });
\n
\n
\n \n", + "itemtype": "method", + "name": "value", + "return": { + "description": "the record in this relationship", + "type": "DS.Model" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 323, + "description": "

Loads a record in a belongs to relationship if it is not already\nloaded. If the relationship is already loaded this method does not\ntrigger a new load.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         data: { type: 'user', id: 1 }\n       }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.value(); // null\n\n userRef.load().then(function(user) {\n   userRef.value() === user\n });
\n
\n
\n \n", + "itemtype": "method", + "name": "load", + "return": { + "description": "a promise that resolves with the record in this belongs-to relationship.", + "type": "Promise" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 371, + "description": "

Triggers a reload of the value in this relationship. If the\nremoteType is "link" Ember Data will use the relationship link to\nreload the relationship. Otherwise it will reload the record by its\nid.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
 // models/blog.js\n export default DS.Model.extend({\n   user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         data: { type: 'user', id: 1 }\n       }\n     }\n   }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.reload().then(function(user) {\n   userRef.value() === user\n });
\n
\n
\n \n", + "itemtype": "method", + "name": "reload", + "return": { + "description": "a promise that resolves with the record in this belongs-to relationship after the reload has completed.", + "type": "Promise" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "DS.Reference", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BooleanTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BooleanTransform.json new file mode 100644 index 000000000..313c83995 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BooleanTransform.json @@ -0,0 +1,98 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.BooleanTransform", + "type": "class", + "attributes": { + "name": "DS.BooleanTransform", + "shortname": "DS.BooleanTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/boolean.js", + "line": 4, + "description": "

The DS.BooleanTransform class is used to serialize and deserialize\nboolean attributes on Ember Data record objects. This transform is\nused when boolean is passed as the type parameter to the\nDS.attr function.

\n

Usage

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  isAdmin: DS.attr('boolean'),\n  name: DS.attr('string'),\n  email: DS.attr('string')\n});
\n
\n
\n \n

By default the boolean transform only allows for values of true or\nfalse. You can opt into allowing null values for\nboolean attributes via DS.attr('boolean', { allowNull: true })

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  email: DS.attr('string'),\n  username: DS.attr('string'),\n  wantsWeeklyEmail: DS.attr('boolean', { allowNull: true })\n});
\n
\n
\n \n", + "extends": "DS.Transform", + "methods": [ + { + "file": "addon/transforms/transform.js", + "line": 71, + "description": "

When given a deserialized value from a record attribute this\nmethod must return the serialized value.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import { isEmpty } from '@ember/utils';\n\nserialize(deserialized, options) {\n  return isEmpty(deserialized) ? null : Number(deserialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "deserialized", + "description": "The deserialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The serialized value" + }, + "class": "DS.BooleanTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + }, + { + "file": "addon/transforms/transform.js", + "line": 92, + "description": "

When given a serialize value from a JSON object this method must\nreturn the deserialized value for the record attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
deserialize(serialized, options) {\n  return empty(serialized) ? null : Number(serialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "deserialize", + "params": [ + { + "name": "serialized", + "description": "The serialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The deserialized value" + }, + "class": "DS.BooleanTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.Transform", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BuildURLMixin.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BuildURLMixin.json new file mode 100644 index 000000000..ac7a2259d --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.BuildURLMixin.json @@ -0,0 +1,438 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.BuildURLMixin", + "type": "class", + "attributes": { + "name": "DS.BuildURLMixin", + "shortname": "DS.BuildURLMixin", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [ + "DS.RESTAdapter" + ], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 6, + "description": "

WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4

\n

Using BuildURLMixin

\n

To use url building, include the mixin when extending an adapter, and call buildURL where needed.\n The default behaviour is designed for RESTAdapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
  export default DS.Adapter.extend(BuildURLMixin, {\n    findRecord: function(store, type, id, snapshot) {\n      var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');\n      return this.ajax(url, 'GET');\n    }\n  });
\n
\n
\n \n

Attributes

\n

The host and namespace attributes will be used if defined, and are optional.

\n", + "methods": [ + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 34, + "description": "

Builds a URL for a given type and optional ID.

\n

By default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see pathForType.

\n

If an ID is specified, it adds the ID to the path generated\nfor the type, separated by a /.

\n

When called by RESTAdapter.findMany() the id and snapshot parameters\nwill be arrays of ids and snapshots.

\n", + "itemtype": "method", + "name": "buildURL", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "single id or array of ids or query", + "type": "(String|Array|Object)" + }, + { + "name": "snapshot", + "description": "single snapshot or array of snapshots", + "type": "(DS.Snapshot|Array)" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "object of query parameters to send for query requests.", + "type": "Object" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 82, + "itemtype": "method", + "name": "_buildURL", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 111, + "description": "

Builds a URL for a store.findRecord(type, id) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindRecord(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id, snapshot);\n    return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 138, + "description": "

Builds a URL for a store.findAll(type) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/comment.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindAll(modelName, snapshot) {\n    return 'data/comments.json';\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 162, + "description": "

Builds a URL for a store.query(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  host: 'https://api.github.com',\n  urlForQuery (query, modelName) {\n    switch(modelName) {\n      case 'repo':\n        return `https://api.github.com/orgs/${query.orgId}/repos`;\n      default:\n        return this._super(...arguments);\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForQuery", + "params": [ + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 192, + "description": "

Builds a URL for a store.queryRecord(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForQueryRecord({ slug }, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/${encodeURIComponent(slug)}`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForQueryRecord", + "params": [ + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 217, + "description": "

Builds a URL for coalesceing multiple store.findRecord(type, id)\nrecords into 1 request when the adapter's coalesceFindRequests\nproperty is true.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForFindMany(ids, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/coalesce`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindMany", + "params": [ + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 245, + "description": "

Builds a URL for fetching a async hasMany relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindHasMany(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(id, modelName);\n    return `${baseUrl}/relationships`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindHasMany", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 272, + "description": "

Builds a URL for fetching a async belongsTo relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindBelongsTo(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(id, modelName);\n    return `${baseUrl}/relationships`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindBelongsTo", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 299, + "description": "

Builds a URL for a record.save() call when the record was created\nlocally using store.createRecord().

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForCreateRecord(modelName, snapshot) {\n    return this._super(...arguments) + '/new';\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForCreateRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 324, + "description": "

Builds a URL for a record.save() call when the record has been update locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForUpdateRecord(id, modelName, snapshot) {\n    return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForUpdateRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 349, + "description": "

Builds a URL for a record.save() call when the record has been deleted locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForDeleteRecord(id, modelName, snapshot) {\n    return this._super(...arguments) + '/destroy';\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForDeleteRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 374, + "itemtype": "method", + "name": "urlPrefix", + "access": "private", + "tagname": "", + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "parentURL", + "description": "", + "type": "String" + } + ], + "return": { + "description": "urlPrefix", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 411, + "description": "

Determines the pathname for a given type.

\n

By default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').

\n

Pathname customization

\n

For example if you have an object LineItem with an\nendpoint of "/line_items/".

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\nimport { pluralize } from 'ember-inflector';\n\nexport default DS.RESTAdapter.extend({\n  pathForType: function(modelName) {\n    var decamelized = decamelize(modelName);\n    return pluralize(decamelized);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "pathForType", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "path", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ConflictError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ConflictError.json new file mode 100644 index 000000000..127d98e39 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ConflictError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.ConflictError", + "type": "class", + "attributes": { + "name": "DS.ConflictError", + "shortname": "DS.ConflictError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 303, + "description": "

A DS.ConflictError equates to a HTTP 409 Conflict response status.\nIt is used by an adapter to indicate that the request could not be processed\nbecause of a conflict in the request. An example scenario would be when\ncreating a record with a client generated id but that id is already known\nto the external API.

\n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.DateTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.DateTransform.json new file mode 100644 index 000000000..c8688b03a --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.DateTransform.json @@ -0,0 +1,98 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.DateTransform", + "type": "class", + "attributes": { + "name": "DS.DateTransform", + "shortname": "DS.DateTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/date.js", + "line": 35, + "description": "

The DS.DateTransform class is used to serialize and deserialize\ndate attributes on Ember Data record objects. This transform is used\nwhen date is passed as the type parameter to the\nDS.attr function. It uses the ISO 8601\nstandard.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/score.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   value: DS.attr('number'),\n   player: DS.belongsTo('player'),\n   date: DS.attr('date')\n });
\n
\n
\n \n", + "extends": "DS.Transform", + "methods": [ + { + "file": "addon/transforms/transform.js", + "line": 71, + "description": "

When given a deserialized value from a record attribute this\nmethod must return the serialized value.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import { isEmpty } from '@ember/utils';\n\nserialize(deserialized, options) {\n  return isEmpty(deserialized) ? null : Number(deserialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "deserialized", + "description": "The deserialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The serialized value" + }, + "class": "DS.DateTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + }, + { + "file": "addon/transforms/transform.js", + "line": 92, + "description": "

When given a serialize value from a JSON object this method must\nreturn the deserialized value for the record attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
deserialize(serialized, options) {\n  return empty(serialized) ? null : Number(serialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "deserialize", + "params": [ + { + "name": "serialized", + "description": "The serialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The deserialized value" + }, + "class": "DS.DateTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.Transform", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.EmbeddedRecordsMixin.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.EmbeddedRecordsMixin.json new file mode 100644 index 000000000..f542ff85f --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.EmbeddedRecordsMixin.json @@ -0,0 +1,205 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.EmbeddedRecordsMixin", + "type": "class", + "attributes": { + "name": "DS.EmbeddedRecordsMixin", + "shortname": "DS.EmbeddedRecordsMixin", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/embedded-records-mixin.js", + "line": 8, + "description": "

Using Embedded Records

\n

DS.EmbeddedRecordsMixin supports serializing embedded records.

\n

To set up embedded records, include the mixin when extending a serializer,\nthen define and configure embedded (model) relationships.

\n

Note that embedded records will serialize with the serializer for their model instead of the serializer in which they are defined.

\n

Below is an example of a per-type serializer (post type).

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n  attrs: {\n    author: { embedded: 'always' },\n    comments: { serialize: 'ids' }\n  }\n});
\n
\n
\n \n

Note that this use of { embedded: 'always' } is unrelated to\nthe { embedded: 'always' } that is defined as an option on DS.attr as part of\ndefining a model while working with the ActiveModelSerializer. Nevertheless,\nusing { embedded: 'always' } as an option to DS.attr is not a valid way to setup\nembedded records.

\n

The attrs option for a resource { embedded: 'always' } is shorthand for:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
{\n  serialize: 'records',\n  deserialize: 'records'\n}
\n
\n
\n \n

Configuring Attrs

\n

A resource's attrs option may be set to use ids, records or false for the\nserialize and deserialize settings.

\n

The attrs property can be set on the ApplicationSerializer or a per-type\nserializer.

\n

In the case where embedded JSON is expected while extracting a payload (reading)\nthe setting is deserialize: 'records', there is no need to use ids when\nextracting as that is the default behavior without this mixin if you are using\nthe vanilla EmbeddedRecordsMixin. Likewise, to embed JSON in the payload while\nserializing serialize: 'records' is the setting to use. There is an option of\nnot embedding JSON in the serialized payload by using serialize: 'ids'. If you\ndo not want the relationship sent at all, you can use serialize: false.

\n

EmbeddedRecordsMixin defaults

\n

If you do not overwrite attrs for a specific relationship, the EmbeddedRecordsMixin\nwill behave in the following way:

\n

BelongsTo: { serialize: 'id', deserialize: 'id' }\nHasMany: { serialize: false, deserialize: 'ids' }

\n

Model Relationships

\n

Embedded records must have a model defined to be extracted and serialized. Note that\nwhen defining any relationships on your model such as belongsTo and hasMany, you\nshould not both specify async: true and also indicate through the serializer's\nattrs attribute that the related model should be embedded for deserialization.\nIf a model is declared embedded for deserialization (embedded: 'always' or deserialize: 'records'),\nthen do not use async: true.

\n

To successfully extract and serialize embedded records the model relationships\nmust be setup correcty. See the\ndefining relationships\nsection of the Defining Models guide page.

\n

Records without an id property are not considered embedded records, model\ninstances must have an id property to be used with Ember Data.

\n

Example JSON payloads, Models and Serializers

\n

When customizing a serializer it is important to grok what the customizations\nare. Please read the docs for the methods this mixin provides, in case you need\nto modify it to fit your specific needs.

\n

For example review the docs for each method of this mixin:

\n\n", + "methods": [ + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 102, + "description": "

Normalize the record and recursively normalize/extract all the embedded records\nwhile pushing them into the store as they are encountered

\n

A payload with an attr configured for embedded records needs to be extracted:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "comments": [{\n      "id": "1",\n      "body": "Rails is unagi"\n    }, {\n      "id": "2",\n      "body": "Omakase O_o"\n    }]\n  }\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "to be normalized", + "type": "Object" + }, + { + "name": "prop", + "description": "the hash has been referenced by", + "type": "String" + } + ], + "return": { + "description": "the normalized hash", + "type": "Object" + }, + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 143, + "description": "

Serialize belongsTo relationship when it is configured as an embedded object.

\n

This example of an author model belongs to a post model:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Post = DS.Model.extend({\n  title:    DS.attr('string'),\n  body:     DS.attr('string'),\n  author:   DS.belongsTo('author')\n});\n\nAuthor = DS.Model.extend({\n  name:     DS.attr('string'),\n  post:     DS.belongsTo('post')\n});
\n
\n
\n \n

Use a custom (type) serializer for the post model to configure embedded author

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n  attrs: {\n    author: { embedded: 'always' }\n  }\n})
\n
\n
\n \n

A payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "author": {\n      "id": "2"\n      "name": "dhh"\n    }\n  }\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeBelongsTo", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 242, + "description": "

Serializes hasMany relationships when it is configured as embedded objects.

\n

This example of a post model has many comments:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Post = DS.Model.extend({\n  title:    DS.attr('string'),\n  body:     DS.attr('string'),\n  comments: DS.hasMany('comment')\n});\n\nComment = DS.Model.extend({\n  body:     DS.attr('string'),\n  post:     DS.belongsTo('post')\n});
\n
\n
\n \n

Use a custom (type) serializer for the post model to configure embedded comments

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data;\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n  attrs: {\n    comments: { embedded: 'always' }\n  }\n})
\n
\n
\n \n

A payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "body": "I want this for my ORM, I want that for my template language..."\n    "comments": [{\n      "id": "1",\n      "body": "Rails is unagi"\n    }, {\n      "id": "2",\n      "body": "Omakase O_o"\n    }]\n  }\n}
\n
\n
\n \n

The attrs options object can use more specific instruction for extracting and\nserializing. When serializing, an option to embed ids, ids-and-types or records can be set.\nWhen extracting the only option is records.

\n

So { embedded: 'always' } is shorthand for:\n{ serialize: 'records', deserialize: 'records' }

\n

To embed the ids for a related object (using a hasMany relationship):

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data;\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n  attrs: {\n    comments: { serialize: 'ids', deserialize: 'records' }\n  }\n})
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "body": "I want this for my ORM, I want that for my template language..."\n    "comments": ["1", "2"]\n  }\n}
\n
\n
\n \n

To embed the relationship as a collection of objects with id and type keys, set\nids-and-types for the related object.

\n

This is particularly useful for polymorphic relationships where records don't share\nthe same table and the id is not enough information.

\n

By example having a user that has many pets:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
User = DS.Model.extend({\n  name:    DS.attr('string'),\n  pets: DS.hasMany('pet', { polymorphic: true })\n});\n\nPet = DS.Model.extend({\n  name: DS.attr('string'),\n});\n\nCat = Pet.extend({\n  // ...\n});\n\nParrot = Pet.extend({\n  // ...\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/user.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data;\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n  attrs: {\n    pets: { serialize: 'ids-and-types', deserialize: 'records' }\n  }\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "user": {\n    "id": "1"\n    "name": "Bertin Osborne",\n    "pets": [\n      { "id": "1", "type": "Cat" },\n      { "id": "1", "type": "Parrot"}\n    ]\n  }\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 455, + "description": "

When serializing an embedded record, modify the property (in the json payload)\nthat refers to the parent record (foreign key for relationship).

\n

Serializing a belongsTo relationship removes the property that refers to the\nparent record

\n

Serializing a hasMany relationship does not remove the property that refers to\nthe parent record.

\n", + "itemtype": "method", + "name": "removeEmbeddedForeignKey", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "embeddedSnapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + }, + { + "name": "json", + "description": "", + "type": "Object" + } + ], + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 532, + "itemtype": "method", + "name": "_extractEmbeddedRecords", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 550, + "itemtype": "method", + "name": "_extractEmbeddedHasMany", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 579, + "itemtype": "method", + "name": "_extractEmbeddedBelongsTo", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 602, + "itemtype": "method", + "name": "_normalizeEmbeddedRelationship", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Ember.HTMLBars.helpers.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Ember.HTMLBars.helpers.json new file mode 100644 index 000000000..90e5ef4cf --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Ember.HTMLBars.helpers.json @@ -0,0 +1,63 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.Ember.HTMLBars.helpers", + "type": "class", + "attributes": { + "name": "DS.Ember.HTMLBars.helpers", + "shortname": "Ember.HTMLBars.helpers", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "methods": [ + { + "file": "node_modules/ember-inflector/addon/lib/helpers/pluralize.js", + "line": 4, + "description": "

If you have Ember Inflector (such as if Ember Data is present),\n pluralize a word. For example, turn "ox" into "oxen".\nExample:\n{{pluralize count myProperty}}\n {{pluralize 1 "oxen"}}\n {{pluralize myProperty}}\n {{pluralize "ox"}}

\n", + "itemtype": "method", + "name": "pluralize", + "params": [ + { + "name": "count", + "description": "count of objects", + "type": "Number|Property", + "optional": true + }, + { + "name": "word", + "description": "word to pluralize", + "type": "String|Property" + } + ], + "class": "DS.Ember.HTMLBars.helpers", + "module": "ember-data" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Errors.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Errors.json new file mode 100644 index 000000000..eb387e3f1 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Errors.json @@ -0,0 +1,303 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.Errors", + "type": "class", + "attributes": { + "name": "DS.Errors", + "shortname": "DS.Errors", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/model/errors.js", + "line": 14, + "description": "

Holds validation errors for a given record, organized by attribute names.

\n

Every DS.Model has an errors property that is an instance of\nDS.Errors. This can be used to display validation error\nmessages returned from the server when a record.save() rejects.

\n

For Example, if you had a User model that looked like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  username: DS.attr('string'),\n  email: DS.attr('string')\n});
\n
\n
\n \n

And you attempted to save a record that did not validate on the backend:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let user = store.createRecord('user', {\n  username: 'tomster',\n  email: 'invalidEmail'\n});\nuser.save();
\n
\n
\n \n

Your backend would be expected to return an error response that described\nthe problem, so that error messages can be generated on the app.

\n

API responses will be translated into instances of DS.Errors differently,\ndepending on the specific combination of adapter and serializer used. You\nmay want to check the documentation or the source code of the libraries\nthat you are using, to know how they expect errors to be communicated.

\n

Errors can be displayed to the user by accessing their property name\nto get an array of all the error objects for that property. Each\nerror object is a JavaScript object with two keys:

\n
    \n
  • message A string containing the error message from the backend
  • \n
  • attribute The name of the property associated with this error message
  • \n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
<label>Username: {{input value=username}} </label>\n{{#each model.errors.username as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}\n\n<label>Email: {{input value=email}} </label>\n{{#each model.errors.email as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

You can also access the special messages property on the error\nobject to get an array of all the error strings.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each model.errors.messages as |message|}}\n  <div class="error">\n    {{message}}\n  </div>\n{{/each}}
\n
\n
\n \n", + "extends": "Ember.Object", + "uses": [ + "Ember.Evented", + "Ember.Enumerable" + ], + "methods": [ + { + "file": "addon/-private/system/model/errors.js", + "line": 90, + "description": "

Register with target handler

\n", + "itemtype": "method", + "name": "registerHandlers", + "params": [ + { + "name": "target", + "description": "", + "type": "Object" + }, + { + "name": "becameInvalid", + "description": "", + "type": "Function" + }, + { + "name": "becameValid", + "description": "", + "type": "Function" + } + ], + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 110, + "description": "

Register with target handler

\n", + "itemtype": "method", + "name": "_registerHandlers", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 135, + "description": "

Returns errors for a given attribute

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let user = store.createRecord('user', {\n  username: 'tomster',\n  email: 'invalidEmail'\n});\nuser.save().catch(function(){\n  user.get('errors').errorsFor('email'); // returns:\n  // [{attribute: "email", message: "Doesn't look like a valid email."}]\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "errorsFor", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Array" + }, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 183, + "itemtype": "method", + "name": "unknownProperty", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 208, + "description": "

Adds error messages to a given attribute and sends\nbecameInvalid event to the record.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
if (!user.get('username') {\n  user.get('errors').add('username', 'This field is required');\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "add", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + }, + { + "name": "messages", + "description": "", + "type": "(Array|String)" + } + ], + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 240, + "description": "

Adds error messages to a given attribute without sending event.

\n", + "itemtype": "method", + "name": "_add", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 254, + "itemtype": "method", + "name": "_findOrCreateMessages", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 279, + "description": "

Removes all error messages from the given attribute and sends\nbecameValid event to the record if there no more errors left.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  email: DS.attr('string'),\n  twoFactorAuth: DS.attr('boolean'),\n  phone: DS.attr('string')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/user/edit.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  actions: {\n    save: function(user) {\n      if (!user.get('twoFactorAuth')) {\n        user.get('errors').remove('phone');\n      }\n      user.save();\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "remove", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + } + ], + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 328, + "description": "

Removes all error messages from the given attribute without sending event.

\n", + "itemtype": "method", + "name": "_remove", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 345, + "description": "

Removes all error messages and sends becameValid event\nto the record.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/user/edit.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
  import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  actions: {\n    retrySave: function(user) {\n      user.get('errors').clear();\n      user.save();\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "clear", + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 379, + "description": "

Removes all error messages.\nto the record.

\n", + "itemtype": "method", + "name": "_clear", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 405, + "description": "

Checks if there is error messages for the given attribute.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/user/edit.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  actions: {\n    save: function(user) {\n      if (user.get('errors').has('email')) {\n        return alert('Please update your email before attempting to save.');\n      }\n      user.save();\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "has", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if there some errors on given attribute", + "type": "Boolean" + }, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/model/errors.js", + "line": 122, + "itemtype": "property", + "name": "errorsByAttributeName", + "type": "{Ember.MapWithDefault}", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 157, + "description": "

An array containing all of the error messages for this\nrecord. This is useful for displaying all errors to the user.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each model.errors.messages as |message|}}\n  <div class="error">\n    {{message}}\n  </div>\n{{/each}}
\n
\n
\n \n", + "itemtype": "property", + "name": "messages", + "type": "{Array}", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 174, + "itemtype": "property", + "name": "content", + "type": "{Array}", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 193, + "description": "

Total number of errors.

\n", + "itemtype": "property", + "name": "length", + "type": "{Number}", + "readonly": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 201, + "itemtype": "property", + "name": "isEmpty", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.Object", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.FilteredRecordArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.FilteredRecordArray.json new file mode 100644 index 000000000..65bdca164 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.FilteredRecordArray.json @@ -0,0 +1,258 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.FilteredRecordArray", + "type": "class", + "attributes": { + "name": "DS.FilteredRecordArray", + "shortname": "DS.FilteredRecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-arrays/filtered-record-array.js", + "line": 5, + "description": "

Represents a list of records whose membership is determined by the\nstore. As records are created, loaded, or modified, the store\nevaluates them to determine if they should be part of the record\narray.

\n", + "extends": "DS.RecordArray", + "methods": [ + { + "file": "addon/-private/system/record-arrays/filtered-record-array.js", + "line": 22, + "description": "

The filterFunction is a function used to test records from the store to\ndetermine if they should be part of the record array.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
var allPeople = store.peekAll('person');\nallPeople.mapBy('name'); // ["Tom Dale", "Yehuda Katz", "Trek Glowacki"]\n\nvar people = store.filter('person', function(person) {\n  if (person.get('name').match(/Katz$/)) { return true; }\n});\npeople.mapBy('name'); // ["Yehuda Katz"]\n\nvar notKatzFilter = function(person) {\n  return !person.get('name').match(/Katz$/);\n};\npeople.set('filterFunction', notKatzFilter);\npeople.mapBy('name'); // ["Tom Dale", "Trek Glowacki"]
\n
\n
\n \n", + "itemtype": "method", + "name": "filterFunction", + "params": [ + { + "name": "record", + "description": "", + "type": "DS.Model" + } + ], + "return": { + "description": "`true` if the record should be in the array", + "type": "Boolean" + }, + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/filtered-record-array.js", + "line": 53, + "itemtype": "method", + "name": "updateFilter", + "access": "private", + "tagname": "", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 101, + "description": "

Retrieves an object from the content by index.

\n", + "itemtype": "method", + "name": "objectAtContent", + "access": "private", + "tagname": "", + "params": [ + { + "name": "index", + "description": "", + "type": "Number" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 114, + "description": "

Used to get the latest version of all of the records in this array\nfrom the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
var people = store.peekAll('person');\npeople.get('isUpdating'); // false\n\npeople.update().then(function() {\n  people.get('isUpdating'); // false\n});\n\npeople.get('isUpdating'); // true
\n
\n
\n \n", + "itemtype": "method", + "name": "update", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 157, + "description": "

Adds an internal model to the RecordArray without duplicates

\n", + "itemtype": "method", + "name": "_pushInternalModels", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 171, + "description": "

Removes an internalModel to the RecordArray.

\n", + "itemtype": "method", + "name": "removeInternalModel", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 182, + "description": "

Saves all of the records in the RecordArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
var messages = store.peekAll('message');\nmessages.forEach(function(message) {\n  message.set('hasBeenSeen', true);\n});\nmessages.save();
\n
\n
\n \n", + "itemtype": "method", + "name": "save", + "return": { + "description": "promise", + "type": "DS.PromiseArray" + }, + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 216, + "itemtype": "method", + "name": "_unregisterFromManager", + "access": "private", + "tagname": "", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 30, + "description": "

The array of client ids backing the record array. When a\nrecord is requested from the record array, the record\nfor the client id at the same index is materialized, if\nnecessary, by the store.

\n", + "itemtype": "property", + "name": "content", + "access": "private", + "tagname": "", + "type": "Ember.Array", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 42, + "description": "

The flag to signal a RecordArray is finished loading data.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
var people = store.peekAll('person');\npeople.get('isLoaded'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isLoaded", + "type": "Boolean", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 56, + "description": "

The flag to signal a RecordArray is currently loading data.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
var people = store.peekAll('person');\npeople.get('isUpdating'); // false\npeople.update();\npeople.get('isUpdating'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isUpdating", + "type": "Boolean", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 73, + "description": "

The store that created this record array.

\n", + "itemtype": "property", + "name": "store", + "access": "private", + "tagname": "", + "type": "DS.Store", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 88, + "description": "

The modelClass represented by this record array.

\n", + "itemtype": "property", + "name": "type", + "type": "DS.Model", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.RecordArray" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.RecordArray", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ForbiddenError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ForbiddenError.json new file mode 100644 index 000000000..7e7cc1db4 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ForbiddenError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.ForbiddenError", + "type": "class", + "attributes": { + "name": "DS.ForbiddenError", + "shortname": "DS.ForbiddenError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 253, + "description": "

A DS.ForbiddenError equates to a HTTP 403 Forbidden response status.\nIt is used by an adapter to signal that a request to the external API was\nvalid but the server is refusing to respond to it. If authorization was\nprovided and is valid, then the authenticated user does not have the\nnecessary permissions for the request.

\n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.HasManyReference.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.HasManyReference.json new file mode 100644 index 000000000..ddd8aa6f6 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.HasManyReference.json @@ -0,0 +1,163 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.HasManyReference", + "type": "class", + "attributes": { + "name": "DS.HasManyReference", + "shortname": "DS.HasManyReference", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/references/has-many.js", + "line": 11, + "description": "

A HasManyReference is a low level API that allows users and addon\nauthor to perform meta-operations on a has-many relationship.

\n", + "methods": [ + { + "file": "addon/-private/system/references/has-many.js", + "line": 31, + "description": "

This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the "link" otherwise it defaults to "id".

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [{ type: 'comment', id: 1 }]\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === "ids") {\n  let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === "link") {\n  let link = commentsRef.link();\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "remoteType", + "return": { + "description": "The name of the remote type. This should either be \"link\" or \"ids\"", + "type": "String" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 78, + "description": "

The link Ember Data will use to fetch or reload this has-many\nrelationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        links: {\n          related: '/posts/1/comments'\n        }\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.link(); // '/posts/1/comments'
\n
\n
\n \n", + "itemtype": "method", + "name": "link", + "return": { + "description": "The link Ember Data will use to fetch or reload this has-many relationship.", + "type": "String" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 117, + "description": "

ids() returns an array of the record ids in this relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [{ type: 'comment', id: 1 }]\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']
\n
\n
\n \n", + "itemtype": "method", + "name": "ids", + "return": { + "description": "The ids in this has-many relationship", + "type": "Array" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 157, + "description": "

The meta data for the has-many relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        links: {\n          related: {\n            href: '/posts/1/comments',\n            meta: {\n              count: 10\n            }\n          }\n        }\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.meta(); // { count: 10 }
\n
\n
\n \n", + "itemtype": "method", + "name": "meta", + "return": { + "description": "The meta information for the has-many relationship.", + "type": "Object" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 200, + "description": "

push can be used to update the data in the relationship and Ember\nData will treat the new data as the canonical value of this\nrelationship on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [{ type: 'comment', id: 1 }]\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n\ncommentsRef.push([\n  [{ type: 'comment', id: 2 }],\n  [{ type: 'comment', id: 3 }],\n])\n\ncommentsRef.ids(); // ['2', '3']
\n
\n
\n ", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "objectOrPromise", + "description": "a promise that resolves to a JSONAPI document object describing the new value of this relationship.", + "type": "Array|Promise" + } + ], + "return": { + "description": "", + "type": "DS.ManyArray" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 313, + "description": "

value() synchronously returns the current value of the has-many\n relationship. Unlike record.get('relationshipName'), calling\n value() on a reference does not trigger a fetch if the async\n relationship is not yet loaded. If the relationship is not loaded\n it will always return null.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [{ type: 'comment', id: 1 }]\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\npost.get('comments').then(function(comments) {\n  commentsRef.value() === comments\n})
\n
\n
\n \n", + "itemtype": "method", + "name": "value", + "return": { + "description": "", + "type": "DS.ManyArray" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 359, + "description": "

Loads the relationship if it is not already loaded. If the\nrelationship is already loaded this method does not trigger a new\nload.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [{ type: 'comment', id: 1 }]\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.load().then(function(comments) {\n  //...\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "load", + "return": { + "description": "a promise that resolves with the ManyArray in\nthis has-many relationship.", + "type": "Promise" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 404, + "description": "

Reloads this has-many relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
export default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
let post = store.push({\n  data: {\n    type: 'post',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [{ type: 'comment', id: 1 }]\n      }\n    }\n  }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.reload().then(function(comments) {\n  //...\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "reload", + "return": { + "description": "a promise that resolves with the ManyArray in this has-many relationship.", + "type": "Promise" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.InvalidError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.InvalidError.json new file mode 100644 index 000000000..ff3c9b7c4 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.InvalidError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.InvalidError", + "type": "class", + "attributes": { + "name": "DS.InvalidError", + "shortname": "DS.InvalidError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 110, + "description": "

A DS.InvalidError is used by an adapter to signal the external API\nwas unable to process a request because the content was not\nsemantically correct or meaningful per the API. Usually this means a\nrecord failed some form of server side validation. When a promise\nfrom an adapter is rejected with a DS.InvalidError the record will\ntransition to the invalid state and the errors will be set to the\nerrors property on the record.

\n

For Ember Data to correctly map errors to their corresponding\nproperties on the model, Ember Data expects each error to be\na valid json-api error object with a source/pointer that matches\nthe property name. For example if you had a Post model that\nlooked like this.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n6\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  title: DS.attr('string'),\n  content: DS.attr('string')\n});
\n
\n
\n \n

To show an error from the server related to the title and\ncontent properties your adapter could return a promise that\nrejects with a DS.InvalidError object that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n
import RSVP from 'RSVP';\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  updateRecord() {\n    // Fictional adapter that always rejects\n    return RSVP.reject(new DS.InvalidError([\n      {\n        detail: 'Must be unique',\n        source: { pointer: '/data/attributes/title' }\n      },\n      {\n        detail: 'Must not be blank',\n        source: { pointer: '/data/attributes/content'}\n      }\n    ]));\n  }\n});
\n
\n
\n \n

Your backend may use different property names for your records the\nstore will attempt extract and normalize the errors using the\nserializer's extractErrors method before the errors get added to\nthe the model. As a result, it is safe for the InvalidError to\nwrap the error payload unaltered.

\n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONAPIAdapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONAPIAdapter.json similarity index 52% rename from json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONAPIAdapter.json rename to json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONAPIAdapter.json index 59c9d2809..0fbd80f29 100644 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONAPIAdapter.json +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONAPIAdapter.json @@ -1,32 +1,27 @@ { "data": { - "id": "ember-data-2.18.5-JSONAPIAdapter", + "id": "ember-data-2.18.5-DS.JSONAPIAdapter", "type": "class", "attributes": { - "name": "JSONAPIAdapter", - "shortname": "JSONAPIAdapter", + "name": "DS.JSONAPIAdapter", + "shortname": "DS.JSONAPIAdapter", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], - "module": "@ember-data/adapter/json-api", - "namespace": "", - "file": "../adapter/src/json-api.ts", - "line": 18, - "description": "

Overview

\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

The JSONAPIAdapter is an adapter whichtransforms the store's\nrequests into HTTP requests that follow the JSON API format.

\n

JSON API Conventions

\n

The JSONAPIAdapter uses JSON API conventions for building the URL\nfor a record and selecting the HTTP verb to use with a request. The\nactions you can take on a record map onto the following URLs in the\nJSON API adapter:

\n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n
\n Action\n \n HTTP Verb\n \n URL\n
\n `store.findRecord('post', 123)`\n \n GET\n \n /posts/123\n
\n `store.findAll('post')`\n \n GET\n \n /posts\n
\n Update `postRecord.save()`\n \n PATCH\n \n /posts/123\n
\n Create `store.createRecord('post').save()`\n \n POST\n \n /posts\n
\n Delete `postRecord.destroyRecord()`\n \n DELETE\n \n /posts/123\n
\n\n

Success and failure

\n

The JSONAPIAdapter will consider a success any response with a\nstatus code of the 2xx family ("Success"), as well as 304 ("Not\nModified"). Any other status code will be considered a failure.

\n

On success, the request promise will be resolved with the full\nresponse payload.

\n

Failed responses with status code 422 ("Unprocessable Entity") will\nbe considered "invalid". The response will be discarded, except for\nthe errors key. The request promise will be rejected with a\nInvalidError. This error object will encapsulate the saved\nerrors value.

\n

Any other status codes will be treated as an adapter error. The\nrequest promise will be rejected, similarly to the invalid case,\nbut with an instance of AdapterError instead.

\n

Endpoint path customization

\n

Endpoint paths can be prefixed with a namespace by setting the\nnamespace property on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  namespace = 'api/1';\n}
\n
\n
\n \n

Requests for the person model would now target /api/1/people/1.

\n

Host customization

\n

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  host = 'https://api.example.com';\n}
\n
\n
\n \n

Requests for the person model would now target\nhttps://api.example.com/people/1.

\n", + "module": "ember-data", + "namespace": "DS", + "file": "addon/adapters/json-api.js", + "line": 13, + "description": "

The JSONAPIAdapter is the default adapter used by Ember Data. It\nis responsible for transforming the store's requests into HTTP\nrequests that follow the JSON API\nformat.

\n

JSON API Conventions

\n

The JSONAPIAdapter uses JSON API conventions for building the url\nfor a record and selecting the HTTP verb to use with a request. The\nactions you can take on a record map onto the following URLs in the\nJSON API adapter:

\n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n
\n Action\n \n HTTP Verb\n \n URL\n
\n `store.findRecord('post', 123)`\n \n GET\n \n /posts/123\n
\n `store.findAll('post')`\n \n GET\n \n /posts\n
\n Update `postRecord.save()`\n \n PATCH\n \n /posts/123\n
\n Create `store.createRecord('post').save()`\n \n POST\n \n /posts\n
\n Delete `postRecord.destroyRecord()`\n \n DELETE\n \n /posts/123\n
\n\n

Success and failure

\n

The JSONAPIAdapter will consider a success any response with a\nstatus code of the 2xx family ("Success"), as well as 304 ("Not\nModified"). Any other status code will be considered a failure.

\n

On success, the request promise will be resolved with the full\nresponse payload.

\n

Failed responses with status code 422 ("Unprocessable Entity") will\nbe considered "invalid". The response will be discarded, except for\nthe errors key. The request promise will be rejected with a\nDS.InvalidError. This error object will encapsulate the saved\nerrors value.

\n

Any other status codes will be treated as an adapter error. The\nrequest promise will be rejected, similarly to the invalid case,\nbut with an instance of DS.AdapterError instead.

\n

Endpoint path customization

\n

Endpoint paths can be prefixed with a namespace by setting the\nnamespace property on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  namespace: 'api/1'\n});
\n
\n
\n \n

Requests for the person model would now target /api/1/people/1.

\n

Host customization

\n

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  host: 'https://api.example.com'\n});
\n
\n
\n \n

Requests for the person model would now target\nhttps://api.example.com/people/1.

\n", "since": "1.13.0", - "mainName": "@ember-data/adapter/json-api", - "tag": "main", - "_main": true, - "access": "public", - "tagname": "", "is_constructor": 1, - "extends": "RESTAdapter", + "extends": "DS.RESTAdapter", "methods": [ { - "file": "../packages/adapter/src/json-api.ts", - "line": 166, + "file": "addon/adapters/json-api.js", + "line": 152, "itemtype": "method", "name": "ajaxOptions", "access": "private", @@ -52,13 +47,14 @@ "description": "", "type": "Object" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/json-api" + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 369, - "description": "

By default, the RESTAdapter will send the query params sorted alphabetically to the\nserver.

\n

For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('posts', { sort: 'price', category: 'pets' });
\n
\n
\n \n

will generate a requests like this /posts?category=pets&sort=price, even if the\nparameters were specified in a different order.

\n

That way the generated URL will be deterministic and that simplifies caching mechanisms\nin the backend.

\n

Setting sortQueryParams to a falsey value will respect the original order.

\n

In case you want to sort the query parameters with a different criteria, set\nsortQueryParams to your custom sort function.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  sortQueryParams(params) {\n    let sortedKeys = Object.keys(params).sort().reverse();\n    let len = sortedKeys.length, newParams = {};\n\n    for (let i = 0; i < len; i++) {\n      newParams[sortedKeys[i]] = params[sortedKeys[i]];\n    }\n\n    return newParams;\n  }\n}
\n
\n
\n \n", + "file": "addon/adapters/rest.js", + "line": 294, + "description": "

By default, the RESTAdapter will send the query params sorted alphabetically to the\nserver.

\n

For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('posts', { sort: 'price', category: 'pets' });
\n
\n
\n \n

will generate a requests like this /posts?category=pets&sort=price, even if the\nparameters were specified in a different order.

\n

That way the generated URL will be deterministic and that simplifies caching mechanisms\nin the backend.

\n

Setting sortQueryParams to a falsey value will respect the original order.

\n

In case you want to sort the query parameters with a different criteria, set\nsortQueryParams to your custom sort function.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  sortQueryParams(params) {\n    let sortedKeys = Object.keys(params).sort().reverse();\n    let len = sortedKeys.length, newParams = {};\n\n    for (let i = 0; i < len; i++) {\n      newParams[sortedKeys[i]] = params[sortedKeys[i]];\n    }\n\n    return newParams;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "sortQueryParams", "params": [ @@ -72,32 +68,29 @@ "description": "", "type": "Object" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 551, + "file": "addon/adapters/rest.js", + "line": 457, "description": "

Called by the store in order to fetch the JSON for a given\ntype and ID.

\n

The findRecord method makes an Ajax request to a URL computed by\nbuildURL, and returns a promise for the resulting payload.

\n

This method performs an HTTP GET request with the id provided as part of the query string.

\n", "since": "1.13.0", "itemtype": "method", "name": "findRecord", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "id", @@ -107,159 +100,140 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 576, + "file": "addon/adapters/rest.js", + "line": 490, "description": "

Called by the store in order to fetch a JSON array for all\nof the records for a given type.

\n

The findAll method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a\npromise for the resulting payload.

\n", "itemtype": "method", "name": "findAll", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" + "name": "sinceToken", + "description": "", + "type": "String" }, { "name": "snapshotRecordArray", "description": "", - "type": "SnapshotRecordArray" + "type": "DS.SnapshotRecordArray" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 607, + "file": "addon/adapters/rest.js", + "line": 526, "description": "

Called by the store in order to fetch a JSON array for\nthe records that match a particular query.

\n

The query method makes an Ajax (HTTP GET) request to a URL\ncomputed by buildURL, and returns a promise for the resulting\npayload.

\n

The query argument is a simple JavaScript object that will be passed directly\nto the server as parameters.

\n", "itemtype": "method", "name": "query", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "query", "description": "", "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 637, + "file": "addon/adapters/rest.js", + "line": 562, "description": "

Called by the store in order to fetch a JSON object for\nthe record that matches a particular query.

\n

The queryRecord method makes an Ajax (HTTP GET) request to a URL\ncomputed by buildURL, and returns a promise for the resulting\npayload.

\n

The query argument is a simple JavaScript object that will be passed directly\nto the server as parameters.

\n", "since": "1.13.0", "itemtype": "method", "name": "queryRecord", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "query", "description": "", "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 672, + "file": "addon/adapters/rest.js", + "line": 599, "description": "

Called by the store in order to fetch several records together if coalesceFindRequests is true

\n

For example, if the original payload looks like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "id": 1,\n  "title": "Rails is omakase",\n  "comments": [ 1, 2, 3 ]\n}
\n
\n
\n \n

The IDs will be passed as a URL-encoded Array of IDs, in this form:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
ids[]=1&ids[]=2&ids[]=3
\n
\n
\n

Many servers, such as Rails and PHP, will automatically convert this URL-encoded array\ninto an Array for you on the server-side. If you want to encode the\nIDs, differently, just override this (one-line) method.

\n

The findMany method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a\npromise for the resulting payload.

\n", "itemtype": "method", "name": "findMany", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "ids", @@ -276,29 +250,28 @@ "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 711, + "file": "addon/adapters/rest.js", + "line": 646, "description": "

Called by the store in order to fetch a JSON array for\nthe unloaded records in a has-many relationship that were originally\nspecified as a URL (inside of links).

\n

For example, if your original payload looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "post": {\n    "id": 1,\n    "title": "Rails is omakase",\n    "links": { "comments": "/posts/1/comments" }\n  }\n}
\n
\n
\n \n

This method will be called with the parent record and /posts/1/comments.

\n

The findHasMany method will make an Ajax (HTTP GET) request to the originally specified URL.

\n

The format of your links value will influence the final request URL via the urlPrefix method:

\n
    \n
  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

    \n
  • \n
  • Links beginning with a single / will have the current adapter's host value prepended to it.

    \n
  • \n
  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

    \n
  • \n
\n", "itemtype": "method", "name": "findHasMany", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" }, { "name": "url", @@ -315,29 +288,28 @@ "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 766, + "file": "addon/adapters/rest.js", + "line": 700, "description": "

Called by the store in order to fetch the JSON for the unloaded record in a\nbelongs-to relationship that was originally specified as a URL (inside of\nlinks).

\n

For example, if your original payload looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "person": {\n    "id": 1,\n    "name": "Tom Dale",\n    "links": { "group": "/people/1/group" }\n  }\n}
\n
\n
\n \n

This method will be called with the parent record and /people/1/group.

\n

The findBelongsTo method will make an Ajax (HTTP GET) request to the originally specified URL.

\n

The format of your links value will influence the final request URL via the urlPrefix method:

\n
    \n
  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

    \n
  • \n
  • Links beginning with a single / will have the current adapter's host value prepended to it.

    \n
  • \n
  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

    \n
  • \n
\n", "itemtype": "method", "name": "findBelongsTo", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" }, { "name": "url", @@ -354,126 +326,122 @@ "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 815, + "file": "addon/adapters/rest.js", + "line": 753, "description": "

Called by the store when a newly created record is\nsaved via the save method on a model record instance.

\n

The createRecord method serializes the record and makes an Ajax (HTTP POST) request\nto a URL computed by buildURL.

\n

See serialize for information on how to customize the serialized form\nof a record.

\n", "itemtype": "method", "name": "createRecord", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 840, + "file": "addon/adapters/rest.js", + "line": 788, "description": "

Called by the store when an existing record is saved\nvia the save method on a model record instance.

\n

The updateRecord method serializes the record and makes an Ajax (HTTP PUT) request\nto a URL computed by buildURL.

\n

See serialize for information on how to customize the serialized form\nof a record.

\n", "itemtype": "method", "name": "updateRecord", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { - "name": "schema", + "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 867, + "file": "addon/adapters/rest.js", + "line": 825, "description": "

Called by the store when a record is deleted.

\n

The deleteRecord method makes an Ajax (HTTP DELETE) request to a URL computed by buildURL.

\n", "itemtype": "method", "name": "deleteRecord", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 917, + "file": "addon/adapters/rest.js", + "line": 875, "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

This implementation groups together records that have the same base URL but\ndiffering ids. For example /comments/1 and /comments/2 will be grouped together\nbecause we know findMany can coalesce them together as /comments?ids[]=1&ids[]=2

\n

It also supports urls where ids are passed as a query param, such as /comments?id=1\nbut not those where there is more than 1 query param such as /comments?id=2&name=David\nCurrently only the query param of id is supported. If you need to support others, please\noverride this or the _stripIDFromURL method.

\n

It does not group records that have differing base urls, such as for example: /posts/1/comments/2\nand /posts/2/comments/3

\n", "itemtype": "method", "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshots", @@ -485,20 +453,19 @@ "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", "type": "Array" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 986, - "description": "

Takes an ajax response, and returns the json payload or an error.

\n

By default this hook just returns the json payload passed to it.\nYou might want to override it in two cases:

\n
    \n
  1. Your API might return useful results in the response headers.\nResponse headers are passed in as the second argument.

    \n
  2. \n
  3. Your API might return errors as successful responses with status code\n200 and an Errors text or object. You can return a InvalidError or a\nAdapterError (or a sub class) from this hook and it will automatically\nreject the promise and put your record into the invalid or error state.

    \n
  4. \n
\n

Returning a InvalidError from this method will cause the\nrecord to transition into the invalid state and make the\nerrors object available on the record. When returning an\nInvalidError the store will attempt to normalize the error data\nreturned from the server using the serializer's extractErrors\nmethod.

\n", + "file": "addon/adapters/rest.js", + "line": 939, + "description": "

Takes an ajax response, and returns the json payload or an error.

\n

By default this hook just returns the json payload passed to it.\nYou might want to override it in two cases:

\n
    \n
  1. Your API might return useful results in the response headers.\nResponse headers are passed in as the second argument.

    \n
  2. \n
  3. Your API might return errors as successful responses with status code\n200 and an Errors text or object. You can return a DS.InvalidError or a\nDS.AdapterError (or a sub class) from this hook and it will automatically\nreject the promise and put your record into the invalid or error state.

    \n
  4. \n
\n

Returning a DS.InvalidError from this method will cause the\nrecord to transition into the invalid state and make the\nerrors object available on the record. When returning an\nDS.InvalidError the store will attempt to normalize the error data\nreturned from the server using the serializer's extractErrors\nmethod.

\n", "since": "1.13.0", "itemtype": "method", "name": "handleResponse", - "access": "public", - "tagname": "", "params": [ { "name": "status", @@ -523,22 +490,21 @@ ], "return": { "description": "response", - "type": "Object | AdapterError" + "type": "Object | DS.AdapterError" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1049, + "file": "addon/adapters/rest.js", + "line": 996, "description": "

Default handleResponse implementation uses this hook to decide if the\nresponse is a success.

\n", "since": "1.13.0", "itemtype": "method", "name": "isSuccess", - "access": "public", - "tagname": "", "params": [ { "name": "status", @@ -560,20 +526,19 @@ "description": "", "type": "Boolean" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1065, + "file": "addon/adapters/rest.js", + "line": 1011, "description": "

Default handleResponse implementation uses this hook to decide if the\nresponse is an invalid error.

\n", "since": "1.13.0", "itemtype": "method", "name": "isInvalid", - "access": "public", - "tagname": "", "params": [ { "name": "status", @@ -595,14 +560,15 @@ "description": "", "type": "Boolean" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1081, + "file": "addon/adapters/rest.js", + "line": 1026, "description": "

Takes a URL, an HTTP method and a hash of data, and makes an\nHTTP request.

\n

When the server responds with a payload, Ember Data will call into extractSingle\nor extractArray (depending on whether the original query was for one record or\nmany records).

\n

By default, ajax method has the following behavior:

\n
    \n
  • It sets the response dataType to "json"
  • \n
  • If the HTTP method is not "GET", it sets the Content-Type to be\napplication/json; charset=utf-8
  • \n
  • If the HTTP method is not "GET", it stringifies the data passed in. The\ndata is the serialized record in the case of a save.
  • \n
  • Registers success and failure handlers.
  • \n
\n", "itemtype": "method", "name": "ajax", @@ -629,14 +595,15 @@ "description": "promise", "type": "Promise" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1142, + "file": "addon/adapters/rest.js", + "line": 1082, "itemtype": "method", "name": "_ajaxRequest", "access": "private", @@ -648,14 +615,15 @@ "type": "Object" } ], - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1166, + "file": "addon/adapters/rest.js", + "line": 1091, "itemtype": "method", "name": "ajaxOptions", "access": "private", @@ -681,14 +649,15 @@ "description": "", "type": "Object" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1241, + "file": "addon/adapters/rest.js", + "line": 1137, "itemtype": "method", "name": "parseErrorResponse", "access": "private", @@ -704,14 +673,15 @@ "description": "", "type": "Object" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1259, + "file": "addon/adapters/rest.js", + "line": 1155, "itemtype": "method", "name": "normalizeErrorResponse", "access": "private", @@ -737,14 +707,15 @@ "description": "errors payload", "type": "Array" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 1289, + "file": "addon/adapters/rest.js", + "line": 1177, "description": "

Generates a detailed ("friendly") error message, with plenty\nof information for debugging (good luck!)

\n", "itemtype": "method", "name": "generatedDetailedMessage", @@ -776,52 +747,28 @@ "description": "detailed error message", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", - "inherited": true, - "inheritedFrom": "RESTAdapter" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1321, - "description": "

Used by findAll and findRecord to build the query's data hash\nsupplied to the ajax method.

\n", - "itemtype": "method", - "name": "buildQuery", - "since": "2.5.0", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 260, - "description": "

The findRecord() method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to findRecord() being called, you\nshould query your persistence layer for a record with the given ID. The findRecord\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.

\n

Here is an example of the findRecord implementation:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findRecord(store, type, id, snapshot) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 87, + "description": "

The findRecord() method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to findRecord() being called, you\nshould query your persistence layer for a record with the given ID. The findRecord\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.

\n

Here is an example findRecord implementation:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findRecord(store, type, id, snapshot) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "findRecord", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "id", @@ -831,75 +778,73 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 302, - "description": "

The findAll() method is used to retrieve all records for a given type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findAll(store, type) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 123, + "description": "

The findAll() method is used to retrieve all records for a given type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findAll(store, type, sinceToken) {\n    let query = { since: sinceToken };\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "findAll", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" + "name": "sinceToken", + "description": "", + "type": "String" }, { "name": "snapshotRecordArray", "description": "", - "type": "SnapshotRecordArray" + "type": "DS.SnapshotRecordArray" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 345, - "description": "

This method is called when you call query on the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  query(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 157, + "description": "

This method is called when you call query on the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  query(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "query", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "query", @@ -909,80 +854,68 @@ { "name": "recordArray", "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" + "type": "DS.AdapterPopulatedRecordArray" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 384, - "description": "

The queryRecord() method is invoked when the store is asked for a single\nrecord through a query object.

\n

In response to queryRecord() being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's push() method\nto push the record into the store.

\n

Here is an example queryRecord implementation:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter, { BuildURLMixin } from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n  queryRecord(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 189, + "description": "

The queryRecord() method is invoked when the store is asked for a single\nrecord through a query object.

\n

In response to queryRecord() being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's push() method\nto push the record into the store.

\n

Here is an example queryRecord implementation:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend(DS.BuildURLMixin, {\n  queryRecord(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "queryRecord", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", "description": "", - "type": "Subclass of Model" + "type": "subclass of DS.Model" }, { "name": "query", "description": "", "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 429, - "description": "

If the globally unique IDs for your records should be generated on the client,\nimplement the generateIdForRecord() method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's primaryKey.

\n

Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls didCreateRecord(). Only implement this method if\nyou intend to generate record IDs on the client-side.

\n

The generateIdForRecord() method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Adapter from '@ember-data/adapter';\nimport { v4 } from 'uuid';\n\nexport default class ApplicationAdapter extends Adapter {\n  generateIdForRecord(store, type, inputProperties) {\n    return v4();\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 227, + "description": "

If the globally unique IDs for your records should be generated on the client,\nimplement the generateIdForRecord() method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's primaryKey.

\n

Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls didCreateRecord(). Only implement this method if\nyou intend to generate record IDs on the client-side.

\n

The generateIdForRecord() method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { v4 } from 'uuid';\n\nexport default DS.Adapter.extend({\n  generateIdForRecord(store, inputProperties) {\n    return v4();\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "generateIdForRecord", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", - "description": "the Model class of the record", - "type": "Model" + "description": "the DS.Model class of the record", + "type": "DS.Model" }, { "name": "inputProperties", @@ -994,24 +927,23 @@ "description": "id", "type": "(String|Number)" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 463, - "description": "

Proxies to the serializer's serialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import Adapter from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter {\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let url = `/${type.modelName}`;\n\n    // ...\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 261, + "description": "

Proxies to the serializer's serialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let url = `/${type.modelName}`;\n\n    // ...\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "serialize", "params": [ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" }, { "name": "options", @@ -1023,131 +955,127 @@ "description": "serialized snapshot", "type": "Object" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 491, - "description": "

Implement this method in a subclass to handle the creation of\nnew records.

\n

Serializes the record and sends it to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n\n    return new RSVP.Promise(function (resolve, reject) {\n      $.ajax({\n        type: 'POST',\n        url: `/${type.modelName}`,\n        dataType: 'json',\n        data: data\n      }).then(function (data) {\n        resolve(data);\n      }, function (jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 288, + "description": "

Implement this method in a subclass to handle the creation of\nnew records.

\n

Serializes the record and sends it to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'POST',\n        url: `/${type.modelName}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "createRecord", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", - "description": "the Model class of the record", - "type": "Model" + "description": "the DS.Model class of the record", + "type": "DS.Model" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 539, - "description": "

Implement this method in a subclass to handle the updating of\na record.

\n

Serializes the record update and sends it to the server.

\n

The updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with undefined and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  updateRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'PUT',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 331, + "description": "

Implement this method in a subclass to handle the updating of\na record.

\n

Serializes the record update and sends it to the server.

\n

The updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with undefined and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  updateRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'PUT',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "updateRecord", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", - "description": "the Model class of the record", - "type": "Model" + "description": "the DS.Model class of the record", + "type": "DS.Model" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 596, - "description": "

Implement this method in a subclass to handle the deletion of\na record.

\n

Sends a delete request for the record to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  deleteRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'DELETE',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        resolve(data)\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 383, + "description": "

Implement this method in a subclass to handle the deletion of\na record.

\n

Sends a delete request for the record to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  deleteRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'DELETE',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "deleteRecord", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", - "description": "the Model class of the record", - "type": "Model" + "description": "the DS.Model class of the record", + "type": "DS.Model" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 667, - "description": "

The store will call findMany instead of multiple findRecord\nrequests to find multiple records at once if coalesceFindRequests\nis true.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findMany(store, type, ids, snapshots) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'GET',\n        url: `/${type.modelName}/`,\n        dataType: 'json',\n        data: { filter: { id: ids.join(',') } }\n      }).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", + "file": "addon/adapter.js", + "line": 438, + "description": "

The store will call findMany instead of multiple findRecord\nrequests to find multiple records at once if coalesceFindRequests\nis true.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findMany(store, type, ids, snapshots) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'GET',\n        url: `/${type.modelName}/`,\n        dataType: 'json',\n        data: { filter: { id: ids.join(',') } }\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "findMany", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "type", - "description": "the Model class of the records", - "type": "Model" + "description": "the DS.Model class of the records", + "type": "DS.Model" }, { "name": "ids", @@ -1164,26 +1092,23 @@ "description": "promise", "type": "Promise" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 705, - "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

For example, if your API has nested URLs that depend on the parent, you will\nwant to group records by their parent.

\n

The default implementation returns the records as a single group.

\n", + "file": "addon/adapter.js", + "line": 477, + "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

For example, if your api has nested URLs that depend on the parent, you will\nwant to group records by their parent.

\n

The default implementation returns the records as a single group.

\n", "itemtype": "method", "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshots", @@ -1195,14 +1120,15 @@ "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", "type": "Array" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 725, + "file": "addon/adapter.js", + "line": 497, "description": "

This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\nstore.findRecord.

\n

If this method returns true, the store will re-fetch a record from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached record.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
shouldReloadRecord(store, ticketSnapshot) {\n  let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n  let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n  if (timeDiff > 20) {\n    return true;\n  } else {\n    return false;\n  }\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findRecord('ticket',\nid) you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, findRecord will not\nresolve until you fetched the latest version.

\n

By default this hook returns false, as most UIs should not block user\ninteractions while waiting on data update.

\n

Note that, with default settings, shouldBackgroundReloadRecord will always\nre-fetch the records in the background even if shouldReloadRecord returns\nfalse. You can override shouldBackgroundReloadRecord if this does not\nsuit your use case.

\n", "since": "1.13.0", "itemtype": "method", @@ -1211,29 +1137,28 @@ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "", "type": "Boolean" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 776, - "description": "

This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\nstore.findAll.

\n

If this method returns true, the store will re-fetch all records from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached records.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
shouldReloadAll(store, snapshotArray) {\n  let snapshots = snapshotArray.snapshots();\n\n  return snapshots.any((ticketSnapshot) => {\n    let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n    let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n    if (timeDiff > 20) {\n      return true;\n    } else {\n      return false;\n    }\n  });\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findAll('ticket') you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, findAll will not\nresolve until you fetched the latest versions.

\n

By default, this method returns true if the passed snapshotRecordArray\nis empty (meaning that there are no records locally available yet),\notherwise, it returns false.

\n

Note that, with default settings, shouldBackgroundReloadAll will always\nre-fetch all the records in the background even if shouldReloadAll returns\nfalse. You can override shouldBackgroundReloadAll if this does not suit\nyour use case.

\n", + "file": "addon/adapter.js", + "line": 547, + "description": "

This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\nstore.findAll.

\n

If this method returns true, the store will re-fetch all records from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached records.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
shouldReloadAll(store, snapshotArray) {\n  let snapshots = snapshotArray.snapshots();\n\n  return snapshots.any((ticketSnapshot) => {\n    let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n    let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n    if (timeDiff > 20) {\n      return true;\n    } else {\n      return false;\n    }\n  });\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findAll('ticket') you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, findAll will not\nresolve until you fetched the latest versions.

\n

By default this methods returns true if the passed snapshotRecordArray\nis empty (meaning that there are no records locally available yet),\notherwise it returns false.

\n

Note that, with default settings, shouldBackgroundReloadAll will always\nre-fetch all the records in the background even if shouldReloadAll returns\nfalse. You can override shouldBackgroundReloadAll if this does not suit\nyour use case.

\n", "since": "1.13.0", "itemtype": "method", "name": "shouldReloadAll", @@ -1241,29 +1166,28 @@ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshotRecordArray", "description": "", - "type": "SnapshotRecordArray" + "type": "DS.SnapshotRecordArray" } ], "return": { "description": "", "type": "Boolean" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 832, - "description": "

This method is used by the store to determine if the store should\nreload a record after the store.findRecord method resolves a\ncached record.

\n

This method is only checked by the store when the store is\nreturning a cached record.

\n

If this method returns true the store will re-fetch a record from\nthe adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadRecord as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
shouldBackgroundReloadRecord(store, snapshot) {\n  let { downlink, effectiveType } = navigator.connection;\n\n  return downlink > 0 && effectiveType === '4g';\n}
\n
\n
\n \n

By default, this hook returns true so the data for the record is updated\nin the background.

\n", + "file": "addon/adapter.js", + "line": 602, + "description": "

This method is used by the store to determine if the store should\nreload a record after the store.findRecord method resolves a\ncached record.

\n

This method is only checked by the store when the store is\nreturning a cached record.

\n

If this method returns true the store will re-fetch a record from\nthe adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadRecord as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
shouldBackgroundReloadRecord(store, snapshot) {\n  let connection = window.navigator.connection;\n\n  if (connection === 'cellular' || connection === 'none') {\n    return false;\n  } else {\n    return true;\n  }\n}
\n
\n
\n \n

By default this hook returns true so the data for the record is updated\nin the background.

\n", "since": "1.13.0", "itemtype": "method", "name": "shouldBackgroundReloadRecord", @@ -1271,29 +1195,28 @@ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "", "type": "Boolean" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 869, - "description": "

This method is used by the store to determine if the store should\nreload a record array after the store.findAll method resolves\nwith a cached record array.

\n

This method is only checked by the store when the store is\nreturning a cached record array.

\n

If this method returns true the store will re-fetch all records\nfrom the adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadAll as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
shouldBackgroundReloadAll(store, snapshotArray) {\n  let { downlink, effectiveType } = navigator.connection;\n\n  return downlink > 0 && effectiveType === '4g';\n}
\n
\n
\n \n

By default this method returns true, indicating that a background reload\nshould always be triggered.

\n", + "file": "addon/adapter.js", + "line": 642, + "description": "

This method is used by the store to determine if the store should\nreload a record array after the store.findAll method resolves\nwith a cached record array.

\n

This method is only checked by the store when the store is\nreturning a cached record array.

\n

If this method returns true the store will re-fetch all records\nfrom the adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadAll as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
shouldBackgroundReloadAll(store, snapshotArray) {\n  let connection = window.navigator.connection;\n\n  if (connection === 'cellular' || connection === 'none') {\n    return false;\n  } else {\n    return true;\n  }\n}
\n
\n
\n \n

By default this method returns true, indicating that a background reload\nshould always be triggered.

\n", "since": "1.13.0", "itemtype": "method", "name": "shouldBackgroundReloadAll", @@ -1301,33 +1224,30 @@ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "snapshotRecordArray", "description": "", - "type": "SnapshotRecordArray" + "type": "DS.SnapshotRecordArray" } ], "return": { "description": "", "type": "Boolean" }, - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 145, - "description": "

Builds a URL for a given type and optional ID.

\n

By default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see pathForType.

\n

If an ID is specified, it adds the ID to the path generated\nfor the type, separated by a /.

\n

When called by RESTAdapter.findMany() the id and snapshot parameters\nwill be arrays of ids and snapshots.

\n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 34, + "description": "

Builds a URL for a given type and optional ID.

\n

By default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see pathForType.

\n

If an ID is specified, it adds the ID to the path generated\nfor the type, separated by a /.

\n

When called by RESTAdapter.findMany() the id and snapshot parameters\nwill be arrays of ids and snapshots.

\n", "itemtype": "method", "name": "buildURL", - "access": "public", - "tagname": "", "params": [ { "name": "modelName", @@ -1342,7 +1262,7 @@ { "name": "snapshot", "description": "single snapshot or array of snapshots", - "type": "(Snapshot|SnapshotRecordArray)" + "type": "(DS.Snapshot|Array)" }, { "name": "requestType", @@ -1359,14 +1279,14 @@ "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 294, + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 82, "itemtype": "method", "name": "_buildURL", "access": "private", @@ -1387,19 +1307,17 @@ "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 329, - "description": "

Builds a URL for a store.findRecord(type, id) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindRecord(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id, snapshot);\n    return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 111, + "description": "

Builds a URL for a store.findRecord(type, id) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindRecord(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id, snapshot);\n    return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForFindRecord", - "access": "public", - "tagname": "", "params": [ { "name": "id", @@ -1414,26 +1332,24 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 357, - "description": "

Builds a URL for a store.findAll(type) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindAll(modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName);\n    return `${baseUrl}/data/comments.json`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 138, + "description": "

Builds a URL for a store.findAll(type) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/comment.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindAll(modelName, snapshot) {\n    return 'data/comments.json';\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForFindAll", - "access": "public", - "tagname": "", "params": [ { "name": "modelName", @@ -1443,26 +1359,24 @@ { "name": "snapshot", "description": "", - "type": "SnapshotRecordArray" + "type": "DS.SnapshotRecordArray" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 383, - "description": "

Builds a URL for a store.query(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  host = 'https://api.github.com';\n  urlForQuery (query, modelName) {\n    switch(modelName) {\n      case 'repo':\n        return `https://api.github.com/orgs/${query.orgId}/repos`;\n      default:\n        return super.urlForQuery(...arguments);\n    }\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 162, + "description": "

Builds a URL for a store.query(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  host: 'https://api.github.com',\n  urlForQuery (query, modelName) {\n    switch(modelName) {\n      case 'repo':\n        return `https://api.github.com/orgs/${query.orgId}/repos`;\n      default:\n        return this._super(...arguments);\n    }\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForQuery", - "access": "public", - "tagname": "", "params": [ { "name": "query", @@ -1479,19 +1393,17 @@ "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 414, - "description": "

Builds a URL for a store.queryRecord(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForQueryRecord({ slug }, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/${encodeURIComponent(slug)}`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 192, + "description": "

Builds a URL for a store.queryRecord(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForQueryRecord({ slug }, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/${encodeURIComponent(slug)}`;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForQueryRecord", - "access": "public", - "tagname": "", "params": [ { "name": "query", @@ -1508,19 +1420,17 @@ "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 440, - "description": "

Builds a URL for coalescing multiple store.findRecord(type, id)\nrecords into 1 request when the adapter's coalesceFindRequests\nproperty is true.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForFindMany(ids, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/coalesce`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 217, + "description": "

Builds a URL for coalesceing multiple store.findRecord(type, id)\nrecords into 1 request when the adapter's coalesceFindRequests\nproperty is true.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForFindMany(ids, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/coalesce`;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForFindMany", - "access": "public", - "tagname": "", "params": [ { "name": "ids", @@ -1542,19 +1452,17 @@ "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 469, - "description": "

Builds a URL for fetching an async hasMany relationship when a URL\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindHasMany(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id);\n    return `${baseUrl}/relationships`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 245, + "description": "

Builds a URL for fetching a async hasMany relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindHasMany(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(id, modelName);\n    return `${baseUrl}/relationships`;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForFindHasMany", - "access": "public", - "tagname": "", "params": [ { "name": "id", @@ -1569,26 +1477,24 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 497, - "description": "

Builds a URL for fetching an async belongsTo relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindBelongsTo(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id);\n    return `${baseUrl}/relationships`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 272, + "description": "

Builds a URL for fetching a async belongsTo relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindBelongsTo(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(id, modelName);\n    return `${baseUrl}/relationships`;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForFindBelongsTo", - "access": "public", - "tagname": "", "params": [ { "name": "id", @@ -1603,26 +1509,24 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 525, - "description": "

Builds a URL for a record.save() call when the record was created\nlocally using store.createRecord().

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForCreateRecord(modelName, snapshot) {\n    return super.urlForCreateRecord(...arguments) + '/new';\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 299, + "description": "

Builds a URL for a record.save() call when the record was created\nlocally using store.createRecord().

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForCreateRecord(modelName, snapshot) {\n    return this._super(...arguments) + '/new';\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForCreateRecord", - "access": "public", - "tagname": "", "params": [ { "name": "modelName", @@ -1632,26 +1536,24 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 551, - "description": "

Builds a URL for a record.save() call when the record has been updated locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForUpdateRecord(id, modelName, snapshot) {\n    return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 324, + "description": "

Builds a URL for a record.save() call when the record has been update locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForUpdateRecord(id, modelName, snapshot) {\n    return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForUpdateRecord", - "access": "public", - "tagname": "", "params": [ { "name": "id", @@ -1666,26 +1568,24 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 577, - "description": "

Builds a URL for a record.save() call when the record has been deleted locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForDeleteRecord(id, modelName, snapshot) {\n    return super.urlForDeleteRecord(...arguments) + '/destroy';\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 349, + "description": "

Builds a URL for a record.save() call when the record has been deleted locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForDeleteRecord(id, modelName, snapshot) {\n    return this._super(...arguments) + '/destroy';\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "urlForDeleteRecord", - "access": "public", - "tagname": "", "params": [ { "name": "id", @@ -1700,21 +1600,21 @@ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" } ], "return": { "description": "url", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 603, + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 374, "itemtype": "method", "name": "urlPrefix", "access": "private", @@ -1735,19 +1635,17 @@ "description": "urlPrefix", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" }, { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 643, - "description": "

Determines the pathname for a given type.

\n

By default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').

\n

Pathname customization

\n

For example, if you have an object LineItem with an\nendpoint of /line_items/.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTAdapter from '@ember-data/adapter/rest';\nimport { decamelize, pluralize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  pathForType(modelName) {\n    var decamelized = decamelize(modelName);\n    return pluralize(decamelized);\n  }\n}
\n
\n
\n \n", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 411, + "description": "

Determines the pathname for a given type.

\n

By default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').

\n

Pathname customization

\n

For example if you have an object LineItem with an\nendpoint of "/line_items/".

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\nimport { pluralize } from 'ember-inflector';\n\nexport default DS.RESTAdapter.extend({\n  pathForType: function(modelName) {\n    var decamelized = decamelize(modelName);\n    return pluralize(decamelized);\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "pathForType", - "access": "public", - "tagname": "", "params": [ { "name": "modelName", @@ -1759,117 +1657,109 @@ "description": "path", "type": "String" }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "namespace": "DS", "inherited": true, - "inheritedFrom": "BuildURLMixin" + "inheritedFrom": "DS.BuildURLMixin" } ], "events": [], "properties": [ { - "file": "../packages/adapter/src/json-api.ts", - "line": 186, - "description": "

By default the JSONAPIAdapter will send each find request coming from a store.find\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.

\n

For example, if you have an initial payload of:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  data: {\n    id: 1,\n    type: 'post',\n    relationship: {\n      comments: {\n        data: [\n          { id: 1, type: 'comment' },\n          { id: 2, type: 'comment' }\n        ]\n      }\n    }\n  }\n}
\n
\n
\n \n

By default calling post.comments will trigger the following requests(assuming the\ncomments haven't been loaded before):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET /comments/1\nGET /comments/2
\n
\n
\n

If you set coalesceFindRequests to true it will instead trigger the following request:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET /comments?filter[id]=1,2
\n
\n
\n

Setting coalesceFindRequests to true also works for store.find requests and belongsTo\nrelationships accessed within the same runloop. If you set coalesceFindRequests: true

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('comment', 1);\nstore.findRecord('comment', 2);
\n
\n
\n \n

will also send a request to: GET /comments?filter[id]=1,2

\n

Note: Requests coalescing rely on URL building strategy. So if you override buildURL in your app\ngroupRecordsForFindMany more likely should be overridden as well in order for coalescing to work.

\n", + "file": "addon/adapters/json-api.js", + "line": 194, + "description": "

By default the JSONAPIAdapter will send each find request coming from a store.find\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.

\n

For example, if you have an initial payload of:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  data: {\n    id: 1,\n    type: 'post',\n    relationship: {\n      comments: {\n        data: [\n          { id: 1, type: 'comment' },\n          { id: 2, type: 'comment' }\n        ]\n      }\n    }\n  }\n}
\n
\n
\n \n

By default calling post.get('comments') will trigger the following requests(assuming the\ncomments haven't been loaded before):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET /comments/1\nGET /comments/2
\n
\n
\n

If you set coalesceFindRequests to true it will instead trigger the following request:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET /comments?filter[id]=1,2
\n
\n
\n

Setting coalesceFindRequests to true also works for store.find requests and belongsTo\nrelationships accessed within the same runloop. If you set coalesceFindRequests: true

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('comment', 1);\nstore.findRecord('comment', 2);
\n
\n
\n \n

will also send a request to: GET /comments?filter[id]=1,2

\n

Note: Requests coalescing rely on URL building strategy. So if you override buildURL in your app\ngroupRecordsForFindMany more likely should be overridden as well in order for coalescing to work.

\n", "itemtype": "property", "name": "coalesceFindRequests", - "access": "public", - "tagname": "", "type": "{boolean}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/json-api" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 342, - "description": "

This property allows ajax to still be used instead when false.

\n", - "itemtype": "property", - "name": "useFetch", - "type": "{Boolean}", - "default": "true", - "access": "public", - "tagname": "", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", - "inherited": true, - "inheritedFrom": "RESTAdapter" + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 427, - "description": "

By default the RESTAdapter will send each find request coming from a store.find\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.

\n

For example, if you have an initial payload of:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  post: {\n    id: 1,\n    comments: [1, 2]\n  }\n}
\n
\n
\n \n

By default calling post.comments will trigger the following requests(assuming the\ncomments haven't been loaded before):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET /comments/1\nGET /comments/2
\n
\n
\n

If you set coalesceFindRequests to true it will instead trigger the following request:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET /comments?ids[]=1&ids[]=2
\n
\n
\n

Setting coalesceFindRequests to true also works for store.find requests and belongsTo\nrelationships accessed within the same runloop. If you set coalesceFindRequests: true

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('comment', 1);\nstore.findRecord('comment', 2);
\n
\n
\n \n

will also send a request to: GET /comments?ids[]=1&ids[]=2

\n

Note: Requests coalescing rely on URL building strategy. So if you override buildURL in your app\ngroupRecordsForFindMany more likely should be overridden as well in order for coalescing to work.

\n", + "file": "addon/adapters/rest.js", + "line": 351, + "description": "

By default the RESTAdapter will send each find request coming from a store.find\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.

\n

For example, if you have an initial payload of:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  post: {\n    id: 1,\n    comments: [1, 2]\n  }\n}
\n
\n
\n \n

By default calling post.get('comments') will trigger the following requests(assuming the\ncomments haven't been loaded before):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET /comments/1\nGET /comments/2
\n
\n
\n

If you set coalesceFindRequests to true it will instead trigger the following request:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET /comments?ids[]=1&ids[]=2
\n
\n
\n

Setting coalesceFindRequests to true also works for store.find requests and belongsTo\nrelationships accessed within the same runloop. If you set coalesceFindRequests: true

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('comment', 1);\nstore.findRecord('comment', 2);
\n
\n
\n \n

will also send a request to: GET /comments?ids[]=1&ids[]=2

\n

Note: Requests coalescing rely on URL building strategy. So if you override buildURL in your app\ngroupRecordsForFindMany more likely should be overridden as well in order for coalescing to work.

\n", "itemtype": "property", "name": "coalesceFindRequests", - "access": "public", - "tagname": "", "type": "{boolean}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 487, - "description": "

Endpoint paths can be prefixed with a namespace by setting the namespace\nproperty on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  namespace = 'api/1';\n}
\n
\n
\n \n

Requests for the Post model would now target /api/1/post/.

\n", + "file": "addon/adapters/rest.js", + "line": 400, + "description": "

Endpoint paths can be prefixed with a namespace by setting the namespace\nproperty on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  namespace: 'api/1'\n});
\n
\n
\n \n

Requests for the Post model would now target /api/1/post/.

\n", "itemtype": "property", "name": "namespace", - "access": "public", - "tagname": "", "type": "{String}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 506, - "description": "

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  host = 'https://api.example.com';\n}
\n
\n
\n \n

Requests for the Post model would now target https://api.example.com/post/.

\n", + "file": "addon/adapters/rest.js", + "line": 418, + "description": "

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  host: 'https://api.example.com'\n});
\n
\n
\n \n

Requests for the Post model would now target https://api.example.com/post/.

\n", "itemtype": "property", "name": "host", - "access": "public", - "tagname": "", "type": "{String}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/rest.ts", - "line": 524, - "description": "

Some APIs require HTTP headers, e.g. to provide an API\nkey. Arbitrary headers can be set as key/value pairs on the\nRESTAdapter's headers object and Ember Data will send them\nalong with each ajax request. For dynamic headers see headers\ncustomization.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import RESTAdapter from '@ember-data/adapter/rest';\nimport { computed } from '@ember/object';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  headers: computed(function() {\n    return {\n      'API_KEY': 'secret key',\n      'ANOTHER_HEADER': 'Some header value'\n    };\n  })\n}
\n
\n
\n \n", + "file": "addon/adapters/rest.js", + "line": 435, + "description": "

Some APIs require HTTP headers, e.g. to provide an API\nkey. Arbitrary headers can be set as key/value pairs on the\nRESTAdapter's headers object and Ember Data will send them\nalong with each ajax request. For dynamic headers see headers\ncustomization.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  headers: {\n    'API_KEY': 'secret key',\n    'ANOTHER_HEADER': 'Some header value'\n  }\n});
\n
\n
\n \n", "itemtype": "property", "name": "headers", - "access": "public", - "tagname": "", "type": "{Object}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/rest", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "RESTAdapter" + "inheritedFrom": "DS.RESTAdapter" }, { - "file": "../packages/adapter/src/index.ts", - "line": 645, - "description": "

By default the store will try to coalesce all findRecord calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.

\n", + "file": "addon/adapter.js", + "line": 65, + "description": "

If you would like your adapter to use a custom serializer you can\nset the defaultSerializer property to be the name of the custom\nserializer.

\n

Note the defaultSerializer serializer has a lower priority than\na model specific serializer (i.e. PostSerializer) or the\napplication serializer.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/django.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  defaultSerializer: 'django'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "defaultSerializer", + "type": "{String}", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 427, + "description": "

By default the store will try to coalesce all fetchRecord calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.

\n", "itemtype": "property", "name": "coalesceFindRequests", - "access": "public", - "tagname": "", "type": "{boolean}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS", "inherited": true, - "inheritedFrom": "Adapter" + "inheritedFrom": "DS.Adapter" } ] }, "relationships": { "parent-class": { "data": { - "id": "ember-data-2.18.5-RESTAdapter", + "id": "ember-data-2.18.5-DS.RESTAdapter", "type": "class" } }, @@ -1878,7 +1768,7 @@ }, "module": { "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/json-api", + "id": "ember-data-2.18.5-ember-data", "type": "module" } }, diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONAPISerializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONAPISerializer.json new file mode 100644 index 000000000..105f0c2d5 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONAPISerializer.json @@ -0,0 +1,1968 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.JSONAPISerializer", + "type": "class", + "attributes": { + "name": "DS.JSONAPISerializer", + "shortname": "DS.JSONAPISerializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/json-api.js", + "line": 15, + "description": "

Ember Data 2.0 Serializer:

\n

In Ember Data a Serializer is used to serialize and deserialize\nrecords when they are transferred in and out of an external source.\nThis process involves normalizing property names, transforming\nattribute values and serializing relationships.

\n

JSONAPISerializer supports the http://jsonapi.org/ spec and is the\nserializer recommended by Ember Data.

\n

This serializer normalizes a JSON API payload that looks like:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/player.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  name: DS.attr('string'),\n  skill: DS.attr('string'),\n  gamesPlayed: DS.attr('number'),\n  club: DS.belongsTo('club')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/club.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  name: DS.attr('string'),\n  location: DS.attr('string'),\n  players: DS.hasMany('player')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n
  {\n    "data": [\n      {\n        "attributes": {\n          "name": "Benfica",\n          "location": "Portugal"\n        },\n        "id": "1",\n        "relationships": {\n          "players": {\n            "data": [\n              {\n                "id": "3",\n                "type": "players"\n              }\n            ]\n          }\n        },\n        "type": "clubs"\n      }\n    ],\n    "included": [\n      {\n        "attributes": {\n          "name": "Eusebio Silva Ferreira",\n          "skill": "Rocket shot",\n          "games-played": 431\n        },\n        "id": "3",\n        "relationships": {\n          "club": {\n            "data": {\n              "id": "1",\n              "type": "clubs"\n            }\n          }\n        },\n        "type": "players"\n      }\n    ]\n  }
\n
\n
\n \n

to the format that the Ember Data store expects.

\n

Customizing meta

\n

Since a JSON API Document can have meta defined in multiple locations you can\nuse the specific serializer hooks if you need to customize the meta.

\n

One scenario would be to camelCase the meta keys of your payload. The example\nbelow shows how this could be done using normalizeArrayResponse and\nextractRelationship.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
export default JSONAPISerializer.extend({\n  normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n    let normalizedDocument = this._super(...arguments);\n\n    // Customize document meta\n    normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n    return normalizedDocument;\n  },\n\n  extractRelationship(relationshipHash) {\n    let normalizedRelationship = this._super(...arguments);\n\n    // Customize relationship meta\n    normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n    return normalizedRelationship;\n  }\n});
\n
\n
\n \n", + "since": "1.13.0", + "extends": "DS.JSONSerializer", + "methods": [ + { + "file": "addon/serializers/json-api.js", + "line": 133, + "itemtype": "method", + "name": "_normalizeDocumentHelper", + "params": [ + { + "name": "documentHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 170, + "itemtype": "method", + "name": "_normalizeRelationshipDataHelper", + "params": [ + { + "name": "relationshipDataHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 198, + "itemtype": "method", + "name": "_normalizeResourceHelper", + "params": [ + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 244, + "itemtype": "method", + "name": "pushPayload", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 258, + "itemtype": "method", + "name": "_normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "isSingle", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 347, + "itemtype": "method", + "name": "_extractType", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "String" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 374, + "description": "

Dasherizes and singularizes the model name in the payload to match\nthe format Ember Data uses internally for the model name.

\n

For example the key posts would be converted to post and the\nkey studentAssesments would be converted to student-assesment.

\n", + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 390, + "description": "

Converts the model name to a pluralized version of the model name.

\n

For example post would be converted to posts and\nstudent-assesment would be converted to student-assesments.

\n", + "itemtype": "method", + "name": "payloadKeyFromModelName", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 426, + "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.\nBy default JSONAPISerializer follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as the word separator in the JSON\nattribute keys.

\n

This behaviour can be easily customized by extending this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { dasherize } from '@ember/string';\n\nexport default DS.JSONAPISerializer.extend({\n  keyForAttribute(attr, method) {\n    return dasherize(attr).toUpperCase();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForAttribute", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 457, + "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties.\nBy default JSONAPISerializer follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as word separators in\nrelationship properties.

\n

This behaviour can be easily customized by extending this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
 import DS from 'ember-data';\n import { underscore } from '@ember/string';\n\n export default DS.JSONAPISerializer.extend({\n   keyForRelationship(key, relationship, method) {\n     return underscore(key);\n   }\n });
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForRelationship", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 636, + "description": "

modelNameFromPayloadType can be used to change the mapping for a DS model\nname, taken from the value in the payload.

\n

Say your API namespaces the type of a model and returns the following\npayload for the post model:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
// GET /api/posts/1\n{\n  "data": {\n    "id": 1,\n    "type: "api::v1::post"\n  }\n}
\n
\n
\n \n

By overwriting modelNameFromPayloadType you can specify that the\npost model should be used:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.JSONAPISerializer.extend({\n  modelNameFromPayloadType(payloadType) {\n    return payloadType.replace('api::v1::', '');\n  }\n});
\n
\n
\n \n

By default the modelName for a model is its singularized name in dasherized\nform. Usually, Ember Data can use the correct inflection to do this for\nyou. Most of the time, you won't need to override\nmodelNameFromPayloadType for this purpose.

\n

Also take a look at\npayloadTypeFromModelName to customize\nhow the type of a record should be serialized.

\n", + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "payloadType", + "description": "type from payload", + "type": "String" + } + ], + "return": { + "description": "modelName", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 684, + "description": "

payloadTypeFromModelName can be used to change the mapping for the type in\nthe payload, taken from the model name.

\n

Say your API namespaces the type of a model and expects the following\npayload when you update the post model:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
// POST /api/posts/1\n{\n  "data": {\n    "id": 1,\n    "type": "api::v1::post"\n  }\n}
\n
\n
\n \n

By overwriting payloadTypeFromModelName you can specify that the\nnamespaces model name for the post should be used:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default JSONAPISerializer.extend({\n  payloadTypeFromModelName(modelName) {\n    return 'api::v1::' + modelName;\n  }\n});
\n
\n
\n \n

By default the payload type is the pluralized model name. Usually, Ember\nData can use the correct inflection to do this for you. Most of the time,\nyou won't need to override payloadTypeFromModelName for this purpose.

\n

Also take a look at\nmodelNameFromPayloadType to customize\nhow the model name from should be mapped from the payload.

\n", + "itemtype": "method", + "name": "payloadTypeFromModelName", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelname", + "description": "modelName from the record", + "type": "String" + } + ], + "return": { + "description": "payloadType", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 173, + "description": "

Given a subclass of DS.Model and a JSON object this method will\niterate through each attribute of the DS.Model and invoke the\nDS.Transform#deserialize method on the matching property of the\nJSON object. This method is typically called after the\nserializer's normalize method.

\n", + "itemtype": "method", + "name": "applyTransforms", + "access": "private", + "tagname": "", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "data", + "description": "The data to transform", + "type": "Object" + } + ], + "return": { + "description": "data The transformed data object", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 200, + "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

This method delegates to a more specific normalize method based on\nthe requestType.

\n

To override this method with a custom one, make sure to call\nreturn this._super(store, primaryModelClass, payload, id, requestType) with your\npre-processed data.

\n

Here's an example of using normalizeResponse manually:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
socket.on('message', function(message) {\n  var data = message.data;\n  var modelClass = store.modelFor(data.modelName);\n  var serializer = store.serializerFor(data.modelName);\n  var normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n  store.push(normalized);\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 260, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 274, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 288, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindAllResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 302, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindBelongsToResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 316, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindHasManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 330, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 344, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 358, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeCreateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 372, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeDeleteRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 386, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeUpdateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 400, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSaveResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 414, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSingleResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 428, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeArrayResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 442, + "itemtype": "method", + "name": "_normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "isSingle", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 489, + "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a DS.Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\nimport { get } from '@ember/object';\n\nexport default DS.JSONSerializer.extend({\n  normalize(typeClass, hash) {\n    var fields = get(typeClass, 'fields');\n\n    fields.forEach(function(field) {\n      var payloadField = underscore(field);\n      if (field === payloadField) { return; }\n\n      hash[field] = hash[payloadField];\n      delete hash[payloadField];\n    });\n\n    return this._super.apply(this, arguments);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 552, + "description": "

Returns the resource's ID.

\n", + "itemtype": "method", + "name": "extractId", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 566, + "description": "

Returns the resource's attributes formatted as a JSON-API "attributes object".

\n

http://jsonapi.org/format/#document-resource-object-attributes

\n", + "itemtype": "method", + "name": "extractAttributes", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 590, + "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", + "itemtype": "method", + "name": "extractRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 639, + "description": "

Returns a polymorphic relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n

relationshipOptions is a hash which contains more information about the\npolymorphic relationship which should be extracted:

\n
    \n
  • resourceHash complete hash of the resource the relationship should be\nextracted from
  • \n
  • relationshipKey key under which the value for the relationship is\nextracted from the resourceHash
  • \n
  • relationshipMeta meta information about the relationship
  • \n
\n", + "itemtype": "method", + "name": "extractPolymorphicRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + }, + { + "name": "relationshipOptions", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 662, + "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", + "itemtype": "method", + "name": "extractRelationships", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 718, + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 728, + "itemtype": "method", + "name": "normalizeRelationships", + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 747, + "itemtype": "method", + "name": "normalizeUsingDeclaredMapping", + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 778, + "description": "

Looks up the property key that was set by the custom attr mapping\npassed to the serializer.

\n", + "itemtype": "method", + "name": "_getMappedKey", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 809, + "description": "

Check attrs.key.serialize property to inform if the key\ncan be serialized

\n", + "itemtype": "method", + "name": "_canSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key can be serialized", + "type": "Boolean" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 824, + "description": "

When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized

\n", + "itemtype": "method", + "name": "_mustSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key must be serialized", + "type": "Boolean" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 840, + "description": "

Check if the given hasMany relationship should be serialized

\n", + "itemtype": "method", + "name": "shouldSerializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 861, + "description": "

Check if the given hasMany relationship should be serialized

\n", + "itemtype": "method", + "name": "_shouldSerializeHasMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 881, + "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  title: DS.attr(),\n  body: DS.attr(),\n\n  author: DS.belongsTo('user')\n});
\n
\n
\n \n

The default serialization would create a JSON object like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "title": "Rails is unagi",\n  "body": "Rails? Omakase? O_O",\n  "author": 12\n}
\n
\n
\n \n

By default, attributes are passed through as-is, unless\nyou specified an attribute type (DS.attr('date')). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.

\n

By default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.

\n

IDs

\n

serialize takes an options hash with a single option:\nincludeId. If this option is true, serialize will,\nby default include the ID in the JSON object it builds.

\n

The adapter passes in includeId: true when serializing\na record for createRecord, but not for updateRecord.

\n

Customization

\n

Your server may expect a different JSON format than the\nbuilt-in serialization format.

\n

In that case, you can implement serialize yourself and\nreturn a JSON hash of your choosing.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      POST_TTL: snapshot.attr('title'),\n      POST_BDY: snapshot.attr('body'),\n      POST_CMS: snapshot.hasMany('comments', { ids: true })\n    };\n\n    if (options.includeId) {\n      json.POST_ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});
\n
\n
\n \n

Customizing an App-Wide Serializer

\n

If you want to define a serializer for your entire\napplication, you'll probably want to use eachAttribute\nand eachRelationship on the record.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
import DS from 'ember-data';\nimport { singularize } from 'ember-inflector';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {};\n\n    snapshot.eachAttribute(function(name) {\n      json[serverAttributeName(name)] = snapshot.attr(name);\n    });\n\n    snapshot.eachRelationship(function(name, relationship) {\n      if (relationship.kind === 'hasMany') {\n        json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n      }\n    });\n\n    if (options.includeId) {\n      json.ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});\n\nfunction serverAttributeName(attribute) {\n  return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n  return serverAttributeName(singularize(name)) + "_IDS";\n}
\n
\n
\n \n

This serializer will generate JSON that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "TITLE": "Rails is omakase",\n  "BODY": "Yep. Omakase.",\n  "COMMENT_IDS": [ 1, 2, 3 ]\n}
\n
\n
\n \n

Tweaking the Default JSON

\n

If you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = this._super(...arguments);\n\n    json.subject = json.title;\n    delete json.title;\n\n    return json;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "json", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1062, + "description": "

You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  serializeIntoHash(data, type, snapshot, options) {\n    var root = decamelize(type.modelName);\n    data[root] = this.serialize(snapshot, options);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeIntoHash", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1094, + "description": "

serializeAttribute can be used to customize how DS.attr\nproperties are serialized

\n

For example if you wanted to ensure all your attributes were always\nserialized as properties on an attributes object you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serializeAttribute(snapshot, json, key, attributes) {\n    json.attributes = json.attributes || {};\n    this._super(snapshot, json.attributes, key, attributes);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeAttribute", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "attribute", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1141, + "description": "

serializeBelongsTo can be used to customize how DS.belongsTo\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n  serializeBelongsTo(snapshot, json, relationship) {\n    var key = relationship.key;\n    var belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;\n\n    json[key] = isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeBelongsTo", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1194, + "description": "

serializeHasMany can be used to customize how DS.hasMany\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serializeHasMany(snapshot, json, relationship) {\n    var key = relationship.key;\n    if (key === 'comments') {\n      return;\n    } else {\n      this._super(...arguments);\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1243, + "description": "

You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n{ polymorphic: true } is pass as the second argument to the\nDS.belongsTo function.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n  serializePolymorphicType(snapshot, json, relationship) {\n    var key = relationship.key;\n    var belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n    if (isNone(belongsTo)) {\n      json[key + '_type'] = null;\n    } else {\n      json[key + '_type'] = belongsTo.modelName;\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializePolymorphicType", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1278, + "description": "

extractMeta is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the meta property of the payload object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  extractMeta(store, typeClass, payload) {\n    if (payload && payload.hasOwnProperty('_pagination')) {\n      let meta = payload._pagination;\n      delete payload._pagination;\n      return meta;\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "extractMeta", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1312, + "description": "

extractErrors is used to extract model errors when a call\nto DS.Model#save fails with an InvalidError. By default\nEmber Data expects error information to be located on the errors\nproperty of the payload object.

\n

This serializer expects this errors object to be an Array similar\nto the following, compliant with the JSON-API specification:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
{\n  "errors": [\n    {\n      "detail": "This username is already taken!",\n      "source": {\n        "pointer": "data/attributes/username"\n      }\n    }, {\n      "detail": "Doesn't look like a valid email.",\n      "source": {\n        "pointer": "data/attributes/email"\n      }\n    }\n  ]\n}
\n
\n
\n \n

The key detail provides a textual description of the problem.\nAlternatively, the key title can be used for the same purpose.

\n

The nested keys source.pointer detail which specific element\nof the request data was invalid.

\n

Note that JSON-API also allows for object-level errors to be placed\nin an object with pointer data, signifying that the problem\ncannot be traced to a specific attribute:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "errors": [\n    {\n      "detail": "Some generic non property error message",\n      "source": {\n        "pointer": "data"\n      }\n    }\n  ]\n}
\n
\n
\n \n

When turn into a DS.Errors object, you can read these errors\nthrough the property base:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each model.errors.base as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

Example of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  extractErrors(store, typeClass, payload, id) {\n    if (payload && typeof payload === 'object' && payload._problems) {\n      payload = payload._problems;\n      this.normalizeErrors(typeClass, payload);\n    }\n    return payload;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "extractErrors", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "(String|Number)" + } + ], + "return": { + "description": "json The deserialized errors", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1423, + "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForAttribute", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1449, + "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties. By default\nJSONSerializer does not provide an implementation of this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
  import DS from 'ember-data';\n  import { underscore } from '@ember/string';\n\n  export default DS.JSONSerializer.extend({\n    keyForRelationship(key, relationship, method) {\n      return `rel_${underscore(key)}`;\n    }\n  });
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForRelationship", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1477, + "description": "

keyForLink can be used to define a custom key when deserializing link\nproperties.

\n", + "itemtype": "method", + "name": "keyForLink", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "kind", + "description": "`belongsTo` or `hasMany`", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1492, + "itemtype": "method", + "name": "transformFor", + "access": "private", + "tagname": "", + "params": [ + { + "name": "attributeType", + "description": "", + "type": "String" + }, + { + "name": "skipAssertion", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "transform", + "type": "DS.Transform" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1512, + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "type", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1534, + "description": "

serializeId can be used to customize how id is serialized\nFor example, your server may expect integer datatype of id

\n

By default the snapshot's id (String) is set on the json hash via json[primaryKey] = snapshot.id.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\nserializeId(snapshot, json, primaryKey) {\n    var id = snapshot.id;\n    json[primaryKey] = parseInt(id, 10);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeId", + "access": "public", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "primaryKey", + "description": "", + "type": "String" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializer.js", + "line": 51, + "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + }, + { + "file": "addon/serializer.js", + "line": 87, + "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + }, + { + "file": "addon/serializer.js", + "line": 129, + "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    var data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + } + ], + "events": [], + "properties": [ + { + "file": "addon/serializers/json.js", + "line": 85, + "description": "

The primaryKey is used when serializing and deserializing\ndata. Ember Data always uses the id property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\nprimaryKey property to match the primaryKey of your external\nstore.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  primaryKey: '_id'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "primaryKey", + "type": "{String}", + "default": "'id'", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 109, + "description": "

The attrs object can be used to declare a simple mapping between\nproperty names on DS.Model records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty key can also be used to designate the attribute's key on\nthe response payload.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  firstName: DS.attr('string'),\n  lastName: DS.attr('string'),\n  occupation: DS.attr('string'),\n  admin: DS.attr('boolean')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  attrs: {\n    admin: 'is_admin',\n    occupation: { key: 'career' }\n  }\n});
\n
\n
\n \n

You can also remove attributes by setting the serialize key to\nfalse in your mapping object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  attrs: {\n    admin: { serialize: false },\n    occupation: { key: 'career' }\n  }\n});
\n
\n
\n \n

When serialized:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "firstName": "Harry",\n  "lastName": "Houdini",\n  "career": "magician"\n}
\n
\n
\n \n

Note that the admin is now not included in the payload.

\n", + "itemtype": "property", + "name": "attrs", + "type": "{Object}", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializer.js", + "line": 29, + "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    var modelClass = this.store.modelFor(relationshipModelName);\n    var relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "store", + "type": "{DS.Store}", + "access": "public", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.JSONSerializer", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONSerializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONSerializer.json new file mode 100644 index 000000000..09ddc6737 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.JSONSerializer.json @@ -0,0 +1,1578 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.JSONSerializer", + "type": "class", + "attributes": { + "name": "DS.JSONSerializer", + "shortname": "DS.JSONSerializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/json.js", + "line": 17, + "description": "

Ember Data 2.0 Serializer:

\n

In Ember Data a Serializer is used to serialize and deserialize\nrecords when they are transferred in and out of an external source.\nThis process involves normalizing property names, transforming\nattribute values and serializing relationships.

\n

By default, Ember Data uses and recommends the JSONAPISerializer.

\n

JSONSerializer is useful for simpler or legacy backends that may\nnot support the http://jsonapi.org/ spec.

\n

For example, given the following User model and JSON payload:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  friends: DS.hasMany('user'),\n  house: DS.belongsTo('location'),\n\n  name: DS.attr('string')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
{\n  id: 1,\n  name: 'Sebastian',\n  friends: [3, 4],\n  links: {\n    house: '/houses/lefkada'\n  }\n}
\n
\n
\n \n

JSONSerializer will normalize the JSON payload to the JSON API format that the\nEmber Data store expects.

\n

You can customize how JSONSerializer processes its payload by passing options in\nthe attrs hash or by subclassing the JSONSerializer and overriding hooks:

\n
    \n
  • To customize how a single record is normalized, use the normalize hook.
  • \n
  • To customize how JSONSerializer normalizes the whole server response, use the\nnormalizeResponse hook.
  • \n
  • To customize how JSONSerializer normalizes a specific response from the server,\nuse one of the many specific normalizeResponse hooks.
  • \n
  • To customize how JSONSerializer normalizes your id, attributes or relationships,\nuse the extractId, extractAttributes and extractRelationships hooks.
  • \n
\n

The JSONSerializer normalization process follows these steps:

\n
    \n
  • normalizeResponse - entry method to the serializer.
  • \n
  • normalizeCreateRecordResponse - a normalizeResponse for a specific operation is called.
  • \n
  • normalizeSingleResponse|normalizeArrayResponse - for methods like createRecord we expect\na single record back, while for methods like findAll we expect multiple records back.
  • \n
  • normalize - normalizeArray iterates and calls normalize for each of its records while normalizeSingle\ncalls it once. This is the method you most likely want to subclass.
  • \n
  • extractId | extractAttributes | extractRelationships - normalize delegates to these methods to\nturn the record payload into the JSON API format.
  • \n
\n", + "extends": "DS.Serializer", + "methods": [ + { + "file": "addon/serializers/json.js", + "line": 173, + "description": "

Given a subclass of DS.Model and a JSON object this method will\niterate through each attribute of the DS.Model and invoke the\nDS.Transform#deserialize method on the matching property of the\nJSON object. This method is typically called after the\nserializer's normalize method.

\n", + "itemtype": "method", + "name": "applyTransforms", + "access": "private", + "tagname": "", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "data", + "description": "The data to transform", + "type": "Object" + } + ], + "return": { + "description": "data The transformed data object", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 200, + "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

This method delegates to a more specific normalize method based on\nthe requestType.

\n

To override this method with a custom one, make sure to call\nreturn this._super(store, primaryModelClass, payload, id, requestType) with your\npre-processed data.

\n

Here's an example of using normalizeResponse manually:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
socket.on('message', function(message) {\n  var data = message.data;\n  var modelClass = store.modelFor(data.modelName);\n  var serializer = store.serializerFor(data.modelName);\n  var normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n  store.push(normalized);\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 260, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 274, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 288, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindAllResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 302, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindBelongsToResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 316, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindHasManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 330, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 344, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 358, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeCreateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 372, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeDeleteRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 386, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeUpdateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 400, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSaveResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 414, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSingleResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 428, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeArrayResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 442, + "itemtype": "method", + "name": "_normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "isSingle", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 489, + "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a DS.Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\nimport { get } from '@ember/object';\n\nexport default DS.JSONSerializer.extend({\n  normalize(typeClass, hash) {\n    var fields = get(typeClass, 'fields');\n\n    fields.forEach(function(field) {\n      var payloadField = underscore(field);\n      if (field === payloadField) { return; }\n\n      hash[field] = hash[payloadField];\n      delete hash[payloadField];\n    });\n\n    return this._super.apply(this, arguments);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 552, + "description": "

Returns the resource's ID.

\n", + "itemtype": "method", + "name": "extractId", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 566, + "description": "

Returns the resource's attributes formatted as a JSON-API "attributes object".

\n

http://jsonapi.org/format/#document-resource-object-attributes

\n", + "itemtype": "method", + "name": "extractAttributes", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 590, + "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", + "itemtype": "method", + "name": "extractRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 639, + "description": "

Returns a polymorphic relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n

relationshipOptions is a hash which contains more information about the\npolymorphic relationship which should be extracted:

\n
    \n
  • resourceHash complete hash of the resource the relationship should be\nextracted from
  • \n
  • relationshipKey key under which the value for the relationship is\nextracted from the resourceHash
  • \n
  • relationshipMeta meta information about the relationship
  • \n
\n", + "itemtype": "method", + "name": "extractPolymorphicRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + }, + { + "name": "relationshipOptions", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 662, + "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", + "itemtype": "method", + "name": "extractRelationships", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 718, + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 728, + "itemtype": "method", + "name": "normalizeRelationships", + "access": "private", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 747, + "itemtype": "method", + "name": "normalizeUsingDeclaredMapping", + "access": "private", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 778, + "description": "

Looks up the property key that was set by the custom attr mapping\npassed to the serializer.

\n", + "itemtype": "method", + "name": "_getMappedKey", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 809, + "description": "

Check attrs.key.serialize property to inform if the key\ncan be serialized

\n", + "itemtype": "method", + "name": "_canSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key can be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 824, + "description": "

When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized

\n", + "itemtype": "method", + "name": "_mustSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key must be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 840, + "description": "

Check if the given hasMany relationship should be serialized

\n", + "itemtype": "method", + "name": "shouldSerializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 861, + "description": "

Check if the given hasMany relationship should be serialized

\n", + "itemtype": "method", + "name": "_shouldSerializeHasMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 881, + "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  title: DS.attr(),\n  body: DS.attr(),\n\n  author: DS.belongsTo('user')\n});
\n
\n
\n \n

The default serialization would create a JSON object like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "title": "Rails is unagi",\n  "body": "Rails? Omakase? O_O",\n  "author": 12\n}
\n
\n
\n \n

By default, attributes are passed through as-is, unless\nyou specified an attribute type (DS.attr('date')). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.

\n

By default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.

\n

IDs

\n

serialize takes an options hash with a single option:\nincludeId. If this option is true, serialize will,\nby default include the ID in the JSON object it builds.

\n

The adapter passes in includeId: true when serializing\na record for createRecord, but not for updateRecord.

\n

Customization

\n

Your server may expect a different JSON format than the\nbuilt-in serialization format.

\n

In that case, you can implement serialize yourself and\nreturn a JSON hash of your choosing.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      POST_TTL: snapshot.attr('title'),\n      POST_BDY: snapshot.attr('body'),\n      POST_CMS: snapshot.hasMany('comments', { ids: true })\n    };\n\n    if (options.includeId) {\n      json.POST_ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});
\n
\n
\n \n

Customizing an App-Wide Serializer

\n

If you want to define a serializer for your entire\napplication, you'll probably want to use eachAttribute\nand eachRelationship on the record.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
import DS from 'ember-data';\nimport { singularize } from 'ember-inflector';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {};\n\n    snapshot.eachAttribute(function(name) {\n      json[serverAttributeName(name)] = snapshot.attr(name);\n    });\n\n    snapshot.eachRelationship(function(name, relationship) {\n      if (relationship.kind === 'hasMany') {\n        json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n      }\n    });\n\n    if (options.includeId) {\n      json.ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});\n\nfunction serverAttributeName(attribute) {\n  return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n  return serverAttributeName(singularize(name)) + "_IDS";\n}
\n
\n
\n \n

This serializer will generate JSON that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "TITLE": "Rails is omakase",\n  "BODY": "Yep. Omakase.",\n  "COMMENT_IDS": [ 1, 2, 3 ]\n}
\n
\n
\n \n

Tweaking the Default JSON

\n

If you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = this._super(...arguments);\n\n    json.subject = json.title;\n    delete json.title;\n\n    return json;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "json", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1062, + "description": "

You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  serializeIntoHash(data, type, snapshot, options) {\n    var root = decamelize(type.modelName);\n    data[root] = this.serialize(snapshot, options);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeIntoHash", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1094, + "description": "

serializeAttribute can be used to customize how DS.attr\nproperties are serialized

\n

For example if you wanted to ensure all your attributes were always\nserialized as properties on an attributes object you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serializeAttribute(snapshot, json, key, attributes) {\n    json.attributes = json.attributes || {};\n    this._super(snapshot, json.attributes, key, attributes);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeAttribute", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "attribute", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1141, + "description": "

serializeBelongsTo can be used to customize how DS.belongsTo\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n  serializeBelongsTo(snapshot, json, relationship) {\n    var key = relationship.key;\n    var belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;\n\n    json[key] = isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeBelongsTo", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1194, + "description": "

serializeHasMany can be used to customize how DS.hasMany\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serializeHasMany(snapshot, json, relationship) {\n    var key = relationship.key;\n    if (key === 'comments') {\n      return;\n    } else {\n      this._super(...arguments);\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1243, + "description": "

You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n{ polymorphic: true } is pass as the second argument to the\nDS.belongsTo function.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n  serializePolymorphicType(snapshot, json, relationship) {\n    var key = relationship.key;\n    var belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n    if (isNone(belongsTo)) {\n      json[key + '_type'] = null;\n    } else {\n      json[key + '_type'] = belongsTo.modelName;\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializePolymorphicType", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1278, + "description": "

extractMeta is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the meta property of the payload object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  extractMeta(store, typeClass, payload) {\n    if (payload && payload.hasOwnProperty('_pagination')) {\n      let meta = payload._pagination;\n      delete payload._pagination;\n      return meta;\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "extractMeta", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1312, + "description": "

extractErrors is used to extract model errors when a call\nto DS.Model#save fails with an InvalidError. By default\nEmber Data expects error information to be located on the errors\nproperty of the payload object.

\n

This serializer expects this errors object to be an Array similar\nto the following, compliant with the JSON-API specification:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
{\n  "errors": [\n    {\n      "detail": "This username is already taken!",\n      "source": {\n        "pointer": "data/attributes/username"\n      }\n    }, {\n      "detail": "Doesn't look like a valid email.",\n      "source": {\n        "pointer": "data/attributes/email"\n      }\n    }\n  ]\n}
\n
\n
\n \n

The key detail provides a textual description of the problem.\nAlternatively, the key title can be used for the same purpose.

\n

The nested keys source.pointer detail which specific element\nof the request data was invalid.

\n

Note that JSON-API also allows for object-level errors to be placed\nin an object with pointer data, signifying that the problem\ncannot be traced to a specific attribute:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "errors": [\n    {\n      "detail": "Some generic non property error message",\n      "source": {\n        "pointer": "data"\n      }\n    }\n  ]\n}
\n
\n
\n \n

When turn into a DS.Errors object, you can read these errors\nthrough the property base:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each model.errors.base as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

Example of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  extractErrors(store, typeClass, payload, id) {\n    if (payload && typeof payload === 'object' && payload._problems) {\n      payload = payload._problems;\n      this.normalizeErrors(typeClass, payload);\n    }\n    return payload;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "extractErrors", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "(String|Number)" + } + ], + "return": { + "description": "json The deserialized errors", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1423, + "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForAttribute", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1449, + "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties. By default\nJSONSerializer does not provide an implementation of this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
  import DS from 'ember-data';\n  import { underscore } from '@ember/string';\n\n  export default DS.JSONSerializer.extend({\n    keyForRelationship(key, relationship, method) {\n      return `rel_${underscore(key)}`;\n    }\n  });
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForRelationship", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1477, + "description": "

keyForLink can be used to define a custom key when deserializing link\nproperties.

\n", + "itemtype": "method", + "name": "keyForLink", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "kind", + "description": "`belongsTo` or `hasMany`", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1492, + "itemtype": "method", + "name": "transformFor", + "access": "private", + "tagname": "", + "params": [ + { + "name": "attributeType", + "description": "", + "type": "String" + }, + { + "name": "skipAssertion", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "transform", + "type": "DS.Transform" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1512, + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "type", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1534, + "description": "

serializeId can be used to customize how id is serialized\nFor example, your server may expect integer datatype of id

\n

By default the snapshot's id (String) is set on the json hash via json[primaryKey] = snapshot.id.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\nserializeId(snapshot, json, primaryKey) {\n    var id = snapshot.id;\n    json[primaryKey] = parseInt(id, 10);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeId", + "access": "public", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "primaryKey", + "description": "", + "type": "String" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializer.js", + "line": 51, + "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + }, + { + "file": "addon/serializer.js", + "line": 87, + "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + }, + { + "file": "addon/serializer.js", + "line": 129, + "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    var data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + } + ], + "events": [], + "properties": [ + { + "file": "addon/serializers/json.js", + "line": 85, + "description": "

The primaryKey is used when serializing and deserializing\ndata. Ember Data always uses the id property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\nprimaryKey property to match the primaryKey of your external\nstore.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  primaryKey: '_id'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "primaryKey", + "type": "{String}", + "default": "'id'", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 109, + "description": "

The attrs object can be used to declare a simple mapping between\nproperty names on DS.Model records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty key can also be used to designate the attribute's key on\nthe response payload.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  firstName: DS.attr('string'),\n  lastName: DS.attr('string'),\n  occupation: DS.attr('string'),\n  admin: DS.attr('boolean')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  attrs: {\n    admin: 'is_admin',\n    occupation: { key: 'career' }\n  }\n});
\n
\n
\n \n

You can also remove attributes by setting the serialize key to\nfalse in your mapping object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  attrs: {\n    admin: { serialize: false },\n    occupation: { key: 'career' }\n  }\n});
\n
\n
\n \n

When serialized:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "firstName": "Harry",\n  "lastName": "Houdini",\n  "career": "magician"\n}
\n
\n
\n \n

Note that the admin is now not included in the payload.

\n", + "itemtype": "property", + "name": "attrs", + "type": "{Object}", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializer.js", + "line": 29, + "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    var modelClass = this.store.modelFor(relationshipModelName);\n    var relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "store", + "type": "{DS.Store}", + "access": "public", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.Serializer", + "type": "class" + } + }, + "descendants": { + "data": [ + { + "type": "class", + "id": "ember-data-2.18.5-DS.JSONAPISerializer" + }, + { + "type": "class", + "id": "ember-data-2.18.5-DS.RESTSerializer" + } + ] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ManyArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ManyArray.json new file mode 100644 index 000000000..f1cf022d8 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ManyArray.json @@ -0,0 +1,165 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.ManyArray", + "type": "class", + "attributes": { + "name": "DS.ManyArray", + "shortname": "DS.ManyArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/many-array.js", + "line": 14, + "description": "

A ManyArray is a MutableArray that represents the contents of a has-many\nrelationship.

\n

The ManyArray is instantiated lazily the first time the relationship is\nrequested.

\n

Inverses

\n

Often, the relationships in Ember Data applications will have\nan inverse. For example, imagine the following models are\ndefined:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  comments: DS.hasMany('comment')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  post: DS.belongsTo('post')\n});
\n
\n
\n \n

If you created a new instance of App.Post and added\na App.Comment record to its comments has-many\nrelationship, you would expect the comment's post\nproperty to be set to the post that contained\nthe has-many.

\n

We call the record to which a relationship belongs the\nrelationship's owner.

\n", + "extends": "Ember.Object", + "uses": [ + "Ember.Evented", + "Ember.MutableArray" + ], + "methods": [ + { + "file": "addon/-private/system/many-array.js", + "line": 216, + "description": "

Reloads all of the records in the manyArray. If the manyArray\nholds a relationship that was originally fetched using a links url\nEmber Data will revisit the original links url to repopulate the\nrelationship.

\n

If the manyArray holds the result of a store.query() reload will\nre-run the original query.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
var user = store.peekRecord('user', 1)\nuser.login().then(function() {\n  user.get('permissions').then(function(permissions) {\n    return permissions.reload();\n  });\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "reload", + "access": "public", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 243, + "description": "

Saves all of the records in the ManyArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
store.findRecord('inbox', 1).then(function(inbox) {\n  inbox.get('messages').then(function(messages) {\n    messages.forEach(function(message) {\n      message.set('isRead', true);\n    });\n    messages.save()\n  });\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "save", + "return": { + "description": "promise", + "type": "DS.PromiseArray" + }, + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 271, + "description": "

Create a child record within the owner

\n", + "itemtype": "method", + "name": "createRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/many-array.js", + "line": 61, + "description": "

The loading state of this array

\n", + "itemtype": "property", + "name": "isLoaded", + "type": "Boolean", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 69, + "description": "

Used for async hasMany arrays\nto keep track of when they will resolve.

\n", + "itemtype": "property", + "name": "promise", + "type": "Ember.RSVP.Promise", + "access": "private", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 78, + "description": "

Metadata associated with the request for async hasMany relationships.

\n

Example

\n

Given that the server returns the following JSON payload when fetching a\nhasMany relationship:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
{\n  "comments": [{\n    "id": 1,\n    "comment": "This is the first comment",\n  }, {\n// ...\n  }],\n\n  "meta": {\n    "page": 1,\n    "total": 5\n  }\n}
\n
\n
\n \n

You can then access the metadata via the meta property:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
post.get('comments').then(function(comments) {\n  var meta = comments.get('meta');\n\n// meta.page => 1\n// meta.total => 5\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "meta", + "type": "Object", + "access": "public", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 118, + "description": "

true if the relationship is polymorphic, false otherwise.

\n", + "itemtype": "property", + "name": "isPolymorphic", + "type": "Boolean", + "access": "private", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 126, + "description": "

The relationship which manages this array.

\n", + "itemtype": "property", + "name": "relationship", + "type": "ManyRelationship", + "access": "private", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.Object", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Model.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Model.json new file mode 100644 index 000000000..567ffadaa --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Model.json @@ -0,0 +1,928 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.Model", + "type": "class", + "attributes": { + "name": "DS.Model", + "shortname": "DS.Model", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/model/model.js", + "line": 76, + "description": "

The model class that all Ember Data records descend from.\n This is the public API of Ember Data models. If you are using Ember Data\n in your application, this is the class you should use.\n If you are working on Ember Data internals, you most likely want to be dealing\n with InternalModel

\n", + "extends": "Ember.Object", + "uses": [ + "Ember.Evented" + ], + "methods": [ + { + "file": "addon/-private/system/model/model.js", + "line": 425, + "description": "

Create a JSON representation of the record, using the serialization\nstrategy of the store's adapter.

\n

serialize takes an optional hash as a parameter, currently\nsupported options are:

\n
    \n
  • includeId: true if the record's ID should be included in the\nJSON representation.
  • \n
\n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "an object whose values are primitive JSON values only", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 443, + "description": "

Use DS.JSONSerializer to\nget the JSON representation of a record.

\n

toJSON takes an optional hash as a parameter, currently\nsupported options are:

\n
    \n
  • includeId: true if the record's ID should be included in the\nJSON representation.
  • \n
\n", + "itemtype": "method", + "name": "toJSON", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "A JSON representation of the object.", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 523, + "itemtype": "method", + "name": "send", + "access": "private", + "tagname": "", + "params": [ + { + "name": "name", + "description": "", + "type": "String" + }, + { + "name": "context", + "description": "", + "type": "Object" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 533, + "itemtype": "method", + "name": "transitionTo", + "access": "private", + "tagname": "", + "params": [ + { + "name": "name", + "description": "", + "type": "String" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 543, + "description": "

Marks the record as deleted but does not save it. You must call\nsave afterwards if you want to persist it. You might use this\nmethod if you want to allow the user to still rollbackAttributes()\nafter a delete was made.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/model/delete.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  actions: {\n    softDelete() {\n      this.get('controller.model').deleteRecord();\n    },\n    confirm() {\n      this.get('controller.model').save();\n    },\n    undo() {\n      this.get('controller.model').rollbackAttributes();\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "deleteRecord", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 575, + "description": "

Same as deleteRecord, but saves the record immediately.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/model/delete.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  actions: {\n    delete() {\n      this.get('controller.model').destroyRecord().then(function() {\n        controller.transitionToRoute('model.index');\n      });\n    }\n  }\n});
\n
\n
\n \n

If you pass an object on the adapterOptions property of the options\nargument it will be passed to your adapter via the snapshot

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
record.destroyRecord({ adapterOptions: { subscribe: false } });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n  deleteRecord(store, type, snapshot) {\n    if (snapshot.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "destroyRecord", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", + "type": "Promise" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 624, + "description": "

Unloads the record from the store. This will cause the record to be destroyed and freed up for garbage collection.

\n", + "itemtype": "method", + "name": "unloadRecord", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 634, + "itemtype": "method", + "name": "_notifyProperties", + "access": "private", + "tagname": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 648, + "description": "

Returns an object, whose keys are changed properties, and value is\nan [oldProp, newProp] array.

\n

The array represents the diff of the canonical state with the local state\nof the model. Note: if the model is created locally, the canonical state is\nempty since the adapter hasn't acknowledged the attributes yet:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/mascot.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  name: DS.attr('string'),\n  isAdmin: DS.attr('boolean', {\n    defaultValue: false\n  })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
let mascot = store.createRecord('mascot');\n\nmascot.changedAttributes(); // {}\n\nmascot.set('name', 'Tomster');\nmascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\nmascot.set('isAdmin', true);\nmascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\nmascot.save().then(function() {\n  mascot.changedAttributes(); // {}\n\n  mascot.set('isAdmin', false);\n  mascot.changedAttributes(); // { isAdmin: [true, false] }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "changedAttributes", + "return": { + "description": "an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 698, + "itemtype": "method", + "name": "adapterDidDirty", + "access": "private", + "tagname": "adapterDidDirty: function() {\nthis.send('becomeDirty');\nthis.updateRecordArraysLater();\n },", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 714, + "description": "

If the model hasDirtyAttributes this function will discard any unsaved\nchanges. If the model isNew it will be removed from the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
record.get('name'); // 'Untitled Document'\nrecord.set('name', 'Doc 1');\nrecord.get('name'); // 'Doc 1'\nrecord.rollbackAttributes();\nrecord.get('name'); // 'Untitled Document'
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "rollbackAttributes", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 747, + "description": "

Save the record and persist any changes to the record to an\nexternal source via the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
record.set('name', 'Tomster');\nrecord.save().then(function() {\n  // Success callback\n}, function() {\n  // Error callback\n});
\n
\n
\n \n

If you pass an object using the adapterOptions property of the options\n argument it will be passed to your adapter via the snapshot.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
record.save({ adapterOptions: { subscribe: false } });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n  updateRecord(store, type, snapshot) {\n    if (snapshot.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "save", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", + "type": "Promise" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 793, + "description": "

Reload the record from the adapter.

\n

This will only work if the record has already finished loading.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/model/view.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  actions: {\n    reload() {\n      this.controller.get('model').reload().then(function(model) {\n        // do something with the reloaded model\n      });\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "reload", + "return": { + "description": "a promise that will be resolved with the record when the\nadapter returns successfully or rejected if the adapter returns\nwith an error.", + "type": "Promise" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 826, + "description": "

Override the default event firing from Ember.Evented to\nalso call methods with the given name.

\n", + "itemtype": "method", + "name": "trigger", + "access": "private", + "tagname": "", + "params": [ + { + "name": "name", + "description": "", + "type": "String" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 854, + "description": "

Get the reference for the specified belongsTo relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/blog.js
1\n2\n3\n
export default DS.Model.extend({\n  user: DS.belongsTo({ async: true })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n
let blog = store.push({\n  data: {\n    type: 'blog',\n    id: 1,\n    relationships: {\n      user: {\n        data: { type: 'user', id: 1 }\n      }\n    }\n  }\n});\nlet userRef = blog.belongsTo('user');\n\n// check if the user relationship is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === "id") {\n  let id = userRef.id();\n} else if (userRef.remoteType() === "link") {\n  let link = userRef.link();\n}\n\n// load user (via store.findRecord or store.findBelongsTo)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({\n  type: 'user',\n  id: 1,\n  attributes: {\n    username: "@user"\n  }\n}).then(function(user) {\n  userRef.value() === user;\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "belongsTo", + "params": [ + { + "name": "name", + "description": "of the relationship", + "type": "String" + } + ], + "since": "2.5.0", + "return": { + "description": "reference for this relationship", + "type": "BelongsToReference" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 919, + "description": "

Get the reference for the specified hasMany relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n
// models/blog.js\nexport default DS.Model.extend({\n  comments: DS.hasMany({ async: true })\n});\n\nlet blog = store.push({\n  data: {\n    type: 'blog',\n    id: 1,\n    relationships: {\n      comments: {\n        data: [\n          { type: 'comment', id: 1 },\n          { type: 'comment', id: 2 }\n        ]\n      }\n    }\n  }\n});\nlet commentsRef = blog.hasMany('comments');\n\n// check if the comments are loaded already\nlet isLoaded = commentsRef.value() !== null;\n\n// get the records of the reference (null if not yet available)\nlet comments = commentsRef.value();\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === "ids") {\n  let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === "link") {\n  let link = commentsRef.link();\n}\n\n// load comments (via store.findMany or store.findHasMany)\ncommentsRef.load().then(...)\n\n// or trigger a reload\ncommentsRef.reload().then(...)\n\n// provide data for reference\ncommentsRef.push([{ type: 'comment', id: 1 }, { type: 'comment', id: 2 }]).then(function(comments) {\n  commentsRef.value() === comments;\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "hasMany", + "params": [ + { + "name": "name", + "description": "of the relationship", + "type": "String" + } + ], + "since": "2.5.0", + "return": { + "description": "reference for this relationship", + "type": "HasManyReference" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 984, + "description": "

Provides info about the model for debugging purposes\nby grouping the properties into more semantic groups.

\n

Meant to be used by debugging tools such as the Chrome Ember Extension.

\n
    \n
  • Groups all attributes in "Attributes" group.
  • \n
  • Groups all belongsTo relationships in "Belongs To" group.
  • \n
  • Groups all hasMany relationships in "Has Many" group.
  • \n
  • Groups all flags in "Flags" group.
  • \n
  • Flags relationship CPs as expensive properties.
  • \n
\n", + "itemtype": "method", + "name": "_debugInfo", + "access": "private", + "tagname": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1049, + "description": "

Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.

\n

The callback method you provide should have the following signature (all\nparameters are optional):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
function(name, descriptor);
\n
\n
\n \n
    \n
  • name the name of the current property in the iteration
  • \n
  • descriptor the meta object that describes this relationship
  • \n
\n

The relationship descriptor argument is an object with the following properties.

\n
    \n
  • key String the name of this relationship on the Model
  • \n
  • kind String "hasMany" or "belongsTo"
  • \n
  • options Object the original options hash passed when the relationship was declared
  • \n
  • parentType DS.Model the type of the Model that owns this relationship
  • \n
  • type String the type name of the related Model
  • \n
\n

Note that in addition to a callback, you can also pass an optional target\nobject that will be set as this on the context.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n serialize: function(record, options) {\n   let json = {};\n\n   record.eachRelationship(function(name, descriptor) {\n     if (descriptor.kind === 'hasMany') {\n       let serializedHasManyName = name.toUpperCase() + '_IDS';\n       json[serializedHasManyName] = record.get(name).mapBy('id');\n     }\n   });\n\n   return json;\n }\n  });
\n
\n
\n \n", + "itemtype": "method", + "name": "eachRelationship", + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1153, + "description": "

Override the class' create() method to raise an error. This\nprevents end users from inadvertently calling create() instead\nof createRecord(). The store is still able to create instances\nby calling the _create() method. To create an instance of a\nDS.Model use store.createRecord.

\n", + "itemtype": "method", + "name": "create", + "access": "private", + "tagname": "", + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1212, + "description": "

For a given relationship name, returns the model type of the relationship.

\n

For example, if you define a model like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   comments: DS.hasMany('comment')\n });
\n
\n
\n \n

Calling store.modelFor('post').typeForRelationship('comments', store) will return Comment.

\n", + "itemtype": "method", + "name": "typeForRelationship", + "static": 1, + "params": [ + { + "name": "name", + "description": "the name of the relationship", + "type": "String" + }, + { + "name": "store", + "description": "an instance of DS.Store", + "type": "Store" + } + ], + "return": { + "description": "the type of the relationship, or undefined", + "type": "DS.Model" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1242, + "description": "

Find the relationship which is the inverse of the one asked for.

\n

For example, if you define models like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   comments: DS.hasMany('message')\n });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/message.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   owner: DS.belongsTo('post')\n });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }
\n
\n
\n \n", + "itemtype": "method", + "name": "inverseFor", + "static": 1, + "params": [ + { + "name": "name", + "description": "the name of the relationship", + "type": "String" + }, + { + "name": "store", + "description": "", + "type": "DS.Store" + } + ], + "return": { + "description": "the inverse relationship, or null", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1581, + "description": "

Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.

\n", + "itemtype": "method", + "name": "eachRelationship", + "static": 1, + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1597, + "description": "

Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.

\n", + "itemtype": "method", + "name": "eachRelatedType", + "static": 1, + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1741, + "description": "

Iterates through the attributes of the model, calling the passed function on each\nattribute.

\n

The callback method you provide should have the following signature (all\nparameters are optional):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
function(name, meta);
\n
\n
\n \n
    \n
  • name the name of the current property in the iteration
  • \n
  • meta the meta object for the attribute property in the iteration
  • \n
\n

Note that in addition to a callback, you can also pass an optional target\nobject that will be set as this on the context.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import DS from 'ember-data';\n\nlet Person = DS.Model.extend({\n   firstName: DS.attr('string'),\n   lastName: DS.attr('string'),\n   birthday: DS.attr('date')\n });\n\nPerson.eachAttribute(function(name, meta) {\n   console.log(name, meta);\n });\n\n// prints:\n// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}\n// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}\n// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
\n
\n
\n \n", + "itemtype": "method", + "name": "eachAttribute", + "params": [ + { + "name": "callback", + "description": "The callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1790, + "description": "

Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.

\n

The callback method you provide should have the following signature (all\nparameters are optional):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
function(name, type);
\n
\n
\n \n
    \n
  • name the name of the current property in the iteration
  • \n
  • type a string containing the name of the type of transformed\napplied to the attribute
  • \n
\n

Note that in addition to a callback, you can also pass an optional target\nobject that will be set as this on the context.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\n\nlet Person = DS.Model.extend({\n   firstName: DS.attr(),\n   lastName: DS.attr('string'),\n   birthday: DS.attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n   console.log(name, type);\n });\n\n// prints:\n// lastName string\n// birthday date
\n
\n
\n \n", + "itemtype": "method", + "name": "eachTransformedAttribute", + "params": [ + { + "name": "callback", + "description": "The callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1862, + "description": "

Discards any unsaved changes to the given attribute. This feature is not enabled by default. You must enable ds-rollback-attribute and be running a canary build.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
record.get('name'); // 'Untitled Document'\nrecord.set('name', 'Doc 1');\nrecord.get('name'); // 'Doc 1'\nrecord.rollbackAttribute('name');\nrecord.get('name'); // 'Untitled Document'
\n
\n
\n \n", + "itemtype": "method", + "name": "rollbackAttribute", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1895, + "description": "

This Ember.js hook allows an object to be notified when a property\nis defined.

\n

In this case, we use it to be notified when an Ember Data user defines a\nbelongs-to relationship. In that case, we need to set up observers for\neach one, allowing us to track relationship changes and automatically\nreflect changes in the inverse has-many array.

\n

This hook passes the class being set up, as well as the key and value\nbeing defined. So, for example, when the user does this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
DS.Model.extend({\n parent: DS.belongsTo('user')\n    });
\n
\n
\n \n

This hook would be called with "parent" as the key and the computed\nproperty returned by DS.belongsTo as the value.

\n", + "itemtype": "method", + "name": "didDefineProperty", + "params": [ + { + "name": "proto", + "description": "", + "type": "Object" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "value", + "description": "", + "type": "Ember.ComputedProperty" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [ + { + "file": "addon/-private/system/model/model.js", + "line": 465, + "description": "

Fired when the record is ready to be interacted with,\nthat is either loaded from the server or created locally.

\n", + "itemtype": "event", + "name": "ready", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 473, + "description": "

Fired when the record is loaded from the server.

\n", + "itemtype": "event", + "name": "didLoad", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 480, + "description": "

Fired when the record is updated.

\n", + "itemtype": "event", + "name": "didUpdate", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 487, + "description": "

Fired when a new record is commited to the server.

\n", + "itemtype": "event", + "name": "didCreate", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 494, + "description": "

Fired when the record is deleted.

\n", + "itemtype": "event", + "name": "didDelete", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 501, + "description": "

Fired when the record becomes invalid.

\n", + "itemtype": "event", + "name": "becameInvalid", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 508, + "description": "

Fired when the record enters the error state.

\n", + "itemtype": "event", + "name": "becameError", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 515, + "description": "

Fired when the record is rolled back.

\n", + "itemtype": "event", + "name": "rolledBack", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + } + ], + "properties": [ + { + "file": "addon/-private/system/model/model.js", + "line": 96, + "description": "

If this property is true the record is in the empty\nstate. Empty is the first state all records enter after they have\nbeen created. Most records created by the store will quickly\ntransition to the loading state if data needs to be fetched from\nthe server or the created state if the record is created on the\nclient. A record can also enter the empty state if the adapter is\nunable to locate the record.

\n", + "itemtype": "property", + "name": "isEmpty", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 110, + "description": "

If this property is true the record is in the loading state. A\nrecord enters this state when the store asks the adapter for its\ndata. It remains in this state until the adapter provides the\nrequested data.

\n", + "itemtype": "property", + "name": "isLoading", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 121, + "description": "

If this property is true the record is in the loaded state. A\nrecord enters this state when its data is populated. Most of a\nrecord's lifecycle is spent inside substates of the loaded\nstate.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let record = store.createRecord('model');\nrecord.get('isLoaded'); // true\n\nstore.findRecord('model', 1).then(function(model) {\n  model.get('isLoaded'); // true\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "isLoaded", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 143, + "description": "

If this property is true the record is in the dirty state. The\nrecord has local changes that have not yet been saved by the\nadapter. This includes records that have been created (but not yet\nsaved) or deleted.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let record = store.createRecord('model');\nrecord.get('hasDirtyAttributes'); // true\n\nstore.findRecord('model', 1).then(function(model) {\n  model.get('hasDirtyAttributes'); // false\n  model.set('foo', 'some value');\n  model.get('hasDirtyAttributes'); // true\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "property", + "name": "hasDirtyAttributes", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 170, + "description": "

If this property is true the record is in the saving state. A\nrecord enters the saving state when save is called, but the\nadapter has not yet acknowledged that the changes have been\npersisted to the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
let record = store.createRecord('model');\nrecord.get('isSaving'); // false\nlet promise = record.save();\nrecord.get('isSaving'); // true\npromise.then(function() {\n  record.get('isSaving'); // false\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "isSaving", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 193, + "description": "

If this property is true the record is in the deleted state\nand has been marked for deletion. When isDeleted is true and\nhasDirtyAttributes is true, the record is deleted locally but the deletion\nwas not yet persisted. When isSaving is true, the change is\nin-flight. When both hasDirtyAttributes and isSaving are false, the\nchange has persisted.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n
let record = store.createRecord('model');\nrecord.get('isDeleted');    // false\nrecord.deleteRecord();\n\n// Locally deleted\nrecord.get('isDeleted');           // true\nrecord.get('hasDirtyAttributes');  // true\nrecord.get('isSaving');            // false\n\n// Persisting the deletion\nlet promise = record.save();\nrecord.get('isDeleted');    // true\nrecord.get('isSaving');     // true\n\n// Deletion Persisted\npromise.then(function() {\n  record.get('isDeleted');          // true\n  record.get('isSaving');           // false\n  record.get('hasDirtyAttributes'); // false\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "isDeleted", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 231, + "description": "

If this property is true the record is in the new state. A\nrecord will be in the new state when it has been created on the\nclient and the adapter has not yet report that it was successfully\nsaved.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let record = store.createRecord('model');\nrecord.get('isNew'); // true\n\nrecord.save().then(function(model) {\n  model.get('isNew'); // false\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "isNew", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 253, + "description": "

If this property is true the record is in the valid state.

\n

A record will be in the valid state when the adapter did not report any\nserver-side validation failures.

\n", + "itemtype": "property", + "name": "isValid", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 264, + "description": "

If the record is in the dirty state this property will report what\nkind of change has caused it to move into the dirty\nstate. Possible values are:

\n
    \n
  • created The record has been created by the client and not yet saved to the adapter.
  • \n
  • updated The record has been updated by the client and not yet saved to the adapter.
  • \n
  • deleted The record has been deleted by the client and not yet saved to the adapter.
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
let record = store.createRecord('model');\nrecord.get('dirtyType'); // 'created'
\n
\n
\n \n", + "itemtype": "property", + "name": "dirtyType", + "type": "{String}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 286, + "description": "

If true the adapter reported that it was unable to save local\nchanges to the backend for any reason other than a server-side\nvalidation error.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
record.get('isError'); // false\nrecord.set('foo', 'valid value');\nrecord.save().then(null, function() {\n  record.get('isError'); // true\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "isError", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 307, + "description": "

If true the store is attempting to reload the record from the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
record.get('isReloading'); // false\nrecord.reload();\nrecord.get('isReloading'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isReloading", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 324, + "description": "

All ember models have an id property. This is an identifier\nmanaged by an external source. These are always coerced to be\nstrings before being used internally. Note when declaring the\nattributes for a model it is an error to declare an id\nattribute.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let record = store.createRecord('model');\nrecord.get('id'); // null\n\nstore.findRecord('model', 1).then(function(model) {\n  model.get('id'); // '1'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "id", + "type": "{String}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 345, + "itemtype": "property", + "name": "currentState", + "access": "private", + "tagname": "", + "type": "{Object}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 352, + "description": "

When the record is in the invalid state this object will contain\nany errors returned by the adapter. When present the errors hash\ncontains keys corresponding to the invalid property names\nand values which are arrays of Javascript objects with two keys:

\n
    \n
  • message A string containing the error message from the backend
  • \n
  • attribute The name of the property associated with this error message
  • \n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
record.get('errors.length'); // 0\nrecord.set('foo', 'invalid value');\nrecord.save().catch(function() {\n  record.get('errors').get('foo');\n  // [{message: 'foo should be a number.', attribute: 'foo'}]\n});
\n
\n
\n \n

The errors property us useful for displaying error messages to\nthe user.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
<label>Username: {{input value=username}} </label>\n{{#each model.errors.username as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}\n<label>Email: {{input value=email}} </label>\n{{#each model.errors.email as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

You can also access the special messages property on the error\nobject to get an array of all the error strings.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each model.errors.messages as |message|}}\n  <div class="error">\n    {{message}}\n  </div>\n{{/each}}
\n
\n
\n \n", + "itemtype": "property", + "name": "errors", + "type": "{DS.Errors}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 416, + "description": "

This property holds the DS.AdapterError object with which\nlast adapter operation was rejected.

\n", + "itemtype": "property", + "name": "adapterError", + "type": "{DS.AdapterError}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1127, + "itemtype": "property", + "name": "data", + "access": "private", + "tagname": "", + "type": "{Object}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1164, + "description": "

Represents the model's class name as a string. This can be used to look up the model's class name through\nDS.Store's modelFor method.

\n

modelName is generated for you by Ember Data. It will be a lowercased, dasherized string.\nFor example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.modelFor('post').modelName; // 'post'\nstore.modelFor('blog-post').modelName; // 'blog-post'
\n
\n
\n \n

The most common place you'll want to access modelName is in your serializer's payloadKeyFromModelName method. For example, to change payload\nkeys to underscore (instead of dasherized), you might use the following code:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
import { underscore } from '@ember/string';\n\nexport default const PostSerializer = DS.RESTSerializer.extend({\n  payloadKeyFromModelName(modelName) {\n    return underscore(modelName);\n  }\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "modelName", + "type": "String", + "readonly": "", + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1361, + "description": "

The model's relationships as a map, keyed on the type of the\nrelationship. The value of each entry is an array containing a descriptor\nfor each relationship with that type, describing the name of the relationship\nas well as the type.

\n

For example, given the following model definition:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/blog.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   users: DS.hasMany('user'),\n   owner: DS.belongsTo('user'),\n   posts: DS.hasMany('post')\n });
\n
\n
\n \n

This computed property would return a map describing these\nrelationships, like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import Ember from 'ember';\nimport Blog from 'app/models/blog';\nimport User from 'app/models/user';\nimport Post from 'app/models/post';\n\nlet relationships = Ember.get(Blog, 'relationships');\nrelationships.get(User);\n//=> [ { name: 'users', kind: 'hasMany' },\n//     { name: 'owner', kind: 'belongsTo' } ]\nrelationships.get(Post);\n//=> [ { name: 'posts', kind: 'hasMany' } ]
\n
\n
\n \n", + "itemtype": "property", + "name": "relationships", + "static": 1, + "type": "Ember.Map", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1404, + "description": "

A hash containing lists of the model's relationships, grouped\nby the relationship kind. For example, given a model with this\ndefinition:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/blog.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   users: DS.hasMany('user'),\n   owner: DS.belongsTo('user'),\n\n   posts: DS.hasMany('post')\n });
\n
\n
\n \n

This property would contain the following:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet relationshipNames = Ember.get(Blog, 'relationshipNames');\nrelationshipNames.hasMany;\n//=> ['users', 'posts']\nrelationshipNames.belongsTo;\n//=> ['owner']
\n
\n
\n \n", + "itemtype": "property", + "name": "relationshipNames", + "static": 1, + "type": "Object", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1453, + "description": "

An array of types directly related to a model. Each type will be\nincluded once, regardless of the number of relationships it has with\nthe model.

\n

For example, given a model with this definition:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/blog.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   users: DS.hasMany('user'),\n   owner: DS.belongsTo('user'),\n\n   posts: DS.hasMany('post')\n });
\n
\n
\n \n

This property would contain the following:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet relatedTypes = Ember.get(Blog, 'relatedTypes');\n//=> [ User, Post ]
\n
\n
\n \n", + "itemtype": "property", + "name": "relatedTypes", + "static": 1, + "type": "Ember.Array", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1488, + "description": "

A map whose keys are the relationships of a model and whose values are\nrelationship descriptors.

\n

For example, given a model with this\ndefinition:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/blog.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   users: DS.hasMany('user'),\n   owner: DS.belongsTo('user'),\n\n   posts: DS.hasMany('post')\n });
\n
\n
\n \n

This property would contain the following:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet relationshipsByName = Ember.get(Blog, 'relationshipsByName');\nrelationshipsByName.get('users');\n//=> { key: 'users', kind: 'hasMany', type: 'user', options: Object, isRelationship: true }\nrelationshipsByName.get('owner');\n//=> { key: 'owner', kind: 'belongsTo', type: 'user', options: Object, isRelationship: true }
\n
\n
\n \n", + "itemtype": "property", + "name": "relationshipsByName", + "static": 1, + "type": "Ember.Map", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1526, + "description": "

A map whose keys are the fields of the model and whose values are strings\ndescribing the kind of the field. A model's fields are the union of all of its\nattributes and relationships.

\n

For example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/blog.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   users: DS.hasMany('user'),\n   owner: DS.belongsTo('user'),\n\n   posts: DS.hasMany('post'),\n\n   title: DS.attr('string')\n });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet fields = Ember.get(Blog, 'fields');\nfields.forEach(function(kind, field) {\n   console.log(field, kind);\n });\n\n// prints:\n// users, hasMany\n// owner, belongsTo\n// posts, hasMany\n// title, attribute
\n
\n
\n \n", + "itemtype": "property", + "name": "fields", + "static": 1, + "type": "Ember.Map", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1638, + "description": "

A map whose keys are the attributes of the model (properties\ndescribed by DS.attr) and whose values are the meta object for the\nproperty.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   firstName: DS.attr('string'),\n   lastName: DS.attr('string'),\n   birthday: DS.attr('date')\n });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import Ember from 'ember';\nimport Person from 'app/models/person';\n\nlet attributes = Ember.get(Person, 'attributes')\n\nattributes.forEach(function(meta, name) {\n   console.log(name, meta);\n });\n\n// prints:\n// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}\n// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}\n// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
\n
\n
\n \n", + "itemtype": "property", + "name": "attributes", + "static": 1, + "type": "{Ember.Map}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1691, + "description": "

A map whose keys are the attributes of the model (properties\ndescribed by DS.attr) and whose values are type of transformation\napplied to each attribute. This map does not include any\nattributes that do not have an transformation type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n   firstName: DS.attr(),\n   lastName: DS.attr('string'),\n   birthday: DS.attr('date')\n });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Ember from 'ember';\nimport Person from 'app/models/person';\n\nlet transformedAttributes = Ember.get(Person, 'transformedAttributes')\n\ntransformedAttributes.forEach(function(field, type) {\n   console.log(field, type);\n });\n\n// prints:\n// lastName string\n// birthday date
\n
\n
\n \n", + "itemtype": "property", + "name": "transformedAttributes", + "static": 1, + "type": "{Ember.Map}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.Object", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.NotFoundError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.NotFoundError.json new file mode 100644 index 000000000..7cea4367e --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.NotFoundError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.NotFoundError", + "type": "class", + "attributes": { + "name": "DS.NotFoundError", + "shortname": "DS.NotFoundError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 265, + "description": "

A DS.NotFoundError equates to a HTTP 404 Not Found response status.\nIt is used by an adapter to signal that a request to the external API\nwas rejected because the resource could not be found on the API.

\n

An example use case would be to detect if the user has entered a route\nfor a specific model that does not exist. For example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
import Route from '@ember/routing/route';\nimport DS from 'ember-data';\n\nconst { NotFoundError } = DS;\n\nexport default Route.extend({\n  model(params) {\n    return this.get('store').findRecord('post', params.post_id);\n  },\n\n  actions: {\n    error(error, transition) {\n      if (error instanceof NotFoundError) {\n        // redirect to a list of all posts instead\n        this.transitionTo('posts');\n      } else {\n        // otherwise let the error bubble\n        return true;\n      }\n    }\n  }\n});
\n
\n
\n \n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.NumberTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.NumberTransform.json new file mode 100644 index 000000000..9e1d2c2fc --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.NumberTransform.json @@ -0,0 +1,98 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.NumberTransform", + "type": "class", + "attributes": { + "name": "DS.NumberTransform", + "shortname": "DS.NumberTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/number.js", + "line": 8, + "description": "

The DS.NumberTransform class is used to serialize and deserialize\nnumeric attributes on Ember Data record objects. This transform is\nused when number is passed as the type parameter to the\nDS.attr function.

\n

Usage

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/score.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  value: DS.attr('number'),\n  player: DS.belongsTo('player'),\n  date: DS.attr('date')\n});
\n
\n
\n \n", + "extends": "DS.Transform", + "methods": [ + { + "file": "addon/transforms/transform.js", + "line": 71, + "description": "

When given a deserialized value from a record attribute this\nmethod must return the serialized value.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import { isEmpty } from '@ember/utils';\n\nserialize(deserialized, options) {\n  return isEmpty(deserialized) ? null : Number(deserialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "deserialized", + "description": "The deserialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The serialized value" + }, + "class": "DS.NumberTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + }, + { + "file": "addon/transforms/transform.js", + "line": 92, + "description": "

When given a serialize value from a JSON object this method must\nreturn the deserialized value for the record attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
deserialize(serialized, options) {\n  return empty(serialized) ? null : Number(serialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "deserialize", + "params": [ + { + "name": "serialized", + "description": "The serialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The deserialized value" + }, + "class": "DS.NumberTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.Transform", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseArray.json new file mode 100644 index 000000000..bca3213f5 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseArray.json @@ -0,0 +1,50 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.PromiseArray", + "type": "class", + "attributes": { + "name": "DS.PromiseArray", + "shortname": "DS.PromiseArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/promise-proxies.js", + "line": 9, + "description": "

A PromiseArray is an object that acts like both an Ember.Array\nand a promise. When the promise is resolved the resulting value\nwill be set to the PromiseArray's content property. This makes\nit easy to create data bindings with the PromiseArray that will be\nupdated when the promise resolves.

\n

For more information see the Ember.PromiseProxyMixin\ndocumentation.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
let promiseArray = DS.PromiseArray.create({\n  promise: $.getJSON('/some/remote/data.json')\n});\n\npromiseArray.get('length'); // 0\n\npromiseArray.then(function() {\n  promiseArray.get('length'); // 100\n});
\n
\n
\n \n", + "extends": "Ember.ArrayProxy", + "uses": [ + "Ember.PromiseProxyMixin" + ], + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.ArrayProxy", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseManyArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseManyArray.json new file mode 100644 index 000000000..a34164b2f --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseManyArray.json @@ -0,0 +1,47 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.PromiseManyArray", + "type": "class", + "attributes": { + "name": "DS.PromiseManyArray", + "shortname": "DS.PromiseManyArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/promise-proxies.js", + "line": 85, + "description": "

A PromiseManyArray is a PromiseArray that also proxies certain method calls\nto the underlying manyArray.\nRight now we proxy:

\n
    \n
  • reload()
  • \n
  • createRecord()
  • \n
  • on()
  • \n
  • one()
  • \n
  • trigger()
  • \n
  • off()
  • \n
  • has()
  • \n
\n", + "extends": "Ember.ArrayProxy", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.ArrayProxy", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseObject.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseObject.json new file mode 100644 index 000000000..c5b768c5b --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.PromiseObject.json @@ -0,0 +1,50 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.PromiseObject", + "type": "class", + "attributes": { + "name": "DS.PromiseObject", + "shortname": "DS.PromiseObject", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/promise-proxies.js", + "line": 42, + "description": "

A PromiseObject is an object that acts like both an Ember.Object\nand a promise. When the promise is resolved, then the resulting value\nwill be set to the PromiseObject's content property. This makes\nit easy to create data bindings with the PromiseObject that will\nbe updated when the promise resolves.

\n

For more information see the Ember.PromiseProxyMixin\ndocumentation.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
let promiseObject = DS.PromiseObject.create({\n  promise: $.getJSON('/some/remote/data.json')\n});\n\npromiseObject.get('name'); // null\n\npromiseObject.then(function() {\n  promiseObject.get('name'); // 'Tomster'\n});
\n
\n
\n \n", + "extends": "Ember.ObjectProxy", + "uses": [ + "Ember.PromiseProxyMixin" + ], + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.ObjectProxy", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RESTAdapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RESTAdapter.json new file mode 100644 index 000000000..434820963 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RESTAdapter.json @@ -0,0 +1,1697 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.RESTAdapter", + "type": "class", + "attributes": { + "name": "DS.RESTAdapter", + "shortname": "DS.RESTAdapter", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/adapters/rest.js", + "line": 33, + "description": "

The REST adapter allows your store to communicate with an HTTP server by\ntransmitting JSON via XHR. Most Ember.js apps that consume a JSON API\nshould use the REST adapter.

\n

This adapter is designed around the idea that the JSON exchanged with\nthe server should be conventional.

\n

Success and failure

\n

The REST adapter will consider a success any response with a status code\nof the 2xx family ("Success"), as well as 304 ("Not Modified"). Any other\nstatus code will be considered a failure.

\n

On success, the request promise will be resolved with the full response\npayload.

\n

Failed responses with status code 422 ("Unprocessable Entity") will be\nconsidered "invalid". The response will be discarded, except for the\nerrors key. The request promise will be rejected with a DS.InvalidError.\nThis error object will encapsulate the saved errors value.

\n

Any other status codes will be treated as an "adapter error". The request\npromise will be rejected, similarly to the "invalid" case, but with\nan instance of DS.AdapterError instead.

\n

JSON Structure

\n

The REST adapter expects the JSON returned from your server to follow\nthese conventions.

\n

Object Root

\n

The JSON payload should be an object that contains the record inside a\nroot property. For example, in response to a GET request for\n/posts/1, the JSON should look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "posts": {\n    "id": 1,\n    "title": "I'm Running to Reform the W3C's Tag",\n    "author": "Yehuda Katz"\n  }\n}
\n
\n
\n \n

Similarly, in response to a GET request for /posts, the JSON should\nlook like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  "posts": [\n    {\n      "id": 1,\n      "title": "I'm Running to Reform the W3C's Tag",\n      "author": "Yehuda Katz"\n    },\n    {\n      "id": 2,\n      "title": "Rails is omakase",\n      "author": "D2H"\n    }\n  ]\n}
\n
\n
\n \n

Note that the object root can be pluralized for both a single-object response\nand an array response: the REST adapter is not strict on this. Further, if the\nHTTP server responds to a GET request to /posts/1 (e.g. the response to a\nfindRecord query) with more than one object in the array, Ember Data will\nonly display the object with the matching ID.

\n

Conventional Names

\n

Attribute names in your JSON payload should be the camelCased versions of\nthe attributes in your Ember.js models.

\n

For example, if you have a Person model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  firstName: DS.attr('string'),\n  lastName: DS.attr('string'),\n  occupation: DS.attr('string')\n});
\n
\n
\n \n

The JSON returned should look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
{\n  "people": {\n    "id": 5,\n    "firstName": "Zaphod",\n    "lastName": "Beeblebrox",\n    "occupation": "President"\n  }\n}
\n
\n
\n \n

Relationships

\n

Relationships are usually represented by ids to the record in the\nrelationship. The related records can then be sideloaded in the\nresponse under a key for the type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
{\n  "posts": {\n    "id": 5,\n    "title": "I'm Running to Reform the W3C's Tag",\n    "author": "Yehuda Katz",\n    "comments": [1, 2]\n  },\n  "comments": [{\n    "id": 1,\n    "author": "User 1",\n    "message": "First!",\n  }, {\n    "id": 2,\n    "author": "User 2",\n    "message": "Good Luck!",\n  }]\n}
\n
\n
\n \n

If the records in the relationship are not known when the response\nis serialized its also possible to represent the relationship as a\nurl using the links key in the response. Ember Data will fetch\nthis url to resolve the relationship when it is accessed for the\nfirst time.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "posts": {\n    "id": 5,\n    "title": "I'm Running to Reform the W3C's Tag",\n    "author": "Yehuda Katz",\n    "links": {\n      "comments": "/posts/5/comments"\n    }\n  }\n}
\n
\n
\n \n

Errors

\n

If a response is considered a failure, the JSON payload is expected to include\na top-level key errors, detailing any specific issues. For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "errors": {\n    "msg": "Something went wrong"\n  }\n}
\n
\n
\n \n

This adapter does not make any assumptions as to the format of the errors\nobject. It will simply be passed along as is, wrapped in an instance\nof DS.InvalidError or DS.AdapterError. The serializer can interpret it\nafterwards.

\n

Customization

\n

Endpoint path customization

\n

Endpoint paths can be prefixed with a namespace by setting the namespace\nproperty on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  namespace: 'api/1'\n});
\n
\n
\n \n

Requests for the Person model would now target /api/1/people/1.

\n

Host customization

\n

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  host: 'https://api.example.com'\n});
\n
\n
\n \n

Headers customization

\n

Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary\nheaders can be set as key/value pairs on the RESTAdapter's headers\nobject and Ember Data will send them along with each ajax request.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  headers: {\n    'API_KEY': 'secret key',\n    'ANOTHER_HEADER': 'Some header value'\n  }\n});
\n
\n
\n \n

headers can also be used as a computed property to support dynamic\nheaders. In the example below, the session object has been\ninjected into an adapter by Ember's container.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\nimport { computed } from '@ember/object';\n\nexport default DS.RESTAdapter.extend({\n  headers: computed('session.authToken', function() {\n    return {\n      'API_KEY': this.get('session.authToken'),\n      'ANOTHER_HEADER': 'Some header value'\n    };\n  })\n});
\n
\n
\n \n

In some cases, your dynamic headers may require data from some\nobject outside of Ember's observer system (for example\ndocument.cookie). You can use the\nvolatile\nfunction to set the property into a non-cached mode causing the headers to\nbe recomputed with every request.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\nimport { get } from '@ember/object';\nimport { computed } from '@ember/object';\n\nexport default DS.RESTAdapter.extend({\n  headers: computed(function() {\n    return {\n      'API_KEY': get(document.cookie.match(/apiKey\\=([^;]*)/), '1'),\n      'ANOTHER_HEADER': 'Some header value'\n    };\n  }).volatile()\n});
\n
\n
\n \n", + "is_constructor": 1, + "extends": "DS.Adapter", + "uses": [ + "DS.BuildURLMixin" + ], + "methods": [ + { + "file": "addon/adapters/rest.js", + "line": 294, + "description": "

By default, the RESTAdapter will send the query params sorted alphabetically to the\nserver.

\n

For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('posts', { sort: 'price', category: 'pets' });
\n
\n
\n \n

will generate a requests like this /posts?category=pets&sort=price, even if the\nparameters were specified in a different order.

\n

That way the generated URL will be deterministic and that simplifies caching mechanisms\nin the backend.

\n

Setting sortQueryParams to a falsey value will respect the original order.

\n

In case you want to sort the query parameters with a different criteria, set\nsortQueryParams to your custom sort function.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  sortQueryParams(params) {\n    let sortedKeys = Object.keys(params).sort().reverse();\n    let len = sortedKeys.length, newParams = {};\n\n    for (let i = 0; i < len; i++) {\n      newParams[sortedKeys[i]] = params[sortedKeys[i]];\n    }\n\n    return newParams;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "sortQueryParams", + "params": [ + { + "name": "obj", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 457, + "description": "

Called by the store in order to fetch the JSON for a given\ntype and ID.

\n

The findRecord method makes an Ajax request to a URL computed by\nbuildURL, and returns a promise for the resulting payload.

\n

This method performs an HTTP GET request with the id provided as part of the query string.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 490, + "description": "

Called by the store in order to fetch a JSON array for all\nof the records for a given type.

\n

The findAll method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a\npromise for the resulting payload.

\n", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "sinceToken", + "description": "", + "type": "String" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 526, + "description": "

Called by the store in order to fetch a JSON array for\nthe records that match a particular query.

\n

The query method makes an Ajax (HTTP GET) request to a URL\ncomputed by buildURL, and returns a promise for the resulting\npayload.

\n

The query argument is a simple JavaScript object that will be passed directly\nto the server as parameters.

\n", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 562, + "description": "

Called by the store in order to fetch a JSON object for\nthe record that matches a particular query.

\n

The queryRecord method makes an Ajax (HTTP GET) request to a URL\ncomputed by buildURL, and returns a promise for the resulting\npayload.

\n

The query argument is a simple JavaScript object that will be passed directly\nto the server as parameters.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 599, + "description": "

Called by the store in order to fetch several records together if coalesceFindRequests is true

\n

For example, if the original payload looks like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "id": 1,\n  "title": "Rails is omakase",\n  "comments": [ 1, 2, 3 ]\n}
\n
\n
\n \n

The IDs will be passed as a URL-encoded Array of IDs, in this form:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
ids[]=1&ids[]=2&ids[]=3
\n
\n
\n

Many servers, such as Rails and PHP, will automatically convert this URL-encoded array\ninto an Array for you on the server-side. If you want to encode the\nIDs, differently, just override this (one-line) method.

\n

The findMany method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a\npromise for the resulting payload.

\n", + "itemtype": "method", + "name": "findMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 646, + "description": "

Called by the store in order to fetch a JSON array for\nthe unloaded records in a has-many relationship that were originally\nspecified as a URL (inside of links).

\n

For example, if your original payload looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "post": {\n    "id": 1,\n    "title": "Rails is omakase",\n    "links": { "comments": "/posts/1/comments" }\n  }\n}
\n
\n
\n \n

This method will be called with the parent record and /posts/1/comments.

\n

The findHasMany method will make an Ajax (HTTP GET) request to the originally specified URL.

\n

The format of your links value will influence the final request URL via the urlPrefix method:

\n
    \n
  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

    \n
  • \n
  • Links beginning with a single / will have the current adapter's host value prepended to it.

    \n
  • \n
  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

    \n
  • \n
\n", + "itemtype": "method", + "name": "findHasMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "relationship", + "description": "meta object describing the relationship", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 700, + "description": "

Called by the store in order to fetch the JSON for the unloaded record in a\nbelongs-to relationship that was originally specified as a URL (inside of\nlinks).

\n

For example, if your original payload looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "person": {\n    "id": 1,\n    "name": "Tom Dale",\n    "links": { "group": "/people/1/group" }\n  }\n}
\n
\n
\n \n

This method will be called with the parent record and /people/1/group.

\n

The findBelongsTo method will make an Ajax (HTTP GET) request to the originally specified URL.

\n

The format of your links value will influence the final request URL via the urlPrefix method:

\n
    \n
  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

    \n
  • \n
  • Links beginning with a single / will have the current adapter's host value prepended to it.

    \n
  • \n
  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

    \n
  • \n
\n", + "itemtype": "method", + "name": "findBelongsTo", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "relationship", + "description": "meta object describing the relationship", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 753, + "description": "

Called by the store when a newly created record is\nsaved via the save method on a model record instance.

\n

The createRecord method serializes the record and makes an Ajax (HTTP POST) request\nto a URL computed by buildURL.

\n

See serialize for information on how to customize the serialized form\nof a record.

\n", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 788, + "description": "

Called by the store when an existing record is saved\nvia the save method on a model record instance.

\n

The updateRecord method serializes the record and makes an Ajax (HTTP PUT) request\nto a URL computed by buildURL.

\n

See serialize for information on how to customize the serialized form\nof a record.

\n", + "itemtype": "method", + "name": "updateRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 825, + "description": "

Called by the store when a record is deleted.

\n

The deleteRecord method makes an Ajax (HTTP DELETE) request to a URL computed by buildURL.

\n", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 875, + "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

This implementation groups together records that have the same base URL but\ndiffering ids. For example /comments/1 and /comments/2 will be grouped together\nbecause we know findMany can coalesce them together as /comments?ids[]=1&ids[]=2

\n

It also supports urls where ids are passed as a query param, such as /comments?id=1\nbut not those where there is more than 1 query param such as /comments?id=2&name=David\nCurrently only the query param of id is supported. If you need to support others, please\noverride this or the _stripIDFromURL method.

\n

It does not group records that have differing base urls, such as for example: /posts/1/comments/2\nand /posts/2/comments/3

\n", + "itemtype": "method", + "name": "groupRecordsForFindMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", + "type": "Array" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 939, + "description": "

Takes an ajax response, and returns the json payload or an error.

\n

By default this hook just returns the json payload passed to it.\nYou might want to override it in two cases:

\n
    \n
  1. Your API might return useful results in the response headers.\nResponse headers are passed in as the second argument.

    \n
  2. \n
  3. Your API might return errors as successful responses with status code\n200 and an Errors text or object. You can return a DS.InvalidError or a\nDS.AdapterError (or a sub class) from this hook and it will automatically\nreject the promise and put your record into the invalid or error state.

    \n
  4. \n
\n

Returning a DS.InvalidError from this method will cause the\nrecord to transition into the invalid state and make the\nerrors object available on the record. When returning an\nDS.InvalidError the store will attempt to normalize the error data\nreturned from the server using the serializer's extractErrors\nmethod.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "handleResponse", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "requestData", + "description": "- the original request information", + "type": "Object" + } + ], + "return": { + "description": "response", + "type": "Object | DS.AdapterError" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 996, + "description": "

Default handleResponse implementation uses this hook to decide if the\nresponse is a success.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "isSuccess", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1011, + "description": "

Default handleResponse implementation uses this hook to decide if the\nresponse is an invalid error.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "isInvalid", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1026, + "description": "

Takes a URL, an HTTP method and a hash of data, and makes an\nHTTP request.

\n

When the server responds with a payload, Ember Data will call into extractSingle\nor extractArray (depending on whether the original query was for one record or\nmany records).

\n

By default, ajax method has the following behavior:

\n
    \n
  • It sets the response dataType to "json"
  • \n
  • If the HTTP method is not "GET", it sets the Content-Type to be\napplication/json; charset=utf-8
  • \n
  • If the HTTP method is not "GET", it stringifies the data passed in. The\ndata is the serialized record in the case of a save.
  • \n
  • Registers success and failure handlers.
  • \n
\n", + "itemtype": "method", + "name": "ajax", + "access": "private", + "tagname": "", + "params": [ + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "type", + "description": "The request type GET, POST, PUT, DELETE etc.", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1082, + "itemtype": "method", + "name": "_ajaxRequest", + "access": "private", + "tagname": "", + "params": [ + { + "name": "options", + "description": "jQuery ajax options to be used for the ajax request", + "type": "Object" + } + ], + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1091, + "itemtype": "method", + "name": "ajaxOptions", + "access": "private", + "tagname": "", + "params": [ + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "type", + "description": "The request type GET, POST, PUT, DELETE etc.", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1137, + "itemtype": "method", + "name": "parseErrorResponse", + "access": "private", + "tagname": "", + "params": [ + { + "name": "responseText", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1155, + "itemtype": "method", + "name": "normalizeErrorResponse", + "access": "private", + "tagname": "", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "errors payload", + "type": "Array" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1177, + "description": "

Generates a detailed ("friendly") error message, with plenty\nof information for debugging (good luck!)

\n", + "itemtype": "method", + "name": "generatedDetailedMessage", + "access": "private", + "tagname": "", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "requestData", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "detailed error message", + "type": "String" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 87, + "description": "

The findRecord() method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to findRecord() being called, you\nshould query your persistence layer for a record with the given ID. The findRecord\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.

\n

Here is an example findRecord implementation:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findRecord(store, type, id, snapshot) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 123, + "description": "

The findAll() method is used to retrieve all records for a given type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findAll(store, type, sinceToken) {\n    let query = { since: sinceToken };\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "sinceToken", + "description": "", + "type": "String" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 157, + "description": "

This method is called when you call query on the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  query(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "recordArray", + "description": "", + "type": "DS.AdapterPopulatedRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 189, + "description": "

The queryRecord() method is invoked when the store is asked for a single\nrecord through a query object.

\n

In response to queryRecord() being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's push() method\nto push the record into the store.

\n

Here is an example queryRecord implementation:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend(DS.BuildURLMixin, {\n  queryRecord(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "subclass of DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 227, + "description": "

If the globally unique IDs for your records should be generated on the client,\nimplement the generateIdForRecord() method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's primaryKey.

\n

Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls didCreateRecord(). Only implement this method if\nyou intend to generate record IDs on the client-side.

\n

The generateIdForRecord() method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { v4 } from 'uuid';\n\nexport default DS.Adapter.extend({\n  generateIdForRecord(store, inputProperties) {\n    return v4();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "generateIdForRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "inputProperties", + "description": "a hash of properties to set on the\n newly created record.", + "type": "Object" + } + ], + "return": { + "description": "id", + "type": "(String|Number)" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 261, + "description": "

Proxies to the serializer's serialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let url = `/${type.modelName}`;\n\n    // ...\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "serialized snapshot", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 288, + "description": "

Implement this method in a subclass to handle the creation of\nnew records.

\n

Serializes the record and sends it to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'POST',\n        url: `/${type.modelName}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 331, + "description": "

Implement this method in a subclass to handle the updating of\na record.

\n

Serializes the record update and sends it to the server.

\n

The updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with undefined and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  updateRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'PUT',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "updateRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 383, + "description": "

Implement this method in a subclass to handle the deletion of\na record.

\n

Sends a delete request for the record to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  deleteRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'DELETE',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 438, + "description": "

The store will call findMany instead of multiple findRecord\nrequests to find multiple records at once if coalesceFindRequests\nis true.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n
import DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n  findMany(store, type, ids, snapshots) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'GET',\n        url: `/${type.modelName}/`,\n        dataType: 'json',\n        data: { filter: { id: ids.join(',') } }\n      }).then(function(data) {\n        run(null, resolve, data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        run(null, reject, jqXHR);\n      });\n    });\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "findMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the records", + "type": "DS.Model" + }, + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 477, + "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

For example, if your api has nested URLs that depend on the parent, you will\nwant to group records by their parent.

\n

The default implementation returns the records as a single group.

\n", + "itemtype": "method", + "name": "groupRecordsForFindMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", + "type": "Array" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 497, + "description": "

This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\nstore.findRecord.

\n

If this method returns true, the store will re-fetch a record from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached record.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
shouldReloadRecord(store, ticketSnapshot) {\n  let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n  let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n  if (timeDiff > 20) {\n    return true;\n  } else {\n    return false;\n  }\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findRecord('ticket',\nid) you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, findRecord will not\nresolve until you fetched the latest version.

\n

By default this hook returns false, as most UIs should not block user\ninteractions while waiting on data update.

\n

Note that, with default settings, shouldBackgroundReloadRecord will always\nre-fetch the records in the background even if shouldReloadRecord returns\nfalse. You can override shouldBackgroundReloadRecord if this does not\nsuit your use case.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldReloadRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 547, + "description": "

This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\nstore.findAll.

\n

If this method returns true, the store will re-fetch all records from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached records.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
shouldReloadAll(store, snapshotArray) {\n  let snapshots = snapshotArray.snapshots();\n\n  return snapshots.any((ticketSnapshot) => {\n    let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n    let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n    if (timeDiff > 20) {\n      return true;\n    } else {\n      return false;\n    }\n  });\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findAll('ticket') you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, findAll will not\nresolve until you fetched the latest versions.

\n

By default this methods returns true if the passed snapshotRecordArray\nis empty (meaning that there are no records locally available yet),\notherwise it returns false.

\n

Note that, with default settings, shouldBackgroundReloadAll will always\nre-fetch all the records in the background even if shouldReloadAll returns\nfalse. You can override shouldBackgroundReloadAll if this does not suit\nyour use case.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldReloadAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 602, + "description": "

This method is used by the store to determine if the store should\nreload a record after the store.findRecord method resolves a\ncached record.

\n

This method is only checked by the store when the store is\nreturning a cached record.

\n

If this method returns true the store will re-fetch a record from\nthe adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadRecord as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
shouldBackgroundReloadRecord(store, snapshot) {\n  let connection = window.navigator.connection;\n\n  if (connection === 'cellular' || connection === 'none') {\n    return false;\n  } else {\n    return true;\n  }\n}
\n
\n
\n \n

By default this hook returns true so the data for the record is updated\nin the background.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldBackgroundReloadRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 642, + "description": "

This method is used by the store to determine if the store should\nreload a record array after the store.findAll method resolves\nwith a cached record array.

\n

This method is only checked by the store when the store is\nreturning a cached record array.

\n

If this method returns true the store will re-fetch all records\nfrom the adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadAll as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
shouldBackgroundReloadAll(store, snapshotArray) {\n  let connection = window.navigator.connection;\n\n  if (connection === 'cellular' || connection === 'none') {\n    return false;\n  } else {\n    return true;\n  }\n}
\n
\n
\n \n

By default this method returns true, indicating that a background reload\nshould always be triggered.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldBackgroundReloadAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 34, + "description": "

Builds a URL for a given type and optional ID.

\n

By default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see pathForType.

\n

If an ID is specified, it adds the ID to the path generated\nfor the type, separated by a /.

\n

When called by RESTAdapter.findMany() the id and snapshot parameters\nwill be arrays of ids and snapshots.

\n", + "itemtype": "method", + "name": "buildURL", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "single id or array of ids or query", + "type": "(String|Array|Object)" + }, + { + "name": "snapshot", + "description": "single snapshot or array of snapshots", + "type": "(DS.Snapshot|Array)" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "object of query parameters to send for query requests.", + "type": "Object" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 82, + "itemtype": "method", + "name": "_buildURL", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 111, + "description": "

Builds a URL for a store.findRecord(type, id) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindRecord(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id, snapshot);\n    return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 138, + "description": "

Builds a URL for a store.findAll(type) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/comment.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindAll(modelName, snapshot) {\n    return 'data/comments.json';\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 162, + "description": "

Builds a URL for a store.query(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  host: 'https://api.github.com',\n  urlForQuery (query, modelName) {\n    switch(modelName) {\n      case 'repo':\n        return `https://api.github.com/orgs/${query.orgId}/repos`;\n      default:\n        return this._super(...arguments);\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForQuery", + "params": [ + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 192, + "description": "

Builds a URL for a store.queryRecord(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForQueryRecord({ slug }, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/${encodeURIComponent(slug)}`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForQueryRecord", + "params": [ + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 217, + "description": "

Builds a URL for coalesceing multiple store.findRecord(type, id)\nrecords into 1 request when the adapter's coalesceFindRequests\nproperty is true.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForFindMany(ids, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/coalesce`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindMany", + "params": [ + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 245, + "description": "

Builds a URL for fetching a async hasMany relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindHasMany(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(id, modelName);\n    return `${baseUrl}/relationships`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindHasMany", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 272, + "description": "

Builds a URL for fetching a async belongsTo relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n  urlForFindBelongsTo(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(id, modelName);\n    return `${baseUrl}/relationships`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForFindBelongsTo", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 299, + "description": "

Builds a URL for a record.save() call when the record was created\nlocally using store.createRecord().

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForCreateRecord(modelName, snapshot) {\n    return this._super(...arguments) + '/new';\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForCreateRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 324, + "description": "

Builds a URL for a record.save() call when the record has been update locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForUpdateRecord(id, modelName, snapshot) {\n    return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForUpdateRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 349, + "description": "

Builds a URL for a record.save() call when the record has been deleted locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  urlForDeleteRecord(id, modelName, snapshot) {\n    return this._super(...arguments) + '/destroy';\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "urlForDeleteRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 374, + "itemtype": "method", + "name": "urlPrefix", + "access": "private", + "tagname": "", + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "parentURL", + "description": "", + "type": "String" + } + ], + "return": { + "description": "urlPrefix", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 411, + "description": "

Determines the pathname for a given type.

\n

By default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').

\n

Pathname customization

\n

For example if you have an object LineItem with an\nendpoint of "/line_items/".

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\nimport { pluralize } from 'ember-inflector';\n\nexport default DS.RESTAdapter.extend({\n  pathForType: function(modelName) {\n    var decamelized = decamelize(modelName);\n    return pluralize(decamelized);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "pathForType", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "path", + "type": "String" + }, + "class": "DS.RESTAdapter", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.BuildURLMixin" + } + ], + "events": [], + "properties": [ + { + "file": "addon/adapters/rest.js", + "line": 351, + "description": "

By default the RESTAdapter will send each find request coming from a store.find\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.

\n

For example, if you have an initial payload of:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  post: {\n    id: 1,\n    comments: [1, 2]\n  }\n}
\n
\n
\n \n

By default calling post.get('comments') will trigger the following requests(assuming the\ncomments haven't been loaded before):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET /comments/1\nGET /comments/2
\n
\n
\n

If you set coalesceFindRequests to true it will instead trigger the following request:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET /comments?ids[]=1&ids[]=2
\n
\n
\n

Setting coalesceFindRequests to true also works for store.find requests and belongsTo\nrelationships accessed within the same runloop. If you set coalesceFindRequests: true

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('comment', 1);\nstore.findRecord('comment', 2);
\n
\n
\n \n

will also send a request to: GET /comments?ids[]=1&ids[]=2

\n

Note: Requests coalescing rely on URL building strategy. So if you override buildURL in your app\ngroupRecordsForFindMany more likely should be overridden as well in order for coalescing to work.

\n", + "itemtype": "property", + "name": "coalesceFindRequests", + "type": "{boolean}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 400, + "description": "

Endpoint paths can be prefixed with a namespace by setting the namespace\nproperty on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  namespace: 'api/1'\n});
\n
\n
\n \n

Requests for the Post model would now target /api/1/post/.

\n", + "itemtype": "property", + "name": "namespace", + "type": "{String}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 418, + "description": "

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  host: 'https://api.example.com'\n});
\n
\n
\n \n

Requests for the Post model would now target https://api.example.com/post/.

\n", + "itemtype": "property", + "name": "host", + "type": "{String}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 435, + "description": "

Some APIs require HTTP headers, e.g. to provide an API\nkey. Arbitrary headers can be set as key/value pairs on the\nRESTAdapter's headers object and Ember Data will send them\nalong with each ajax request. For dynamic headers see headers\ncustomization.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n  headers: {\n    'API_KEY': 'secret key',\n    'ANOTHER_HEADER': 'Some header value'\n  }\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "headers", + "type": "{Object}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 65, + "description": "

If you would like your adapter to use a custom serializer you can\nset the defaultSerializer property to be the name of the custom\nserializer.

\n

Note the defaultSerializer serializer has a lower priority than\na model specific serializer (i.e. PostSerializer) or the\napplication serializer.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/django.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  defaultSerializer: 'django'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "defaultSerializer", + "type": "{String}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + }, + { + "file": "addon/adapter.js", + "line": 427, + "description": "

By default the store will try to coalesce all fetchRecord calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.

\n", + "itemtype": "property", + "name": "coalesceFindRequests", + "type": "{boolean}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Adapter" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.Adapter", + "type": "class" + } + }, + "descendants": { + "data": [ + { + "type": "class", + "id": "ember-data-2.18.5-DS.JSONAPIAdapter" + } + ] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RESTSerializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RESTSerializer.json new file mode 100644 index 000000000..b4b03290e --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RESTSerializer.json @@ -0,0 +1,1987 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.RESTSerializer", + "type": "class", + "attributes": { + "name": "DS.RESTSerializer", + "shortname": "DS.RESTSerializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/rest.js", + "line": 21, + "description": "

Normally, applications will use the RESTSerializer by implementing\nthe normalize method.

\n

This allows you to do whatever kind of munging you need, and is\nespecially useful if your server is inconsistent and you need to\ndo munging differently for many different kinds of responses.

\n

See the normalize documentation for more information.

\n

Across the Board Normalization

\n

There are also a number of hooks that you might find useful to define\nacross-the-board rules for your payload. These rules will be useful\nif your server is consistent, or if you're building an adapter for\nan infrastructure service, like Firebase, and want to encode service\nconventions.

\n

For example, if all of your keys are underscored and all-caps, but\notherwise consistent with the names you use in your models, you\ncan implement across-the-board rules for how to convert an attribute\nname in your model to a key in your JSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n});
\n
\n
\n \n

You can also implement keyForRelationship, which takes the name\nof the relationship as the first parameter, the kind of\nrelationship (hasMany or belongsTo) as the second parameter, and\nthe method (serialize or deserialize) as the third parameter.

\n", + "extends": "DS.JSONSerializer", + "methods": [ + { + "file": "addon/serializers/rest.js", + "line": 66, + "description": "

keyForPolymorphicType can be used to define a custom key when\nserializing and deserializing a polymorphic type. By default, the\nreturned key is ${key}Type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
 import DS from 'ember-data';\n\n export default DS.RESTSerializer.extend({\n   keyForPolymorphicType(key, relationship) {\n     var relationshipKey = this.keyForRelationship(key);\n\n     return 'type-' + relationshipKey;\n   }\n });
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForPolymorphicType", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 97, + "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a DS.Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

For example, if you have a payload that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  "post": {\n    "id": 1,\n    "title": "Rails is omakase",\n    "comments": [ 1, 2 ]\n  },\n  "comments": [{\n    "id": 1,\n    "body": "FIRST"\n  }, {\n    "id": 2,\n    "body": "Rails is unagi"\n  }]\n}
\n
\n
\n \n

The normalize method will be called three times:

\n
    \n
  • With App.Post, "posts" and { id: 1, title: "Rails is omakase", ... }
  • \n
  • With App.Comment, "comments" and { id: 1, body: "FIRST" }
  • \n
  • With App.Comment, "comments" and { id: 2, body: "Rails is unagi" }
  • \n
\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations. You will only need to implement\nnormalize and manipulate the payload as desired.

\n

For example, if the IDs under "comments" are provided as _id instead of\nid, you can specify how to normalize just the comments:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n  normalize(model, hash, prop) {\n    if (prop === 'comments') {\n      hash.id = hash._id;\n      delete hash._id;\n    }\n\n    return this._super(...arguments);\n  }\n});
\n
\n
\n \n

On each call to the normalize method, the third parameter (prop) is always\none of the keys that were in the original payload or in the result of another\nnormalization as normalizeResponse.

\n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + }, + { + "name": "prop", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 174, + "description": "

Normalizes an array of resource payloads and returns a JSON-API Document\nwith primary data and, if any, included data as { data, included }.

\n", + "itemtype": "method", + "name": "_normalizeArray", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "arrayHash", + "description": "", + "type": "Object" + }, + { + "name": "prop", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 385, + "description": "

This method allows you to push a payload containing top-level\ncollections of records organized per type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
{\n  "posts": [{\n    "id": "1",\n    "title": "Rails is omakase",\n    "author", "1",\n    "comments": [ "1" ]\n  }],\n  "comments": [{\n    "id": "1",\n    "body": "FIRST"\n  }],\n  "users": [{\n    "id": "1",\n    "name": "@d2h"\n  }]\n}
\n
\n
\n \n

It will first normalize the payload, so you can use this to push\nin data streaming in from your server structured the same way\nthat fetches and saves are structured.

\n", + "itemtype": "method", + "name": "pushPayload", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 449, + "description": "

This method is used to convert each JSON root key in the payload\ninto a modelName that it can use to look up the appropriate model for\nthat part of the payload.

\n

For example, your server may send a model name that does not correspond with\nthe name of the model in your app. Let's take a look at an example model,\nand an example payload:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
  {\n    "blog/post": {\n      "id": "1\n    }\n  }
\n
\n
\n \n

Ember Data is going to normalize the payload's root key for the modelName. As a result,\nit will try to look up the "blog/post" model. Since we don't have a model called "blog/post"\n(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error\nbecause it cannot find the "blog/post" model.

\n

Since we want to remove this namespace, we can define a serializer for the application that will\nremove "blog/" from the payload key whenver it's encountered by Ember Data:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n  modelNameFromPayloadKey(payloadKey) {\n    if (payloadKey === 'blog/post') {\n      return this._super(payloadKey.replace('blog/', ''));\n    } else {\n     return this._super(payloadKey);\n    }\n  }\n});
\n
\n
\n \n

After refreshing, Ember Data will appropriately look up the "post" model.

\n

By default the modelName for a model is its\nname in dasherized form. This means that a payload key like "blogPost" would be\nnormalized to "blog-post" when Ember Data looks up the model. Usually, Ember Data\ncan use the correct inflection to do this for you. Most of the time, you won't\nneed to override modelNameFromPayloadKey for this purpose.

\n", + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 513, + "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  title: DS.attr(),\n  body: DS.attr(),\n\n  author: DS.belongsTo('user')\n});
\n
\n
\n \n

The default serialization would create a JSON object like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "title": "Rails is unagi",\n  "body": "Rails? Omakase? O_O",\n  "author": 12\n}
\n
\n
\n \n

By default, attributes are passed through as-is, unless\nyou specified an attribute type (DS.attr('date')). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.

\n

By default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.

\n

IDs

\n

serialize takes an options hash with a single option:\nincludeId. If this option is true, serialize will,\nby default include the ID in the JSON object it builds.

\n

The adapter passes in includeId: true when serializing\na record for createRecord, but not for updateRecord.

\n

Customization

\n

Your server may expect a different JSON format than the\nbuilt-in serialization format.

\n

In that case, you can implement serialize yourself and\nreturn a JSON hash of your choosing.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      POST_TTL: snapshot.attr('title'),\n      POST_BDY: snapshot.attr('body'),\n      POST_CMS: snapshot.hasMany('comments', { ids: true })\n    };\n\n    if (options.includeId) {\n      json.POST_ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});
\n
\n
\n \n

Customizing an App-Wide Serializer

\n

If you want to define a serializer for your entire\napplication, you'll probably want to use eachAttribute\nand eachRelationship on the record.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
import DS from 'ember-data';\nimport { pluralize } from 'ember-inflector';\n\nexport default DS.RESTSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {};\n\n    snapshot.eachAttribute(function(name) {\n      json[serverAttributeName(name)] = snapshot.attr(name);\n    });\n\n    snapshot.eachRelationship(function(name, relationship) {\n      if (relationship.kind === 'hasMany') {\n        json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n      }\n    });\n\n    if (options.includeId) {\n      json.ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});\n\nfunction serverAttributeName(attribute) {\n  return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n  return serverAttributeName(singularize(name)) + "_IDS";\n}
\n
\n
\n \n

This serializer will generate JSON that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "TITLE": "Rails is omakase",\n  "BODY": "Yep. Omakase.",\n  "COMMENT_IDS": [ 1, 2, 3 ]\n}
\n
\n
\n \n

Tweaking the Default JSON

\n

If you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n  serialize(snapshot, options) {\n    var json = this._super(snapshot, options);\n\n    json.subject = json.title;\n    delete json.title;\n\n    return json;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "json", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 669, + "description": "

You can use this method to customize the root keys serialized into the JSON.\nThe hash property should be modified by reference (possibly using something like _.extend)\nBy default the REST Serializer sends the modelName of a model, which is a camelized\nversion of the name.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  serializeIntoHash(data, type, record, options) {\n    var root = decamelize(type.modelName);\n    data[root] = this.serialize(record, options);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeIntoHash", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 700, + "description": "

You can use payloadKeyFromModelName to override the root key for an outgoing\nrequest. By default, the RESTSerializer returns a camelized version of the\nmodel's name.

\n

For a model called TacoParty, its modelName would be the string taco-party. The RESTSerializer\nwill send it to the server with tacoParty as the root key in the JSON payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  "tacoParty": {\n    "id": "1",\n    "location": "Matthew Beale's House"\n  }\n}
\n
\n
\n \n

For example, your server may expect dasherized root objects:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { dasherize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  payloadKeyFromModelName(modelName) {\n    return dasherize(modelName);\n  }\n});
\n
\n
\n \n

Given a TacoParty model, calling save on it would produce an outgoing\nrequest like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  "taco-party": {\n    "id": "1",\n    "location": "Matthew Beale's House"\n  }\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "payloadKeyFromModelName", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 750, + "description": "

You can use this method to customize how polymorphic objects are serialized.\nBy default the REST Serializer creates the key by appending Type to\nthe attribute and value from the model's camelcased model name.

\n", + "itemtype": "method", + "name": "serializePolymorphicType", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 794, + "description": "

You can use this method to customize how a polymorphic relationship should\nbe extracted.

\n", + "itemtype": "method", + "name": "extractPolymorphicRelationship", + "params": [ + { + "name": "relationshipType", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + }, + { + "name": "relationshipOptions", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 869, + "description": "

modelNameFromPayloadType can be used to change the mapping for a DS model\nname, taken from the value in the payload.

\n

Say your API namespaces the type of a model and returns the following\npayload for the post model, which has a polymorphic user relationship:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
// GET /api/posts/1\n{\n  "post": {\n    "id": 1,\n    "user": 1,\n    "userType: "api::v1::administrator"\n  }\n}
\n
\n
\n \n

By overwriting modelNameFromPayloadType you can specify that the\nadministrator model should be used:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n  modelNameFromPayloadType(payloadType) {\n    return payloadType.replace('api::v1::', '');\n  }\n});
\n
\n
\n \n

By default the modelName for a model is its name in dasherized form.\nUsually, Ember Data can use the correct inflection to do this for you. Most\nof the time, you won't need to override modelNameFromPayloadType for this\npurpose.

\n

Also take a look at\npayloadTypeFromModelName to customize\nhow the type of a record should be serialized.

\n", + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "payloadType", + "description": "type from payload", + "type": "String" + } + ], + "return": { + "description": "modelName", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 918, + "description": "

payloadTypeFromModelName can be used to change the mapping for the type in\nthe payload, taken from the model name.

\n

Say your API namespaces the type of a model and expects the following\npayload when you update the post model, which has a polymorphic user\nrelationship:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
// POST /api/posts/1\n{\n  "post": {\n    "id": 1,\n    "user": 1,\n    "userType": "api::v1::administrator"\n  }\n}
\n
\n
\n \n

By overwriting payloadTypeFromModelName you can specify that the\nnamespaces model name for the administrator should be used:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n  payloadTypeFromModelName(modelName) {\n    return 'api::v1::' + modelName;\n  }\n});
\n
\n
\n \n

By default the payload type is the camelized model name. Usually, Ember\nData can use the correct inflection to do this for you. Most of the time,\nyou won't need to override payloadTypeFromModelName for this purpose.

\n

Also take a look at\nmodelNameFromPayloadType to customize\nhow the model name from should be mapped from the payload.

\n", + "itemtype": "method", + "name": "payloadTypeFromModelName", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "modelName from the record", + "type": "String" + } + ], + "return": { + "description": "payloadType", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 173, + "description": "

Given a subclass of DS.Model and a JSON object this method will\niterate through each attribute of the DS.Model and invoke the\nDS.Transform#deserialize method on the matching property of the\nJSON object. This method is typically called after the\nserializer's normalize method.

\n", + "itemtype": "method", + "name": "applyTransforms", + "access": "private", + "tagname": "", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "data", + "description": "The data to transform", + "type": "Object" + } + ], + "return": { + "description": "data The transformed data object", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 200, + "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

This method delegates to a more specific normalize method based on\nthe requestType.

\n

To override this method with a custom one, make sure to call\nreturn this._super(store, primaryModelClass, payload, id, requestType) with your\npre-processed data.

\n

Here's an example of using normalizeResponse manually:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
socket.on('message', function(message) {\n  var data = message.data;\n  var modelClass = store.modelFor(data.modelName);\n  var serializer = store.serializerFor(data.modelName);\n  var normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n  store.push(normalized);\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 260, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 274, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 288, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindAllResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 302, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindBelongsToResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 316, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindHasManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 330, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 344, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 358, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeCreateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 372, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeDeleteRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 386, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeUpdateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 400, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSaveResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 414, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSingleResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 428, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeArrayResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 442, + "itemtype": "method", + "name": "_normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "isSingle", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 489, + "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a DS.Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\nimport { get } from '@ember/object';\n\nexport default DS.JSONSerializer.extend({\n  normalize(typeClass, hash) {\n    var fields = get(typeClass, 'fields');\n\n    fields.forEach(function(field) {\n      var payloadField = underscore(field);\n      if (field === payloadField) { return; }\n\n      hash[field] = hash[payloadField];\n      delete hash[payloadField];\n    });\n\n    return this._super.apply(this, arguments);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 552, + "description": "

Returns the resource's ID.

\n", + "itemtype": "method", + "name": "extractId", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 566, + "description": "

Returns the resource's attributes formatted as a JSON-API "attributes object".

\n

http://jsonapi.org/format/#document-resource-object-attributes

\n", + "itemtype": "method", + "name": "extractAttributes", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 590, + "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", + "itemtype": "method", + "name": "extractRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 639, + "description": "

Returns a polymorphic relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n

relationshipOptions is a hash which contains more information about the\npolymorphic relationship which should be extracted:

\n
    \n
  • resourceHash complete hash of the resource the relationship should be\nextracted from
  • \n
  • relationshipKey key under which the value for the relationship is\nextracted from the resourceHash
  • \n
  • relationshipMeta meta information about the relationship
  • \n
\n", + "itemtype": "method", + "name": "extractPolymorphicRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + }, + { + "name": "relationshipOptions", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 662, + "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", + "itemtype": "method", + "name": "extractRelationships", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 718, + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 728, + "itemtype": "method", + "name": "normalizeRelationships", + "access": "private", + "tagname": "", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 747, + "itemtype": "method", + "name": "normalizeUsingDeclaredMapping", + "access": "private", + "tagname": "", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 778, + "description": "

Looks up the property key that was set by the custom attr mapping\npassed to the serializer.

\n", + "itemtype": "method", + "name": "_getMappedKey", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "key", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 809, + "description": "

Check attrs.key.serialize property to inform if the key\ncan be serialized

\n", + "itemtype": "method", + "name": "_canSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key can be serialized", + "type": "Boolean" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 824, + "description": "

When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized

\n", + "itemtype": "method", + "name": "_mustSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key must be serialized", + "type": "Boolean" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 840, + "description": "

Check if the given hasMany relationship should be serialized

\n", + "itemtype": "method", + "name": "shouldSerializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 861, + "description": "

Check if the given hasMany relationship should be serialized

\n", + "itemtype": "method", + "name": "_shouldSerializeHasMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 881, + "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  title: DS.attr(),\n  body: DS.attr(),\n\n  author: DS.belongsTo('user')\n});
\n
\n
\n \n

The default serialization would create a JSON object like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "title": "Rails is unagi",\n  "body": "Rails? Omakase? O_O",\n  "author": 12\n}
\n
\n
\n \n

By default, attributes are passed through as-is, unless\nyou specified an attribute type (DS.attr('date')). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.

\n

By default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.

\n

IDs

\n

serialize takes an options hash with a single option:\nincludeId. If this option is true, serialize will,\nby default include the ID in the JSON object it builds.

\n

The adapter passes in includeId: true when serializing\na record for createRecord, but not for updateRecord.

\n

Customization

\n

Your server may expect a different JSON format than the\nbuilt-in serialization format.

\n

In that case, you can implement serialize yourself and\nreturn a JSON hash of your choosing.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      POST_TTL: snapshot.attr('title'),\n      POST_BDY: snapshot.attr('body'),\n      POST_CMS: snapshot.hasMany('comments', { ids: true })\n    };\n\n    if (options.includeId) {\n      json.POST_ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});
\n
\n
\n \n

Customizing an App-Wide Serializer

\n

If you want to define a serializer for your entire\napplication, you'll probably want to use eachAttribute\nand eachRelationship on the record.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
import DS from 'ember-data';\nimport { singularize } from 'ember-inflector';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = {};\n\n    snapshot.eachAttribute(function(name) {\n      json[serverAttributeName(name)] = snapshot.attr(name);\n    });\n\n    snapshot.eachRelationship(function(name, relationship) {\n      if (relationship.kind === 'hasMany') {\n        json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n      }\n    });\n\n    if (options.includeId) {\n      json.ID_ = snapshot.id;\n    }\n\n    return json;\n  }\n});\n\nfunction serverAttributeName(attribute) {\n  return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n  return serverAttributeName(singularize(name)) + "_IDS";\n}
\n
\n
\n \n

This serializer will generate JSON that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "TITLE": "Rails is omakase",\n  "BODY": "Yep. Omakase.",\n  "COMMENT_IDS": [ 1, 2, 3 ]\n}
\n
\n
\n \n

Tweaking the Default JSON

\n

If you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serialize(snapshot, options) {\n    var json = this._super(...arguments);\n\n    json.subject = json.title;\n    delete json.title;\n\n    return json;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "json", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1062, + "description": "

You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import DS from 'ember-data';\nimport { decamelize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  serializeIntoHash(data, type, snapshot, options) {\n    var root = decamelize(type.modelName);\n    data[root] = this.serialize(snapshot, options);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeIntoHash", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1094, + "description": "

serializeAttribute can be used to customize how DS.attr\nproperties are serialized

\n

For example if you wanted to ensure all your attributes were always\nserialized as properties on an attributes object you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serializeAttribute(snapshot, json, key, attributes) {\n    json.attributes = json.attributes || {};\n    this._super(snapshot, json.attributes, key, attributes);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeAttribute", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "attribute", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1141, + "description": "

serializeBelongsTo can be used to customize how DS.belongsTo\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n  serializeBelongsTo(snapshot, json, relationship) {\n    var key = relationship.key;\n    var belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;\n\n    json[key] = isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeBelongsTo", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1194, + "description": "

serializeHasMany can be used to customize how DS.hasMany\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  serializeHasMany(snapshot, json, relationship) {\n    var key = relationship.key;\n    if (key === 'comments') {\n      return;\n    } else {\n      this._super(...arguments);\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1243, + "description": "

You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n{ polymorphic: true } is pass as the second argument to the\nDS.belongsTo function.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n  serializePolymorphicType(snapshot, json, relationship) {\n    var key = relationship.key;\n    var belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n    if (isNone(belongsTo)) {\n      json[key + '_type'] = null;\n    } else {\n      json[key + '_type'] = belongsTo.modelName;\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializePolymorphicType", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1278, + "description": "

extractMeta is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the meta property of the payload object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  extractMeta(store, typeClass, payload) {\n    if (payload && payload.hasOwnProperty('_pagination')) {\n      let meta = payload._pagination;\n      delete payload._pagination;\n      return meta;\n    }\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "extractMeta", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1312, + "description": "

extractErrors is used to extract model errors when a call\nto DS.Model#save fails with an InvalidError. By default\nEmber Data expects error information to be located on the errors\nproperty of the payload object.

\n

This serializer expects this errors object to be an Array similar\nto the following, compliant with the JSON-API specification:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
{\n  "errors": [\n    {\n      "detail": "This username is already taken!",\n      "source": {\n        "pointer": "data/attributes/username"\n      }\n    }, {\n      "detail": "Doesn't look like a valid email.",\n      "source": {\n        "pointer": "data/attributes/email"\n      }\n    }\n  ]\n}
\n
\n
\n \n

The key detail provides a textual description of the problem.\nAlternatively, the key title can be used for the same purpose.

\n

The nested keys source.pointer detail which specific element\nof the request data was invalid.

\n

Note that JSON-API also allows for object-level errors to be placed\nin an object with pointer data, signifying that the problem\ncannot be traced to a specific attribute:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "errors": [\n    {\n      "detail": "Some generic non property error message",\n      "source": {\n        "pointer": "data"\n      }\n    }\n  ]\n}
\n
\n
\n \n

When turn into a DS.Errors object, you can read these errors\nthrough the property base:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each model.errors.base as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

Example of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  extractErrors(store, typeClass, payload, id) {\n    if (payload && typeof payload === 'object' && payload._problems) {\n      payload = payload._problems;\n      this.normalizeErrors(typeClass, payload);\n    }\n    return payload;\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "extractErrors", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "(String|Number)" + } + ], + "return": { + "description": "json The deserialized errors", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1423, + "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\nimport { underscore } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForAttribute", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1449, + "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties. By default\nJSONSerializer does not provide an implementation of this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
  import DS from 'ember-data';\n  import { underscore } from '@ember/string';\n\n  export default DS.JSONSerializer.extend({\n    keyForRelationship(key, relationship, method) {\n      return `rel_${underscore(key)}`;\n    }\n  });
\n
\n
\n \n", + "itemtype": "method", + "name": "keyForRelationship", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1477, + "description": "

keyForLink can be used to define a custom key when deserializing link\nproperties.

\n", + "itemtype": "method", + "name": "keyForLink", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "kind", + "description": "`belongsTo` or `hasMany`", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1492, + "itemtype": "method", + "name": "transformFor", + "access": "private", + "tagname": "", + "params": [ + { + "name": "attributeType", + "description": "", + "type": "String" + }, + { + "name": "skipAssertion", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "transform", + "type": "DS.Transform" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1512, + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "type", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 1534, + "description": "

serializeId can be used to customize how id is serialized\nFor example, your server may expect integer datatype of id

\n

By default the snapshot's id (String) is set on the json hash via json[primaryKey] = snapshot.id.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\nserializeId(snapshot, json, primaryKey) {\n    var id = snapshot.id;\n    json[primaryKey] = parseInt(id, 10);\n  }\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serializeId", + "access": "public", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "primaryKey", + "description": "", + "type": "String" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializer.js", + "line": 51, + "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + }, + { + "file": "addon/serializer.js", + "line": 87, + "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + }, + { + "file": "addon/serializer.js", + "line": 129, + "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    var data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + } + ], + "events": [], + "properties": [ + { + "file": "addon/serializers/json.js", + "line": 85, + "description": "

The primaryKey is used when serializing and deserializing\ndata. Ember Data always uses the id property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\nprimaryKey property to match the primaryKey of your external\nstore.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  primaryKey: '_id'\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "primaryKey", + "type": "{String}", + "default": "'id'", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializers/json.js", + "line": 109, + "description": "

The attrs object can be used to declare a simple mapping between\nproperty names on DS.Model records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty key can also be used to designate the attribute's key on\nthe response payload.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  firstName: DS.attr('string'),\n  lastName: DS.attr('string'),\n  occupation: DS.attr('string'),\n  admin: DS.attr('boolean')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  attrs: {\n    admin: 'is_admin',\n    occupation: { key: 'career' }\n  }\n});
\n
\n
\n \n

You can also remove attributes by setting the serialize key to\nfalse in your mapping object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n  attrs: {\n    admin: { serialize: false },\n    occupation: { key: 'career' }\n  }\n});
\n
\n
\n \n

When serialized:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "firstName": "Harry",\n  "lastName": "Houdini",\n  "career": "magician"\n}
\n
\n
\n \n

Note that the admin is now not included in the payload.

\n", + "itemtype": "property", + "name": "attrs", + "type": "{Object}", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.JSONSerializer" + }, + { + "file": "addon/serializer.js", + "line": 29, + "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    var modelClass = this.store.modelFor(relationshipModelName);\n    var relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "store", + "type": "{DS.Store}", + "access": "public", + "tagname": "", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Serializer" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.JSONSerializer", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordArray.json new file mode 100644 index 000000000..61111d508 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordArray.json @@ -0,0 +1,216 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.RecordArray", + "type": "class", + "attributes": { + "name": "DS.RecordArray", + "shortname": "DS.RecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 13, + "description": "

A record array is an array that contains records of a certain modelName. The record\narray materializes records as needed when they are retrieved for the first\ntime. You should not create record arrays yourself. Instead, an instance of\nDS.RecordArray or its subclasses will be returned by your application's store\nin response to queries.

\n", + "extends": "Ember.ArrayProxy", + "uses": [ + "Ember.Evented" + ], + "methods": [ + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 101, + "description": "

Retrieves an object from the content by index.

\n", + "itemtype": "method", + "name": "objectAtContent", + "access": "private", + "tagname": "", + "params": [ + { + "name": "index", + "description": "", + "type": "Number" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 114, + "description": "

Used to get the latest version of all of the records in this array\nfrom the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
var people = store.peekAll('person');\npeople.get('isUpdating'); // false\n\npeople.update().then(function() {\n  people.get('isUpdating'); // false\n});\n\npeople.get('isUpdating'); // true
\n
\n
\n \n", + "itemtype": "method", + "name": "update", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 157, + "description": "

Adds an internal model to the RecordArray without duplicates

\n", + "itemtype": "method", + "name": "_pushInternalModels", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 171, + "description": "

Removes an internalModel to the RecordArray.

\n", + "itemtype": "method", + "name": "removeInternalModel", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 182, + "description": "

Saves all of the records in the RecordArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
var messages = store.peekAll('message');\nmessages.forEach(function(message) {\n  message.set('hasBeenSeen', true);\n});\nmessages.save();
\n
\n
\n \n", + "itemtype": "method", + "name": "save", + "return": { + "description": "promise", + "type": "DS.PromiseArray" + }, + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 216, + "itemtype": "method", + "name": "_unregisterFromManager", + "access": "private", + "tagname": "", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 30, + "description": "

The array of client ids backing the record array. When a\nrecord is requested from the record array, the record\nfor the client id at the same index is materialized, if\nnecessary, by the store.

\n", + "itemtype": "property", + "name": "content", + "access": "private", + "tagname": "", + "type": "Ember.Array", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 42, + "description": "

The flag to signal a RecordArray is finished loading data.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
var people = store.peekAll('person');\npeople.get('isLoaded'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isLoaded", + "type": "Boolean", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 56, + "description": "

The flag to signal a RecordArray is currently loading data.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
var people = store.peekAll('person');\npeople.get('isUpdating'); // false\npeople.update();\npeople.get('isUpdating'); // true
\n
\n
\n \n", + "itemtype": "property", + "name": "isUpdating", + "type": "Boolean", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 73, + "description": "

The store that created this record array.

\n", + "itemtype": "property", + "name": "store", + "access": "private", + "tagname": "", + "type": "DS.Store", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 88, + "description": "

The modelClass represented by this record array.

\n", + "itemtype": "property", + "name": "type", + "type": "DS.Model", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.ArrayProxy", + "type": "missing" + } + }, + "descendants": { + "data": [ + { + "type": "class", + "id": "ember-data-2.18.5-DS.AdapterPopulatedRecordArray" + }, + { + "type": "class", + "id": "ember-data-2.18.5-DS.FilteredRecordArray" + } + ] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordArrayManager.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordArrayManager.json new file mode 100644 index 000000000..22c67fa36 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordArrayManager.json @@ -0,0 +1,270 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.RecordArrayManager", + "type": "class", + "attributes": { + "name": "DS.RecordArrayManager", + "shortname": "DS.RecordArrayManager", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-array-manager.js", + "line": 50, + "access": "private", + "tagname": "", + "methods": [ + { + "file": "addon/-private/system/record-array-manager.js", + "line": 145, + "description": "

Update an individual filter.

\n", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "updateFilterRecordArray", + "params": [ + { + "name": "array", + "description": "", + "type": "DS.FilteredRecordArray" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "internalModels", + "description": "", + "type": "Array" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 211, + "description": "

This method is invoked if the filterFunction property is\nchanged on a DS.FilteredRecordArray.

\n

It essentially re-runs the filter from scratch. This same\nmethod is invoked when the filter is created in th first place.

\n", + "itemtype": "method", + "name": "updateFilter", + "params": [ + { + "name": "array", + "description": "", + "type": "Array" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "filter", + "description": "", + "type": "Function" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 239, + "description": "

Get the DS.RecordArray for a modelName, which contains all loaded records of\ngiven modelName.

\n", + "itemtype": "method", + "name": "liveRecordArrayFor", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 279, + "description": "

Get the DS.RecordArray for a modelName, which contains all loaded records of\ngiven modelName.

\n", + "itemtype": "method", + "name": "filteredRecordArraysFor", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 294, + "description": "

Create a DS.RecordArray for a modelName.

\n", + "itemtype": "method", + "name": "createRecordArray", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "_content", + "description": "(optional|private)", + "type": "Array" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 321, + "description": "

Create a DS.FilteredRecordArray for a modelName and register it for updates.

\n", + "itemtype": "method", + "name": "createFilteredRecordArray", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "filter", + "description": "", + "type": "Function" + }, + { + "name": "query", + "description": "(optional", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "DS.FilteredRecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 348, + "description": "

Create a DS.AdapterPopulatedRecordArray for a modelName with given query.

\n", + "itemtype": "method", + "name": "createAdapterPopulatedRecordArray", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "DS.AdapterPopulatedRecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 390, + "description": "

Register a RecordArray for a given modelName to be backed by\na filter function. This will cause the array to update\nautomatically when records of that modelName change attribute\nvalues or states.

\n", + "itemtype": "method", + "name": "registerFilteredRecordArray", + "params": [ + { + "name": "array", + "description": "", + "type": "DS.RecordArray" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "filter", + "description": "", + "type": "Function" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 409, + "description": "

Unregister a RecordArray.\nSo manager will not update this array.

\n", + "itemtype": "method", + "name": "unregisterRecordArray", + "params": [ + { + "name": "array", + "description": "", + "type": "DS.RecordArray" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RecordReference.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordReference.json similarity index 55% rename from json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RecordReference.json rename to json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordReference.json index 8b65f79d9..3a9f93058 100644 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RecordReference.json +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RecordReference.json @@ -1,133 +1,110 @@ { "data": { - "id": "ember-data-2.18.5-RecordReference", + "id": "ember-data-2.18.5-DS.RecordReference", "type": "class", "attributes": { - "name": "RecordReference", - "shortname": "RecordReference", + "name": "DS.RecordReference", + "shortname": "DS.RecordReference", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/legacy-model-support/record-reference.ts", - "line": 18, - "description": "

A RecordReference is a low-level API that allows users and\naddon authors to perform meta-operations on a record.

\n", - "access": "public", - "tagname": "", - "extends": "Reference", + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/references/record.js", + "line": 4, + "description": "

An RecordReference is a low level API that allows users and\naddon author to perform meta-operations on a record.

\n", "methods": [ { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 55, + "file": "addon/-private/system/references/record.js", + "line": 21, "description": "

The id of the record that this reference refers to.

\n

Together, the type and id properties form a composite key for\nthe identity map.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
let userRef = store.getReference('user', 1);\n\nuserRef.id(); // '1'
\n
\n
\n \n", "itemtype": "method", "name": "id", - "access": "public", - "tagname": "", "return": { "description": "The id of the record.", "type": "String" }, - "class": "RecordReference", - "module": "@ember-data/store" + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 78, - "description": "

The identifier of the record that this reference refers to.

\n

Together, the type and id properties form a composite key for\nthe identity map.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
let userRef = store.getReference('user', 1);\n\nuserRef.identifier(); // '1'
\n
\n
\n \n", - "itemtype": "method", - "name": "identifier", - "access": "public", - "tagname": "", - "return": { - "description": "The identifier of the record.", - "type": "String" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 100, - "description": "

How the reference will be looked up when it is loaded. Currently\nthis always returns identity to signify that a record will be\nloaded by its type and id.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
const userRef = store.getReference('user', 1);\n\nuserRef.remoteType(); // 'identity'
\n
\n
\n \n", + "file": "addon/-private/system/references/record.js", + "line": 42, + "description": "

How the reference will be looked up when it is loaded: Currently\nthis always return identity to signifying that a record will be\nloaded by the type and id.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
const userRef = store.getReference('user', 1);\n\nuserRef.remoteType(); // 'identity'
\n
\n
\n \n", "itemtype": "method", "name": "remoteType", - "access": "public", - "tagname": "", "return": { "description": "'identity'", "type": "String" }, - "class": "RecordReference", - "module": "@ember-data/store" + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 121, - "description": "

This API allows you to provide a reference with new data. The\nsimplest usage of this API is similar to store.push: you provide a\nnormalized hash of data and the object represented by the reference\nwill update.

\n

If you pass a promise to push, Ember Data will not ask the adapter\nfor the data if another attempt to fetch it is made in the\ninterim. When the promise resolves, the underlying object is updated\nwith the new data, and the promise returned by this function is resolved\nwith that object.

\n

For example, recordReference.push(promise) will be resolved with a\nrecord.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
 let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n   data: {\n     id: "1",\n     type: "user",\n     attributes: {\n       username: "@user"\n     }\n   }\n }).then(function(user) {\n   userRef.value() === user;\n });
\n
\n
\n \n", + "file": "addon/-private/system/references/record.js", + "line": 62, + "description": "

This API allows you to provide a reference with new data. The\nsimplest usage of this API is similar to store.push: you provide a\nnormalized hash of data and the object represented by the reference\nwill update.

\n

If you pass a promise to push, Ember Data will not ask the adapter\nfor the data if another attempt to fetch it is made in the\ninterim. When the promise resolves, the underlying object is updated\nwith the new data, and the promise returned by this function is resolved\nwith that object.

\n

For example, recordReference.push(promise) will be resolved with a\nrecord.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
 let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({ data: { id: 1, username: "@user" }}).then(function(user) {\n   userRef.value() === user;\n });
\n
\n
\n \n", "itemtype": "method", "name": "push", - "access": "public", - "tagname": "", "params": [ { - "name": "objectOrPromise", - "description": "a JSON:API ResourceDocument or a promise resolving to one" + "name": "UNKNOWN", + "description": "", + "type": "Promise|Object" } ], "return": { - "description": "a promise for the value (record or relationship)" + "description": "Promise a promise for the value (record or relationship)" }, - "class": "RecordReference", - "module": "@ember-data/store" + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 167, + "file": "addon/-private/system/references/record.js", + "line": 98, "description": "

If the entity referred to by the reference is already loaded, it is\npresent as reference.value. Otherwise the value returned by this function\nis null.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
 let userRef = store.getReference('user', 1);\n\n userRef.value(); // user
\n
\n
\n \n", "itemtype": "method", "name": "value", - "access": "public", - "tagname": "", "return": { "description": "the record for this RecordReference", - "type": "Model" + "type": "DS.Model" }, - "class": "RecordReference", - "module": "@ember-data/store" + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 188, + "file": "addon/-private/system/references/record.js", + "line": 121, "description": "

Triggers a fetch for the backing entity based on its remoteType\n(see remoteType definitions per reference type).

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
let userRef = store.getReference('user', 1);\n\n// load user (via store.find)\nuserRef.load().then(...)
\n
\n
\n \n", "itemtype": "method", "name": "load", - "access": "public", - "tagname": "", "return": { "description": "the record for this RecordReference", "type": "Promise" }, - "class": "RecordReference", - "module": "@ember-data/store" + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 213, + "file": "addon/-private/system/references/record.js", + "line": 141, "description": "

Reloads the record if it is already loaded. If the record is not\nloaded it will load the record via store.findRecord

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
let userRef = store.getReference('user', 1);\n\n// or trigger a reload\nuserRef.reload().then(...)
\n
\n
\n \n", "itemtype": "method", "name": "reload", - "access": "public", - "tagname": "", "return": { "description": "the record for this RecordReference", "type": "Promise" }, - "class": "RecordReference", - "module": "@ember-data/store" + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" } ], "events": [], @@ -135,17 +112,14 @@ }, "relationships": { "parent-class": { - "data": { - "id": "Reference", - "type": "missing" - } + "data": null }, "descendants": { "data": [] }, "module": { "data": { - "id": "ember-data-2.18.5-@ember-data/store", + "id": "ember-data-2.18.5-ember-data", "type": "module" } }, diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RootState.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RootState.json new file mode 100644 index 000000000..f0028ed80 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.RootState.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.RootState", + "type": "class", + "attributes": { + "name": "DS.RootState", + "shortname": "DS.RootState", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/model/states.js", + "line": 10, + "description": "

State

\n

Each record has a currentState property that explicitly tracks what\nstate a record is in at any given time. For instance, if a record is\nnewly created and has not yet been sent to the adapter to be saved,\nit would be in the root.loaded.created.uncommitted state. If a\nrecord has had local modifications made to it that are in the\nprocess of being saved, the record would be in the\nroot.loaded.updated.inFlight state. (This state paths will be\nexplained in more detail below.)

\n

Events are sent by the record or its store to the record's\ncurrentState property. How the state reacts to these events is\ndependent on which state it is in. In some states, certain events\nwill be invalid and will cause an exception to be raised.

\n

States are hierarchical and every state is a substate of the\nRootState. For example, a record can be in the\nroot.deleted.uncommitted state, then transition into the\nroot.deleted.inFlight state. If a child state does not implement\nan event handler, the state manager will attempt to invoke the event\non all parent states until the root state is reached. The state\nhierarchy of a record is described in terms of a path string. You\ncan determine a record's current state by getting the state's\nstateName property:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
record.get('currentState.stateName');\n//=> "root.created.uncommitted"
\n
\n
\n \n

The hierarchy of valid states that ship with ember data looks like\nthis:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
* root\n  * deleted\n    * saved\n    * uncommitted\n    * inFlight\n  * empty\n  * loaded\n    * created\n      * uncommitted\n      * inFlight\n    * saved\n    * updated\n      * uncommitted\n      * inFlight\n  * loading
\n
\n
\n \n

The DS.Model states are themselves stateless. What that means is\nthat, the hierarchical states that each of those points to is a\nshared data structure. For performance reasons, instead of each\nrecord getting its own copy of the hierarchy of states, each record\npoints to this global, immutable shared instance. How does a state\nknow which record it should be acting on? We pass the record\ninstance into the state's event handlers as the first argument.

\n

The record passed as the first parameter is where you should stash\nstate about the record if needed; you should never store data on the state\nobject itself.

\n

Events and Flags

\n

A state may implement zero or more events and flags.

\n

Events

\n

Events are named functions that are invoked when sent to a record. The\nrecord will first look for a method with the given name on the\ncurrent state. If no method is found, it will search the current\nstate's parent, and then its grandparent, and so on until reaching\nthe top of the hierarchy. If the root is reached without an event\nhandler being found, an exception will be raised. This can be very\nhelpful when debugging new features.

\n

Here's an example implementation of a state with a myEvent event handler:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
aState: DS.State.create({\n  myEvent: function(manager, param) {\n    console.log("Received myEvent with", param);\n  }\n})
\n
\n
\n \n

To trigger this event:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
record.send('myEvent', 'foo');\n//=> "Received myEvent with foo"
\n
\n
\n \n

Note that an optional parameter can be sent to a record's send() method,\nwhich will be passed as the second parameter to the event handler.

\n

Events should transition to a different state if appropriate. This can be\ndone by calling the record's transitionTo() method with a path to the\ndesired state. The state manager will attempt to resolve the state path\nrelative to the current state. If no state is found at that path, it will\nattempt to resolve it relative to the current state's parent, and then its\nparent, and so on until the root is reached. For example, imagine a hierarchy\nlike this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
* created\n  * uncommitted <-- currentState\n  * inFlight\n* updated\n  * inFlight
\n
\n
\n

If we are currently in the uncommitted state, calling\ntransitionTo('inFlight') would transition to the created.inFlight state,\nwhile calling transitionTo('updated.inFlight') would transition to\nthe updated.inFlight state.

\n

Remember that only events should ever cause a state transition. You should\nnever call transitionTo() from outside a state's event handler. If you are\ntempted to do so, create a new event and send that to the state manager.

\n

Flags

\n

Flags are Boolean values that can be used to introspect a record's current\nstate in a more user-friendly way than examining its state path. For example,\ninstead of doing this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
var statePath = record.get('stateManager.currentPath');\nif (statePath === 'created.inFlight') {\n  doSomething();\n}
\n
\n
\n \n

You can say:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
if (record.get('isNew') && record.get('isSaving')) {\n  doSomething();\n}
\n
\n
\n \n

If your state does not set a value for a given flag, the value will\nbe inherited from its parent (or the first place in the state hierarchy\nwhere it is defined).

\n

The current set of flags are defined below. If you want to add a new flag,\nin addition to the area below, you will also need to declare it in the\nDS.Model class.

\n\n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Serializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Serializer.json similarity index 56% rename from json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Serializer.json rename to json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Serializer.json index a9ba2f205..1505a131b 100644 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Serializer.json +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Serializer.json @@ -1,43 +1,39 @@ { "data": { - "id": "ember-data-2.18.5-Serializer", + "id": "ember-data-2.18.5-DS.Serializer", "type": "class", "attributes": { - "name": "Serializer", - "shortname": "Serializer", + "name": "DS.Serializer", + "shortname": "DS.Serializer", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/index.ts", - "line": 115, - "description": "
\n

⚠️ CAUTION you likely want the docs for Serializer\nas extending this abstract class is unnecessary.

\n
\n

Serializer is an abstract base class that you may override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:

\n
    \n
  • normalizeResponse()
  • \n
  • serialize()
  • \n
\n

And you can optionally override the following methods:

\n
    \n
  • normalize()
  • \n
\n

For an example implementation, see\nJSONSerializer, the included JSON serializer.

\n", - "access": "public", - "tagname": "", - "extends": "Ember.EmberObject", + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializer.js", + "line": 7, + "description": "

DS.Serializer is an abstract base class that you should override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:

\n
    \n
  • normalizeResponse()
  • \n
  • serialize()
  • \n
\n

And you can optionally override the following methods:

\n
    \n
  • normalize()
  • \n
\n

For an example implementation, see\nDS.JSONSerializer, the included JSON serializer.

\n", + "extends": "Ember.Object", "methods": [ { - "file": "../packages/serializer/src/index.ts", - "line": 162, + "file": "addon/serializer.js", + "line": 51, "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", "since": "1.13.0", "itemtype": "method", "name": "normalizeResponse", - "access": "public", - "tagname": "", "params": [ { "name": "store", "description": "", - "type": "Store" + "type": "DS.Store" }, { "name": "primaryModelClass", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "payload", @@ -59,22 +55,21 @@ "description": "JSON-API Document", "type": "Object" }, - "class": "Serializer", - "module": "@ember-data/serializer" + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/serializer/src/index.ts", - "line": 198, - "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    let json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", + "file": "addon/serializer.js", + "line": 87, + "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    var json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", "itemtype": "method", "name": "serialize", - "access": "public", - "tagname": "", "params": [ { "name": "snapshot", "description": "", - "type": "Snapshot" + "type": "DS.Snapshot" }, { "name": "options", @@ -87,22 +82,21 @@ "description": "", "type": "Object" }, - "class": "Serializer", - "module": "@ember-data/serializer" + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/serializer/src/index.ts", - "line": 240, - "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    let data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", + "file": "addon/serializer.js", + "line": 129, + "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    var data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", "itemtype": "method", "name": "normalize", - "access": "public", - "tagname": "", "params": [ { "name": "typeClass", "description": "", - "type": "Model" + "type": "DS.Model" }, { "name": "hash", @@ -114,30 +108,32 @@ "description": "", "type": "Object" }, - "class": "Serializer", - "module": "@ember-data/serializer" + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" } ], "events": [], "properties": [ { - "file": "../packages/serializer/src/index.ts", - "line": 140, - "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    let modelClass = this.store.modelFor(relationshipModelName);\n    let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", + "file": "addon/serializer.js", + "line": 29, + "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    var modelClass = this.store.modelFor(relationshipModelName);\n    var relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", "itemtype": "property", "name": "store", - "type": "{Store}", + "type": "{DS.Store}", "access": "public", "tagname": "", - "class": "Serializer", - "module": "@ember-data/serializer" + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" } ] }, "relationships": { "parent-class": { "data": { - "id": "Ember.EmberObject", + "id": "Ember.Object", "type": "missing" } }, @@ -145,13 +141,13 @@ "data": [ { "type": "class", - "id": "ember-data-2.18.5-JSONSerializer" + "id": "ember-data-2.18.5-DS.JSONSerializer" } ] }, "module": { "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", + "id": "ember-data-2.18.5-ember-data", "type": "module" } }, diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ServerError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ServerError.json new file mode 100644 index 000000000..9f55bd947 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.ServerError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.ServerError", + "type": "class", + "attributes": { + "name": "DS.ServerError", + "shortname": "DS.ServerError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 315, + "description": "

A DS.ServerError equates to a HTTP 500 Internal Server Error response\nstatus. It is used by the adapter to indicate that a request has failed\nbecause of an error in the external API.

\n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Snapshot.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Snapshot.json similarity index 63% rename from json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Snapshot.json rename to json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Snapshot.json index 7b3339a01..5db5bd22d 100644 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Snapshot.json +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Snapshot.json @@ -1,51 +1,33 @@ { "data": { - "id": "ember-data-2.18.5-Snapshot", + "id": "ember-data-2.18.5-DS.Snapshot", "type": "class", "attributes": { - "name": "Snapshot", - "shortname": "Snapshot", + "name": "DS.Snapshot", + "shortname": "DS.Snapshot", "classitems": [], "plugins": [], "extensions": [], "plugin_for": [], "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 21, - "description": "

Snapshot is not directly instantiable.\nInstances are provided to a consuming application's\nadapters and serializers for certain requests.

\n

Snapshots are only available when using @ember-data/legacy-compat\nfor legacy compatibility with adapters and serializers.

\n", - "access": "public", + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/snapshot.js", + "line": 9, + "access": "private", "tagname": "", - "methods": [ + "is_constructor": 1, + "params": [ { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 47, - "itemtype": "method", - "name": "constructor", - "is_constructor": 1, - "access": "private", - "tagname": "", - "params": [ - { - "name": "options", - "description": "" - }, - { - "name": "identifier", - "description": "" - }, - { - "name": "_store", - "description": "" - } - ], - "class": "Snapshot", - "module": "@ember-data/store" - }, + "name": "internalModel", + "description": "The model to create a snapshot from", + "type": "DS.Model" + } + ], + "methods": [ { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 174, + "file": "addon/-private/system/snapshot.js", + "line": 90, "description": "

Returns the value of an attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.attr('author'); // => 'Tomster'\npostSnapshot.attr('title'); // => 'Ember.js rocks'
\n
\n
\n \n

Note: Values are loaded eagerly and cached when the snapshot is created.

\n", "itemtype": "method", "name": "attr", @@ -60,14 +42,13 @@ "description": "The attribute value or undefined", "type": "Object" }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 199, + "file": "addon/-private/system/snapshot.js", + "line": 114, "description": "

Returns all attributes and their corresponding values.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
\n
\n
\n \n", "itemtype": "method", "name": "attributes", @@ -75,14 +56,13 @@ "description": "All attributes of the current snapshot", "type": "Object" }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 217, + "file": "addon/-private/system/snapshot.js", + "line": 131, "description": "

Returns all changed attributes and their old and new values.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostModel.set('title', 'Ember.js rocks!');\npostSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }
\n
\n
\n \n", "itemtype": "method", "name": "changedAttributes", @@ -90,15 +70,14 @@ "description": "All changed attributes of the current snapshot", "type": "Object" }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 248, - "description": "

Returns the current value of a belongsTo relationship.

\n

belongsTo takes an optional hash of options as a second parameter,\ncurrently supported options are:

\n
    \n
  • id: set to true if you only want the ID of the related record to be\nreturned.
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
// store.push('post', { id: 1, title: 'Hello World' });\n// store.createRecord('comment', { body: 'Lorem ipsum', post: post });\ncommentSnapshot.belongsTo('post'); // => Snapshot\ncommentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n// store.push('comment', { id: 1, body: 'Lorem ipsum' });\ncommentSnapshot.belongsTo('post'); // => undefined
\n
\n
\n \n

Calling belongsTo will return a new Snapshot as long as there's any known\ndata for the relationship available, such as an ID. If the relationship is\nknown but unset, belongsTo will return null. If the contents of the\nrelationship is unknown belongsTo will return undefined.

\n

Note: Relationships are loaded lazily and cached upon first access.

\n", + "file": "addon/-private/system/snapshot.js", + "line": 157, + "description": "

Returns the current value of a belongsTo relationship.

\n

belongsTo takes an optional hash of options as a second parameter,\ncurrently supported options are:

\n
    \n
  • id: set to true if you only want the ID of the related record to be\nreturned.
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
// store.push('post', { id: 1, title: 'Hello World' });\n// store.createRecord('comment', { body: 'Lorem ipsum', post: post });\ncommentSnapshot.belongsTo('post'); // => DS.Snapshot\ncommentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n// store.push('comment', { id: 1, body: 'Lorem ipsum' });\ncommentSnapshot.belongsTo('post'); // => undefined
\n
\n
\n \n

Calling belongsTo will return a new Snapshot as long as there's any known\ndata for the relationship available, such as an ID. If the relationship is\nknown but unset, belongsTo will return null. If the contents of the\nrelationship is unknown belongsTo will return undefined.

\n

Note: Relationships are loaded lazily and cached upon first access.

\n", "itemtype": "method", "name": "belongsTo", "params": [ @@ -114,19 +93,18 @@ "optional": true } ], - "access": "public", - "tagname": "", "return": { "description": "A snapshot or ID of a known\nrelationship or null if the relationship is known but unset. undefined\nwill be returned if the contents of the relationship is unknown.", - "type": "(Snapshot|String|null|undefined)" + "type": "(DS.Snapshot|String|null|undefined)" }, - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 359, - "description": "

Returns the current value of a hasMany relationship.

\n

hasMany takes an optional hash of options as a second parameter,\ncurrently supported options are:

\n
    \n
  • ids: set to true if you only want the IDs of the related records to be\nreturned.
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\npostSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\npostSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n// store.push('post', { id: 1, title: 'Hello World' });\npostSnapshot.hasMany('comments'); // => undefined
\n
\n
\n \n

Note: Relationships are loaded lazily and cached upon first access.

\n", + "file": "addon/-private/system/snapshot.js", + "line": 234, + "description": "

Returns the current value of a hasMany relationship.

\n

hasMany takes an optional hash of options as a second parameter,\ncurrently supported options are:

\n
    \n
  • ids: set to true if you only want the IDs of the related records to be\nreturned.
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\npostSnapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]\npostSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n// store.push('post', { id: 1, title: 'Hello World' });\npostSnapshot.hasMany('comments'); // => undefined
\n
\n
\n \n

Note: Relationships are loaded lazily and cached upon first access.

\n", "itemtype": "method", "name": "hasMany", "params": [ @@ -142,18 +120,17 @@ "optional": true } ], - "access": "public", - "tagname": "", "return": { "description": "An array of snapshots or IDs of a known\nrelationship or an empty array if the relationship is known but unset.\nundefined will be returned if the contents of the relationship is unknown.", "type": "(Array|undefined)" }, - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 466, + "file": "addon/-private/system/snapshot.js", + "line": 306, "description": "

Iterates through all the attributes of the model, calling the passed\nfunction on each attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
snapshot.eachAttribute(function(name, meta) {\n  // ...\n});
\n
\n
\n \n", "itemtype": "method", "name": "eachAttribute", @@ -170,14 +147,13 @@ "optional": true } ], - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 490, + "file": "addon/-private/system/snapshot.js", + "line": 326, "description": "

Iterates through all the relationships of the model, calling the passed\nfunction on each relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
snapshot.eachRelationship(function(name, relationship) {\n  // ...\n});
\n
\n
\n \n", "itemtype": "method", "name": "eachRelationship", @@ -194,15 +170,14 @@ "optional": true } ], - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 514, - "description": "

Serializes the snapshot using the serializer for the model.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import Adapter from '@ember-data/adapter';\n\nexport 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 \n", + "file": "addon/-private/system/snapshot.js", + "line": 346, + "description": "

Serializes the snapshot using the serializer for the model.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  createRecord(store, type, snapshot) {\n    var data = snapshot.serialize({ includeId: true });\n    var url = `/${type.modelName}`;\n\n    return fetch(url, {\n      method: 'POST',\n      body: data,\n    }).then((response) => response.json())\n  }\n});
\n
\n
\n \n", "itemtype": "method", "name": "serialize", "params": [ @@ -216,85 +191,67 @@ "description": "an object whose values are primitive JSON values only", "type": "Object" }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" } ], "events": [], "properties": [ { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 67, - "description": "

The unique RecordIdentifier associated with this Snapshot.

\n", + "file": "addon/-private/system/snapshot.js", + "line": 27, + "description": "

The underlying record for this snapshot. Can be used to access methods and\nproperties defined on the record.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
let json = snapshot.record.toJSON();
\n
\n
\n \n", "itemtype": "property", - "name": "identifier", - "access": "public", - "tagname": "", - "type": "{StableRecordIdentifier}", - "class": "Snapshot", - "module": "@ember-data/store" + "name": "record", + "type": "{DS.Model}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 87, + "file": "addon/-private/system/snapshot.js", + "line": 43, "description": "

The id of the snapshot's underlying record

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.id; // => '1'
\n
\n
\n \n", "itemtype": "property", "name": "id", "type": "{String}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 103, + "file": "addon/-private/system/snapshot.js", + "line": 58, "description": "

A hash of adapter options

\n", "itemtype": "property", "name": "adapterOptions", "type": "{Object}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 111, - "description": "

If include was passed to the options hash for the request, the value\nwould be available here.

\n", - "itemtype": "property", - "name": "include", - "type": "{String|Array}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 121, + "file": "addon/-private/system/snapshot.js", + "line": 66, "description": "

The name of the type of the underlying record for this snapshot, as a string.

\n", "itemtype": "property", "name": "modelName", "type": "{String}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" }, { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 135, - "description": "

The underlying record for this snapshot. Can be used to access methods and\nproperties defined on the record.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
let json = snapshot.record.toJSON();
\n
\n
\n \n", + "file": "addon/-private/system/snapshot.js", + "line": 77, + "description": "

The type of the underlying record for this snapshot, as a DS.Model.

\n", "itemtype": "property", - "name": "record", - "type": "{Model}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" + "name": "type", + "type": "{DS.Model}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" } ] }, @@ -307,7 +264,7 @@ }, "module": { "data": { - "id": "ember-data-2.18.5-@ember-data/store", + "id": "ember-data-2.18.5-ember-data", "type": "module" } }, diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.SnapshotRecordArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.SnapshotRecordArray.json new file mode 100644 index 000000000..53b420ded --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.SnapshotRecordArray.json @@ -0,0 +1,154 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.SnapshotRecordArray", + "type": "class", + "attributes": { + "name": "DS.SnapshotRecordArray", + "shortname": "DS.SnapshotRecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/snapshot-record-array.js", + "line": 5, + "access": "private", + "tagname": "", + "is_constructor": 1, + "params": [ + { + "name": "snapshots", + "description": "An array of snapshots", + "type": "Array" + }, + { + "name": "meta", + "description": "", + "type": "Object" + } + ], + "methods": [ + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 129, + "description": "

Get snapshots of the underlying record array

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import DS from 'ember-data'\n\nexport default DS.JSONAPIAdapter.extend({\n  shouldReloadAll(store, snapshotArray) {\n    var snapshots = snapshotArray.snapshots();\n\n    return snapshots.any(function(ticketSnapshot) {\n      var 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 \n", + "itemtype": "method", + "name": "snapshots", + "return": { + "description": "Array of snapshots", + "type": "Array" + }, + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 15, + "description": "

An array of snapshots

\n", + "access": "private", + "tagname": "", + "itemtype": "property", + "name": "_snapshots", + "type": "{Array}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 23, + "description": "

An array of records

\n", + "access": "private", + "tagname": "", + "itemtype": "property", + "name": "_recordArray", + "type": "{Array}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 31, + "description": "

Number of records in the array

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data'\n\nexport default DS.JSONAPIAdapter.extend({\n  shouldReloadAll(store, snapshotRecordArray) {\n    return !snapshotRecordArray.length;\n  },\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "length", + "type": "{Number}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 53, + "description": "

Meta objects for the record array.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import DS from 'ember-data'\n\nexport default DS.JSONAPIAdapter.extend({\n  shouldReloadAll(store, snapshotRecordArray) {\n    var lastRequestTime = snapshotRecordArray.meta.lastRequestTime;\n    var twentyMinutes = 20 * 60 * 1000;\n    return Date.now() > lastRequestTime + twentyMinutes;\n  },\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "meta", + "type": "{Object}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 75, + "description": "

A hash of adapter options passed into the store method for this request.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n  findAll(store, type, sinceToken, snapshotRecordArray) {\n    if (snapshotRecordArray.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "adapterOptions", + "type": "{Object}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 98, + "description": "

The relationships to include for this request.

\n

Example

\n

```app/adapters/application.js\nimport DS from 'ember-data';

\n

export default DS.Adapter.extend({\n findAll(store, type, snapshotRecordArray) {\n var url = /${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)};

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
return fetch(url).then((response) => response.json())
\n
\n
\n

}\n});

\n", + "itemtype": "property", + "name": "include", + "type": "{String|Array}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 120, + "description": "

The type of the underlying records for the snapshots in the array, as a DS.Model

\n", + "itemtype": "property", + "name": "type", + "type": "{DS.Model}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Store.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Store.json new file mode 100644 index 000000000..348644fb5 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Store.json @@ -0,0 +1,1125 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.Store", + "type": "class", + "attributes": { + "name": "DS.Store", + "shortname": "DS.Store", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/store.js", + "line": 125, + "description": "

The store contains all of the data for records loaded from the server.\nIt is also responsible for creating instances of DS.Model that wrap\nthe individual data for a record, so that they can be bound to in your\nHandlebars templates.

\n

Define your application's store like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/services/store.js
1\n2\n3\n4\n
import DS from 'ember-data';\n\nexport default DS.Store.extend({\n});
\n
\n
\n \n

Most Ember.js applications will only have a single DS.Store that is\nautomatically created by their Ember.Application.

\n

You can retrieve models from the store in several ways. To retrieve a record\nfor a specific id, use DS.Store's findRecord() method:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('person', 123).then(function (person) {\n});
\n
\n
\n \n

By default, the store will talk to your backend using a standard\nREST mechanism. You can customize how the store talks to your\nbackend by specifying a custom adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n
import DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n});
\n
\n
\n \n

You can learn more about writing a custom adapter by reading the DS.Adapter\ndocumentation.

\n

Store createRecord() vs. push() vs. pushPayload()

\n

The store provides multiple ways to create new record objects. They have\nsome subtle differences in their use which are detailed below:

\n

createRecord is used for creating new\nrecords on the client side. This will return a new record in the\ncreated.uncommitted state. In order to persist this record to the\nbackend you will need to call record.save().

\n

push is used to notify Ember Data's store of new or\nupdated records that exist in the backend. This will return a record\nin the loaded.saved state. The primary use-case for store#push is\nto notify Ember Data about record updates (full or partial) that happen\noutside of the normal adapter methods (for example\nSSE or Web\nSockets).

\n

pushPayload is a convenience wrapper for\nstore#push that will deserialize payloads if the\nSerializer implements a pushPayload method.

\n

Note: When creating a new record using any of the above methods\nEmber Data will update DS.RecordArrays such as those returned by\nstore#peekAll() or store#findAll(). This means any\ndata bindings or computed properties that depend on the RecordArray\nwill automatically be synced to include the new or updated record\nvalues.

\n", + "extends": "Ember.Service", + "methods": [ + { + "file": "addon/-private/system/store.js", + "line": 200, + "itemtype": "method", + "name": "init", + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 258, + "description": "

Returns a JSON representation of the record using a custom\ntype-specific serializer, if one exists.

\n

The available options are:

\n
    \n
  • includeId: true if the record's ID should be included in\nthe JSON representation
  • \n
\n", + "itemtype": "method", + "name": "serialize", + "access": "private", + "tagname": "", + "deprecated": true, + "params": [ + { + "name": "record", + "description": "the record to serialize", + "type": "DS.Model" + }, + { + "name": "options", + "description": "an options hash", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 311, + "description": "

Create a new record in the current store. The properties passed\nto this method are set on the newly created record.

\n

To create a new instance of a Post:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.createRecord('post', {\n  title: 'Rails is omakase'\n});
\n
\n
\n \n

To create a new instance of a Post that has a relationship with a User record:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let user = this.store.peekRecord('user', 1);\nstore.createRecord('post', {\n  title: 'Rails is omakase',\n  user: user\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "inputProperties", + "description": "a hash of properties to set on the\n newly created record.", + "type": "Object" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 371, + "description": "

If possible, this method asks the adapter to generate an ID for\na newly created record.

\n", + "itemtype": "method", + "name": "_generateId", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "properties", + "description": "from the new record", + "type": "Object" + } + ], + "return": { + "description": "if the adapter can generate one, an ID", + "type": "String" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 396, + "description": "

For symmetry, a record can be deleted via the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let post = store.createRecord('post', {\n  title: 'Rails is omakase'\n});\n\nstore.deleteRecord(post);
\n
\n
\n \n", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "record", + "description": "", + "type": "DS.Model" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 416, + "description": "

For symmetry, a record can be unloaded via the store.\nThis will cause the record to be destroyed and freed up for garbage collection.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.findRecord('post', 1).then(function(post) {\n  store.unloadRecord(post);\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "unloadRecord", + "params": [ + { + "name": "record", + "description": "", + "type": "DS.Model" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 439, + "itemtype": "method", + "name": "find", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String|Integer" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 463, + "description": "

This method returns a record for a given type and id combination.

\n

The findRecord method will always resolve its promise with the same\nobject for a given type and id.

\n

The findRecord method will always return a promise that will be\nresolved with the record.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id);\n  }\n});
\n
\n
\n \n

If the record is not yet available, the store will ask the adapter's find\nmethod to find the necessary data. If the record is already present in the\nstore, it depends on the reload behavior when the returned promise\nresolves.

\n

Preloading

\n

You can optionally preload specific attributes and relationships that you know of\nby passing them via the passed options.

\n

For example, if your Ember route looks like /posts/1/comments/2 and your API route\nfor the comment also looks like /posts/1/comments/2 if you want to fetch the comment\nwithout fetching the post you can pass in the post to the findRecord call:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.findRecord('comment', 2, { preload: { post: 1 } });
\n
\n
\n \n

If you have access to the post model you can also pass the model itself:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.findRecord('post', 1).then(function (myPostModel) {\n  store.findRecord('comment', 2, { post: myPostModel });\n});
\n
\n
\n \n

Reloading

\n

The reload behavior is configured either via the passed options hash or\nthe result of the adapter's shouldReloadRecord.

\n

If { reload: true } is passed or adapter.shouldReloadRecord evaluates\nto true, then the returned promise resolves once the adapter returns\ndata, regardless if the requested record is already in the store:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
store.push({\n  data: {\n    id: 1,\n    type: 'post',\n    revision: 1\n  }\n});\n\n// adapter#findRecord resolves with\n// [\n//   {\n//     id: 1,\n//     type: 'post',\n//     revision: 2\n//   }\n// ]\nstore.findRecord('post', 1, { reload: true }).then(function(post) {\n  post.get('revision'); // 2\n});
\n
\n
\n \n

If no reload is indicated via the abovementioned ways, then the promise\nimmediately resolves with the cached version in the store.

\n

Background Reloading

\n

Optionally, if adapter.shouldBackgroundReloadRecord evaluates to true,\nthen a background reload is started, which updates the records' data, once\nit is available:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n
// app/adapters/post.js\nimport ApplicationAdapter from "./application";\n\nexport default ApplicationAdapter.extend({\n  shouldReloadRecord(store, snapshot) {\n    return false;\n  },\n\n  shouldBackgroundReloadRecord(store, snapshot) {\n    return true;\n  }\n});\n\n// ...\n\nstore.push({\n  data: {\n    id: 1,\n    type: 'post',\n    revision: 1\n  }\n});\n\nlet blogPost = store.findRecord('post', 1).then(function(post) {\n  post.get('revision'); // 1\n});\n\n// later, once adapter#findRecord resolved with\n// [\n//   {\n//     id: 1,\n//     type: 'post',\n//     revision: 2\n//   }\n// ]\n\nblogPost.get('revision'); // 2
\n
\n
\n \n

If you would like to force or prevent background reloading, you can set a\nboolean value for backgroundReload in the options object for\nfindRecord.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post/edit.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { backgroundReload: false });\n  }\n});
\n
\n
\n \n

If you pass an object on the adapterOptions property of the options\nargument it will be passed to you adapter via the snapshot

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post/edit.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id, {\n      adapterOptions: { subscribe: false }\n    });\n  }\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n  findRecord(store, type, id, snapshot) {\n    if (snapshot.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n});
\n
\n
\n \n

See peekRecord to get the cached version of a record.

\n\n

If you use an adapter such as Ember's default\nJSONAPIAdapter\nthat supports the JSON API specification and if your server\nendpoint supports the use of an\n'include' query parameter,\nyou can use findRecord() to automatically retrieve additional records related to\nthe one you request by supplying an include parameter in the options object.

\n

For example, given a post model that has a hasMany relationship with a comment\nmodel, when we retrieve a specific post we can have the server also return that post's\ncomments in the same request:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { include: 'comments' });\n  }\n});
\n
\n
\n \n

In this case, the post's comments would then be available in your template as\nmodel.comments.

\n

Multiple relationships can be requested using an include parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the post's\ncomments and the authors of those comments the request would look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });\n  }\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "(String|Integer)" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 753, + "description": "

This method makes a series of requests to the adapter's find method\nand returns a promise that resolves once they are all loaded.

\n", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "findByIds", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "ids", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 778, + "description": "

This method is called by findRecord if it discovers that a particular\ntype/id pair hasn't been loaded yet to kick off a request to the\nadapter.

\n", + "itemtype": "method", + "name": "_fetchRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "model", + "type": "InternalModel" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 977, + "description": "

Get the reference for the specified record.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n
let userRef = store.getReference('user', 1);\n\n// check if the user is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === 'id') {\nlet id = userRef.id();\n}\n\n// load user (via store.find)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({ id: 1, username: '@user' }).then(function(user) {\n  userRef.value() === user;\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "getReference", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String|Integer" + } + ], + "since": "2.5.0", + "return": { + "description": "", + "type": "RecordReference" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1020, + "description": "

Get a record by a given type and ID without triggering a fetch.

\n

This method will synchronously return the record if it is available in the store,\notherwise it will return null. A record is available if it has been fetched earlier, or\npushed manually into the store.

\n

See findRecord if you would like to request this record from the backend.

\n

Note: This is a synchronous method and does not return a promise.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
let post = store.peekRecord('post', 1);\n\npost.get('id'); // 1
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "peekRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String|Integer" + } + ], + "return": { + "description": "record", + "type": "DS.Model|null" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1057, + "description": "

This method is called by the record's reload method.

\n

This method calls the adapter's find method, which returns a promise. When\nthat promise resolves, reloadRecord will resolve the promise returned\nby the record's reload.

\n", + "itemtype": "method", + "name": "reloadRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "DS.Model" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1080, + "description": "

This method returns true if a record for a given modelName and id is already\nloaded in the store. Use this function to know beforehand if a findRecord()\nwill result in a request or that it will be a cache hit.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
store.hasRecordForId('post', 1); // false\nstore.findRecord('post', 1).then(function() {\n  store.hasRecordForId('post', 1); // true\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "hasRecordForId", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "(String|Integer)" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1111, + "description": "

Returns id record for a given type and ID. If one isn't already loaded,\nit builds a new record and leaves it in the empty state.

\n", + "itemtype": "method", + "name": "recordForId", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "(String|Integer)" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1157, + "itemtype": "method", + "name": "findMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModels", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1174, + "description": "

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\nrelationship is fetched.

\n

The link (which is usually a URL) is passed through unchanged, so the\nadapter can make whatever request it wants.

\n

The usual use-case is for the server to register a URL as a link, and\nthen use that URL in the future to make a request for the relationship.

\n", + "itemtype": "method", + "name": "findHasMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "link", + "description": "", + "type": "Any" + }, + { + "name": "relationship", + "description": "", + "type": "(Relationship)" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1201, + "itemtype": "method", + "name": "findBelongsTo", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "link", + "description": "", + "type": "Any" + }, + { + "name": "relationship", + "description": "", + "type": "Relationship" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1218, + "description": "

This method delegates a query to the adapter. This is the one place where\nadapter-level semantics are exposed to the application.

\n

Each time this method is called a new request is made through the adapter.

\n

Exposing queries this way seems preferable to creating an abstract query\nlanguage for all server-side queries, and then require all adapters to\nimplement them.

\n
\n

If you do something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('person', { page: 1 });
\n
\n
\n \n

The call made to the server, using a Rails backend, will look something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
Started GET "/api/v1/person?page=1"\nProcessing by Api::V1::PersonsController#index as HTML\nParameters: { "page"=>"1" }
\n
\n
\n
\n

If you do something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('person', { ids: [1, 2, 3] });
\n
\n
\n \n

The call to the server, using a Rails backend, will look something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
Started GET "/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3"\nProcessing by Api::V1::PersonsController#index as HTML\nParameters: { "ids" => ["1", "2", "3"] }
\n
\n
\n

This method returns a promise, which is resolved with an\nAdapterPopulatedRecordArray\nonce the server returns.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "an opaque query to be used by the adapter", + "type": "Any" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1302, + "description": "

This method makes a request for one record, where the id is not known\nbeforehand (if the id is known, use findRecord\ninstead).

\n

This method can be used when it is certain that the server will return a\nsingle object for the primary data.

\n

Each time this method is called a new request is made through the adapter.

\n

Let's assume our API provides an endpoint for the currently logged in user\nvia:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
// GET /api/current_user\n{\n  user: {\n    id: 1234,\n    username: 'admin'\n  }\n}
\n
\n
\n

Since the specific id of the user is not known beforehand, we can use\nqueryRecord to get the user:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
store.queryRecord('user', {}).then(function(user) {\n  let username = user.get('username');\n  console.log(`Currently logged in as ${username}`);\n});
\n
\n
\n \n

The request is made through the adapters' queryRecord:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import $ from 'jquery';\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n  queryRecord(modelName, query) {\n    return $.getJSON('/api/current_user');\n  }\n});
\n
\n
\n \n

Note: the primary use case for store.queryRecord is when a single record\nis queried and the id is not known beforehand. In all other cases\nstore.query and using the first item of the array is likely the preferred\nway:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
// GET /users?username=unique\n{\n  data: [{\n    id: 1234,\n    type: 'user',\n    attributes: {\n      username: "unique"\n    }\n  }]\n}
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
store.query('user', { username: 'unique' }).then(function(users) {\n  return users.get('firstObject');\n}).then(function(user) {\n  let id = user.get('id');\n});
\n
\n
\n \n

This method returns a promise, which resolves with the found record.

\n

If the adapter returns no data for the primary data of the payload, then\nqueryRecord resolves with null:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
// GET /users?username=unique\n{\n  data: null\n}
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.queryRecord('user', { username: 'unique' }).then(function(user) {\n  console.log(user); // null\n});
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "an opaque query to be used by the adapter", + "type": "Any" + } + ], + "return": { + "description": "promise which resolves with the found record or `null`", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1421, + "description": "

findAll asks the adapter's findAll method to find the records for the\ngiven type, and returns a promise which will resolve with all records of\nthis type present in the store, even if the adapter only returns a subset\nof them.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/authors.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findAll('author');\n  }\n});
\n
\n
\n \n

When the returned promise resolves depends on the reload behavior,\nconfigured via the passed options hash and the result of the adapter's\nshouldReloadAll method.

\n

Reloading

\n

If { reload: true } is passed or adapter.shouldReloadAll evaluates to\ntrue, then the returned promise resolves once the adapter returns data,\nregardless if there are already records in the store:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
store.push({\n  data: {\n    id: 'first',\n    type: 'author'\n  }\n});\n\n// adapter#findAll resolves with\n// [\n//   {\n//     id: 'second',\n//     type: 'author'\n//   }\n// ]\nstore.findAll('author', { reload: true }).then(function(authors) {\n  authors.getEach('id'); // ['first', 'second']\n});
\n
\n
\n \n

If no reload is indicated via the abovementioned ways, then the promise\nimmediately resolves with all the records currently loaded in the store.

\n

Background Reloading

\n

Optionally, if adapter.shouldBackgroundReloadAll evaluates to true,\nthen a background reload is started. Once this resolves, the array with\nwhich the promise resolves, is updated automatically so it contains all the\nrecords in the store:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n
import DS from 'ember-data';\nexport default DS.Adapter.extend({\n  shouldReloadAll(store, snapshotsArray) {\n    return false;\n  },\n\n  shouldBackgroundReloadAll(store, snapshotsArray) {\n    return true;\n  }\n});\n\n// ...\n\nstore.push({\n  data: {\n    id: 'first',\n    type: 'author'\n  }\n});\n\nlet allAuthors;\nstore.findAll('author').then(function(authors) {\n  authors.getEach('id'); // ['first']\n\n  allAuthors = authors;\n});\n\n// later, once adapter#findAll resolved with\n// [\n//   {\n//     id: 'second',\n//     type: 'author'\n//   }\n// ]\n\nallAuthors.getEach('id'); // ['first', 'second']
\n
\n
\n \n

If you would like to force or prevent background reloading, you can set a\nboolean value for backgroundReload in the options object for\nfindAll.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post/edit.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model() {\n    return this.store.findAll('post', { backgroundReload: false });\n  }\n});
\n
\n
\n \n

If you pass an object on the adapterOptions property of the options\nargument it will be passed to you adapter via the snapshotRecordArray

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/posts.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model(params) {\n    return this.store.findAll('post', {\n      adapterOptions: { subscribe: false }\n    });\n  }\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n  findAll(store, type, sinceToken, snapshotRecordArray) {\n    if (snapshotRecordArray.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n});
\n
\n
\n \n

See peekAll to get an array of current records in the\nstore, without waiting until a reload is finished.

\n\n

If you use an adapter such as Ember's default\nJSONAPIAdapter\nthat supports the JSON API specification and if your server\nendpoint supports the use of an\n'include' query parameter,\nyou can use findAll() to automatically retrieve additional records related to\nthose requested by supplying an include parameter in the options object.

\n

For example, given a post model that has a hasMany relationship with a comment\nmodel, when we retrieve all of the post records we can have the server also return\nall of the posts' comments in the same request:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/posts.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model() {\n    return this.store.findAll('post', { include: 'comments' });\n  }\n});
\n
\n
\n \n

Multiple relationships can be requested using an include parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the posts'\ncomments and the authors of those comments the request would look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/posts.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default Route.extend({\n  model() {\n    return this.store.findAll('post', { include: 'comments,comments.author' });\n  }\n});
\n
\n
\n \n

See query to only get a subset of records from the server.

\n", + "since": "1.13.0", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1624, + "itemtype": "method", + "name": "_fetchAll", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "DS.Model" + }, + { + "name": "array", + "description": "", + "type": "DS.RecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1662, + "itemtype": "method", + "name": "_didUpdateAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1677, + "description": "

This method returns a filtered array that contains all of the\nknown records for a given type in the store.

\n

Note that because it's just a filter, the result will contain any\nlocally created records of the type, however, it will not make a\nrequest to the backend to retrieve additional records. If you\nwould like to request all the records from the backend please use\nstore.findAll.

\n

Also note that multiple calls to peekAll for a given type will always\nreturn the same RecordArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
let localPosts = store.peekAll('post');
\n
\n
\n \n", + "since": "1.13.0", + "itemtype": "method", + "name": "peekAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1709, + "description": "

This method unloads all records in the store.\nIt schedules unloading to happen during the next run loop.

\n

Optionally you can pass a type which unload all records for a given type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.unloadAll();\nstore.unloadAll('post');
\n
\n
\n \n", + "itemtype": "method", + "name": "unloadAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1734, + "description": "

Takes a type and filter function, and returns a live RecordArray that\nremains up to date as new records are loaded into the store or created\nlocally.

\n

The filter function takes a materialized record, and returns true\nif the record should be included in the filter and false if it should\nnot.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.filter('post', function(post) {\n  return post.get('unread');\n});
\n
\n
\n \n

The filter function is called once on all records for the type when\nit is created, and then once on each newly loaded or created record.

\n

If any of a record's properties change, or if it changes state, the\nfilter function will be invoked again to determine whether it should\nstill be in the array.

\n

Optionally you can pass a query, which is the equivalent of calling\nquery with that same query, to fetch additional records\nfrom the server. The results returned by the server could then appear\nin the filter if they match the filter function.

\n

The query itself is not used to filter records, it's only sent to your\nserver for you to be able to do server-side filtering. The filter\nfunction will be applied on the returned results regardless.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
store.filter('post', { unread: true }, function(post) {\n  return post.get('unread');\n}).then(function(unreadPosts) {\n  unreadPosts.get('length'); // 5\n  let unreadPost = unreadPosts.objectAt(0);\n  unreadPost.set('unread', false);\n  unreadPosts.get('length'); // 4\n});
\n
\n
\n \n", + "itemtype": "method", + "name": "filter", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "optional query", + "type": "Object" + }, + { + "name": "filter", + "description": "", + "type": "Function" + } + ], + "return": { + "description": "", + "type": "DS.PromiseArray" + }, + "deprecated": true, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1821, + "description": "

This method has been deprecated and is an alias for store.hasRecordForId, which should\nbe used instead.

\n", + "deprecated": true, + "itemtype": "method", + "name": "recordIsLoaded", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1844, + "description": "

This method is called by record.save, and gets passed a\nresolver for the promise that record.save returns.

\n

It schedules saving to happen at the end of the run loop.

\n", + "itemtype": "method", + "name": "scheduleSave", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "resolver", + "description": "", + "type": "Resolver" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1867, + "description": "

This method is called at the end of the run loop, and\nflushes any records passed into scheduleSave

\n", + "itemtype": "method", + "name": "flushPendingSave", + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1902, + "description": "

This method is called once the promise returned by an\nadapter's createRecord, updateRecord or deleteRecord\nis resolved.

\n

If the data provides a server-generated ID, it will\nupdate the record and the store's indexes.

\n", + "itemtype": "method", + "name": "didSaveRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "the in-flight internal model", + "type": "InternalModel" + }, + { + "name": "data", + "description": "optional data (see above)", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1933, + "description": "

This method is called once the promise returned by an\nadapter's createRecord, updateRecord or deleteRecord\nis rejected with a DS.InvalidError.

\n", + "itemtype": "method", + "name": "recordWasInvalid", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "errors", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1947, + "description": "

This method is called once the promise returned by an\nadapter's createRecord, updateRecord or deleteRecord\nis rejected (with anything other than a DS.InvalidError).

\n", + "itemtype": "method", + "name": "recordWasError", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "error", + "description": "", + "type": "Error" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1961, + "description": "

When an adapter's createRecord, updateRecord or deleteRecord\nresolves with data, this method extracts the ID from the supplied\ndata.

\n", + "itemtype": "method", + "name": "updateId", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1999, + "description": "

Returns a map of IDs to client IDs for a given modelName.

\n", + "itemtype": "method", + "name": "_internalModelsFor", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "recordMap", + "type": "Object" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2016, + "description": "

This internal method is used by push.

\n", + "itemtype": "method", + "name": "_load", + "access": "private", + "tagname": "", + "params": [ + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2087, + "description": "

Returns the model class for the particular modelName.

\n

The class of a model might be useful if you want to get a list of all the\nrelationship names of the model, see\nrelationshipNames\nfor example.

\n", + "itemtype": "method", + "name": "modelFor", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.Model" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2167, + "description": "

Push some data for a given type into the store.

\n

This method expects normalized JSON API document. This means you have to follow JSON API specification with few minor adjustments:

\n
    \n
  • record's type should always be in singular, dasherized form
  • \n
  • members (properties) should be camelCased
  • \n
\n

Your primary data should be wrapped inside data property:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
store.push({\n  data: {\n    // primary data for single record of type `Person`\n    id: '1',\n    type: 'person',\n    attributes: {\n      firstName: 'Daniel',\n      lastName: 'Kmak'\n    }\n  }\n});
\n
\n
\n \n

Demo.

\n

data property can also hold an array (of records):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
store.push({\n  data: [\n    // an array of records\n    {\n      id: '1',\n      type: 'person',\n      attributes: {\n        firstName: 'Daniel',\n        lastName: 'Kmak'\n      }\n    },\n    {\n      id: '2',\n      type: 'person',\n      attributes: {\n        firstName: 'Tom',\n        lastName: 'Dale'\n      }\n    }\n  ]\n});
\n
\n
\n \n

Demo.

\n

There are some typical properties for JSONAPI payload:

\n
    \n
  • id - mandatory, unique record's key
  • \n
  • type - mandatory string which matches model's dasherized name in singular form
  • \n
  • attributes - object which holds data for record attributes - DS.attr's declared in model
  • \n
  • relationships - object which must contain any of the following properties under each relationships' respective key (example path is relationships.achievements.data):
      \n
    • links
    • \n
    • data - place for primary data
    • \n
    • meta - object which contains meta-information about relationship
    • \n
    \n
  • \n
\n

For this model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  firstName: DS.attr('string'),\n  lastName: DS.attr('string'),\n\n  children: DS.hasMany('person')\n});
\n
\n
\n \n

To represent the children as IDs:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n
{\n  data: {\n    id: '1',\n    type: 'person',\n    attributes: {\n      firstName: 'Tom',\n      lastName: 'Dale'\n    },\n    relationships: {\n      children: {\n        data: [\n          {\n            id: '2',\n            type: 'person'\n          },\n          {\n            id: '3',\n            type: 'person'\n          },\n          {\n            id: '4',\n            type: 'person'\n          }\n        ]\n      }\n    }\n  }\n}
\n
\n
\n \n

Demo.

\n

To represent the children relationship as a URL:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
{\n  data: {\n    id: '1',\n    type: 'person',\n    attributes: {\n      firstName: 'Tom',\n      lastName: 'Dale'\n    },\n    relationships: {\n      children: {\n        links: {\n          related: '/people/1/children'\n        }\n      }\n    }\n  }\n}
\n
\n
\n \n

If you're streaming data or implementing an adapter, make sure\nthat you have converted the incoming data into this form. The\nstore's normalize method is a convenience\nhelper for converting a json payload into the form Ember Data\nexpects.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.push(store.normalize('person', data));
\n
\n
\n \n

This method can be used both to push in brand new\nrecords, as well as to update existing records.

\n", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "the record(s) that was created or\n updated.", + "type": "DS.Model|Array" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2465, + "description": "

Push some raw data into the store.

\n

This method can be used both to push in brand new\nrecords, as well as to update existing records. You\ncan push in more than one type of object at once.\nAll objects should be in the format expected by the\nserializer.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n
import DS from 'ember-data';\n\nexport default DS.ActiveModelSerializer;
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
let pushData = {\n  posts: [\n    { id: 1, post_title: "Great post", comment_ids: [2] }\n  ],\n  comments: [\n    { id: 2, comment_body: "Insightful comment" }\n  ]\n}\n\nstore.pushPayload(pushData);
\n
\n
\n \n

By default, the data will be deserialized using a default\nserializer (the application serializer if it exists).

\n

Alternatively, pushPayload will accept a model type which\nwill determine which serializer will process the payload.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n
import DS from 'ember-data';\n\nexport default DS.ActiveModelSerializer;
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n
import DS from 'ember-data';\n\nexport default DS.JSONSerializer;
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.pushPayload(pushData); // Will use the application serializer\nstore.pushPayload('post', pushData); // Will use the post serializer
\n
\n
\n \n", + "itemtype": "method", + "name": "pushPayload", + "params": [ + { + "name": "modelName", + "description": "Optionally, a model type used to determine which serializer will be used", + "type": "String" + }, + { + "name": "inputPayload", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2540, + "description": "

normalize converts a json payload into the normalized form that\npush expects.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\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 \n", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "modelName", + "description": "The name of the model type for this payload", + "type": "String" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "The normalized payload", + "type": "Object" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2569, + "description": "

Build a brand new record for a given type, ID, and\ninitial data.

\n", + "itemtype": "method", + "name": "_buildInternalModel", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "internal model", + "type": "InternalModel" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2624, + "description": "

When a record is destroyed, this un-indexes it and\nremoves it from any record arrays so it can be GCed.

\n", + "itemtype": "method", + "name": "_removeFromIdMap", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2643, + "description": "

Returns an instance of the adapter for a given type. For\nexample, adapterFor('person') will return an instance of\nApp.PersonAdapter.

\n

If no App.PersonAdapter is found, this method will look\nfor an App.ApplicationAdapter (the default adapter for\nyour entire application).

\n

If no App.ApplicationAdapter is found, it will return\nthe value of the defaultAdapter.

\n", + "itemtype": "method", + "name": "adapterFor", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "DS.Adapter" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2673, + "description": "

Returns an instance of the serializer for a given type. For\nexample, serializerFor('person') will return an instance of\nApp.PersonSerializer.

\n

If no App.PersonSerializer is found, this method will look\nfor an App.ApplicationSerializer (the default serializer for\nyour entire application).

\n

if no App.ApplicationSerializer is found, it will attempt\nto get the defaultSerializer from the PersonAdapter\n(adapterFor('person')).

\n

If a serializer cannot be found on the adapter, it will fall back\nto an instance of DS.JSONSerializer.

\n", + "itemtype": "method", + "name": "serializerFor", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "the record to serialize", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.Serializer" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/system/store.js", + "line": 237, + "description": "

The default adapter to use to communicate to a backend server or\nother persistence layer. This will be overridden by an application\nadapter if present.

\n

If you want to specify app/adapters/custom.js as a string, do:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Store.extend({\n  adapter: 'custom',\n});
\n
\n
\n \n", + "itemtype": "property", + "name": "adapter", + "default": "'-json-api'", + "type": "{String}", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 284, + "description": "

This property returns the adapter, after resolving a possible\nstring key.

\n

If the supplied adapter was a class, or a String property\npath resolved to a class, this property will instantiate the\nclass.

\n

This property is cacheable, so the same instance of a specified\nadapter class should be used for the lifetime of the store.

\n", + "itemtype": "property", + "name": "defaultAdapter", + "access": "private", + "tagname": "", + "return": { + "description": "DS.Adapter" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "relationships": { + "parent-class": { + "data": { + "id": "Ember.Service", + "type": "missing" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.String.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.String.json new file mode 100644 index 000000000..6ba19581a --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.String.json @@ -0,0 +1,60 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.String", + "type": "class", + "attributes": { + "name": "DS.String", + "shortname": "String", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "methods": [ + { + "file": "node_modules/ember-inflector/addon/lib/ext/string.js", + "line": 8, + "description": "

See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}}

\n", + "itemtype": "method", + "name": "pluralize", + "class": "DS.String", + "module": "ember-data" + }, + { + "file": "node_modules/ember-inflector/addon/lib/ext/string.js", + "line": 27, + "description": "

See {{#crossLink "Ember.String/singularize"}}{{/crossLink}}

\n", + "itemtype": "method", + "name": "singularize", + "class": "DS.String", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.StringTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.StringTransform.json new file mode 100644 index 000000000..7828a1c10 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.StringTransform.json @@ -0,0 +1,98 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.StringTransform", + "type": "class", + "attributes": { + "name": "DS.StringTransform", + "shortname": "DS.StringTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/string.js", + "line": 4, + "description": "

The DS.StringTransform class is used to serialize and deserialize\nstring attributes on Ember Data record objects. This transform is\nused when string is passed as the type parameter to the\nDS.attr function.

\n

Usage

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  isAdmin: DS.attr('boolean'),\n  name: DS.attr('string'),\n  email: DS.attr('string')\n});
\n
\n
\n \n", + "extends": "DS.Transform", + "methods": [ + { + "file": "addon/transforms/transform.js", + "line": 71, + "description": "

When given a deserialized value from a record attribute this\nmethod must return the serialized value.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import { isEmpty } from '@ember/utils';\n\nserialize(deserialized, options) {\n  return isEmpty(deserialized) ? null : Number(deserialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "deserialized", + "description": "The deserialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The serialized value" + }, + "class": "DS.StringTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + }, + { + "file": "addon/transforms/transform.js", + "line": 92, + "description": "

When given a serialize value from a JSON object this method must\nreturn the deserialized value for the record attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
deserialize(serialized, options) {\n  return empty(serialized) ? null : Number(serialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "deserialize", + "params": [ + { + "name": "serialized", + "description": "The serialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The deserialized value" + }, + "class": "DS.StringTransform", + "module": "ember-data", + "namespace": "DS", + "inherited": true, + "inheritedFrom": "DS.Transform" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": { + "id": "ember-data-2.18.5-DS.Transform", + "type": "class" + } + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.TimeoutError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.TimeoutError.json new file mode 100644 index 000000000..0f8d117dc --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.TimeoutError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.TimeoutError", + "type": "class", + "attributes": { + "name": "DS.TimeoutError", + "shortname": "DS.TimeoutError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 171, + "description": "

A DS.TimeoutError is used by an adapter to signal that a request\nto the external API has timed out. I.e. no response was received from\nthe external API within an allowed time period.

\n

An example use case would be to warn the user to check their internet\nconnection if an adapter operation has timed out:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n
import Route from '@ember/routing/route';\nimport DS from 'ember-data';\n\nconst { TimeoutError } = DS;\n\nexport default Route.extend({\n  actions: {\n    error(error, transition) {\n      if (error instanceof TimeoutError) {\n        // alert the user\n        alert('Are you still connected to the internet?');\n        return;\n      }\n\n      // ...other error handling logic\n    }\n  }\n});
\n
\n
\n \n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Transform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Transform.json new file mode 100644 index 000000000..e44d009ff --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.Transform.json @@ -0,0 +1,107 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.Transform", + "type": "class", + "attributes": { + "name": "DS.Transform", + "shortname": "DS.Transform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/transform.js", + "line": 3, + "description": "

The DS.Transform class is used to serialize and deserialize model\nattributes when they are saved or loaded from an\nadapter. Subclassing DS.Transform is useful for creating custom\nattributes. All subclasses of DS.Transform must implement a\nserialize and a deserialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/transforms/temperature.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import DS from 'ember-data';\n\n// Converts centigrade in the JSON to fahrenheit in the app\nexport default DS.Transform.extend({\n  deserialize(serialized, options) {\n    return (serialized *  1.8) + 32;\n  },\n\n  serialize(deserialized, options) {\n    return (deserialized - 32) / 1.8;\n  }\n});
\n
\n
\n \n

The options passed into the DS.attr function when the attribute is\ndeclared on the model is also available in the transform.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
export default DS.Model.extend({\n  title: DS.attr('string'),\n  markdown: DS.attr('markdown', {\n    markdown: {\n      gfm: false,\n      sanitize: true\n    }\n  })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/transforms/markdown.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
export default DS.Transform.extend({\n  serialize(deserialized, options) {\n    return deserialized.raw;\n  },\n\n  deserialize(serialized, options) {\n    var markdownOptions = options.markdown || {};\n\n    return marked(serialized, markdownOptions);\n  }\n});
\n
\n
\n \n

Usage

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/requirement.js
1\n2\n3\n4\n5\n6\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  name: DS.attr('string'),\n  temperature: DS.attr('temperature')\n});
\n
\n
\n \n", + "methods": [ + { + "file": "addon/transforms/transform.js", + "line": 71, + "description": "

When given a deserialized value from a record attribute this\nmethod must return the serialized value.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
import { isEmpty } from '@ember/utils';\n\nserialize(deserialized, options) {\n  return isEmpty(deserialized) ? null : Number(deserialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "deserialized", + "description": "The deserialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The serialized value" + }, + "class": "DS.Transform", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/transforms/transform.js", + "line": 92, + "description": "

When given a serialize value from a JSON object this method must\nreturn the deserialized value for the record attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
deserialize(serialized, options) {\n  return empty(serialized) ? null : Number(serialized);\n}
\n
\n
\n \n", + "itemtype": "method", + "name": "deserialize", + "params": [ + { + "name": "serialized", + "description": "The serialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The deserialized value" + }, + "class": "DS.Transform", + "module": "ember-data", + "namespace": "DS" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [ + { + "type": "class", + "id": "ember-data-2.18.5-DS.BooleanTransform" + }, + { + "type": "class", + "id": "ember-data-2.18.5-DS.DateTransform" + }, + { + "type": "class", + "id": "ember-data-2.18.5-DS.NumberTransform" + }, + { + "type": "class", + "id": "ember-data-2.18.5-DS.StringTransform" + } + ] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.UnauthorizedError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.UnauthorizedError.json new file mode 100644 index 000000000..f89f110c5 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DS.UnauthorizedError.json @@ -0,0 +1,43 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS.UnauthorizedError", + "type": "class", + "attributes": { + "name": "DS.UnauthorizedError", + "shortname": "DS.UnauthorizedError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 218, + "description": "

A DS.UnauthorizedError equates to a HTTP 401 Unauthorized response\nstatus. It is used by an adapter to signal that a request to the external\nAPI was rejected because authorization is required and has failed or has not\nyet been provided.

\n

An example use case would be to redirect the user to a log in route if a\nrequest is unauthorized:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n
import Route from '@ember/routing/route';\nimport DS from 'ember-data';\n\nconst { UnauthorizedError } = DS;\n\nexport default Route.extend({\n  actions: {\n    error(error, transition) {\n      if (error instanceof UnauthorizedError) {\n        // go to the sign in route\n        this.transitionTo('login');\n        return;\n      }\n\n      // ...other error handling logic\n    }\n  }\n});
\n
\n
\n \n", + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DateTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DateTransform.json deleted file mode 100644 index e97e2028b..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DateTransform.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-DateTransform", - "type": "class", - "attributes": { - "name": "DateTransform", - "shortname": "DateTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/date.js", - "line": 5, - "description": "

The DateTransform class is used to serialize and deserialize\ndate attributes on Ember Data record objects. This transform is used\nwhen date is passed as the type parameter to the\nattr function. It uses the ISO 8601\nstandard.

\n

```app/models/score.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class ScoreModel extends Model {

\n", - "attr": "('date') date;\n }\n```", - "belongsto": "('player') player;", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DebugLogging.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DebugLogging.json deleted file mode 100644 index f1248eb94..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-DebugLogging.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-DebugLogging", - "type": "class", - "attributes": { - "name": "DebugLogging", - "shortname": "DebugLogging", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/debug", - "namespace": "", - "file": "../private-build-infra/virtual-packages/debugging.js", - "line": 4, - "description": "

Many portions of the internals are helpfully instrumented with logging that can be activated\nat build time. This instrumentation is always removed from production builds or any builds\nthat has not explicitly activated it. To activate it set the appropriate flag to true.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
  let app = new EmberApp(defaults, {\n    emberData: {\n      debug: {\n          LOG_PAYLOADS: false, // data store received to update cache with\n          LOG_OPERATIONS: false, // updates to cache remote state\n          LOG_MUTATIONS: false, // updates to cache local state\n          LOG_NOTIFICATIONS: false,\n          LOG_REQUESTS: false,\n          LOG_REQUEST_STATUS: false,\n          LOG_IDENTIFIERS: false,\n          LOG_GRAPH: false,\n          LOG_INSTANCE_CACHE: false,\n      }\n    }\n  });
\n
\n
\n \n", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [ - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 31, - "description": "

log payloads received by the store\nvia push or returned from a delete/update/create\noperation.

\n", - "itemtype": "property", - "name": "LOG_PAYLOADS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 40, - "description": "

log remote-state updates to the cache

\n", - "itemtype": "property", - "name": "LOG_OPERATIONS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 47, - "description": "

log local-state updates to the cache

\n", - "itemtype": "property", - "name": "LOG_MUTATIONS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 54, - "description": "

log notifications received by the NotificationManager

\n", - "itemtype": "property", - "name": "LOG_NOTIFICATIONS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 61, - "description": "

log requests issued by the RequestManager

\n", - "itemtype": "property", - "name": "LOG_REQUESTS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 68, - "description": "

log updates to requests the store has issued to\nthe network (adapter) to fulfill.

\n", - "itemtype": "property", - "name": "LOG_REQUEST_STATUS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 76, - "description": "

log peek, generation and updates to\nRecord Identifiers.

\n", - "itemtype": "property", - "name": "LOG_IDENTIFIERS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 84, - "description": "

log updates received by the graph (relationship pointer storage)

\n", - "itemtype": "property", - "name": "LOG_GRAPH", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 91, - "description": "

log creation/removal of RecordData and Record\ninstances.

\n", - "itemtype": "property", - "name": "LOG_INSTANCE_CACHE", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/debug", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-EmbeddedRecordsMixin.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-EmbeddedRecordsMixin.json deleted file mode 100644 index 9a48c1beb..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-EmbeddedRecordsMixin.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-EmbeddedRecordsMixin", - "type": "class", - "attributes": { - "name": "EmbeddedRecordsMixin", - "shortname": "EmbeddedRecordsMixin", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/rest", - "namespace": "", - "file": "../serializer/src/-private/embedded-records-mixin.js", - "line": 10, - "description": "

Using Embedded Records

\n

EmbeddedRecordsMixin supports serializing embedded records.

\n

To set up embedded records, include the mixin when extending a serializer,\nthen define and configure embedded (model) relationships.

\n

Note that embedded records will serialize with the serializer for their model instead of the serializer in which they are defined.

\n

Note also that this mixin does not work with JSONAPISerializer because the JSON:API specification does not describe how to format embedded resources.

\n

Below is an example of a per-type serializer (post type).

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n  attrs = {\n    author: { embedded: 'always' },\n    comments: { serialize: 'ids' }\n  }\n}
\n
\n
\n \n

Note that this use of { embedded: 'always' } is unrelated to\nthe { embedded: 'always' } that is defined as an option on attr as part of\ndefining a model while working with the ActiveModelSerializer. Nevertheless,\nusing { embedded: 'always' } as an option to attr is not a valid way to set up\nembedded records.

\n

The attrs option for a resource { embedded: 'always' } is shorthand for:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
{\n  serialize: 'records',\n  deserialize: 'records'\n}
\n
\n
\n \n

Configuring Attrs

\n

A resource's attrs option may be set to use ids, records or false for the\nserialize and deserialize settings.

\n

The attrs property can be set on the ApplicationSerializer or a per-type\nserializer.

\n

In the case where embedded JSON is expected while extracting a payload (reading)\nthe setting is deserialize: 'records', there is no need to use ids when\nextracting as that is the default behaviour without this mixin if you are using\nthe vanilla EmbeddedRecordsMixin. Likewise, to embed JSON in the payload while\nserializing serialize: 'records' is the setting to use. There is an option of\nnot embedding JSON in the serialized payload by using serialize: 'ids'. If you\ndo not want the relationship sent at all, you can use serialize: false.

\n

EmbeddedRecordsMixin defaults

\n

If you do not overwrite attrs for a specific relationship, the EmbeddedRecordsMixin\nwill behave in the following way:

\n

BelongsTo: { serialize: 'id', deserialize: 'id' }\nHasMany: { serialize: false, deserialize: 'ids' }

\n

Model Relationships

\n

Embedded records must have a model defined to be extracted and serialized. Note that\nwhen defining any relationships on your model such as belongsTo and hasMany, you\nshould not both specify async: true and also indicate through the serializer's\nattrs attribute that the related model should be embedded for deserialization.\nIf a model is declared embedded for deserialization (embedded: 'always' or deserialize: 'records'),\nthen do not use async: true.

\n

To successfully extract and serialize embedded records the model relationships\nmust be set up correctly. See the\ndefining relationships\nsection of the Defining Models guide page.

\n

Records without an id property are not considered embedded records, model\ninstances must have an id property to be used with Ember Data.

\n

Example JSON payloads, Models and Serializers

\n

When customizing a serializer it is important to grok what the customizations\nare. Please read the docs for the methods this mixin provides, in case you need\nto modify it to fit your specific needs.

\n

For example, review the docs for each method of this mixin:

\n\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 105, - "description": "

Normalize the record and recursively normalize/extract all the embedded records\nwhile pushing them into the store as they are encountered

\n

A payload with an attr configured for embedded records needs to be extracted:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "comments": [{\n      "id": "1",\n      "body": "Rails is unagi"\n    }, {\n      "id": "2",\n      "body": "Omakase O_o"\n    }]\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "to be normalized", - "type": "Object" - }, - { - "name": "prop", - "description": "the hash has been referenced by", - "type": "String" - } - ], - "return": { - "description": "the normalized hash", - "type": "Object" - }, - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 149, - "description": "

Serialize belongsTo relationship when it is configured as an embedded object.

\n

This example of an author model belongs to a post model:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Model, { attr, belongsTo } from '@ember-data/model';\n\nPost = Model.extend({\n  title:    attr('string'),\n  body:     attr('string'),\n  author:   belongsTo('author')\n});\n\nAuthor = Model.extend({\n  name:     attr('string'),\n  post:     belongsTo('post')\n});
\n
\n
\n \n

Use a custom (type) serializer for the post model to configure embedded author

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n  attrs = {\n    author: { embedded: 'always' }\n  }\n}
\n
\n
\n \n

A payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "author": {\n      "id": "2"\n      "name": "dhh"\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 253, - "description": "

Serializes hasMany relationships when it is configured as embedded objects.

\n

This example of a post model has many comments:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\nPost = Model.extend({\n  title:    attr('string'),\n  body:     attr('string'),\n  comments: hasMany('comment')\n});\n\nComment = Model.extend({\n  body:     attr('string'),\n  post:     belongsTo('post')\n});
\n
\n
\n \n

Use a custom (type) serializer for the post model to configure embedded comments

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n  attrs = {\n    comments: { embedded: 'always' }\n  }\n}
\n
\n
\n \n

A payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "body": "I want this for my ORM, I want that for my template language..."\n    "comments": [{\n      "id": "1",\n      "body": "Rails is unagi"\n    }, {\n      "id": "2",\n      "body": "Omakase O_o"\n    }]\n  }\n}
\n
\n
\n \n

The attrs options object can use more specific instruction for extracting and\nserializing. When serializing, an option to embed ids, ids-and-types or records can be set.\nWhen extracting the only option is records.

\n

So { embedded: 'always' } is shorthand for:\n{ serialize: 'records', deserialize: 'records' }

\n

To embed the ids for a related object (using a hasMany relationship):

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n  attrs = {\n    comments: { serialize: 'ids', deserialize: 'records' }\n  }\n}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
{\n  "post": {\n    "id": "1"\n    "title": "Rails is omakase",\n    "body": "I want this for my ORM, I want that for my template language..."\n    "comments": ["1", "2"]\n  }\n}
\n
\n
\n \n

To embed the relationship as a collection of objects with id and type keys, set\nids-and-types for the related object.

\n

This is particularly useful for polymorphic relationships where records don't share\nthe same table and the id is not enough information.

\n

For example having a user that has many pets:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
User = Model.extend({\n  name: attr('string'),\n  pets: hasMany('pet', { polymorphic: true })\n});\n\nPet = Model.extend({\n  name: attr('string'),\n});\n\nCat = Pet.extend({\n  // ...\n});\n\nParrot = Pet.extend({\n  // ...\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/user.js
1\n2\n3\n4\n5\n6\n7\n
import RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class UserSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n  attrs = {\n    pets: { serialize: 'ids-and-types', deserialize: 'records' }\n  }\n}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "user": {\n    "id": "1"\n    "name": "Bertin Osborne",\n    "pets": [\n      { "id": "1", "type": "Cat" },\n      { "id": "1", "type": "Parrot"}\n    ]\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 470, - "description": "

When serializing an embedded record, modify the property (in the JSON payload)\nthat refers to the parent record (foreign key for the relationship).

\n

Serializing a belongsTo relationship removes the property that refers to the\nparent record

\n

Serializing a hasMany relationship does not remove the property that refers to\nthe parent record.

\n", - "itemtype": "method", - "name": "removeEmbeddedForeignKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "embeddedSnapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - }, - { - "name": "json", - "description": "", - "type": "Object" - } - ], - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 549, - "itemtype": "method", - "name": "_extractEmbeddedRecords", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 567, - "itemtype": "method", - "name": "_extractEmbeddedHasMany", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 596, - "itemtype": "method", - "name": "_extractEmbeddedBelongsTo", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 619, - "itemtype": "method", - "name": "_normalizeEmbeddedRelationship", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/rest", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Ember.HTMLBars.helpers.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Ember.HTMLBars.helpers.json new file mode 100644 index 000000000..f411c845a --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Ember.HTMLBars.helpers.json @@ -0,0 +1,57 @@ +{ + "data": { + "id": "ember-data-2.18.5-Ember.HTMLBars.helpers", + "type": "class", + "attributes": { + "name": "Ember.HTMLBars.helpers", + "shortname": "Ember.HTMLBars.helpers", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "methods": [ + { + "file": "node_modules/ember-inflector/addon/lib/helpers/singularize.js", + "line": 4, + "description": "

If you have Ember Inflector (such as if Ember Data is present),\n singularize a word. For example, turn "oxen" into "ox".\nExample:\n{{singularize myProperty}}\n {{singularize "oxen"}}

\n", + "itemtype": "method", + "name": "singularize", + "params": [ + { + "name": "word", + "description": "word to singularize", + "type": "String|Property" + } + ], + "class": "Ember.HTMLBars.helpers", + "module": "ember-data" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Ember.Inflector.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Ember.Inflector.json new file mode 100644 index 000000000..c39794908 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Ember.Inflector.json @@ -0,0 +1,216 @@ +{ + "data": { + "id": "ember-data-2.18.5-Ember.Inflector", + "type": "class", + "attributes": { + "name": "Ember.Inflector", + "shortname": "Ember.Inflector", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "Ember", + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 32, + "description": "

Inflector.Ember provides a mechanism for supplying inflection rules for your\napplication. Ember includes a default set of inflection rules, and provides an\nAPI for providing additional rules.

\n

Examples:

\n

Creating an inflector with no rules.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
var inflector = new Ember.Inflector();
\n
\n
\n \n

Creating an inflector with the default ember ruleset.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
var inflector = new Ember.Inflector(Ember.Inflector.defaultRules);\n\ninflector.pluralize('cow'); //=> 'kine'\ninflector.singularize('kine'); //=> 'cow'
\n
\n
\n \n

Creating an inflector and adding rules later.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
var inflector = Ember.Inflector.inflector;\n\ninflector.pluralize('advice'); // => 'advices'\ninflector.uncountable('advice');\ninflector.pluralize('advice'); // => 'advice'\n\ninflector.pluralize('formula'); // => 'formulas'\ninflector.irregular('formula', 'formulae');\ninflector.pluralize('formula'); // => 'formulae'\n\n// you would not need to add these as they are the default rules\ninflector.plural(/$/, 's');\ninflector.singular(/s$/i, '');
\n
\n
\n \n

Creating an inflector with a nondefault ruleset.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
var rules = {\n  plurals:  [\n    [ /$/, 's' ]\n  ],\n  singular: [\n    [ /\\s$/, '' ]\n  ],\n  irregularPairs: [\n    [ 'cow', 'kine' ]\n  ],\n  uncountable: [ 'fish' ]\n};\n\nvar inflector = new Ember.Inflector(rules);
\n
\n
\n \n", + "methods": [ + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 125, + "access": "public", + "tagname": "As inflections can be costly, and commonly the same subset of words are repeatedly\ninflected an optional cache is provided.", + "itemtype": "method", + "name": "enableCache", + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 148, + "access": "public", + "tagname": "", + "itemtype": "method", + "name": "purgedCache", + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 159, + "access": "public", + "tagname": "disable caching", + "itemtype": "method", + "name": "disableCache;", + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 177, + "itemtype": "method", + "name": "plural", + "params": [ + { + "name": "regex", + "description": "", + "type": "RegExp" + }, + { + "name": "string", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 187, + "itemtype": "method", + "name": "singular", + "params": [ + { + "name": "regex", + "description": "", + "type": "RegExp" + }, + { + "name": "string", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 197, + "itemtype": "method", + "name": "uncountable", + "params": [ + { + "name": "regex", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 206, + "itemtype": "method", + "name": "irregular", + "params": [ + { + "name": "singular", + "description": "", + "type": "String" + }, + { + "name": "plural", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 216, + "itemtype": "method", + "name": "pluralize", + "params": [ + { + "name": "word", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 235, + "itemtype": "method", + "name": "singularize", + "params": [ + { + "name": "word", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 247, + "access": "protected", + "tagname": "", + "itemtype": "method", + "name": "inflect", + "params": [ + { + "name": "word", + "description": "", + "type": "String" + }, + { + "name": "typeRules", + "description": "", + "type": "Object" + }, + { + "name": "irregular", + "description": "", + "type": "Object" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Errors.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Errors.json deleted file mode 100644 index c5e62ec9e..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Errors.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Errors", - "type": "class", - "attributes": { - "name": "Errors", - "shortname": "Errors", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/errors.ts", - "line": 30, - "description": "

Holds validation errors for a given record, organized by attribute names.

\n

This class is not directly instantiable.

\n

Every Model has an errors property that is an instance of\nErrors. This can be used to display validation error\nmessages returned from the server when a record.save() rejects.

\n

For Example, if you had a User model that looked like this:

\n

```app/models/user.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "attr": "('string') email;\n}\n```\nAnd you attempted to save a record that did not validate on the backend:\n\n```javascript\nlet user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n});\nuser.save();\n```\n\nYour backend would be expected to return an error response that described\nthe problem, so that error messages can be generated on the app.\n\nAPI responses will be translated into instances of `Errors` differently,\ndepending on the specific combination of adapter and serializer used. You\nmay want to check the documentation or the source code of the libraries\nthat you are using, to know how they expect errors to be communicated.\n\nErrors can be displayed to the user by accessing their property name\nto get an array of all the error objects for that property. Each\nerror object is a JavaScript object with two keys:\n\n- `message` A string containing the error message from the backend\n- `attribute` The name of the property associated with this error message\n\n```handlebars\n\n{{#each @model.errors.username as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n\n\n{{#each @model.errors.email as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\nYou can also access the special `messages` property on the error\nobject to get an array of all the error strings.\n\n```handlebars\n{{#each @model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", - "access": "public", - "tagname": "", - "extends": "Ember.ArrayProxy", - "methods": [ - { - "file": "../packages/model/src/-private/errors.ts", - "line": 117, - "description": "

Returns errors for a given attribute

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let user = store.createRecord('user', {\n  username: 'tomster',\n  email: 'invalidEmail'\n});\nuser.save().catch(function(){\n  user.errors.errorsFor('email'); // returns:\n  // [{attribute: "email", message: "Doesn't look like a valid email."}]\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "errorsFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "attribute", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Array" - }, - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 184, - "itemtype": "method", - "name": "unknownProperty", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 216, - "description": "

Manually adds errors to the record. This will trigger the becameInvalid event/ lifecycle method on\n the record and transition the record into an invalid state.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
 let errors = user.errors;\n\n // add multiple errors\n errors.add('password', [\n   'Must be at least 12 characters',\n   'Must contain at least one symbol',\n   'Cannot contain your name'\n ]);\n\n errors.errorsFor('password');\n // =>\n // [\n //   { attribute: 'password', message: 'Must be at least 12 characters' },\n //   { attribute: 'password', message: 'Must contain at least one symbol' },\n //   { attribute: 'password', message: 'Cannot contain your name' },\n // ]\n\n // add a single error\n errors.add('username', 'This field is required');\n\n errors.errorsFor('username');\n // =>\n // [\n //   { attribute: 'username', message: 'This field is required' },\n // ]
\n
\n
\n \n", - "itemtype": "method", - "name": "add", - "access": "public", - "tagname": "", - "params": [ - { - "name": "attribute", - "description": "- the property name of an attribute or relationship", - "type": "String" - }, - { - "name": "messages", - "description": "- an error message or array of error messages for the attribute", - "type": "String[]|string" - } - ], - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 263, - "itemtype": "method", - "name": "_findOrCreateMessages", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 288, - "description": "

Manually removes all errors for a given member from the record.\n This will transition the record into a valid state, and\n triggers the becameValid event and lifecycle method.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
 let errors = user.errors;\n errors.add('phone', ['error-1', 'error-2']);\n\n errors.errorsFor('phone');\n // =>\n // [\n //   { attribute: 'phone', message: 'error-1' },\n //   { attribute: 'phone', message: 'error-2' },\n // ]\n\n errors.remove('phone');\n\n errors.errorsFor('phone');\n // => undefined
\n
\n
\n \n", - "itemtype": "method", - "name": "remove", - "access": "public", - "tagname": "", - "params": [ - { - "name": "member", - "description": "- the property name of an attribute or relationship", - "type": "String" - } - ], - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 339, - "description": "

Manually clears all errors for the record.\n This will transition the record into a valid state, and\n will trigger the becameValid event and lifecycle method.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n
let errors = user.errors;\nerrors.add('username', ['error-a']);\nerrors.add('phone', ['error-1', 'error-2']);\n\nerrors.errorsFor('username');\n// =>\n// [\n//   { attribute: 'username', message: 'error-a' },\n// ]\n\nerrors.errorsFor('phone');\n// =>\n// [\n//   { attribute: 'phone', message: 'error-1' },\n//   { attribute: 'phone', message: 'error-2' },\n// ]\n\nerrors.clear();\n\nerrors.errorsFor('username');\n// => undefined\n\nerrors.errorsFor('phone');\n// => undefined\n\nerrors.messages\n// => []
\n
\n
\n \n", - "itemtype": "method", - "name": "clear", - "access": "public", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 399, - "description": "

Checks if there are error messages for the given attribute.

\n

```app/controllers/user/edit.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';

\n

export default class UserEditController extends Controller {

\n", - "action": "save(user) {\n if (user.errors.has('email')) {\n return alert('Please update your email before attempting to save.');\n }\n user.save();\n }\n}\n```", - "itemtype": "method", - "name": "has", - "access": "public", - "tagname": "", - "params": [ - { - "name": "attribute", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if there some errors on given attribute", - "type": "Boolean" - }, - "class": "Errors", - "module": "@ember-data/model" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/model/src/-private/errors.ts", - "line": 107, - "itemtype": "property", - "name": "errorsByAttributeName", - "type": "{MapWithDefault}", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 155, - "description": "

An array containing all of the error messages for this\nrecord. This is useful for displaying all errors to the user.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each @model.errors.messages as |message|}}\n  <div class="error">\n    {{message}}\n  </div>\n{{/each}}
\n
\n
\n \n", - "itemtype": "property", - "name": "messages", - "access": "public", - "tagname": "", - "type": "{Array}", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 174, - "itemtype": "property", - "name": "content", - "type": "{Array}", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 196, - "description": "

Total number of errors.

\n", - "itemtype": "property", - "name": "length", - "type": "{Number}", - "access": "public", - "tagname": "", - "readonly": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 205, - "description": "

true if we have no errors.

\n", - "itemtype": "property", - "name": "isEmpty", - "type": "{Boolean}", - "access": "public", - "tagname": "", - "readonly": "", - "class": "Errors", - "module": "@ember-data/model" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "Ember.ArrayProxy", - "type": "missing" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Fetch.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Fetch.json deleted file mode 100644 index 9d2441d0d..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Fetch.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Fetch", - "type": "class", - "attributes": { - "name": "Fetch", - "shortname": "Fetch", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request/fetch", - "namespace": "", - "file": "../request/src/fetch.ts", - "line": 25, - "description": "

A basic handler which converts a request into a\nfetch call presuming the response to be json.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
import Fetch from '@ember-data/request/fetch';\n\nmanager.use([Fetch]);
\n
\n
\n \n", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/request/fetch", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ForbiddenError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ForbiddenError.json deleted file mode 100644 index 10036f995..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ForbiddenError.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-ForbiddenError", - "type": "class", - "attributes": { - "name": "ForbiddenError", - "shortname": "ForbiddenError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 265, - "description": "

A ForbiddenError equates to a HTTP 403 Forbidden response status.\nIt is used by an adapter to signal that a request to the external API was\nvalid but the server is refusing to respond to it. If authorization was\nprovided and is valid, then the authenticated user does not have the\nnecessary permissions for the request.

\n", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Future.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Future.json deleted file mode 100644 index 3ab861f0f..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Future.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Future", - "type": "class", - "attributes": { - "name": "Future", - "shortname": "Future", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request", - "namespace": "", - "file": "../request/src/-private/types.ts", - "line": 63, - "description": "

A Future is a Promise which resolves to a StructuredDocument\nwhile providing the ability to abort the underlying request,\ngetStream the response before the outer promise resolves;

\n", - "extends": "Promise", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/request/src/-private/types.ts", - "line": 73, - "description": "

Cancel this request by firing the AbortController's signal.

\n", - "itemtype": "method", - "name": "abort", - "params": [ - { - "name": "reason", - "description": "optional reason for aborting the request", - "type": "String", - "optional": true - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "", - "type": "Void" - }, - "class": "Future", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/types.ts", - "line": 82, - "description": "

Get the response stream, if any, once made available.

\n", - "itemtype": "method", - "name": "getStream", - "access": "public", - "tagname": "", - "return": { - "description": "", - "type": "Promise" - }, - "class": "Future", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/types.ts", - "line": 91, - "description": "

Run a callback when this request completes. Use sparingly,\nmostly useful for instrumentation and infrastructure.

\n", - "itemtype": "method", - "name": "onFinalize", - "params": [ - { - "name": "cb", - "description": "the callback to run" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "void" - }, - "class": "Future", - "module": "@ember-data/request" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "Promise", - "type": "missing" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/request", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-HasManyReference.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-HasManyReference.json deleted file mode 100644 index b87fdd6b3..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-HasManyReference.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-HasManyReference", - "type": "class", - "attributes": { - "name": "HasManyReference", - "shortname": "HasManyReference", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/references/has-many.ts", - "line": 45, - "description": "

A HasManyReference is a low-level API that allows users and addon\nauthors to perform meta-operations on a has-many relationship.

\n", - "access": "public", - "tagname": "", - "extends": "Reference", - "methods": [ - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 153, - "description": "

This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the "link" otherwise it defaults to "id".

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n```", - "itemtype": "method", - "name": "remoteType", - "access": "public", - "tagname": "", - "return": { - "description": "The name of the remote type. This should either be `link` or `ids`", - "type": "String" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 204, - "description": "

ids() returns an array of the record IDs in this relationship.

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n```", - "itemtype": "method", - "name": "ids", - "access": "public", - "tagname": "", - "return": { - "description": "The ids in this has-many relationship", - "type": "Array" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 243, - "description": "

The link Ember Data will use to fetch or reload this belongs-to\nrelationship. By default it uses only the "related" resource linkage.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n
// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\nexport default Model.extend({\n   user: belongsTo('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       user: {\n         links: {\n           related: '/articles/1/author'\n         }\n       }\n     }\n   }\n });\nlet userRef = blog.belongsTo('user');\n\n// get the identifier of the reference\nif (userRef.remoteType() === "link") {\n   let link = userRef.link();\n }
\n
\n
\n \n", - "itemtype": "method", - "name": "link", - "access": "public", - "tagname": "", - "return": { - "description": "The link Ember Data will use to fetch or reload this belongs-to relationship.", - "type": "String" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 293, - "description": "

any links that have been received for this relationship

\n", - "itemtype": "method", - "name": "links", - "access": "public", - "tagname": "", - "return": { - "description": "" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 306, - "description": "

The meta data for the has-many relationship.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n
// models/blog.js\nimport Model, { hasMany } from '@ember-data/model';\nexport default Model.extend({\n   users: hasMany('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n   data: {\n     type: 'blog',\n     id: 1,\n     relationships: {\n       users: {\n         links: {\n           related: {\n             href: '/articles/1/authors'\n           },\n         },\n         meta: {\n           lastUpdated: 1458014400000\n         }\n       }\n     }\n   }\n });\n\nlet usersRef = blog.hasMany('user');\n\nusersRef.meta() // { lastUpdated: 1458014400000 }
\n
\n
\n \n", - "itemtype": "method", - "name": "meta", - "access": "public", - "tagname": "", - "return": { - "description": "The meta information for the belongs-to relationship.", - "type": "Object" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 355, - "description": "

push can be used to update the data in the relationship and Ember\nData will treat the new data as the canonical value of this\nrelationship on the backend.

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n\ncommentsRef.push([\n[{ type: 'comment', id: 2 }],\n[{ type: 'comment', id: 3 }],\n])\n\ncommentsRef.ids(); // ['2', '3']\n```", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "objectOrPromise", - "description": "a promise that resolves to a JSONAPI document object describing the new value of this relationship.", - "type": "Array|Promise" - } - ], - "return": { - "description": "", - "type": "ManyArray" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 459, - "description": "

value() synchronously returns the current value of the has-many\nrelationship. Unlike record.relationshipName, calling\nvalue() on a reference does not trigger a fetch if the async\nrelationship is not yet loaded. If the relationship is not loaded\nit will always return null.

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\npost.comments.then(function(comments) {\n commentsRef.value() === comments\n})\n```", - "itemtype": "method", - "name": "value", - "access": "public", - "tagname": "", - "return": { - "description": "", - "type": "ManyArray" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 517, - "description": "

Loads the relationship if it is not already loaded. If the\nrelationship is already loaded this method does not trigger a new\nload. This causes a request to the specified\nrelationship link or reloads all items currently in the relationship.

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.load().then(function(comments) {\n //...\n});\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference.\n\nExample\n\n```javascript\ncommentsRef.load({ adapterOptions: { isPrivate: true } })\n .then(function(comments) {\n //...\n });\n```\n\n```app/adapters/comment.js\nexport default ApplicationAdapter.extend({\n findMany(store, type, id, snapshots) {\n // In the adapter you will have access to adapterOptions.\n let adapterOptions = snapshots[0].adapterOptions;\n }\n});\n```", - "itemtype": "method", - "name": "load", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the ManyArray in\nthis has-many relationship.", - "type": "Promise" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 592, - "description": "

Reloads this has-many relationship. This causes a request to the specified\nrelationship link or reloads all items currently in the relationship.

\n

Example

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.reload().then(function(comments) {\n //...\n});\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference. A full example\ncan be found in the `load` method.\n\nExample\n\n```javascript\ncommentsRef.reload({ adapterOptions: { isPrivate: true } })\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the ManyArray in this has-many relationship.", - "type": "Promise" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 101, - "description": "

An array of identifiers for the records that this reference refers to.

\n", - "itemtype": "property", - "name": "identifiers", - "type": "StableRecordIdentifier[]", - "access": "public", - "tagname": "", - "class": "HasManyReference", - "module": "@ember-data/model" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "Reference", - "type": "missing" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-IdentifierCache.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-IdentifierCache.json deleted file mode 100644 index 920875ecc..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-IdentifierCache.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-IdentifierCache", - "type": "class", - "attributes": { - "name": "IdentifierCache", - "shortname": "IdentifierCache", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/caches/identifier-cache.ts", - "line": 143, - "description": "

Each instance of {Store} receives a unique instance of a IdentifierCache.

\n

This cache is responsible for assigning or retrieving the unique identify\nfor arbitrary resource data encountered by the store. Data representing\na unique resource or record should always be represented by the same\nidentifier.

\n

It can be configured by consuming applications.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 180, - "description": "

Internal hook to allow management of merge conflicts with identifiers.

\n

we allow late binding of this private internal merge so that\nthe cache can insert itself here to handle elimination of duplicates

\n", - "itemtype": "method", - "name": "__configureMerge", - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 193, - "itemtype": "method", - "name": "_getRecordIdentifier", - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 344, - "description": "

allows us to peek without generating when needed\nuseful for the "create" case when we need to see if\nwe are accidentally overwritting something

\n", - "itemtype": "method", - "name": "peekRecordIdentifier", - "params": [ - { - "name": "resource", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier | undefined" - }, - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 358, - "description": "

Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.\nReturns null if the request does not have a cacheKey or url.

\n", - "itemtype": "method", - "name": "getOrCreateDocumentIdentifier", - "params": [ - { - "name": "request", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 392, - "description": "

Returns the Identifier for the given Resource, creates one if it does not yet exist.

\n

Specifically this means that we:

\n
    \n
  • validate the id type and lid combo against known identifiers
  • \n
  • return an object with an lid that is stable (repeated calls with the same\nid + type or lid will return the same lid value)
  • \n
  • this referential stability of the object itself is guaranteed
  • \n
\n", - "itemtype": "method", - "name": "getOrCreateRecordIdentifier", - "params": [ - { - "name": "resource", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 415, - "description": "

Returns a new Identifier for the supplied data. Call this method to generate\nan identifier when a new resource is being created local to the client and\npotentially does not have an id.

\n

Delegates generation to the user supplied GenerateMethod if one has been provided\nwith the signature generateMethod({ type }, 'record').

\n", - "itemtype": "method", - "name": "createIdentifierForNewRecord", - "params": [ - { - "name": "data", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 455, - "description": "

Provides the opportunity to update secondary lookup tables for existing identifiers\nCalled after an identifier created with createIdentifierForNewRecord has been\ncommitted.

\n

Assigned id to an Identifier if id has not previously existed; however,\nattempting to change the id or calling update without providing an id when\none is missing will throw an error.

\n
    \n
  • sets id (if id was previously null)

    \n
  • \n
  • lid and type MUST NOT be altered post creation

    \n

    If a merge occurs, it is possible the returned identifier does not match the originally\nprovided identifier. In this case the abandoned identifier will go through the usual\nforgetRecordIdentifier codepaths.

    \n
  • \n
\n", - "itemtype": "method", - "name": "updateRecordIdentifier", - "params": [ - { - "name": "identifierObject", - "description": "" - }, - { - "name": "data", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 544, - "itemtype": "method", - "name": "_mergeRecordIdentifiers", - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 574, - "description": "

Provides the opportunity to eliminate an identifier from secondary lookup tables\nas well as eliminates it from ember-data's own lookup tables and book keeping.

\n

Useful when a record has been deleted and the deletion has been persisted and\nwe do not care about the record anymore. Especially useful when an id of a\ndeleted record might be reused later for a new record.

\n", - "itemtype": "method", - "name": "forgetRecordIdentifier", - "params": [ - { - "name": "identifierObject", - "description": "" - } - ], - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-IdentityMap.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-IdentityMap.json new file mode 100644 index 000000000..4ce7f86f2 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-IdentityMap.json @@ -0,0 +1,100 @@ +{ + "data": { + "id": "ember-data-2.18.5-IdentityMap", + "type": "class", + "attributes": { + "name": "IdentityMap", + "shortname": "IdentityMap", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/identity-map.js", + "line": 4, + "description": "

IdentityMap is a custom storage map for records by modelName\nused by DS.Store.

\n", + "access": "private", + "tagname": "", + "methods": [ + { + "file": "addon/-private/system/diff-array.js", + "line": 1, + "itemtype": "method", + "name": "diffArray", + "access": "private", + "tagname": "", + "params": [ + { + "name": "oldArray", + "description": "the old array", + "type": "Array" + }, + { + "name": "newArray", + "description": "the new array", + "type": "Array" + } + ], + "return": { + "description": "{\n firstChangeIndex: , // null if no change\n addedCount: , // 0 if no change\n removedCount: // 0 if no change\n }", + "type": "Hash" + }, + "class": "IdentityMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/identity-map.js", + "line": 16, + "description": "

Retrieves the InternalModelMap for a given modelName,\ncreating one if one did not already exist. This is\nsimilar to getWithDefault or get on a MapWithDefault

\n", + "itemtype": "method", + "name": "retrieve", + "params": [ + { + "name": "modelName", + "description": "a previously normalized modelName" + } + ], + "return": { + "description": "the InternalModelMap for the given modelName", + "type": "InternalModelMap" + }, + "class": "IdentityMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/identity-map.js", + "line": 35, + "description": "

Clears the contents of all known RecordMaps, but does\nnot remove the InternalModelMap instances.

\n", + "itemtype": "method", + "name": "clear", + "class": "IdentityMap", + "module": "ember-data" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InspectorDataAdapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InspectorDataAdapter.json deleted file mode 100644 index 2b24bd9af..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InspectorDataAdapter.json +++ /dev/null @@ -1,321 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-InspectorDataAdapter", - "type": "class", - "attributes": { - "name": "InspectorDataAdapter", - "shortname": "InspectorDataAdapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/debug", - "namespace": "", - "file": "../debug/addon/index.js", - "line": 46, - "description": "

Implements @ember/debug/data-adapter with for EmberData\nintegration with the ember-inspector.

\n", - "extends": "DataAdapter", - "access": "private", - "tagname": "", - "methods": [ - { - "file": "../packages/debug/addon/index.js", - "line": 57, - "description": "

Specifies how records can be filtered based on the state of the record\nRecords returned will need to have a filterValues\nproperty with a key for every name in the returned array

\n", - "itemtype": "method", - "name": "getFilters", - "access": "private", - "tagname": "", - "return": { - "description": "List of objects defining filters\n The object should have a `name` and `desc` property", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 79, - "description": "

Fetch the model types and observe them for changes.\nMaintains the list of model types without needing the Model package for detection.

\n", - "itemtype": "method", - "name": "watchModelTypes", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typesAdded", - "description": "Callback to call to add types.\nTakes an array of objects containing wrapped types (returned from `wrapModelType`).", - "type": "Function" - }, - { - "name": "typesUpdated", - "description": "Callback to call when a type has changed.\nTakes an array of objects containing wrapped types.", - "type": "Function" - } - ], - "return": { - "description": "Method to call to remove all observers", - "type": "Function" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 130, - "description": "

Loop over the discovered types and use the callbacks from watchModelTypes to notify\nthe consumer of this adapter about the mdoels.

\n", - "itemtype": "method", - "name": "watchTypeIfUnseen", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "discoveredTypes", - "description": "", - "type": "Map" - }, - { - "name": "type", - "description": "", - "type": "String" - }, - { - "name": "typesAdded", - "description": "", - "type": "Function" - }, - { - "name": "typesUpdated", - "description": "", - "type": "Function" - }, - { - "name": "releaseMethods", - "description": "", - "type": "Array" - } - ], - "access": "private", - "tagname": "", - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 153, - "description": "

Creates a human readable string used for column headers

\n", - "itemtype": "method", - "name": "columnNameToDesc", - "access": "private", - "tagname": "", - "params": [ - { - "name": "name", - "description": "The attribute name", - "type": "String" - } - ], - "return": { - "description": "Human readable string based on the attribute name", - "type": "String" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 165, - "description": "

Get the columns for a given model type

\n", - "itemtype": "method", - "name": "columnsForType", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "An array of columns of the following format:\n name: {String} The name of the column\n desc: {String} Humanized description (what would show in a table column name)", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 194, - "description": "

Fetches all loaded records for a given type

\n", - "itemtype": "method", - "name": "getRecords", - "access": "private", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "of the record", - "type": "Model" - }, - { - "name": "modelName", - "description": "of the record", - "type": "String" - } - ], - "return": { - "description": "An array of Model records\n This array will be observed for changes,\n so it should update when new records are added/removed", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 220, - "description": "

Gets the values for each column\nThis is the attribute values for a given record

\n", - "itemtype": "method", - "name": "getRecordColumnValues", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "to get values from", - "type": "Model" - } - ], - "return": { - "description": "Keys should match column names defined by the model type", - "type": "Object" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 242, - "description": "

Returns keywords to match when searching records

\n", - "itemtype": "method", - "name": "getRecordKeywords", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "Relevant keywords for search based on the record's attribute values", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 258, - "description": "

Returns the values of filters defined by getFilters\nThese reflect the state of the record

\n", - "itemtype": "method", - "name": "getRecordFilterValues", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "The record state filter values", - "type": "Object" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 275, - "description": "

Returns a color that represents the record's state\nPossible colors: black, blue, green

\n", - "itemtype": "method", - "name": "getRecordColor", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "The record color", - "type": "String" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 294, - "description": "

Observes all relevant properties and re-sends the wrapped record\nwhen a change occurs

\n", - "itemtype": "method", - "name": "observeRecord", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - }, - { - "name": "recordUpdated", - "description": "Callback used to notify changes", - "type": "Function" - } - ], - "return": { - "description": "The function to call to remove all observers", - "type": "Function" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "DataAdapter", - "type": "missing" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/debug", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InternalModelMap.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InternalModelMap.json new file mode 100644 index 000000000..518a82243 --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InternalModelMap.json @@ -0,0 +1,55 @@ +{ + "data": { + "id": "ember-data-2.18.5-InternalModelMap", + "type": "class", + "attributes": { + "name": "InternalModelMap", + "shortname": "InternalModelMap", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/internal-model-map.js", + "line": 4, + "description": "

InternalModelMap is a custom storage map for internalModels of a given modelName\nused by IdentityMap.

\n

It was extracted from an implicit pojo based "internalModel map" and preserves\nthat interface while we work towards a more official API.

\n", + "access": "private", + "tagname": "", + "methods": [ + { + "file": "addon/-private/system/internal-model-map.js", + "line": 95, + "description": "

Destroy all models in the internalModelTest and wipe metadata.

\n", + "itemtype": "method", + "name": "clear", + "class": "InternalModelMap", + "module": "ember-data" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InvalidError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InvalidError.json deleted file mode 100644 index 4e236243c..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-InvalidError.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-InvalidError", - "type": "class", - "attributes": { - "name": "InvalidError", - "shortname": "InvalidError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 119, - "description": "

A InvalidError is used by an adapter to signal the external API\nwas unable to process a request because the content was not\nsemantically correct or meaningful per the API. Usually, this means a\nrecord failed some form of server-side validation. When a promise\nfrom an adapter is rejected with a InvalidError the record will\ntransition to the invalid state and the errors will be set to the\nerrors property on the record.

\n

For Ember Data to correctly map errors to their corresponding\nproperties on the model, Ember Data expects each error to be\na valid JSON-API error object with a source/pointer that matches\nthe property name. For example, if you had a Post model that\nlooked like this.

\n

```app/models/post.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "attr": "('string') content;\n}\n```\n\nTo show an error from the server related to the `title` and\n`content` properties your adapter could return a promise that\nrejects with a `InvalidError` object that looks like this:\n\n```app/adapters/post.js\nimport RSVP from 'RSVP';\nimport RESTAdapter from '@ember-data/adapter/rest';\nimport { InvalidError } from '@ember-data/adapter/error';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n updateRecord() {\n // Fictional adapter that always rejects\n return RSVP.reject(new InvalidError([\n {\n detail: 'Must be unique',\n source: { pointer: '/data/attributes/title' }\n },\n {\n detail: 'Must not be blank',\n source: { pointer: '/data/attributes/content'}\n }\n ]));\n }\n}\n```\n\nYour backend may use different property names for your records the\nstore will attempt to extract and normalize the errors using the\nserializer's `extractErrors` method before the errors get added to\nthe model. As a result, it is safe for the `InvalidError` to\nwrap the error payload unaltered.", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONAPISerializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONAPISerializer.json deleted file mode 100644 index 9e0fca767..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONAPISerializer.json +++ /dev/null @@ -1,1965 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-JSONAPISerializer", - "type": "class", - "attributes": { - "name": "JSONAPISerializer", - "shortname": "JSONAPISerializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/json-api", - "namespace": "", - "file": "../serializer/src/json-api.js", - "line": 13, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.

\n

JSONAPISerializer supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.

\n

This serializer normalizes a JSON API payload that looks like:

\n

```app/models/player.js\n import Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class Player extends Model {

\n", - "attr": "('string') location;", - "belongsto": "('club') club;\n }\n ```\n\n ```app/models/club.js\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Club extends Model {", - "hasmany": "('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```", - "mainName": "@ember-data/serializer/json-api", - "tag": "main", - "_main": true, - "since": "1.13.0", - "access": "public", - "tagname": "", - "extends": "JSONSerializer", - "methods": [ - { - "file": "../packages/serializer/src/json-api.js", - "line": 139, - "itemtype": "method", - "name": "_normalizeDocumentHelper", - "params": [ - { - "name": "documentHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 176, - "itemtype": "method", - "name": "_normalizeRelationshipDataHelper", - "params": [ - { - "name": "relationshipDataHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 188, - "itemtype": "method", - "name": "_normalizeResourceHelper", - "params": [ - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 215, - "description": "

Normalize some data and push it into the store.

\n", - "itemtype": "method", - "name": "pushPayload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 228, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 278, - "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 305, - "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationships", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 343, - "itemtype": "method", - "name": "_extractType", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "String" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 354, - "description": "

Dasherizes and singularizes the model name in the payload to match\nthe format Ember Data uses internally for the model name.

\n

For example the key posts would be converted to post and the\nkey studentAssesments would be converted to student-assesment.

\n", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 370, - "description": "

Converts the model name to a pluralized version of the model name.

\n

For example post would be converted to posts and\nstudent-assesment would be converted to student-assesments.

\n", - "itemtype": "method", - "name": "payloadKeyFromModelName", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 406, - "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.\nBy default JSONAPISerializer follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as the word separator in the JSON\nattribute keys.

\n

This behaviour can be easily customized by extending this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPISerializer from '@ember-data/serializer/json-api';\nimport { dasherize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONAPISerializer {\n  keyForAttribute(attr, method) {\n    return dasherize(attr).toUpperCase();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 438, - "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties.\nBy default JSONAPISerializer follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as word separators in\nrelationship properties.

\n

This behaviour can be easily customized by extending this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
 import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n   keyForRelationship(key, relationship, method) {\n     return underscore(key);\n   }\n }
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 470, - "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

For example, consider this model:

\n

```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class CommentModel extends Model {

\n", - "attr": "body;", - "belongsto": "('user', { async: false, inverse: null })\n author;\n}\n```\n\nThe default serialization would create a JSON-API resource object like:\n\n```javascript\n{\n \"data\": {\n \"type\": \"comments\",\n \"attributes\": {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n },\n \"relationships\": {\n \"author\": {\n \"data\": {\n \"id\": \"12\",\n \"type\": \"users\"\n }\n }\n }\n }\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the attributes hash.\n\nBelongs-to relationships are converted into JSON-API\nresource identifier objects.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe JSONAPIAdapter passes in `includeId: true` when serializing a record\nfor `createRecord` or `updateRecord`.\n\n## Customization\n\nYour server may expect data in a different format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn data formatted to match your API's expectations, or override\nthe invoked adapter method and do the serialization in the adapter directly\nby using the provided snapshot.\n\nIf your API's format differs greatly from the JSON:API spec, you should\nconsider authoring your own adapter and serializer instead of extending\nthis class.\n\n```app/serializers/post.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\n\nexport default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\nimport { underscore, singularize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return underscore(attribute).toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + '_IDS';\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n}\n```\n\n## Tweaking the Default Formatting\n\nIf you just want to do some small tweaks on the default JSON:API formatted response,\nyou can call `super.serialize` first and make the tweaks\non the returned object.\n\n```app/serializers/post.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\n\nexport default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.data.attributes.subject = json.data.attributes.title;\n delete json.data.attributes.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 188, - "description": "

Given a subclass of Model and a JSON object this method will\niterate through each attribute of the Model and invoke the\nTransform#deserialize method on the matching property of the\nJSON object. This method is typically called after the\nserializer's normalize method.

\n", - "itemtype": "method", - "name": "applyTransforms", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "data", - "description": "The data to transform", - "type": "Object" - } - ], - "return": { - "description": "data The transformed data object", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 217, - "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

This method delegates to a more specific normalize method based on\nthe requestType.

\n

To override this method with a custom one, make sure to call\nreturn super.normalizeResponse(store, primaryModelClass, payload, id, requestType) with your\npre-processed data.

\n

Here's an example of using normalizeResponse manually:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
socket.on('message', function(message) {\n  let data = message.data;\n  let modelClass = store.modelFor(data.modelName);\n  let serializer = store.serializerFor(data.modelName);\n  let normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n  store.push(normalized);\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 278, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 296, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is queryRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 314, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findAll

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindAllResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 332, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findBelongsTo

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindBelongsToResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 350, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findHasMany

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindHasManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 368, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findMany

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 386, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is query

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 404, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is createRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeCreateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 422, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is deleteRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeDeleteRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 440, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is updateRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeUpdateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 458, - "description": "

normalizeUpdateRecordResponse, normalizeCreateRecordResponse and\nnormalizeDeleteRecordResponse delegate to this method by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSaveResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 476, - "description": "

normalizeQueryResponse and normalizeFindRecordResponse delegate to this\nmethod by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSingleResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 494, - "description": "

normalizeQueryResponse, normalizeFindManyResponse, and normalizeFindHasManyResponse delegate\nto this method by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeArrayResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 512, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 561, - "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '<app-name>/utils/string-utils';\nimport { get } from '@ember/object';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  normalize(typeClass, hash) {\n    let fields = typeClass.fields;\n\n    fields.forEach(function(type, field) {\n      let payloadField = underscore(field);\n      if (field === payloadField) { return; }\n\n      hash[field] = hash[payloadField];\n      delete hash[payloadField];\n    });\n\n    return super.normalize(...arguments);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 625, - "description": "

Returns the resource's ID.

\n", - "itemtype": "method", - "name": "extractId", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 640, - "description": "

Returns the resource's attributes formatted as a JSON-API "attributes object".

\n

http://jsonapi.org/format/#document-resource-object-attributes

\n", - "itemtype": "method", - "name": "extractAttributes", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 665, - "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 700, - "description": "

Returns a polymorphic relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n

relationshipOptions is a hash which contains more information about the\npolymorphic relationship which should be extracted:

\n
    \n
  • resourceHash complete hash of the resource the relationship should be\nextracted from
  • \n
  • relationshipKey key under which the value for the relationship is\nextracted from the resourceHash
  • \n
  • relationshipMeta meta information about the relationship
  • \n
\n", - "itemtype": "method", - "name": "extractPolymorphicRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - }, - { - "name": "relationshipOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 724, - "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationships", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 796, - "description": "

Dasherizes the model name in the payload

\n", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 808, - "itemtype": "method", - "name": "normalizeRelationships", - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 831, - "itemtype": "method", - "name": "normalizeUsingDeclaredMapping", - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 864, - "description": "

Looks up the property key that was set by the custom attr mapping\npassed to the serializer.

\n", - "itemtype": "method", - "name": "_getMappedKey", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 903, - "description": "

Check attrs.key.serialize property to inform if the key\ncan be serialized

\n", - "itemtype": "method", - "name": "_canSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key can be serialized", - "type": "Boolean" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 918, - "description": "

When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized

\n", - "itemtype": "method", - "name": "_mustSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key must be serialized", - "type": "Boolean" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 934, - "description": "

Check if the given hasMany relationship should be serialized

\n

By default only many-to-many and many-to-none relationships are serialized.\nThis could be configured per relationship by Serializer's attrs object.

\n", - "itemtype": "method", - "name": "shouldSerializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "relationshipType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the hasMany relationship should be serialized", - "type": "Boolean" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 957, - "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n

```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class CommentModel extends Model {

\n", - "attr": "body;", - "belongsto": "('user') author;\n}\n```\n\nThe default serialization would create a JSON object like:\n\n```javascript\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\nimport { singularize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call `super.serialize` first and make the tweaks on\nthe returned JSON.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1135, - "description": "

You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTSerializer from '@ember-data/serializer/rest';\nimport { decamelize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  serializeIntoHash(data, type, snapshot, options) {\n    let root = decamelize(type.modelName);\n    data[root] = this.serialize(snapshot, options);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeIntoHash", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1168, - "description": "

serializeAttribute can be used to customize how attr\nproperties are serialized

\n

For example if you wanted to ensure all your attributes were always\nserialized as properties on an attributes object you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  serializeAttribute(snapshot, json, key, attributes) {\n    json.attributes = json.attributes || {};\n    super.serializeAttribute(snapshot, json.attributes, key, attributes);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "attribute", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1216, - "description": "

serializeBelongsTo can be used to customize how belongsTo\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  serializeBelongsTo(snapshot, json, relationship) {\n    let key = relationship.key;\n    let belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;\n\n    json[key] = !belongsTo ? null : belongsTo.record.toJSON();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1270, - "description": "

serializeHasMany can be used to customize how hasMany\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  serializeHasMany(snapshot, json, relationship) {\n    let key = relationship.key;\n    if (key === 'comments') {\n      return;\n    } else {\n      super.serializeHasMany(...arguments);\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1317, - "description": "

You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n{ polymorphic: true } is pass as the second argument to the\nbelongsTo function.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class CommentSerializer extends JSONSerializer {\n  serializePolymorphicType(snapshot, json, relationship) {\n    let key = relationship.key;\n    let belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n    if (!belongsTo) {\n      json[key + '_type'] = null;\n    } else {\n      json[key + '_type'] = belongsTo.modelName;\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializePolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1352, - "description": "

extractMeta is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the meta property of the payload object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  extractMeta(store, typeClass, payload) {\n    if (payload && payload.hasOwnProperty('_pagination')) {\n      let meta = payload._pagination;\n      delete payload._pagination;\n      return meta;\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "extractMeta", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1387, - "description": "

extractErrors is used to extract model errors when a call\nto Model#save fails with an InvalidError. By default\nEmber Data expects error information to be located on the errors\nproperty of the payload object.

\n

This serializer expects this errors object to be an Array similar\nto the following, compliant with the https://jsonapi.org/format/#errors specification:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
{\n  "errors": [\n    {\n      "detail": "This username is already taken!",\n      "source": {\n        "pointer": "data/attributes/username"\n      }\n    }, {\n      "detail": "Doesn't look like a valid email.",\n      "source": {\n        "pointer": "data/attributes/email"\n      }\n    }\n  ]\n}
\n
\n
\n \n

The key detail provides a textual description of the problem.\nAlternatively, the key title can be used for the same purpose.

\n

The nested keys source.pointer detail which specific element\nof the request data was invalid.

\n

Note that JSON-API also allows for object-level errors to be placed\nin an object with pointer data, signifying that the problem\ncannot be traced to a specific attribute:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "errors": [\n    {\n      "detail": "Some generic non property error message",\n      "source": {\n        "pointer": "data"\n      }\n    }\n  ]\n}
\n
\n
\n \n

When turn into a Errors object, you can read these errors\nthrough the property base:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each @model.errors.base as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

Example of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  extractErrors(store, typeClass, payload, id) {\n    if (payload && typeof payload === 'object' && payload._problems) {\n      payload = payload._problems;\n      this.normalizeErrors(typeClass, payload);\n    }\n    return payload;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "extractErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "(String|Number)" - } - ], - "return": { - "description": "json The deserialized errors", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1522, - "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1549, - "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties. By default\nJSONSerializer does not provide an implementation of this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
  import JSONSerializer from '@ember-data/serializer/json';\n  import { underscore } from '<app-name>/utils/string-utils';\n\n  export default class PostSerializer extends JSONSerializer {\n    keyForRelationship(key, relationship, method) {\n      return `rel_${underscore(key)}`;\n    }\n  }
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1578, - "description": "

keyForLink can be used to define a custom key when deserializing link\nproperties.

\n", - "itemtype": "method", - "name": "keyForLink", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "kind", - "description": "`belongsTo` or `hasMany`", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1594, - "itemtype": "method", - "name": "transformFor", - "access": "private", - "tagname": "", - "params": [ - { - "name": "attributeType", - "description": "", - "type": "String" - }, - { - "name": "skipAssertion", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "transform", - "type": "Transform" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 162, - "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 198, - "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    let json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 240, - "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    let data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/serializer/src/json.js", - "line": 94, - "description": "

The primaryKey is used when serializing and deserializing\ndata. Ember Data always uses the id property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\nprimaryKey property to match the primaryKey of your external\nstore.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  primaryKey = '_id'\n}
\n
\n
\n \n", - "itemtype": "property", - "name": "primaryKey", - "type": "{String}", - "access": "public", - "tagname": "", - "default": "'id'", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 119, - "description": "

The attrs object can be used to declare a simple mapping between\nproperty names on Model records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty key can also be used to designate the attribute's key on\nthe response payload.

\n

Example

\n

```app/models/person.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class PersonModel extends Model {

\n", - "attr": "('boolean') admin;\n}\n```\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PersonSerializer extends JSONSerializer {\n attrs = {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n}\n```\n\nYou can also remove attributes and relationships by setting the `serialize`\nkey to `false` in your mapping object.\n\nExample\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n attrs = {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n}\n```\n\nWhen serialized:\n\n```javascript\n{\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n}\n```\n\nNote that the `admin` is now not included in the payload.\n\nSetting `serialize` to `true` enforces serialization for hasMany\nrelationships even if it's neither a many-to-many nor many-to-none\nrelationship.", - "itemtype": "property", - "name": "attrs", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 140, - "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    let modelClass = this.store.modelFor(relationshipModelName);\n    let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "store", - "type": "{Store}", - "access": "public", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-JSONSerializer", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/json-api", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONSerializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONSerializer.json deleted file mode 100644 index 208754174..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-JSONSerializer.json +++ /dev/null @@ -1,1548 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-JSONSerializer", - "type": "class", - "attributes": { - "name": "JSONSerializer", - "shortname": "JSONSerializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/json", - "namespace": "", - "file": "../serializer/src/json.js", - "line": 16, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.

\n

By default, EmberData uses and recommends the JSONAPISerializer.

\n

JSONSerializer is useful for simpler or legacy backends that may\n not support the http://jsonapi.org/ spec.

\n

For example, given the following User model and JSON payload:

\n

```app/models/user.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "hasmany": "('user') friends;", - "belongsto": "('location') house;", - "attr": "('string') name;\n }\n ```\n\n ```js\n {\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n }\n ```\n\n `JSONSerializer` will normalize the JSON payload to the JSON API format that the\n Ember Data store expects.\n\n You can customize how JSONSerializer processes its payload by passing options in\n the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\n The `JSONSerializer` normalization process follows these steps:\n\n 1. `normalizeResponse`\n - entry method to the serializer.\n 2. `normalizeCreateRecordResponse`\n - a `normalizeResponse` for a specific operation is called.\n 3. `normalizeSingleResponse`|`normalizeArrayResponse`\n - for methods like `createRecord` we expect a single record back, while for methods like `findAll` we expect multiple records back.\n 4. `normalize`\n - `normalizeArrayResponse` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n 5. `extractId` | `extractAttributes` | `extractRelationships`\n - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.", - "mainName": "@ember-data/serializer/json", - "tag": "main", - "_main": true, - "access": "public", - "tagname": "", - "extends": "Serializer", - "methods": [ - { - "file": "../packages/serializer/src/json.js", - "line": 188, - "description": "

Given a subclass of Model and a JSON object this method will\niterate through each attribute of the Model and invoke the\nTransform#deserialize method on the matching property of the\nJSON object. This method is typically called after the\nserializer's normalize method.

\n", - "itemtype": "method", - "name": "applyTransforms", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "data", - "description": "The data to transform", - "type": "Object" - } - ], - "return": { - "description": "data The transformed data object", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 217, - "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

This method delegates to a more specific normalize method based on\nthe requestType.

\n

To override this method with a custom one, make sure to call\nreturn super.normalizeResponse(store, primaryModelClass, payload, id, requestType) with your\npre-processed data.

\n

Here's an example of using normalizeResponse manually:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
socket.on('message', function(message) {\n  let data = message.data;\n  let modelClass = store.modelFor(data.modelName);\n  let serializer = store.serializerFor(data.modelName);\n  let normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n  store.push(normalized);\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 278, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 296, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is queryRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 314, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findAll

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindAllResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 332, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findBelongsTo

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindBelongsToResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 350, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findHasMany

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindHasManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 368, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findMany

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 386, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is query

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 404, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is createRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeCreateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 422, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is deleteRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeDeleteRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 440, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is updateRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeUpdateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 458, - "description": "

normalizeUpdateRecordResponse, normalizeCreateRecordResponse and\nnormalizeDeleteRecordResponse delegate to this method by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSaveResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 476, - "description": "

normalizeQueryResponse and normalizeFindRecordResponse delegate to this\nmethod by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSingleResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 494, - "description": "

normalizeQueryResponse, normalizeFindManyResponse, and normalizeFindHasManyResponse delegate\nto this method by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeArrayResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 512, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 561, - "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '<app-name>/utils/string-utils';\nimport { get } from '@ember/object';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  normalize(typeClass, hash) {\n    let fields = typeClass.fields;\n\n    fields.forEach(function(type, field) {\n      let payloadField = underscore(field);\n      if (field === payloadField) { return; }\n\n      hash[field] = hash[payloadField];\n      delete hash[payloadField];\n    });\n\n    return super.normalize(...arguments);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 625, - "description": "

Returns the resource's ID.

\n", - "itemtype": "method", - "name": "extractId", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 640, - "description": "

Returns the resource's attributes formatted as a JSON-API "attributes object".

\n

http://jsonapi.org/format/#document-resource-object-attributes

\n", - "itemtype": "method", - "name": "extractAttributes", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 665, - "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 700, - "description": "

Returns a polymorphic relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n

relationshipOptions is a hash which contains more information about the\npolymorphic relationship which should be extracted:

\n
    \n
  • resourceHash complete hash of the resource the relationship should be\nextracted from
  • \n
  • relationshipKey key under which the value for the relationship is\nextracted from the resourceHash
  • \n
  • relationshipMeta meta information about the relationship
  • \n
\n", - "itemtype": "method", - "name": "extractPolymorphicRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - }, - { - "name": "relationshipOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 724, - "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationships", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 796, - "description": "

Dasherizes the model name in the payload

\n", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 808, - "itemtype": "method", - "name": "normalizeRelationships", - "access": "private", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 831, - "itemtype": "method", - "name": "normalizeUsingDeclaredMapping", - "access": "private", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 864, - "description": "

Looks up the property key that was set by the custom attr mapping\npassed to the serializer.

\n", - "itemtype": "method", - "name": "_getMappedKey", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 903, - "description": "

Check attrs.key.serialize property to inform if the key\ncan be serialized

\n", - "itemtype": "method", - "name": "_canSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key can be serialized", - "type": "Boolean" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 918, - "description": "

When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized

\n", - "itemtype": "method", - "name": "_mustSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key must be serialized", - "type": "Boolean" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 934, - "description": "

Check if the given hasMany relationship should be serialized

\n

By default only many-to-many and many-to-none relationships are serialized.\nThis could be configured per relationship by Serializer's attrs object.

\n", - "itemtype": "method", - "name": "shouldSerializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "relationshipType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the hasMany relationship should be serialized", - "type": "Boolean" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 957, - "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n

```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class CommentModel extends Model {

\n", - "attr": "body;", - "belongsto": "('user') author;\n}\n```\n\nThe default serialization would create a JSON object like:\n\n```javascript\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\nimport { singularize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call `super.serialize` first and make the tweaks on\nthe returned JSON.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1135, - "description": "

You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTSerializer from '@ember-data/serializer/rest';\nimport { decamelize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  serializeIntoHash(data, type, snapshot, options) {\n    let root = decamelize(type.modelName);\n    data[root] = this.serialize(snapshot, options);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeIntoHash", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1168, - "description": "

serializeAttribute can be used to customize how attr\nproperties are serialized

\n

For example if you wanted to ensure all your attributes were always\nserialized as properties on an attributes object you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  serializeAttribute(snapshot, json, key, attributes) {\n    json.attributes = json.attributes || {};\n    super.serializeAttribute(snapshot, json.attributes, key, attributes);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "attribute", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1216, - "description": "

serializeBelongsTo can be used to customize how belongsTo\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  serializeBelongsTo(snapshot, json, relationship) {\n    let key = relationship.key;\n    let belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;\n\n    json[key] = !belongsTo ? null : belongsTo.record.toJSON();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1270, - "description": "

serializeHasMany can be used to customize how hasMany\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  serializeHasMany(snapshot, json, relationship) {\n    let key = relationship.key;\n    if (key === 'comments') {\n      return;\n    } else {\n      super.serializeHasMany(...arguments);\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1317, - "description": "

You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n{ polymorphic: true } is pass as the second argument to the\nbelongsTo function.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class CommentSerializer extends JSONSerializer {\n  serializePolymorphicType(snapshot, json, relationship) {\n    let key = relationship.key;\n    let belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n    if (!belongsTo) {\n      json[key + '_type'] = null;\n    } else {\n      json[key + '_type'] = belongsTo.modelName;\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializePolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1352, - "description": "

extractMeta is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the meta property of the payload object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  extractMeta(store, typeClass, payload) {\n    if (payload && payload.hasOwnProperty('_pagination')) {\n      let meta = payload._pagination;\n      delete payload._pagination;\n      return meta;\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "extractMeta", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1387, - "description": "

extractErrors is used to extract model errors when a call\nto Model#save fails with an InvalidError. By default\nEmber Data expects error information to be located on the errors\nproperty of the payload object.

\n

This serializer expects this errors object to be an Array similar\nto the following, compliant with the https://jsonapi.org/format/#errors specification:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
{\n  "errors": [\n    {\n      "detail": "This username is already taken!",\n      "source": {\n        "pointer": "data/attributes/username"\n      }\n    }, {\n      "detail": "Doesn't look like a valid email.",\n      "source": {\n        "pointer": "data/attributes/email"\n      }\n    }\n  ]\n}
\n
\n
\n \n

The key detail provides a textual description of the problem.\nAlternatively, the key title can be used for the same purpose.

\n

The nested keys source.pointer detail which specific element\nof the request data was invalid.

\n

Note that JSON-API also allows for object-level errors to be placed\nin an object with pointer data, signifying that the problem\ncannot be traced to a specific attribute:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "errors": [\n    {\n      "detail": "Some generic non property error message",\n      "source": {\n        "pointer": "data"\n      }\n    }\n  ]\n}
\n
\n
\n \n

When turn into a Errors object, you can read these errors\nthrough the property base:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each @model.errors.base as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

Example of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  extractErrors(store, typeClass, payload, id) {\n    if (payload && typeof payload === 'object' && payload._problems) {\n      payload = payload._problems;\n      this.normalizeErrors(typeClass, payload);\n    }\n    return payload;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "extractErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "(String|Number)" - } - ], - "return": { - "description": "json The deserialized errors", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1522, - "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1549, - "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties. By default\nJSONSerializer does not provide an implementation of this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
  import JSONSerializer from '@ember-data/serializer/json';\n  import { underscore } from '<app-name>/utils/string-utils';\n\n  export default class PostSerializer extends JSONSerializer {\n    keyForRelationship(key, relationship, method) {\n      return `rel_${underscore(key)}`;\n    }\n  }
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1578, - "description": "

keyForLink can be used to define a custom key when deserializing link\nproperties.

\n", - "itemtype": "method", - "name": "keyForLink", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "kind", - "description": "`belongsTo` or `hasMany`", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1594, - "itemtype": "method", - "name": "transformFor", - "access": "private", - "tagname": "", - "params": [ - { - "name": "attributeType", - "description": "", - "type": "String" - }, - { - "name": "skipAssertion", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "transform", - "type": "Transform" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 162, - "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 198, - "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    let json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 240, - "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    let data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/serializer/src/json.js", - "line": 94, - "description": "

The primaryKey is used when serializing and deserializing\ndata. Ember Data always uses the id property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\nprimaryKey property to match the primaryKey of your external\nstore.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  primaryKey = '_id'\n}
\n
\n
\n \n", - "itemtype": "property", - "name": "primaryKey", - "type": "{String}", - "access": "public", - "tagname": "", - "default": "'id'", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 119, - "description": "

The attrs object can be used to declare a simple mapping between\nproperty names on Model records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty key can also be used to designate the attribute's key on\nthe response payload.

\n

Example

\n

```app/models/person.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class PersonModel extends Model {

\n", - "attr": "('boolean') admin;\n}\n```\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PersonSerializer extends JSONSerializer {\n attrs = {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n}\n```\n\nYou can also remove attributes and relationships by setting the `serialize`\nkey to `false` in your mapping object.\n\nExample\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n attrs = {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n}\n```\n\nWhen serialized:\n\n```javascript\n{\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n}\n```\n\nNote that the `admin` is now not included in the payload.\n\nSetting `serialize` to `true` enforces serialization for hasMany\nrelationships even if it's neither a many-to-many nor many-to-none\nrelationship.", - "itemtype": "property", - "name": "attrs", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 140, - "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    let modelClass = this.store.modelFor(relationshipModelName);\n    let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "store", - "type": "{Store}", - "access": "public", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-Serializer", - "type": "class" - } - }, - "descendants": { - "data": [ - { - "type": "class", - "id": "ember-data-2.18.5-JSONAPISerializer" - }, - { - "type": "class", - "id": "ember-data-2.18.5-RESTSerializer" - } - ] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/json", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ManyArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ManyArray.json deleted file mode 100644 index daf580a89..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ManyArray.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-ManyArray", - "type": "class", - "attributes": { - "name": "ManyArray", - "shortname": "ManyArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../model/src/-private/many-array.ts", - "line": 43, - "description": "

A ManyArray is a MutableArray that represents the contents of a has-many\nrelationship.

\n

The ManyArray is instantiated lazily the first time the relationship is\nrequested.

\n

This class is not intended to be directly instantiated by consuming applications.

\n

Inverses

\n

Often, the relationships in Ember Data applications will have\nan inverse. For example, imagine the following models are\ndefined:

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment') comments;\n}\n```\n\n```app/models/comment.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "belongsto": "('post') post;\n}\n```\n\nIf you created a new instance of `Post` and added\na `Comment` record to its `comments` has-many\nrelationship, you would expect the comment's `post`\nproperty to be set to the post that contained\nthe has-many.\n\nWe call the record to which a relationship belongs-to the\nrelationship's _owner_.", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 284, - "description": "

Reloads all of the records in the manyArray. If the manyArray\nholds a relationship that was originally fetched using a links url\nEmber Data will revisit the original links url to repopulate the\nrelationship.

\n

If the manyArray holds the result of a store.query() reload will\nre-run the original query.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let user = store.peekRecord('user', '1')\nawait login(user);\n\nlet permissions = await user.permissions;\nawait permissions.reload();
\n
\n
\n \n", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 311, - "description": "

Saves all of the records in the ManyArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let inbox = await store.findRecord('inbox', '1');\nlet messages = await inbox.messages;\nmessages.forEach((message) => {\n  message.isRead = true;\n});\nmessages.save();
\n
\n
\n \n", - "itemtype": "method", - "name": "save", - "access": "public", - "tagname": "", - "return": { - "description": "promise", - "type": "PromiseArray" - }, - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 330, - "description": "

Create a child record within the owner

\n", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "record", - "type": "Model" - }, - "class": "ManyArray", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 88, - "description": "

The loading state of this array

\n", - "itemtype": "property", - "name": "isLoaded", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 96, - "description": "

true if the relationship is polymorphic, false otherwise.

\n", - "itemtype": "property", - "name": "isPolymorphic", - "type": "Boolean", - "access": "private", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 104, - "description": "

Metadata associated with the request for async hasMany relationships.

\n

Example

\n

Given that the server returns the following JSON payload when fetching a\nhasMany relationship:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
{\n  "comments": [{\n    "id": 1,\n    "comment": "This is the first comment",\n  }, {\n// ...\n  }],\n\n  "meta": {\n    "page": 1,\n    "total": 5\n  }\n}
\n
\n
\n \n

You can then access the meta data via the meta property:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let comments = await post.comments;\nlet meta = comments.meta;\n\n// meta.page => 1\n// meta.total => 5
\n
\n
\n \n", - "itemtype": "property", - "name": "meta", - "type": "Object | null", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 142, - "description": "

Retrieve the links for this relationship

\n", - "itemtype": "property", - "name": "links", - "type": "Object | null", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Model.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Model.json deleted file mode 100644 index 5de104d7a..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Model.json +++ /dev/null @@ -1,804 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Model", - "type": "class", - "attributes": { - "name": "Model", - "shortname": "Model", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/model.js", - "line": 100, - "description": "

Base class from which Models can be defined.

\n

```js\nimport Model, { attr } from '@ember-data/model';

\n

export default class User extends Model {

\n", - "attr": "name;\n}\n```", - "access": "public", - "tagname": "", - "extends": "Ember.EmberObject", - "methods": [ - { - "file": "../packages/model/src/-private/model.js", - "line": 610, - "description": "

Create a JSON representation of the record, using the serialization\nstrategy of the store's adapter.

\n

serialize takes an optional hash as a parameter, currently\nsupported options are:

\n
    \n
  • includeId: true if the record's ID should be included in the\nJSON representation.
  • \n
\n", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "an object whose values are primitive JSON values only", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 645, - "description": "

Marks the record as deleted but does not save it. You must call\nsave afterwards if you want to persist it. You might use this\nmethod if you want to allow the user to still rollbackAttributes()\nafter a delete was made.

\n

Example

\n

```app/controllers/model/delete.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';

\n

export default class ModelDeleteController extends Controller {

\n", - "action": "undo() {\n this.model.rollbackAttributes();\n }\n}\n```", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 685, - "description": "

Same as deleteRecord, but saves the record immediately.

\n

Example

\n

```app/controllers/model/delete.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';

\n

export default class ModelDeleteController extends Controller {

\n", - "action": "delete() {\n this.model.destroyRecord().then(function() {\n this.transitionToRoute('model.index');\n });\n }\n}\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to your adapter via the snapshot\n\n```js\nrecord.destroyRecord({ adapterOptions: { subscribe: false } });\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n deleteRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n}\n```", - "itemtype": "method", - "name": "destroyRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", - "type": "Promise" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 744, - "description": "

Unloads the record from the store. This will not send a delete request\nto your server, it just unloads the record from memory.

\n", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 758, - "itemtype": "method", - "name": "_notifyProperties", - "access": "private", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 775, - "description": "

Returns an object, whose keys are changed properties, and value is\nan [oldProp, newProp] array.

\n

The array represents the diff of the canonical state with the local state\nof the model. Note: if the model is created locally, the canonical state is\nempty since the adapter hasn't acknowledged the attributes yet:

\n

Example

\n

```app/models/mascot.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class MascotModel extends Model {

\n", - "attr": "('boolean', {\n defaultValue: false\n })\n isAdmin;\n}\n```\n\n```javascript\nlet mascot = store.createRecord('mascot');\n\nmascot.changedAttributes(); // {}\n\nmascot.set('name', 'Tomster');\nmascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\nmascot.set('isAdmin', true);\nmascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\nmascot.save().then(function() {\n mascot.changedAttributes(); // {}\n\n mascot.set('isAdmin', false);\n mascot.changedAttributes(); // { isAdmin: [true, false] }\n});\n```", - "itemtype": "method", - "name": "changedAttributes", - "access": "public", - "tagname": "", - "return": { - "description": "an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 825, - "description": "

If the model hasDirtyAttributes this function will discard any unsaved\nchanges. If the model isNew it will be removed from the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
record.name; // 'Untitled Document'\nrecord.set('name', 'Doc 1');\nrecord.name; // 'Doc 1'\nrecord.rollbackAttributes();\nrecord.name; // 'Untitled Document'
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "rollbackAttributes", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 857, - "itemtype": "method", - "name": "_createSnapshot", - "access": "private", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 873, - "description": "

Save the record and persist any changes to the record to an\nexternal source via the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
record.set('name', 'Tomster');\nrecord.save().then(function() {\n  // Success callback\n}, function() {\n  // Error callback\n});
\n
\n
\n \n

If you pass an object using the adapterOptions property of the options\n argument it will be passed to your adapter via the snapshot.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
record.save({ adapterOptions: { subscribe: false } });
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n  updateRecord(store, type, snapshot) {\n    if (snapshot.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "save", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", - "type": "Promise" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 926, - "description": "

Reload the record from the adapter.

\n

This will only work if the record has already finished loading.

\n

Example

\n

```app/controllers/model/view.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';

\n

export default class ViewController extends Controller {

\n", - "action": "reload() {\n this.model.reload().then(function(model) {\n // do something with the reloaded model\n });\n }\n}\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "optional, may include `adapterOptions` hash which will be passed to adapter request", - "type": "Object" - } - ], - "return": { - "description": "a promise that will be resolved with the record when the\nadapter returns successfully or rejected if the adapter returns\nwith an error.", - "type": "Promise" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 987, - "description": "

Get the reference for the specified belongsTo relationship.

\n

Example

\n

```app/models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n```\n\n```javascript\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n});\nlet userRef = blog.belongsTo('user');\n\n// check if the user relationship is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n} else if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n}\n\n// load user (via store.findRecord or store.findBelongsTo)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n}).then(function(user) {\n userRef.value() === user;\n});\n```", - "itemtype": "method", - "name": "belongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "name", - "description": "of the relationship", - "type": "String" - } - ], - "since": "2.5.0", - "return": { - "description": "reference for this relationship", - "type": "BelongsToReference" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1055, - "description": "

Get the reference for the specified hasMany relationship.

\n

Example

\n

```app/models/blog.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n comments: {\n data: [\n { type: 'comment', id: 1 },\n { type: 'comment', id: 2 }\n ]\n }\n }\n }\n});\nlet commentsRef = blog.hasMany('comments');\n\n// check if the comments are loaded already\nlet isLoaded = commentsRef.value() !== null;\n\n// get the records of the reference (null if not yet available)\nlet comments = commentsRef.value();\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n\n// load comments (via store.findMany or store.findHasMany)\ncommentsRef.load().then(...)\n\n// or trigger a reload\ncommentsRef.reload().then(...)\n\n// provide data for reference\ncommentsRef.push([{ type: 'comment', id: 1 }, { type: 'comment', id: 2 }]).then(function(comments) {\n commentsRef.value() === comments;\n});\n```", - "itemtype": "method", - "name": "hasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "name", - "description": "of the relationship", - "type": "String" - } - ], - "since": "2.5.0", - "return": { - "description": "reference for this relationship", - "type": "HasManyReference" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1118, - "description": "

Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.

\n

The callback method you provide should have the following signature (all\nparameters are optional):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
function(name, descriptor);
\n
\n
\n \n
    \n
  • name the name of the current property in the iteration
  • \n
  • descriptor the meta object that describes this relationship
  • \n
\n

The relationship descriptor argument is an object with the following properties.

\n
    \n
  • key String the name of this relationship on the Model
  • \n
  • kind String "hasMany" or "belongsTo"
  • \n
  • options Object the original options hash passed when the relationship was declared
  • \n
  • parentType Model the type of the Model that owns this relationship
  • \n
  • type String the type name of the related Model
  • \n
\n

Note that in addition to a callback, you can also pass an optional target\nobject that will be set as this on the context.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n   serialize(record, options) {\n   let json = {};\n\n   record.eachRelationship(function(name, descriptor) {\n     if (descriptor.kind === 'hasMany') {\n       let serializedHasManyName = name.toUpperCase() + '_IDS';\n       json[serializedHasManyName] = record.get(name).map(r => r.id);\n     }\n   });\n\n   return json;\n }\n  }
\n
\n
\n \n", - "itemtype": "method", - "name": "eachRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1189, - "description": "

Create should only ever be called by the store. To create an instance of a\nModel in a dirty state use store.createRecord.

\n

To create instances of Model in a clean state, use store.push

\n", - "itemtype": "method", - "name": "create", - "access": "private", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1250, - "description": "

For a given relationship name, returns the model type of the relationship.

\n

For example, if you define a model like this:

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('comment') comments;\n}\n```\n\nCalling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.", - "itemtype": "method", - "name": "typeForRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "an instance of Store", - "type": "Store" - } - ], - "return": { - "description": "the type of the relationship, or undefined", - "type": "Model" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1291, - "description": "

Find the relationship which is the inverse of the one asked for.

\n

For example, if you define models like this:

\n

```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';

\n

export default class PostModel extends Model {

\n", - "hasmany": "('message') comments;\n }\n```\n\n```app/models/message.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class MessageModel extends Model {", - "belongsto": "('post') owner;\n }\n```\n\n``` js\nstore.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }\n```", - "itemtype": "method", - "name": "inverseFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "", - "type": "Store" - } - ], - "return": { - "description": "the inverse relationship, or null", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1806, - "description": "

Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.

\n", - "itemtype": "method", - "name": "eachRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1828, - "description": "

Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.

\n", - "itemtype": "method", - "name": "eachRelatedType", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2001, - "description": "

Iterates through the attributes of the model, calling the passed function on each\nattribute.

\n

The callback method you provide should have the following signature (all\nparameters are optional):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
function(name, meta);
\n
\n
\n \n
    \n
  • name the name of the current property in the iteration
  • \n
  • meta the meta object for the attribute property in the iteration
  • \n
\n

Note that in addition to a callback, you can also pass an optional target\nobject that will be set as this on the context.

\n

Example

\n

```javascript\nimport Model, { attr } from '@ember-data/model';

\n

class PersonModel extends Model {

\n", - "attr": "('date') birthday;\n }\n\nPersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", - "itemtype": "method", - "name": "eachAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2056, - "description": "

Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.

\n

The callback method you provide should have the following signature (all\nparameters are optional):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
function(name, type);
\n
\n
\n \n
    \n
  • name the name of the current property in the iteration
  • \n
  • type a string containing the name of the type of transformed\napplied to the attribute
  • \n
\n

Note that in addition to a callback, you can also pass an optional target\nobject that will be set as this on the context.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Model, { attr } from '@ember-data/model';\n\nlet Person = Model.extend({\n   firstName: attr(),\n   lastName: attr('string'),\n   birthday: attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n   // do thing\n });\n\n// prints:\n// lastName string\n// birthday date
\n
\n
\n \n", - "itemtype": "method", - "name": "eachTransformedAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2112, - "description": "

Returns the name of the model class.

\n", - "itemtype": "method", - "name": "toString", - "access": "public", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2135, - "description": "

Provides info about the model for debugging purposes\nby grouping the properties into more semantic groups.

\n

Meant to be used by debugging tools such as the Chrome Ember Extension.

\n
    \n
  • Groups all attributes in "Attributes" group.
  • \n
  • Groups all belongsTo relationships in "Belongs To" group.
  • \n
  • Groups all hasMany relationships in "Has Many" group.
  • \n
  • Groups all flags in "Flags" group.
  • \n
  • Flags relationship CPs as expensive properties.
  • \n
\n", - "itemtype": "method", - "name": "_debugInfo", - "access": "private", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/model/src/-private/model.js", - "line": 171, - "description": "

If this property is true the record is in the empty\nstate. Empty is the first state all records enter after they have\nbeen created. Most records created by the store will quickly\ntransition to the loading state if data needs to be fetched from\nthe server or the created state if the record is created on the\nclient. A record can also enter the empty state if the adapter is\nunable to locate the record.

\n", - "itemtype": "property", - "name": "isEmpty", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 190, - "description": "

If this property is true the record is in the loading state. A\nrecord enters this state when the store asks the adapter for its\ndata. It remains in this state until the adapter provides the\nrequested data.

\n", - "itemtype": "property", - "name": "isLoading", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 206, - "description": "

If this property is true the record is in the loaded state. A\nrecord enters this state when its data is populated. Most of a\nrecord's lifecycle is spent inside substates of the loaded\nstate.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let record = store.createRecord('model');\nrecord.isLoaded; // true\n\nstore.findRecord('model', 1).then(function(model) {\n  model.isLoaded; // true\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "isLoaded", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 233, - "description": "

If this property is true the record is in the dirty state. The\nrecord has local changes that have not yet been saved by the\nadapter. This includes records that have been created (but not yet\nsaved) or deleted.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let record = store.createRecord('model');\nrecord.hasDirtyAttributes; // true\n\nstore.findRecord('model', 1).then(function(model) {\n  model.hasDirtyAttributes; // false\n  model.set('foo', 'some value');\n  model.hasDirtyAttributes; // true\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "property", - "name": "hasDirtyAttributes", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 263, - "description": "

If this property is true the record is in the saving state. A\nrecord enters the saving state when save is called, but the\nadapter has not yet acknowledged that the changes have been\npersisted to the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
let record = store.createRecord('model');\nrecord.isSaving; // false\nlet promise = record.save();\nrecord.isSaving; // true\npromise.then(function() {\n  record.isSaving; // false\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "isSaving", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 291, - "description": "

If this property is true the record is in the deleted state\nand has been marked for deletion. When isDeleted is true and\nhasDirtyAttributes is true, the record is deleted locally but the deletion\nwas not yet persisted. When isSaving is true, the change is\nin-flight. When both hasDirtyAttributes and isSaving are false, the\nchange has persisted.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n
let record = store.createRecord('model');\nrecord.isDeleted;    // false\nrecord.deleteRecord();\n\n// Locally deleted\nrecord.isDeleted;           // true\nrecord.hasDirtyAttributes;  // true\nrecord.isSaving;            // false\n\n// Persisting the deletion\nlet promise = record.save();\nrecord.isDeleted;    // true\nrecord.isSaving;     // true\n\n// Deletion Persisted\npromise.then(function() {\n  record.isDeleted;          // true\n  record.isSaving;           // false\n  record.hasDirtyAttributes; // false\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "isDeleted", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 334, - "description": "

If this property is true the record is in the new state. A\nrecord will be in the new state when it has been created on the\nclient and the adapter has not yet report that it was successfully\nsaved.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let record = store.createRecord('model');\nrecord.isNew; // true\n\nrecord.save().then(function(model) {\n  model.isNew; // false\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "isNew", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 361, - "description": "

If this property is true the record is in the valid state.

\n

A record will be in the valid state when the adapter did not report any\nserver-side validation failures.

\n", - "itemtype": "property", - "name": "isValid", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 377, - "description": "

If the record is in the dirty state this property will report what\nkind of change has caused it to move into the dirty\nstate. Possible values are:

\n
    \n
  • created The record has been created by the client and not yet saved to the adapter.
  • \n
  • updated The record has been updated by the client and not yet saved to the adapter.
  • \n
  • deleted The record has been deleted by the client and not yet saved to the adapter.
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
let record = store.createRecord('model');\nrecord.dirtyType; // 'created'
\n
\n
\n \n", - "itemtype": "property", - "name": "dirtyType", - "access": "public", - "tagname": "", - "type": "{String}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 403, - "description": "

If true the adapter reported that it was unable to save local\nchanges to the backend for any reason other than a server-side\nvalidation error.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
record.isError; // false\nrecord.set('foo', 'valid value');\nrecord.save().then(null, function() {\n  record.isError; // true\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "isError", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 433, - "description": "

If true the store is attempting to reload the record from the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
record.isReloading; // false\nrecord.reload();\nrecord.isReloading; // true
\n
\n
\n \n", - "itemtype": "property", - "name": "isReloading", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 451, - "description": "

All ember models have an id property. This is an identifier\nmanaged by an external source. These are always coerced to be\nstrings before being used internally. Note when declaring the\nattributes for a model it is an error to declare an id\nattribute.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
let record = store.createRecord('model');\nrecord.id; // null\n\nstore.findRecord('model', 1).then(function(model) {\n  model.id; // '1'\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "id", - "access": "public", - "tagname": "", - "type": "{String}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 504, - "itemtype": "property", - "name": "currentState", - "access": "private", - "tagname": "", - "type": "{Object}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 528, - "description": "

The store service instance which created this record instance

\n", - "itemtype": "property", - "name": "store", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 535, - "description": "

When the record is in the invalid state this object will contain\nany errors returned by the adapter. When present the errors hash\ncontains keys corresponding to the invalid property names\nand values which are arrays of Javascript objects with two keys:

\n
    \n
  • message A string containing the error message from the backend
  • \n
  • attribute The name of the property associated with this error message
  • \n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
record.errors.length; // 0\nrecord.set('foo', 'invalid value');\nrecord.save().catch(function() {\n  record.errors.foo;\n  // [{message: 'foo should be a number.', attribute: 'foo'}]\n});
\n
\n
\n \n

The errors property is useful for displaying error messages to\nthe user.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
<label>Username: <Input @value={{@model.username}} /> </label>\n{{#each @model.errors.username as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}\n<label>Email: <Input @value={{@model.email}} /> </label>\n{{#each @model.errors.email as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

You can also access the special messages property on the error\nobject to get an array of all the error strings.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each @model.errors.messages as |message|}}\n  <div class="error">\n    {{message}}\n  </div>\n{{/each}}
\n
\n
\n \n", - "itemtype": "property", - "name": "errors", - "access": "public", - "tagname": "", - "type": "{Errors}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 594, - "description": "

This property holds the AdapterError object with which\nlast adapter operation was rejected.

\n", - "itemtype": "property", - "name": "adapterError", - "access": "public", - "tagname": "", - "type": "{AdapterError}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1200, - "description": "

Represents the model's class name as a string. This can be used to look up the model's class name through\nStore's modelFor method.

\n

modelName is generated for you by Ember Data. It will be a lowercased, dasherized string.\nFor example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.modelFor('post').modelName; // 'post'\nstore.modelFor('blog-post').modelName; // 'blog-post'
\n
\n
\n \n

The most common place you'll want to access modelName is in your serializer's payloadKeyFromModelName method. For example, to change payload\nkeys to underscore (instead of dasherized), you might use the following code:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTSerializer from '@ember-data/serializer/rest';\nimport { underscore } from '<app-name>/utils/string-utils';\n\nexport default const PostSerializer = RESTSerializer.extend({\n  payloadKeyFromModelName(modelName) {\n    return underscore(modelName);\n  }\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "modelName", - "access": "public", - "tagname": "", - "type": "String", - "readonly": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1480, - "description": "

The model's relationships as a map, keyed on the type of the\nrelationship. The value of each entry is an array containing a descriptor\nfor each relationship with that type, describing the name of the relationship\nas well as the type.

\n

For example, given the following model definition:

\n

```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "hasmany": "('post') posts;\n }\n```\n\nThis computed property would return a map describing these\nrelationships, like this:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\nimport User from 'app/models/user';\nimport Post from 'app/models/post';\n\nlet relationships = Blog.relationships;\nrelationships.user;\n//=> [ { name: 'users', kind: 'hasMany' },\n// { name: 'owner', kind: 'belongsTo' } ]\nrelationships.post;\n//=> [ { name: 'posts', kind: 'hasMany' } ]\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relationships", - "access": "public", - "tagname": "", - "static": 1, - "type": "Map", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1546, - "description": "

A hash containing lists of the model's relationships, grouped\nby the relationship kind. For example, given a model with this\ndefinition:

\n

```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "hasmany": "('post') posts;\n }\n```\n\nThis property would contain the following:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\n\nlet relationshipNames = Blog.relationshipNames;\nrelationshipNames.hasMany;\n//=> ['users', 'posts']\nrelationshipNames.belongsTo;\n//=> ['owner']\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relationshipNames", - "access": "public", - "tagname": "", - "static": 1, - "type": "Object", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1601, - "description": "

An array of types directly related to a model. Each type will be\nincluded once, regardless of the number of relationships it has with\nthe model.

\n

For example, given a model with this definition:

\n

```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "hasmany": "('post') posts;\n }\n```\n\nThis property would contain the following:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\n\nlet relatedTypes = Blog.relatedTypes');\n//=> ['user', 'post']\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relatedTypes", - "access": "public", - "tagname": "", - "static": 1, - "type": "Ember.Array", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1662, - "description": "

A map whose keys are the relationships of a model and whose values are\nrelationship descriptors.

\n

For example, given a model with this\ndefinition:

\n

```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "hasmany": "('post') posts;\n }\n```\n\nThis property would contain the following:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\n\nlet relationshipsByName = Blog.relationshipsByName;\nrelationshipsByName.users;\n//=> { key: 'users', kind: 'hasMany', type: 'user', options: Object, isRelationship: true }\nrelationshipsByName.owner;\n//=> { key: 'owner', kind: 'belongsTo', type: 'user', options: Object, isRelationship: true }\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relationshipsByName", - "access": "public", - "tagname": "", - "static": 1, - "type": "Map", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1744, - "description": "

A map whose keys are the fields of the model and whose values are strings\ndescribing the kind of the field. A model's fields are the union of all of its\nattributes and relationships.

\n

For example:

\n

```app/models/blog.js\nimport Model, { attr, belongsTo, hasMany } from '@ember-data/model';

\n

export default class BlogModel extends Model {

\n", - "hasmany": "('post') posts;", - "belongsto": "('user') owner;", - "attr": "('string') title;\n }\n```\n\n```js\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog'\n\nlet fields = Blog.fields;\nfields.forEach(function(kind, field) {\n // do thing\n });\n\n// prints:\n// users, hasMany\n// owner, belongsTo\n// posts, hasMany\n// title, attribute\n```", - "itemtype": "property", - "name": "fields", - "access": "public", - "tagname": "", - "static": 1, - "type": "Map", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1880, - "description": "

A map whose keys are the attributes of the model (properties\ndescribed by attr) and whose values are the meta object for the\nproperty.

\n

Example

\n

```app/models/person.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class PersonModel extends Model {

\n", - "attr": "('date') birthday;\n }\n```\n\n```javascript\nimport { get } from '@ember/object';\nimport Person from 'app/models/person'\n\nlet attributes = Person.attributes\n\nattributes.forEach(function(meta, name) {\n // do thing\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", - "itemtype": "property", - "name": "attributes", - "access": "public", - "tagname": "", - "static": 1, - "type": "{Map}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1944, - "description": "

A map whose keys are the attributes of the model (properties\ndescribed by attr) and whose values are type of transformation\napplied to each attribute. This map does not include any\nattributes that do not have an transformation type.

\n

Example

\n

```app/models/person.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class PersonModel extends Model {

\n", - "attr": "('date') birthday;\n }\n```\n\n```javascript\nimport { get } from '@ember/object';\nimport Person from 'app/models/person';\n\nlet transformedAttributes = Person.transformedAttributes\n\ntransformedAttributes.forEach(function(field, type) {\n // do thing\n });\n\n// prints:\n// lastName string\n// birthday date\n```", - "itemtype": "property", - "name": "transformedAttributes", - "access": "public", - "tagname": "", - "static": 1, - "type": "{Map}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "Ember.EmberObject", - "type": "missing" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NotFoundError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NotFoundError.json deleted file mode 100644 index 165a039ea..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NotFoundError.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-NotFoundError", - "type": "class", - "attributes": { - "name": "NotFoundError", - "shortname": "NotFoundError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 279, - "description": "

A NotFoundError equates to a HTTP 404 Not Found response status.\nIt is used by an adapter to signal that a request to the external API\nwas rejected because the resource could not be found on the API.

\n

An example use case would be to detect if the user has entered a route\nfor a specific model that does not exist. For example:

\n

```app/routes/post.js\nimport Route from '@ember/routing/route';\nimport { NotFoundError } from '@ember-data/adapter/error';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';

\n

export default class PostRoute extends Route {

\n", - "service": "store;\n model(params) {\n return this.store.findRecord('post', params.post_id);\n }", - "action": "error(error, transition) {\n if (error instanceof NotFoundError) {\n // redirect to a list of all posts instead\n this.transitionTo('posts');\n } else {\n // otherwise let the error bubble\n return true;\n }\n }\n}\n```", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NotificationManager.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NotificationManager.json deleted file mode 100644 index 141b38745..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NotificationManager.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-NotificationManager", - "type": "class", - "attributes": { - "name": "NotificationManager", - "shortname": "NotificationManager", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/managers/notification-manager.ts", - "line": 70, - "description": "

The NotificationManager provides the ability to subscribe to\nchanges to Cache state.

\n

This Feature is what allows EmberData to create subscriptions that\nwork with any framework or change-notification system.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/store/src/-private/managers/notification-manager.ts", - "line": 101, - "description": "

Subscribe to changes for a given resource identifier, resource addition/removal, or document addition/removal.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';\n\nexport interface NotificationCallback {\n  (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;\n  (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n  (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;\n}\nexport interface ResourceOperationCallback {\n  // resource updates\n  (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;\n}\nexport interface DocumentOperationCallback {\n  // document updates\n  (identifier: StableDocumentIdentifier, notificationType: CacheOperation): void;\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "subscribe", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'" - }, - { - "name": "callback", - "description": "", - "type": "NotificationCallback | ResourceOperationCallback | DocumentOperationCallback" - } - ], - "return": { - "description": "an opaque token to be used with unsubscribe", - "type": "UnsubscribeToken" - }, - "class": "NotificationManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/notification-manager.ts", - "line": 156, - "description": "

remove a previous subscription

\n", - "itemtype": "method", - "name": "unsubscribe", - "access": "public", - "tagname": "", - "params": [ - { - "name": "token", - "description": "", - "type": "UnsubscribeToken" - } - ], - "class": "NotificationManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/notification-manager.ts", - "line": 169, - "description": "

Custom Caches and Application Code should not call this method directly.

\n", - "itemtype": "method", - "name": "notify", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "value", - "description": "" - }, - { - "name": "key", - "description": "" - } - ], - "return": { - "description": "whether a notification was delivered to any subscribers", - "type": "Boolean" - }, - "access": "private", - "tagname": "", - "class": "NotificationManager", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NumberTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NumberTransform.json deleted file mode 100644 index a29cd4a8d..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-NumberTransform.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-NumberTransform", - "type": "class", - "attributes": { - "name": "NumberTransform", - "shortname": "NumberTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/number.js", - "line": 9, - "description": "

The NumberTransform class is used to serialize and deserialize\nnumeric attributes on Ember Data record objects. This transform is\nused when number is passed as the type parameter to the\nattr function.

\n

Usage

\n

```app/models/score.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class ScoreModel extends Model {

\n", - "attr": "('date') date;\n}\n```", - "belongsto": "('player') player;", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-PromiseBelongsTo.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-PromiseBelongsTo.json deleted file mode 100644 index 494d8ab9d..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-PromiseBelongsTo.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-PromiseBelongsTo", - "type": "class", - "attributes": { - "name": "PromiseBelongsTo", - "shortname": "PromiseBelongsTo", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/promise-belongs-to.ts", - "line": 38, - "description": "

A PromiseBelongsTo is a PromiseObject that also proxies certain method calls\nto the underlying belongsTo model.\nRight now we proxy:

\n
    \n
  • reload()
  • \n
\n", - "extends": "PromiseObject", - "access": "private", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "PromiseObject", - "type": "missing" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-PromiseManyArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-PromiseManyArray.json deleted file mode 100644 index 2002eb7a3..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-PromiseManyArray.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-PromiseManyArray", - "type": "class", - "attributes": { - "name": "PromiseManyArray", - "shortname": "PromiseManyArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/promise-many-array.ts", - "line": 20, - "description": "

This class is returned as the result of accessing an async hasMany relationship\non an instance of a Model extending from @ember-data/model.

\n

A PromiseManyArray is an iterable proxy that allows templates to consume related\nManyArrays and update once their contents are no longer pending.

\n

In your JS code you should resolve the promise first.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
const comments = await post.comments;
\n
\n
\n \n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 82, - "description": "

Iterate the proxied content. Called by the glimmer iterator in #each\nWe do not guarantee that forEach will always be available. This\nmay eventually be made to use Symbol.Iterator once glimmer supports it.

\n", - "itemtype": "method", - "name": "forEach", - "params": [ - { - "name": "cb", - "description": "" - } - ], - "return": { - "description": "" - }, - "access": "private", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 98, - "description": "

Reload the relationship

\n", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "" - } - ], - "return": { - "description": "" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 142, - "description": "

chain this promise

\n", - "itemtype": "method", - "name": "then", - "access": "public", - "tagname": "", - "params": [ - { - "name": "success", - "description": "" - }, - { - "name": "fail", - "description": "" - } - ], - "return": { - "description": "Promise" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 155, - "description": "

catch errors thrown by this promise

\n", - "itemtype": "method", - "name": "catch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "" - } - ], - "return": { - "description": "Promise" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 166, - "description": "

run cleanup after this promise completes

\n", - "itemtype": "method", - "name": "finally", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "" - } - ], - "return": { - "description": "Promise" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 56, - "description": "

Retrieve the length of the content

\n", - "itemtype": "property", - "name": "length", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 113, - "description": "

Whether the loading promise is still pending

\n", - "itemtype": "property", - "name": "isPending", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 120, - "description": "

Whether the loading promise rejected

\n", - "itemtype": "property", - "name": "isRejected", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 127, - "description": "

Whether the loading promise succeeded

\n", - "itemtype": "property", - "name": "isFulfilled", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 134, - "description": "

Whether the loading promise completed (resolved or rejected)

\n", - "itemtype": "property", - "name": "isSettled", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 188, - "description": "

Retrieve the links for this relationship

\n", - "itemtype": "property", - "name": "links", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 198, - "description": "

Retrieve the meta for this relationship

\n", - "itemtype": "property", - "name": "meta", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RESTAdapter.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RESTAdapter.json deleted file mode 100644 index 89c06b040..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RESTAdapter.json +++ /dev/null @@ -1,1803 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-RESTAdapter", - "type": "class", - "attributes": { - "name": "RESTAdapter", - "shortname": "RESTAdapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/rest", - "namespace": "", - "file": "../adapter/src/rest.ts", - "line": 68, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

The REST adapter allows your store to communicate with an HTTP server by\n transmitting JSON via XHR.

\n

This adapter is designed around the idea that the JSON exchanged with\n the server should be conventional. It builds URLs in a manner that follows\n the structure of most common REST-style web services.

\n

Success and failure

\n

The REST adapter will consider a success any response with a status code\n of the 2xx family ("Success"), as well as 304 ("Not Modified"). Any other\n status code will be considered a failure.

\n

On success, the request promise will be resolved with the full response\n payload.

\n

Failed responses with status code 422 ("Unprocessable Entity") will be\n considered "invalid". The response will be discarded, except for the\n errors key. The request promise will be rejected with a InvalidError.\n This error object will encapsulate the saved errors value.

\n

Any other status codes will be treated as an "adapter error". The request\n promise will be rejected, similarly to the "invalid" case, but with\n an instance of AdapterError instead.

\n

JSON Structure

\n

The REST adapter expects the JSON returned from your server to follow\n these conventions.

\n

Object Root

\n

The JSON payload should be an object that contains the record inside a\n root property. For example, in response to a GET request for\n /posts/1, the JSON should look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
 {\n   "posts": {\n     "id": 1,\n     "title": "I'm Running to Reform the W3C's Tag",\n     "author": "Yehuda Katz"\n   }\n }
\n
\n
\n \n

Similarly, in response to a GET request for /posts, the JSON should\n look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
 {\n   "posts": [\n     {\n       "id": 1,\n       "title": "I'm Running to Reform the W3C's Tag",\n       "author": "Yehuda Katz"\n     },\n     {\n       "id": 2,\n       "title": "Rails is omakase",\n       "author": "D2H"\n     }\n   ]\n }
\n
\n
\n \n

Note that the object root can be pluralized for both a single-object response\n and an array response: the REST adapter is not strict on this. Further, if the\n HTTP server responds to a GET request to /posts/1 (e.g. the response to a\n findRecord query) with more than one object in the array, Ember Data will\n only display the object with the matching ID.

\n

Conventional Names

\n

Attribute names in your JSON payload should be the camelCased versions of\n the attributes in your Ember.js models.

\n

For example, if you have a Person model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n
 import Model, { attr } from '@ember-data/model';\n\n export default Model.extend({\n   firstName: attr('string'),\n   lastName: attr('string'),\n   occupation: attr('string')\n });
\n
\n
\n \n

The JSON returned should look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
 {\n   "people": {\n     "id": 5,\n     "firstName": "Zaphod",\n     "lastName": "Beeblebrox",\n     "occupation": "President"\n   }\n }
\n
\n
\n \n

Relationships

\n

Relationships are usually represented by ids to the record in the\n relationship. The related records can then be sideloaded in the\n response under a key for the type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
 {\n   "posts": {\n     "id": 5,\n     "title": "I'm Running to Reform the W3C's Tag",\n     "author": "Yehuda Katz",\n     "comments": [1, 2]\n   },\n   "comments": [{\n     "id": 1,\n     "author": "User 1",\n     "message": "First!",\n   }, {\n     "id": 2,\n     "author": "User 2",\n     "message": "Good Luck!",\n   }]\n }
\n
\n
\n \n

If the records in the relationship are not known when the response\n is serialized it's also possible to represent the relationship as a\n URL using the links key in the response. Ember Data will fetch\n this URL to resolve the relationship when it is accessed for the\n first time.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
 {\n   "posts": {\n     "id": 5,\n     "title": "I'm Running to Reform the W3C's Tag",\n     "author": "Yehuda Katz",\n     "links": {\n       "comments": "/posts/5/comments"\n     }\n   }\n }
\n
\n
\n \n

Errors

\n

If a response is considered a failure, the JSON payload is expected to include\n a top-level key errors, detailing any specific issues. For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
 {\n   "errors": {\n     "msg": "Something went wrong"\n   }\n }
\n
\n
\n \n

This adapter does not make any assumptions as to the format of the errors\n object. It will simply be passed along as is, wrapped in an instance\n of InvalidError or AdapterError. The serializer can interpret it\n afterwards.

\n

Customization

\n

Endpoint path customization

\n

Endpoint paths can be prefixed with a namespace by setting the namespace\n property on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
 import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   namespace = 'api/1';\n }
\n
\n
\n \n

Requests for the Person model would now target /api/1/people/1.

\n

Host customization

\n

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
 import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   host = 'https://api.example.com';\n }
\n
\n
\n \n

Headers customization

\n

Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary\n headers can be set as key/value pairs on the RESTAdapter's headers\n object and Ember Data will send them along with each ajax request.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
 import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   headers: computed(function() {\n     return {\n       'API_KEY': 'secret key',\n       'ANOTHER_HEADER': 'Some header value'\n     };\n   }\n }
\n
\n
\n \n

headers can also be used as a computed property to support dynamic\n headers. In the example below, the session object has been\n injected into an adapter by Ember's container.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
 import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   headers: computed('session.authToken', function() {\n     return {\n       'API_KEY': this.session.authToken,\n       'ANOTHER_HEADER': 'Some header value'\n     };\n   })\n }
\n
\n
\n \n

In some cases, your dynamic headers may require data from some\n object outside of Ember's observer system (for example\n document.cookie). You can use the\n volatile\n function to set the property into a non-cached mode causing the headers to\n be recomputed with every request.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
 import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   headers: computed(function() {\n     return {\n       'API_KEY': document.cookie.match(/apiKey\\=([^;]*)/)['1'],\n       'ANOTHER_HEADER': 'Some header value'\n     };\n   }).volatile()\n }
\n
\n
\n \n", - "mainName": "@ember-data/adapter/rest", - "tag": "main", - "_main": true, - "access": "public", - "tagname": "", - "is_constructor": 1, - "extends": "Adapter", - "uses": [ - "BuildURLMixin" - ], - "methods": [ - { - "file": "../packages/adapter/src/rest.ts", - "line": 369, - "description": "

By default, the RESTAdapter will send the query params sorted alphabetically to the\nserver.

\n

For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('posts', { sort: 'price', category: 'pets' });
\n
\n
\n \n

will generate a requests like this /posts?category=pets&sort=price, even if the\nparameters were specified in a different order.

\n

That way the generated URL will be deterministic and that simplifies caching mechanisms\nin the backend.

\n

Setting sortQueryParams to a falsey value will respect the original order.

\n

In case you want to sort the query parameters with a different criteria, set\nsortQueryParams to your custom sort function.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  sortQueryParams(params) {\n    let sortedKeys = Object.keys(params).sort().reverse();\n    let len = sortedKeys.length, newParams = {};\n\n    for (let i = 0; i < len; i++) {\n      newParams[sortedKeys[i]] = params[sortedKeys[i]];\n    }\n\n    return newParams;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "sortQueryParams", - "params": [ - { - "name": "obj", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 551, - "description": "

Called by the store in order to fetch the JSON for a given\ntype and ID.

\n

The findRecord method makes an Ajax request to a URL computed by\nbuildURL, and returns a promise for the resulting payload.

\n

This method performs an HTTP GET request with the id provided as part of the query string.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "findRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 576, - "description": "

Called by the store in order to fetch a JSON array for all\nof the records for a given type.

\n

The findAll method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a\npromise for the resulting payload.

\n", - "itemtype": "method", - "name": "findAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 607, - "description": "

Called by the store in order to fetch a JSON array for\nthe records that match a particular query.

\n

The query method makes an Ajax (HTTP GET) request to a URL\ncomputed by buildURL, and returns a promise for the resulting\npayload.

\n

The query argument is a simple JavaScript object that will be passed directly\nto the server as parameters.

\n", - "itemtype": "method", - "name": "query", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 637, - "description": "

Called by the store in order to fetch a JSON object for\nthe record that matches a particular query.

\n

The queryRecord method makes an Ajax (HTTP GET) request to a URL\ncomputed by buildURL, and returns a promise for the resulting\npayload.

\n

The query argument is a simple JavaScript object that will be passed directly\nto the server as parameters.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "queryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 672, - "description": "

Called by the store in order to fetch several records together if coalesceFindRequests is true

\n

For example, if the original payload looks like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{\n  "id": 1,\n  "title": "Rails is omakase",\n  "comments": [ 1, 2, 3 ]\n}
\n
\n
\n \n

The IDs will be passed as a URL-encoded Array of IDs, in this form:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
ids[]=1&ids[]=2&ids[]=3
\n
\n
\n

Many servers, such as Rails and PHP, will automatically convert this URL-encoded array\ninto an Array for you on the server-side. If you want to encode the\nIDs, differently, just override this (one-line) method.

\n

The findMany method makes an Ajax (HTTP GET) request to a URL computed by buildURL, and returns a\npromise for the resulting payload.

\n", - "itemtype": "method", - "name": "findMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 711, - "description": "

Called by the store in order to fetch a JSON array for\nthe unloaded records in a has-many relationship that were originally\nspecified as a URL (inside of links).

\n

For example, if your original payload looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "post": {\n    "id": 1,\n    "title": "Rails is omakase",\n    "links": { "comments": "/posts/1/comments" }\n  }\n}
\n
\n
\n \n

This method will be called with the parent record and /posts/1/comments.

\n

The findHasMany method will make an Ajax (HTTP GET) request to the originally specified URL.

\n

The format of your links value will influence the final request URL via the urlPrefix method:

\n
    \n
  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

    \n
  • \n
  • Links beginning with a single / will have the current adapter's host value prepended to it.

    \n
  • \n
  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

    \n
  • \n
\n", - "itemtype": "method", - "name": "findHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "relationship", - "description": "meta object describing the relationship", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 766, - "description": "

Called by the store in order to fetch the JSON for the unloaded record in a\nbelongs-to relationship that was originally specified as a URL (inside of\nlinks).

\n

For example, if your original payload looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
{\n  "person": {\n    "id": 1,\n    "name": "Tom Dale",\n    "links": { "group": "/people/1/group" }\n  }\n}
\n
\n
\n \n

This method will be called with the parent record and /people/1/group.

\n

The findBelongsTo method will make an Ajax (HTTP GET) request to the originally specified URL.

\n

The format of your links value will influence the final request URL via the urlPrefix method:

\n
    \n
  • Links beginning with //, http://, https://, will be used as is, with no further manipulation.

    \n
  • \n
  • Links beginning with a single / will have the current adapter's host value prepended to it.

    \n
  • \n
  • Links with no beginning / will have a parentURL prepended to it, via the current adapter's buildURL.

    \n
  • \n
\n", - "itemtype": "method", - "name": "findBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "relationship", - "description": "meta object describing the relationship", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 815, - "description": "

Called by the store when a newly created record is\nsaved via the save method on a model record instance.

\n

The createRecord method serializes the record and makes an Ajax (HTTP POST) request\nto a URL computed by buildURL.

\n

See serialize for information on how to customize the serialized form\nof a record.

\n", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 840, - "description": "

Called by the store when an existing record is saved\nvia the save method on a model record instance.

\n

The updateRecord method serializes the record and makes an Ajax (HTTP PUT) request\nto a URL computed by buildURL.

\n

See serialize for information on how to customize the serialized form\nof a record.

\n", - "itemtype": "method", - "name": "updateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "schema", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 867, - "description": "

Called by the store when a record is deleted.

\n

The deleteRecord method makes an Ajax (HTTP DELETE) request to a URL computed by buildURL.

\n", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 917, - "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

This implementation groups together records that have the same base URL but\ndiffering ids. For example /comments/1 and /comments/2 will be grouped together\nbecause we know findMany can coalesce them together as /comments?ids[]=1&ids[]=2

\n

It also supports urls where ids are passed as a query param, such as /comments?id=1\nbut not those where there is more than 1 query param such as /comments?id=2&name=David\nCurrently only the query param of id is supported. If you need to support others, please\noverride this or the _stripIDFromURL method.

\n

It does not group records that have differing base urls, such as for example: /posts/1/comments/2\nand /posts/2/comments/3

\n", - "itemtype": "method", - "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", - "type": "Array" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 986, - "description": "

Takes an ajax response, and returns the json payload or an error.

\n

By default this hook just returns the json payload passed to it.\nYou might want to override it in two cases:

\n
    \n
  1. Your API might return useful results in the response headers.\nResponse headers are passed in as the second argument.

    \n
  2. \n
  3. Your API might return errors as successful responses with status code\n200 and an Errors text or object. You can return a InvalidError or a\nAdapterError (or a sub class) from this hook and it will automatically\nreject the promise and put your record into the invalid or error state.

    \n
  4. \n
\n

Returning a InvalidError from this method will cause the\nrecord to transition into the invalid state and make the\nerrors object available on the record. When returning an\nInvalidError the store will attempt to normalize the error data\nreturned from the server using the serializer's extractErrors\nmethod.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "handleResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "requestData", - "description": "- the original request information", - "type": "Object" - } - ], - "return": { - "description": "response", - "type": "Object | AdapterError" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1049, - "description": "

Default handleResponse implementation uses this hook to decide if the\nresponse is a success.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "isSuccess", - "access": "public", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1065, - "description": "

Default handleResponse implementation uses this hook to decide if the\nresponse is an invalid error.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "isInvalid", - "access": "public", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1081, - "description": "

Takes a URL, an HTTP method and a hash of data, and makes an\nHTTP request.

\n

When the server responds with a payload, Ember Data will call into extractSingle\nor extractArray (depending on whether the original query was for one record or\nmany records).

\n

By default, ajax method has the following behavior:

\n
    \n
  • It sets the response dataType to "json"
  • \n
  • If the HTTP method is not "GET", it sets the Content-Type to be\napplication/json; charset=utf-8
  • \n
  • If the HTTP method is not "GET", it stringifies the data passed in. The\ndata is the serialized record in the case of a save.
  • \n
  • Registers success and failure handlers.
  • \n
\n", - "itemtype": "method", - "name": "ajax", - "access": "private", - "tagname": "", - "params": [ - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "type", - "description": "The request type GET, POST, PUT, DELETE etc.", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1142, - "itemtype": "method", - "name": "_ajaxRequest", - "access": "private", - "tagname": "", - "params": [ - { - "name": "options", - "description": "jQuery ajax options to be used for the ajax request", - "type": "Object" - } - ], - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1166, - "itemtype": "method", - "name": "ajaxOptions", - "access": "private", - "tagname": "", - "params": [ - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "type", - "description": "The request type GET, POST, PUT, DELETE etc.", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1241, - "itemtype": "method", - "name": "parseErrorResponse", - "access": "private", - "tagname": "", - "params": [ - { - "name": "responseText", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1259, - "itemtype": "method", - "name": "normalizeErrorResponse", - "access": "private", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "errors payload", - "type": "Array" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1289, - "description": "

Generates a detailed ("friendly") error message, with plenty\nof information for debugging (good luck!)

\n", - "itemtype": "method", - "name": "generatedDetailedMessage", - "access": "private", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "requestData", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "detailed error message", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1321, - "description": "

Used by findAll and findRecord to build the query's data hash\nsupplied to the ajax method.

\n", - "itemtype": "method", - "name": "buildQuery", - "since": "2.5.0", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 260, - "description": "

The findRecord() method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to findRecord() being called, you\nshould query your persistence layer for a record with the given ID. The findRecord\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.

\n

Here is an example of the findRecord implementation:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findRecord(store, type, id, snapshot) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "findRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 302, - "description": "

The findAll() method is used to retrieve all records for a given type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findAll(store, type) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "findAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 345, - "description": "

This method is called when you call query on the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  query(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "query", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 384, - "description": "

The queryRecord() method is invoked when the store is asked for a single\nrecord through a query object.

\n

In response to queryRecord() being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's push() method\nto push the record into the store.

\n

Here is an example queryRecord implementation:

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Adapter, { BuildURLMixin } from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n  queryRecord(store, type, query) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.getJSON(`/${type.modelName}`, query).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "queryRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Subclass of Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 429, - "description": "

If the globally unique IDs for your records should be generated on the client,\nimplement the generateIdForRecord() method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's primaryKey.

\n

Most traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls didCreateRecord(). Only implement this method if\nyou intend to generate record IDs on the client-side.

\n

The generateIdForRecord() method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Adapter from '@ember-data/adapter';\nimport { v4 } from 'uuid';\n\nexport default class ApplicationAdapter extends Adapter {\n  generateIdForRecord(store, type, inputProperties) {\n    return v4();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "generateIdForRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "inputProperties", - "description": "a hash of properties to set on the\n newly created record.", - "type": "Object" - } - ], - "return": { - "description": "id", - "type": "(String|Number)" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 463, - "description": "

Proxies to the serializer's serialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import Adapter from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter {\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let url = `/${type.modelName}`;\n\n    // ...\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serialize", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "serialized snapshot", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 491, - "description": "

Implement this method in a subclass to handle the creation of\nnew records.

\n

Serializes the record and sends it to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  createRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n\n    return new RSVP.Promise(function (resolve, reject) {\n      $.ajax({\n        type: 'POST',\n        url: `/${type.modelName}`,\n        dataType: 'json',\n        data: data\n      }).then(function (data) {\n        resolve(data);\n      }, function (jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "createRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 539, - "description": "

Implement this method in a subclass to handle the updating of\na record.

\n

Serializes the record update and sends it to the server.

\n

The updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with undefined and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  updateRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'PUT',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "updateRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 596, - "description": "

Implement this method in a subclass to handle the deletion of\na record.

\n

Sends a delete request for the record to the server.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  deleteRecord(store, type, snapshot) {\n    let data = this.serialize(snapshot, { includeId: true });\n    let id = snapshot.id;\n\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'DELETE',\n        url: `/${type.modelName}/${id}`,\n        dataType: 'json',\n        data: data\n      }).then(function(data) {\n        resolve(data)\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "deleteRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 667, - "description": "

The store will call findMany instead of multiple findRecord\nrequests to find multiple records at once if coalesceFindRequests\nis true.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
import Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n  findMany(store, type, ids, snapshots) {\n    return new RSVP.Promise(function(resolve, reject) {\n      $.ajax({\n        type: 'GET',\n        url: `/${type.modelName}/`,\n        dataType: 'json',\n        data: { filter: { id: ids.join(',') } }\n      }).then(function(data) {\n        resolve(data);\n      }, function(jqXHR) {\n        jqXHR.then = null; // tame jQuery's ill mannered promises\n        reject(jqXHR);\n      });\n    });\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "findMany", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the records", - "type": "Model" - }, - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 705, - "description": "

Organize records into groups, each of which is to be passed to separate\ncalls to findMany.

\n

For example, if your API has nested URLs that depend on the parent, you will\nwant to group records by their parent.

\n

The default implementation returns the records as a single group.

\n", - "itemtype": "method", - "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", - "type": "Array" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 725, - "description": "

This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\nstore.findRecord.

\n

If this method returns true, the store will re-fetch a record from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached record.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
shouldReloadRecord(store, ticketSnapshot) {\n  let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n  let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n  if (timeDiff > 20) {\n    return true;\n  } else {\n    return false;\n  }\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findRecord('ticket',\nid) you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, findRecord will not\nresolve until you fetched the latest version.

\n

By default this hook returns false, as most UIs should not block user\ninteractions while waiting on data update.

\n

Note that, with default settings, shouldBackgroundReloadRecord will always\nre-fetch the records in the background even if shouldReloadRecord returns\nfalse. You can override shouldBackgroundReloadRecord if this does not\nsuit your use case.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldReloadRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 776, - "description": "

This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\nstore.findAll.

\n

If this method returns true, the store will re-fetch all records from\nthe adapter. If this method returns false, the store will resolve\nimmediately using the cached records.

\n

For example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
shouldReloadAll(store, snapshotArray) {\n  let snapshots = snapshotArray.snapshots();\n\n  return snapshots.any((ticketSnapshot) => {\n    let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n    let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n    if (timeDiff > 20) {\n      return true;\n    } else {\n      return false;\n    }\n  });\n}
\n
\n
\n \n

This method would ensure that whenever you do store.findAll('ticket') you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, findAll will not\nresolve until you fetched the latest versions.

\n

By default, this method returns true if the passed snapshotRecordArray\nis empty (meaning that there are no records locally available yet),\notherwise, it returns false.

\n

Note that, with default settings, shouldBackgroundReloadAll will always\nre-fetch all the records in the background even if shouldReloadAll returns\nfalse. You can override shouldBackgroundReloadAll if this does not suit\nyour use case.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldReloadAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 832, - "description": "

This method is used by the store to determine if the store should\nreload a record after the store.findRecord method resolves a\ncached record.

\n

This method is only checked by the store when the store is\nreturning a cached record.

\n

If this method returns true the store will re-fetch a record from\nthe adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadRecord as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
shouldBackgroundReloadRecord(store, snapshot) {\n  let { downlink, effectiveType } = navigator.connection;\n\n  return downlink > 0 && effectiveType === '4g';\n}
\n
\n
\n \n

By default, this hook returns true so the data for the record is updated\nin the background.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldBackgroundReloadRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 869, - "description": "

This method is used by the store to determine if the store should\nreload a record array after the store.findAll method resolves\nwith a cached record array.

\n

This method is only checked by the store when the store is\nreturning a cached record array.

\n

If this method returns true the store will re-fetch all records\nfrom the adapter.

\n

For example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\nshouldBackgroundReloadAll as follows:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
shouldBackgroundReloadAll(store, snapshotArray) {\n  let { downlink, effectiveType } = navigator.connection;\n\n  return downlink > 0 && effectiveType === '4g';\n}
\n
\n
\n \n

By default this method returns true, indicating that a background reload\nshould always be triggered.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldBackgroundReloadAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 145, - "description": "

Builds a URL for a given type and optional ID.

\n

By default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see pathForType.

\n

If an ID is specified, it adds the ID to the path generated\nfor the type, separated by a /.

\n

When called by RESTAdapter.findMany() the id and snapshot parameters\nwill be arrays of ids and snapshots.

\n", - "itemtype": "method", - "name": "buildURL", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "id", - "description": "single id or array of ids or query", - "type": "(String|Array|Object)" - }, - { - "name": "snapshot", - "description": "single snapshot or array of snapshots", - "type": "(Snapshot|SnapshotRecordArray)" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "object of query parameters to send for query requests.", - "type": "Object" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 294, - "itemtype": "method", - "name": "_buildURL", - "access": "private", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "id", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 329, - "description": "

Builds a URL for a store.findRecord(type, id) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindRecord(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id, snapshot);\n    return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 357, - "description": "

Builds a URL for a store.findAll(type) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindAll(modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName);\n    return `${baseUrl}/data/comments.json`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 383, - "description": "

Builds a URL for a store.query(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  host = 'https://api.github.com';\n  urlForQuery (query, modelName) {\n    switch(modelName) {\n      case 'repo':\n        return `https://api.github.com/orgs/${query.orgId}/repos`;\n      default:\n        return super.urlForQuery(...arguments);\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForQuery", - "access": "public", - "tagname": "", - "params": [ - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 414, - "description": "

Builds a URL for a store.queryRecord(type, query) call.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForQueryRecord({ slug }, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/${encodeURIComponent(slug)}`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForQueryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 440, - "description": "

Builds a URL for coalescing multiple store.findRecord(type, id)\nrecords into 1 request when the adapter's coalesceFindRequests\nproperty is true.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForFindMany(ids, modelName) {\n    let baseUrl = this.buildURL();\n    return `${baseUrl}/coalesce`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 469, - "description": "

Builds a URL for fetching an async hasMany relationship when a URL\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindHasMany(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id);\n    return `${baseUrl}/relationships`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 497, - "description": "

Builds a URL for fetching an async belongsTo relationship when a url\nis not provided by the server.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  urlForFindBelongsTo(id, modelName, snapshot) {\n    let baseUrl = this.buildURL(modelName, id);\n    return `${baseUrl}/relationships`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForFindBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 525, - "description": "

Builds a URL for a record.save() call when the record was created\nlocally using store.createRecord().

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForCreateRecord(modelName, snapshot) {\n    return super.urlForCreateRecord(...arguments) + '/new';\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForCreateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 551, - "description": "

Builds a URL for a record.save() call when the record has been updated locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForUpdateRecord(id, modelName, snapshot) {\n    return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForUpdateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 577, - "description": "

Builds a URL for a record.save() call when the record has been deleted locally.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  urlForDeleteRecord(id, modelName, snapshot) {\n    return super.urlForDeleteRecord(...arguments) + '/destroy';\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "urlForDeleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 603, - "itemtype": "method", - "name": "urlPrefix", - "access": "private", - "tagname": "", - "params": [ - { - "name": "path", - "description": "", - "type": "String" - }, - { - "name": "parentURL", - "description": "", - "type": "String" - } - ], - "return": { - "description": "urlPrefix", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 643, - "description": "

Determines the pathname for a given type.

\n

By default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').

\n

Pathname customization

\n

For example, if you have an object LineItem with an\nendpoint of /line_items/.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTAdapter from '@ember-data/adapter/rest';\nimport { decamelize, pluralize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  pathForType(modelName) {\n    var decamelized = decamelize(modelName);\n    return pluralize(decamelized);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "pathForType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "path", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "BuildURLMixin" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/adapter/src/rest.ts", - "line": 342, - "description": "

This property allows ajax to still be used instead when false.

\n", - "itemtype": "property", - "name": "useFetch", - "type": "{Boolean}", - "default": "true", - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 427, - "description": "

By default the RESTAdapter will send each find request coming from a store.find\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.

\n

For example, if you have an initial payload of:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  post: {\n    id: 1,\n    comments: [1, 2]\n  }\n}
\n
\n
\n \n

By default calling post.comments will trigger the following requests(assuming the\ncomments haven't been loaded before):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET /comments/1\nGET /comments/2
\n
\n
\n

If you set coalesceFindRequests to true it will instead trigger the following request:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET /comments?ids[]=1&ids[]=2
\n
\n
\n

Setting coalesceFindRequests to true also works for store.find requests and belongsTo\nrelationships accessed within the same runloop. If you set coalesceFindRequests: true

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.findRecord('comment', 1);\nstore.findRecord('comment', 2);
\n
\n
\n \n

will also send a request to: GET /comments?ids[]=1&ids[]=2

\n

Note: Requests coalescing rely on URL building strategy. So if you override buildURL in your app\ngroupRecordsForFindMany more likely should be overridden as well in order for coalescing to work.

\n", - "itemtype": "property", - "name": "coalesceFindRequests", - "access": "public", - "tagname": "", - "type": "{boolean}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 487, - "description": "

Endpoint paths can be prefixed with a namespace by setting the namespace\nproperty on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  namespace = 'api/1';\n}
\n
\n
\n \n

Requests for the Post model would now target /api/1/post/.

\n", - "itemtype": "property", - "name": "namespace", - "access": "public", - "tagname": "", - "type": "{String}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 506, - "description": "

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  host = 'https://api.example.com';\n}
\n
\n
\n \n

Requests for the Post model would now target https://api.example.com/post/.

\n", - "itemtype": "property", - "name": "host", - "access": "public", - "tagname": "", - "type": "{String}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 524, - "description": "

Some APIs require HTTP headers, e.g. to provide an API\nkey. Arbitrary headers can be set as key/value pairs on the\nRESTAdapter's headers object and Ember Data will send them\nalong with each ajax request. For dynamic headers see headers\ncustomization.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import RESTAdapter from '@ember-data/adapter/rest';\nimport { computed } from '@ember/object';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n  headers: computed(function() {\n    return {\n      'API_KEY': 'secret key',\n      'ANOTHER_HEADER': 'Some header value'\n    };\n  })\n}
\n
\n
\n \n", - "itemtype": "property", - "name": "headers", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 645, - "description": "

By default the store will try to coalesce all findRecord calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.

\n", - "itemtype": "property", - "name": "coalesceFindRequests", - "access": "public", - "tagname": "", - "type": "{boolean}", - "class": "RESTAdapter", - "module": "@ember-data/adapter", - "inherited": true, - "inheritedFrom": "Adapter" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-Adapter", - "type": "class" - } - }, - "descendants": { - "data": [ - { - "type": "class", - "id": "ember-data-2.18.5-JSONAPIAdapter" - } - ] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/rest", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RESTSerializer.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RESTSerializer.json deleted file mode 100644 index 12bbee5a1..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RESTSerializer.json +++ /dev/null @@ -1,1958 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-RESTSerializer", - "type": "class", - "attributes": { - "name": "RESTSerializer", - "shortname": "RESTSerializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/rest", - "namespace": "", - "file": "../serializer/src/rest.js", - "line": 18, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

Normally, applications will use the RESTSerializer by implementing\n the normalize method.

\n

This allows you to do whatever kind of munging you need and is\n especially useful if your server is inconsistent and you need to\n do munging differently for many different kinds of responses.

\n

See the normalize documentation for more information.

\n

Across the Board Normalization

\n

There are also a number of hooks that you might find useful to define\n across-the-board rules for your payload. These rules will be useful\n if your server is consistent, or if you're building an adapter for\n an infrastructure service, like Firebase, and want to encode service\n conventions.

\n

For example, if all of your keys are underscored and all-caps, but\n otherwise consistent with the names you use in your models, you\n can implement across-the-board rules for how to convert an attribute\n name in your model to a key in your JSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
 import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends RESTSerializer {\n   keyForAttribute(attr, method) {\n     return underscore(attr).toUpperCase();\n   }\n }
\n
\n
\n \n

You can also implement keyForRelationship, which takes the name\n of the relationship as the first parameter, the kind of\n relationship (hasMany or belongsTo) as the second parameter, and\n the method (serialize or deserialize) as the third parameter.

\n", - "mainName": "@ember-data/serializer/rest", - "tag": "main", - "_main": true, - "access": "public", - "tagname": "", - "extends": "JSONSerializer", - "methods": [ - { - "file": "../packages/serializer/src/rest.js", - "line": 71, - "description": "

keyForPolymorphicType can be used to define a custom key when\nserializing and deserializing a polymorphic type. By default, the\nreturned key is ${key}Type.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
 import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer {\n   keyForPolymorphicType(key, relationship) {\n     let relationshipKey = this.keyForRelationship(key);\n\n     return 'type-' + relationshipKey;\n   }\n }
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForPolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 103, - "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

For example, if you have a payload that looks like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
{\n  "post": {\n    "id": 1,\n    "title": "Rails is omakase",\n    "comments": [ 1, 2 ]\n  },\n  "comments": [{\n    "id": 1,\n    "body": "FIRST"\n  }, {\n    "id": 2,\n    "body": "Rails is unagi"\n  }]\n}
\n
\n
\n \n

The normalize method will be called three times:

\n
    \n
  • With App.Post, "posts" and { id: 1, title: "Rails is omakase", ... }
  • \n
  • With App.Comment, "comments" and { id: 1, body: "FIRST" }
  • \n
  • With App.Comment, "comments" and { id: 2, body: "Rails is unagi" }
  • \n
\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations. You will only need to implement\nnormalize and manipulate the payload as desired.

\n

For example, if the IDs under "comments" are provided as _id instead of\nid, you can specify how to normalize just the comments:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  normalize(model, hash, prop) {\n    if (prop === 'comments') {\n      hash.id = hash._id;\n      delete hash._id;\n    }\n\n    return super.normalize(...arguments);\n  }\n}
\n
\n
\n \n

On each call to the normalize method, the third parameter (prop) is always\none of the keys that were in the original payload or in the result of another\nnormalization as normalizeResponse.

\n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - }, - { - "name": "prop", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 171, - "description": "

Normalizes an array of resource payloads and returns a JSON-API Document\nwith primary data and, if any, included data as { data, included }.

\n", - "itemtype": "method", - "name": "_normalizeArray", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "arrayHash", - "description": "", - "type": "Object" - }, - { - "name": "prop", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 222, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 364, - "description": "

This method allows you to push a payload containing top-level\ncollections of records organized per type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
{\n  "posts": [{\n    "id": "1",\n    "title": "Rails is omakase",\n    "author", "1",\n    "comments": [ "1" ]\n  }],\n  "comments": [{\n    "id": "1",\n    "body": "FIRST"\n  }],\n  "users": [{\n    "id": "1",\n    "name": "@d2h"\n  }]\n}
\n
\n
\n \n

It will first normalize the payload, so you can use this to push\nin data streaming in from your server structured the same way\nthat fetches and saves are structured.

\n", - "itemtype": "method", - "name": "pushPayload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 425, - "description": "

This method is used to convert each JSON root key in the payload\ninto a modelName that it can use to look up the appropriate model for\nthat part of the payload.

\n

For example, your server may send a model name that does not correspond with\nthe name of the model in your app. Let's take a look at an example model,\nand an example payload:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n
import Model from '@ember-data/model';\n\nexport default class Post extends Model {}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
  {\n    "blog/post": {\n      "id": "1\n    }\n  }
\n
\n
\n \n

Ember Data is going to normalize the payload's root key for the modelName. As a result,\nit will try to look up the "blog/post" model. Since we don't have a model called "blog/post"\n(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error\nbecause it cannot find the "blog/post" model.

\n

Since we want to remove this namespace, we can define a serializer for the application that will\nremove "blog/" from the payload key whenver it's encountered by Ember Data:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  modelNameFromPayloadKey(payloadKey) {\n    if (payloadKey === 'blog/post') {\n      return super.modelNameFromPayloadKey(payloadKey.replace('blog/', ''));\n    } else {\n     return super.modelNameFromPayloadKey(payloadKey);\n    }\n  }\n}
\n
\n
\n \n

After refreshing, Ember Data will appropriately look up the "post" model.

\n

By default the modelName for a model is its\nname in dasherized form. This means that a payload key like "blogPost" would be\nnormalized to "blog-post" when Ember Data looks up the model. Usually, Ember Data\ncan use the correct inflection to do this for you. Most of the time, you won't\nneed to override modelNameFromPayloadKey for this purpose.

\n", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 489, - "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n

```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class Comment extends Model {

\n", - "attr": "body", - "belongsto": "('user') author\n}\n```\n\nThe default serialization would create a JSON object like:\n\n```js\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\nimport { pluralize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute(function(name) {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship(function(name, relationship) {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```js\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ 1, 2, 3 ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.\n\n```app/serializers/post.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(snapshot, options);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 646, - "description": "

You can use this method to customize the root keys serialized into the JSON.\nThe hash property should be modified by reference (possibly using something like _.extend)\nBy default the REST Serializer sends the modelName of a model, which is a camelized\nversion of the name.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTSerializer from '@ember-data/serializer/rest';\nimport { decamelize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  serializeIntoHash(data, type, record, options) {\n    let root = decamelize(type.modelName);\n    data[root] = this.serialize(record, options);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeIntoHash", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 678, - "description": "

You can use payloadKeyFromModelName to override the root key for an outgoing\nrequest. By default, the RESTSerializer returns a camelized version of the\nmodel's name.

\n

For a model called TacoParty, its modelName would be the string taco-party. The RESTSerializer\nwill send it to the server with tacoParty as the root key in the JSON payload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  "tacoParty": {\n    "id": "1",\n    "location": "Matthew Beale's House"\n  }\n}
\n
\n
\n \n

For example, your server may expect dasherized root objects:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import RESTSerializer from '@ember-data/serializer/rest';\nimport { dasherize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  payloadKeyFromModelName(modelName) {\n    return dasherize(modelName);\n  }\n}
\n
\n
\n \n

Given a TacoParty model, calling save on it would produce an outgoing\nrequest like:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
{\n  "taco-party": {\n    "id": "1",\n    "location": "Matthew Beale's House"\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "payloadKeyFromModelName", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 729, - "description": "

You can use this method to customize how polymorphic objects are serialized.\nBy default the REST Serializer creates the key by appending Type to\nthe attribute and value from the model's camelcased model name.

\n", - "itemtype": "method", - "name": "serializePolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 752, - "description": "

You can use this method to customize how a polymorphic relationship should\nbe extracted.

\n", - "itemtype": "method", - "name": "extractPolymorphicRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipType", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - }, - { - "name": "relationshipOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 188, - "description": "

Given a subclass of Model and a JSON object this method will\niterate through each attribute of the Model and invoke the\nTransform#deserialize method on the matching property of the\nJSON object. This method is typically called after the\nserializer's normalize method.

\n", - "itemtype": "method", - "name": "applyTransforms", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "data", - "description": "The data to transform", - "type": "Object" - } - ], - "return": { - "description": "data The transformed data object", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 217, - "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

This method delegates to a more specific normalize method based on\nthe requestType.

\n

To override this method with a custom one, make sure to call\nreturn super.normalizeResponse(store, primaryModelClass, payload, id, requestType) with your\npre-processed data.

\n

Here's an example of using normalizeResponse manually:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
socket.on('message', function(message) {\n  let data = message.data;\n  let modelClass = store.modelFor(data.modelName);\n  let serializer = store.serializerFor(data.modelName);\n  let normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n  store.push(normalized);\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 278, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 296, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is queryRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 314, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findAll

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindAllResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 332, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findBelongsTo

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindBelongsToResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 350, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findHasMany

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindHasManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 368, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is findMany

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 386, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is query

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 404, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is createRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeCreateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 422, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is deleteRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeDeleteRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 440, - "description": "

Called by the default normalizeResponse implementation when the\ntype of request is updateRecord

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeUpdateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 458, - "description": "

normalizeUpdateRecordResponse, normalizeCreateRecordResponse and\nnormalizeDeleteRecordResponse delegate to this method by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSaveResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 476, - "description": "

normalizeQueryResponse and normalizeFindRecordResponse delegate to this\nmethod by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSingleResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 494, - "description": "

normalizeQueryResponse, normalizeFindManyResponse, and normalizeFindHasManyResponse delegate\nto this method by default.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeArrayResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 512, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 561, - "description": "

Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.

\n

It takes the type of the record that is being normalized\n(as a Model class), the property where the hash was\noriginally found, and the hash to normalize.

\n

You can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '<app-name>/utils/string-utils';\nimport { get } from '@ember/object';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  normalize(typeClass, hash) {\n    let fields = typeClass.fields;\n\n    fields.forEach(function(type, field) {\n      let payloadField = underscore(field);\n      if (field === payloadField) { return; }\n\n      hash[field] = hash[payloadField];\n      delete hash[payloadField];\n    });\n\n    return super.normalize(...arguments);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 625, - "description": "

Returns the resource's ID.

\n", - "itemtype": "method", - "name": "extractId", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 640, - "description": "

Returns the resource's attributes formatted as a JSON-API "attributes object".

\n

http://jsonapi.org/format/#document-resource-object-attributes

\n", - "itemtype": "method", - "name": "extractAttributes", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 665, - "description": "

Returns a relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 700, - "description": "

Returns a polymorphic relationship formatted as a JSON-API "relationship object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n

relationshipOptions is a hash which contains more information about the\npolymorphic relationship which should be extracted:

\n
    \n
  • resourceHash complete hash of the resource the relationship should be\nextracted from
  • \n
  • relationshipKey key under which the value for the relationship is\nextracted from the resourceHash
  • \n
  • relationshipMeta meta information about the relationship
  • \n
\n", - "itemtype": "method", - "name": "extractPolymorphicRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - }, - { - "name": "relationshipOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 724, - "description": "

Returns the resource's relationships formatted as a JSON-API "relationships object".

\n

http://jsonapi.org/format/#document-resource-object-relationships

\n", - "itemtype": "method", - "name": "extractRelationships", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 796, - "description": "

Dasherizes the model name in the payload

\n", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 808, - "itemtype": "method", - "name": "normalizeRelationships", - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 831, - "itemtype": "method", - "name": "normalizeUsingDeclaredMapping", - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 864, - "description": "

Looks up the property key that was set by the custom attr mapping\npassed to the serializer.

\n", - "itemtype": "method", - "name": "_getMappedKey", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "key", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 903, - "description": "

Check attrs.key.serialize property to inform if the key\ncan be serialized

\n", - "itemtype": "method", - "name": "_canSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key can be serialized", - "type": "Boolean" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 918, - "description": "

When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized

\n", - "itemtype": "method", - "name": "_mustSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key must be serialized", - "type": "Boolean" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 934, - "description": "

Check if the given hasMany relationship should be serialized

\n

By default only many-to-many and many-to-none relationships are serialized.\nThis could be configured per relationship by Serializer's attrs object.

\n", - "itemtype": "method", - "name": "shouldSerializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "relationshipType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the hasMany relationship should be serialized", - "type": "Boolean" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 957, - "description": "

Called when a record is saved in order to convert the\nrecord into JSON.

\n

By default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.

\n

For example, consider this model:

\n

```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class CommentModel extends Model {

\n", - "attr": "body;", - "belongsto": "('user') author;\n}\n```\n\nThe default serialization would create a JSON object like:\n\n```javascript\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\nimport { singularize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call `super.serialize` first and make the tweaks on\nthe returned JSON.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1135, - "description": "

You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.

\n

For example, your server may expect underscored root objects.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RESTSerializer from '@ember-data/serializer/rest';\nimport { decamelize } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n  serializeIntoHash(data, type, snapshot, options) {\n    let root = decamelize(type.modelName);\n    data[root] = this.serialize(snapshot, options);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeIntoHash", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1168, - "description": "

serializeAttribute can be used to customize how attr\nproperties are serialized

\n

For example if you wanted to ensure all your attributes were always\nserialized as properties on an attributes object you could\nwrite:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  serializeAttribute(snapshot, json, key, attributes) {\n    json.attributes = json.attributes || {};\n    super.serializeAttribute(snapshot, json.attributes, key, attributes);\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "attribute", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1216, - "description": "

serializeBelongsTo can be used to customize how belongsTo\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  serializeBelongsTo(snapshot, json, relationship) {\n    let key = relationship.key;\n    let belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;\n\n    json[key] = !belongsTo ? null : belongsTo.record.toJSON();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1270, - "description": "

serializeHasMany can be used to customize how hasMany\nproperties are serialized.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  serializeHasMany(snapshot, json, relationship) {\n    let key = relationship.key;\n    if (key === 'comments') {\n      return;\n    } else {\n      super.serializeHasMany(...arguments);\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1317, - "description": "

You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n{ polymorphic: true } is pass as the second argument to the\nbelongsTo function.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class CommentSerializer extends JSONSerializer {\n  serializePolymorphicType(snapshot, json, relationship) {\n    let key = relationship.key;\n    let belongsTo = snapshot.belongsTo(key);\n\n    key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n    if (!belongsTo) {\n      json[key + '_type'] = null;\n    } else {\n      json[key + '_type'] = belongsTo.modelName;\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serializePolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1352, - "description": "

extractMeta is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the meta property of the payload object.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  extractMeta(store, typeClass, payload) {\n    if (payload && payload.hasOwnProperty('_pagination')) {\n      let meta = payload._pagination;\n      delete payload._pagination;\n      return meta;\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "extractMeta", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1387, - "description": "

extractErrors is used to extract model errors when a call\nto Model#save fails with an InvalidError. By default\nEmber Data expects error information to be located on the errors\nproperty of the payload object.

\n

This serializer expects this errors object to be an Array similar\nto the following, compliant with the https://jsonapi.org/format/#errors specification:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
{\n  "errors": [\n    {\n      "detail": "This username is already taken!",\n      "source": {\n        "pointer": "data/attributes/username"\n      }\n    }, {\n      "detail": "Doesn't look like a valid email.",\n      "source": {\n        "pointer": "data/attributes/email"\n      }\n    }\n  ]\n}
\n
\n
\n \n

The key detail provides a textual description of the problem.\nAlternatively, the key title can be used for the same purpose.

\n

The nested keys source.pointer detail which specific element\nof the request data was invalid.

\n

Note that JSON-API also allows for object-level errors to be placed\nin an object with pointer data, signifying that the problem\ncannot be traced to a specific attribute:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
{\n  "errors": [\n    {\n      "detail": "Some generic non property error message",\n      "source": {\n        "pointer": "data"\n      }\n    }\n  ]\n}
\n
\n
\n \n

When turn into a Errors object, you can read these errors\nthrough the property base:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
{{#each @model.errors.base as |error|}}\n  <div class="error">\n    {{error.message}}\n  </div>\n{{/each}}
\n
\n
\n \n

Example of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n  extractErrors(store, typeClass, payload, id) {\n    if (payload && typeof payload === 'object' && payload._problems) {\n      payload = payload._problems;\n      this.normalizeErrors(typeClass, payload);\n    }\n    return payload;\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "extractErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "(String|Number)" - } - ], - "return": { - "description": "json The deserialized errors", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1522, - "description": "

keyForAttribute can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
import JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '<app-name>/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  keyForAttribute(attr, method) {\n    return underscore(attr).toUpperCase();\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1549, - "description": "

keyForRelationship can be used to define a custom key when\nserializing and deserializing relationship properties. By default\nJSONSerializer does not provide an implementation of this method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n4\n5\n6\n7\n8\n
  import JSONSerializer from '@ember-data/serializer/json';\n  import { underscore } from '<app-name>/utils/string-utils';\n\n  export default class PostSerializer extends JSONSerializer {\n    keyForRelationship(key, relationship, method) {\n      return `rel_${underscore(key)}`;\n    }\n  }
\n
\n
\n \n", - "itemtype": "method", - "name": "keyForRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1578, - "description": "

keyForLink can be used to define a custom key when deserializing link\nproperties.

\n", - "itemtype": "method", - "name": "keyForLink", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "kind", - "description": "`belongsTo` or `hasMany`", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1594, - "itemtype": "method", - "name": "transformFor", - "access": "private", - "tagname": "", - "params": [ - { - "name": "attributeType", - "description": "", - "type": "String" - }, - { - "name": "skipAssertion", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "transform", - "type": "Transform" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 162, - "description": "

The normalizeResponse method is used to normalize a payload from the\nserver to a JSON-API Document.

\n

http://jsonapi.org/format/#document-structure

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
Serializer.extend({\n  normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n    if (requestType === 'findRecord') {\n      return this.normalize(primaryModelClass, payload);\n    } else {\n      return payload.reduce(function(documentHash, item) {\n        let { data, included } = this.normalize(primaryModelClass, item);\n        documentHash.included.push(...included);\n        documentHash.data.push(data);\n        return documentHash;\n      }, { data: [], included: [] })\n    }\n  }\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 198, - "description": "

The serialize method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.

\n

serialize takes an optional options hash with a single option:

\n
    \n
  • includeId: If this is true, serialize should include the ID\nin the serialized object it builds.
  • \n
\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
Serializer.extend({\n  serialize(snapshot, options) {\n    let json = {\n      id: snapshot.id\n    };\n\n    snapshot.eachAttribute((key, attribute) => {\n      json[key] = snapshot.attr(key);\n    });\n\n    snapshot.eachRelationship((key, relationship) => {\n      if (relationship.kind === 'belongsTo') {\n        json[key] = snapshot.belongsTo(key, { id: true });\n      } else if (relationship.kind === 'hasMany') {\n        json[key] = snapshot.hasMany(key, { ids: true });\n      }\n    });\n\n    return json;\n  },\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 240, - "description": "

The normalize method is used to convert a payload received from your\nexternal data source into the normalized form store.push() expects. You\nshould override this method, munge the hash and return the normalized\npayload.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
Serializer.extend({\n  normalize(modelClass, resourceHash) {\n    let data = {\n      id:            resourceHash.id,\n      type:          modelClass.modelName,\n      attributes:    resourceHash\n    };\n    return { data: data };\n  }\n})
\n
\n
\n \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/serializer/src/json.js", - "line": 94, - "description": "

The primaryKey is used when serializing and deserializing\ndata. Ember Data always uses the id property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\nprimaryKey property to match the primaryKey of your external\nstore.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n  primaryKey = '_id'\n}
\n
\n
\n \n", - "itemtype": "property", - "name": "primaryKey", - "type": "{String}", - "access": "public", - "tagname": "", - "default": "'id'", - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 119, - "description": "

The attrs object can be used to declare a simple mapping between\nproperty names on Model records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty key can also be used to designate the attribute's key on\nthe response payload.

\n

Example

\n

```app/models/person.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class PersonModel extends Model {

\n", - "attr": "('boolean') admin;\n}\n```\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PersonSerializer extends JSONSerializer {\n attrs = {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n}\n```\n\nYou can also remove attributes and relationships by setting the `serialize`\nkey to `false` in your mapping object.\n\nExample\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n attrs = {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n}\n```\n\nWhen serialized:\n\n```javascript\n{\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n}\n```\n\nNote that the `admin` is now not included in the payload.\n\nSetting `serialize` to `true` enforces serialization for hasMany\nrelationships even if it's neither a many-to-many nor many-to-none\nrelationship.", - "itemtype": "property", - "name": "attrs", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "RESTSerializer", - "module": "@ember-data/serializer/json", - "inherited": true, - "inheritedFrom": "JSONSerializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 140, - "description": "

The store property is the application's store that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.

\n

Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
Serializer.extend({\n  extractRelationship(relationshipModelName, relationshipHash) {\n    let modelClass = this.store.modelFor(relationshipModelName);\n    let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n    return relationshipSerializer.normalize(modelClass, relationshipHash);\n  }\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "store", - "type": "{Store}", - "access": "public", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer", - "inherited": true, - "inheritedFrom": "Serializer" - } - ] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-JSONSerializer", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/rest", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RecordArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RecordArray.json deleted file mode 100644 index 6284409e6..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RecordArray.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-RecordArray", - "type": "class", - "attributes": { - "name": "RecordArray", - "shortname": "RecordArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/record-arrays/identifier-array.ts", - "line": 149, - "description": "

A record array is an array that contains records of a certain type (or modelName).\nThe record array materializes records as needed when they are retrieved for the first\ntime. You should not create record arrays yourself. Instead, an instance of\nRecordArray or its subclasses will be returned by your application's store\nin response to queries.

\n

This class should not be imported and instantiated by consuming applications.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 432, - "description": "

Used to get the latest version of all of the records in this array\nfrom the adapter.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let people = store.peekAll('person');\npeople.isUpdating; // false\n\npeople.update().then(function() {\n  people.isUpdating; // false\n});\n\npeople.isUpdating; // true
\n
\n
\n \n", - "itemtype": "method", - "name": "update", - "access": "public", - "tagname": "", - "class": "RecordArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 483, - "description": "

Saves all of the records in the RecordArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let messages = store.peekAll('message');\nmessages.forEach(function(message) {\n  message.hasBeenSeen = true;\n});\nmessages.save();
\n
\n
\n \n", - "itemtype": "method", - "name": "save", - "access": "public", - "tagname": "", - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RecordArray", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 166, - "description": "

The flag to signal a RecordArray is currently loading data.\nExample

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
let people = store.peekAll('person');\npeople.isUpdating; // false\npeople.update();\npeople.isUpdating; // true
\n
\n
\n \n", - "itemtype": "property", - "name": "isUpdating", - "access": "public", - "tagname": "", - "type": "Boolean", - "class": "RecordArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 195, - "description": "

The store that created this record array.

\n", - "itemtype": "property", - "name": "store", - "access": "private", - "tagname": "", - "type": "Store", - "class": "RecordArray", - "module": "@ember-data/store" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RelationshipPayloads.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RelationshipPayloads.json new file mode 100644 index 000000000..e75b71e5f --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RelationshipPayloads.json @@ -0,0 +1,137 @@ +{ + "data": { + "id": "ember-data-2.18.5-RelationshipPayloads", + "type": "class", + "attributes": { + "name": "RelationshipPayloads", + "shortname": "RelationshipPayloads", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 37, + "description": "

Manages the payloads for both sides of a single relationship, across all model\ninstances.

\n

For example, with

\n

const User = DS.Model.extend({\n hobbies: DS.hasMany('hobby')\n });

\n

const Hobby = DS.Model.extend({\n user: DS.belongsTo('user')\n });

\n

let relationshipPayloads = new RelationshipPayloads('user', 'hobbies', 'hobby', 'user');

\n

let userPayload = {\n data: {\n id: 1,\n type: 'user',\n relationships: {\n hobbies: {\n data: [{\n id: 2,\n type: 'hobby',\n }]\n }\n }\n }\n };

\n

// here we expect the payload of the individual relationship\nrelationshipPayloads.push('user', 1, 'hobbies', userPayload.data.relationships.hobbies);

\n

relationshipPayloads.get('user', 1, 'hobbies');\nrelationshipPayloads.get('hobby', 2, 'user');

\n", + "access": "private", + "tagname": "", + "methods": [ + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 93, + "description": "

Get the payload for the relationship of an individual record.

\n

This might return the raw payload as pushed into the store, or one computed\nfrom the payload of the inverse relationship.

\n", + "itemtype": "method", + "name": "get", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 112, + "description": "

Push a relationship payload for an individual record.

\n

This will make the payload available later for both this relationship and its inverse.

\n", + "itemtype": "method", + "name": "push", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 123, + "description": "

Unload the relationship payload for an individual record.

\n

This does not unload the inverse relationship payload.

\n", + "itemtype": "method", + "name": "unload", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 141, + "return": { + "description": "true iff `modelName` and `relationshipName` refer to the\nleft hand side of this relationship, as opposed to the right hand side.", + "type": "Boolean" + }, + "itemtype": "method", + "name": "_isLHS", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 161, + "return": { + "description": "true iff `modelName` and `relationshipName` refer to the\nright hand side of this relationship, as opposed to the left hand side.", + "type": "Boolean" + }, + "itemtype": "method", + "name": "_isRHS", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 268, + "description": "

Populate the inverse relationship for relationshipData.

\n

If relationshipData is an array (eg because the relationship is hasMany)\nthis means populate each inverse, otherwise populate only the single\ninverse.

\n", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "_populateInverse", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 296, + "description": "

Actually add inversePayload to inverseIdToPayloads. This is part of\n_populateInverse after we've normalized the case of relationshipData\nbeing either an array or a pojo.

\n

We still have to handle the case that the inverse relationship payload may\nbe an array or pojo.

\n", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "_addToInverse", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 350, + "description": "

Remove the relationship in previousPayload from its inverse(s), because\nthis relationship payload has just been updated (eg because the same\nrelationship had multiple payloads pushed before the relationship was\ninitialized).

\n", + "itemtype": "method", + "name": "_removeInverse", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 381, + "description": "

Remove id from its inverse record with id inverseId. If the inverse\nrelationship is a belongsTo, this means just setting it to null, if the\ninverse relationship is a hasMany, then remove that id from its array of ids.

\n", + "itemtype": "method", + "name": "_removeFromInverse", + "class": "RelationshipPayloads", + "module": "ember-data" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RelationshipPayloadsManager.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RelationshipPayloadsManager.json new file mode 100644 index 000000000..b0ad6671d --- /dev/null +++ b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RelationshipPayloadsManager.json @@ -0,0 +1,107 @@ +{ + "data": { + "id": "ember-data-2.18.5-RelationshipPayloadsManager", + "type": "class", + "attributes": { + "name": "RelationshipPayloadsManager", + "shortname": "RelationshipPayloadsManager", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 6, + "description": "

Manages relationship payloads for a given store, for uninitialized\nrelationships. Acts as a single source of truth (of payloads) for both sides\nof an uninitialized relationship so they can agree on the most up-to-date\npayload received without needing too much eager processing when those payloads\nare pushed into the store.

\n

This minimizes the work spent on relationships that are never initialized.

\n

Once relationships are initialized, their state is managed in a relationship\nstate object (eg BelongsToRelationship or ManyRelationship).

\n", + "example": [ + "\n\n let relationshipPayloadsManager = new RelationshipPayloadsManager(store);\n\n const User = DS.Model.extend({\n hobbies: DS.hasMany('hobby')\n });\n\n const Hobby = DS.Model.extend({\n user: DS.belongsTo('user')\n });\n\n let userPayload = {\n data: {\n id: 1,\n type: 'user',\n relationships: {\n hobbies: {\n data: [{\n id: 2,\n type: 'hobby'\n }]\n }\n }\n },\n };\n relationshipPayloadsManager.push('user', 1, userPayload.data.relationships);\n\n relationshipPayloadsManager.get('hobby', 2, 'user') === {\n {\n data: {\n id: 1,\n type: 'user'\n }\n }\n }" + ], + "access": "private", + "tagname": "", + "methods": [ + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 67, + "description": "

Find the payload for the given relationship of the given model.

\n

Returns the payload for the given relationship, whether raw or computed from\nthe payload of the inverse relationship.

\n", + "example": [ + "\n\n relationshipPayloadsManager.get('hobby', 2, 'user') === {\n {\n data: {\n id: 1,\n type: 'user'\n }\n }\n }" + ], + "itemtype": "method", + "name": "get", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 91, + "description": "

Push a model's relationships payload into this cache.

\n", + "example": [ + "\n\n let userPayload = {\n data: {\n id: 1,\n type: 'user',\n relationships: {\n hobbies: {\n data: [{\n id: 2,\n type: 'hobby'\n }]\n }\n }\n },\n };\n relationshipPayloadsManager.push('user', 1, userPayload.data.relationships);" + ], + "itemtype": "method", + "name": "push", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 125, + "description": "

Unload a model's relationships payload.

\n", + "itemtype": "method", + "name": "unload", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 141, + "description": "

Find the RelationshipPayloads object for the given relationship. The same\nRelationshipPayloads object is returned for either side of a relationship.

\n", + "example": [ + "\n\n const User = DS.Model.extend({\n hobbies: DS.hasMany('hobby')\n });\n\n const Hobby = DS.Model.extend({\n user: DS.belongsTo('user')\n });\n\n relationshipPayloads.get('user', 'hobbies') === relationshipPayloads.get('hobby', 'user');\n\nThe signature has a somewhat large arity to avoid extra work, such as\n a) string manipulation & allocation with `modelName` and\n `relationshipName`\n b) repeatedly getting `relationshipsByName` via `Ember.get`" + ], + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "_getRelationshipPayloads", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 293, + "description": "

Create the RelationshipsPayload for the relationship modelName, relationshipName, and its inverse.

\n", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "_initializeRelationshipPayloads", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + } + ], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RequestManager.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RequestManager.json deleted file mode 100644 index 4f3ce0ea9..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RequestManager.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-RequestManager", - "type": "class", - "attributes": { - "name": "RequestManager", - "shortname": "RequestManager", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request", - "namespace": "", - "file": "../request/src/-private/manager.ts", - "line": 415, - "description": "
\n
\n
\n \n \n \n \n \n \n \n
1\n
import RequestManager from '@ember-data/request';
\n
\n
\n \n

A RequestManager provides a request/response flow in which configured\nhandlers are successively given the opportunity to handle, modify, or\npass-along a request.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
interface RequestManager {\n  request<T>(req: RequestInfo): Future<T>;\n}
\n
\n
\n \n

For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\nimport Auth from 'ember-simple-auth/ember-data-handler';\nimport Config from './config';\n\nconst { apiUrl } = Config;\n\n// ... create manager\nconst manager = new RequestManager();\nmanager.use([Auth, Fetch]);\n\n// ... execute a request\nconst response = await manager.request({\n  url: `${apiUrl}/users`\n});
\n
\n
\n \n

Futures

\n

The return value of manager.request is a Future, which allows\naccess to limited information about the request while it is still\npending and fulfills with the final state when the request completes.

\n

A Future is cancellable via abort.

\n

Handlers may optionally expose a ReadableStream to the Future for\nstreaming data; however, when doing so the future should not resolve\nuntil the response stream is fully read.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
interface Future<T> extends Promise<StructuredDocument<T>> {\n  abort(): void;\n\n  async getStream(): ReadableStream | null;\n}
\n
\n
\n \n

StructuredDocuments

\n

A Future resolves with a StructuredDataDocument or rejects with a StructuredErrorDocument.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
interface StructuredDataDocument<T> {\n  request: ImmutableRequestInfo;\n  response: ImmutableResponseInfo;\n  content: T;\n}\ninterface StructuredErrorDocument extends Error {\n  request: ImmutableRequestInfo;\n  response: ImmutableResponseInfo;\n  error: string | object;\n}\ntype StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
\n
\n
\n \n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/request/src/-private/manager.ts", - "line": 501, - "description": "

Register a handler to use for primary cache intercept.

\n

Only one such handler may exist. If using the same\nRequestManager as the Store instance the Store\nregisters itself as a Cache handler.

\n", - "itemtype": "method", - "name": "useCache", - "access": "public", - "tagname": "", - "params": [ - { - "name": "cacheHandler", - "description": "", - "type": "Handler[]" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "RequestManager", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/manager.ts", - "line": 528, - "description": "

Register handler(s) to use when a request is issued.

\n

Handlers will be invoked in the order they are registered.\nEach Handler is given the opportunity to handle the request,\ncurry the request, or pass along a modified request.

\n", - "itemtype": "method", - "name": "use", - "access": "public", - "tagname": "", - "params": [ - { - "name": "newHandlers", - "description": "", - "type": "Handler[]" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "RequestManager", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/manager.ts", - "line": 562, - "description": "

Issue a Request.

\n

Returns a Future that fulfills with a StructuredDocument

\n", - "itemtype": "method", - "name": "request", - "access": "public", - "tagname": "", - "params": [ - { - "name": "request", - "description": "", - "type": "RequestInfo" - } - ], - "return": { - "description": "", - "type": "Future" - }, - "class": "RequestManager", - "module": "@ember-data/request" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/request", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RequestStateService.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RequestStateService.json deleted file mode 100644 index 7674fe647..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-RequestStateService.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-RequestStateService", - "type": "class", - "attributes": { - "name": "RequestStateService", - "shortname": "RequestStateService", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/network/request-cache.ts", - "line": 31, - "description": "

The RequestStateService is used to track the state of requests\nfor fetching or updating known resource identifies that are inflight.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/store/src/-private/network/request-cache.ts", - "line": 159, - "description": "

Subscribe to requests for a given resource identity.

\n

The callback will receive the current state of the request.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
interface RequestState {\n  state: 'pending' | 'fulfilled' | 'rejected';\n  type: 'query' | 'mutation';\n  request: Request;\n  response?: { data: unknown };\n}
\n
\n
\n \n

Note: It should be considered dangerous to use this API for more than simple\nstate derivation or debugging. The request and response properties are poorly\nspec'd and may change unexpectedly when shifting what Handlers are in use or how\nrequests are issued from the Store.

\n

We expect to revisit this API in the near future as we continue to refine the\nRequestManager ergonomics, as a simpler but more powerful direct integration\nwith the RequestManager for these purposes is likely to be a better long-term\ndesign.

\n", - "itemtype": "method", - "name": "subscribeForRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - }, - { - "name": "callback", - "description": "", - "type": "(state: RequestState) => void" - } - ], - "class": "RequestStateService", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/network/request-cache.ts", - "line": 195, - "description": "

Retrieve all active requests for a given resource identity.

\n", - "itemtype": "method", - "name": "getPendingRequestsForRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - } - ], - "return": { - "description": "an array of request states for any pending requests for the given identifier", - "type": "RequestState[]" - }, - "class": "RequestStateService", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/network/request-cache.ts", - "line": 210, - "description": "

Retrieve the last completed request for a given resource identity.

\n", - "itemtype": "method", - "name": "getLastRequestForRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - } - ], - "return": { - "description": "the state of the most recent request for the given identifier", - "type": "RequestState | null" - }, - "class": "RequestStateService", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-SchemaService.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-SchemaService.json deleted file mode 100644 index 5d9279236..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-SchemaService.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-SchemaService", - "type": "class", - "attributes": { - "name": "SchemaService", - "shortname": "SchemaService", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../../ember-data-types/q/schema-service.ts", - "line": 8, - "description": "

A SchemaDefinitionService implementation provides the ability\nto query for various information about a resource in an abstract manner.

\n

How an implementation determines this information is left up to the implementation,\nthis means that schema information could be lazily populated, derived-on-demand,\nor progressively enhanced during the course of an application's runtime.

\n

The implementation provided to work with @ember-data/model makes use of the\nstatic schema properties on those classes to respond to these queries; however,\nthat is not a necessary approach. For instance, Schema information could be sideloaded\nor pre-flighted for API calls, resulting in no need to bundle and ship potentially\nlarge and expensive JSON or JS schemas to pull information from.

\n

To register a custom schema implementation, extend the store service or\nlookup and register the schema service first thing on app-boot. Example below\nshows extending the service.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import Store from '@ember-data/store';\nimport CustomSchemas from './custom-schemas';\n\nexport default class extends Store {\n  constructor(...args) {\n    super(...args);\n    this.registerSchemaDefinitionService(new CustomSchemas());\n  }\n}
\n
\n
\n \n

At runtime, both the Store and the StoreWrapper provide\naccess to this service via the getSchemaDefinitionService() method.

\n

```ts\nexport default class extends Component {

\n", - "service": "store;\n\n get attributes() {\n return this.store\n .getSchemaDefinitionService()\n .attributesDefinitionFor(this.args.dataType);\n }\n}\n```\n\nThis is not a class and cannot be instantiated.", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../ember-data-types/q/schema-service.ts", - "line": 59, - "description": "

Queries whether the schema-definition-service recognizes type as a resource type

\n", - "itemtype": "method", - "name": "doesTypeExist", - "access": "public", - "tagname": "", - "params": [ - { - "name": "type", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "SchemaService", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/schema-service.ts", - "line": 69, - "description": "

Returns definitions for all properties of the specified resource\nthat are considered "attributes". Generally these are properties\nthat are not related to book-keeping state on the client and do\nnot represent a linkage to another resource.

\n

The return value should be a dictionary of key:value pairs\nwhere the key is the attribute or property's name and value\nis an object with at least the property name which should also\nmatch key.

\n

Optionally, this object may also specify type, which should\nbe a string reference to a transform, and options which\nshould be dictionary in which any key:value pairs are permissable.

\n

For instance, when using @ember-data/model, the following attribute\ndefinition:

\n

```ts\nclass extends Model {

\n", - "attr": "firstName;\n}\n```\n\nWould be returned as:\n\n```js\n{\n greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },\n birthday: { name: 'birthday', type: 'date' },\n firstName: { name: 'firstName' }\n}\n```", - "itemtype": "method", - "name": "attributesDefinitionFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "}", - "description": "identifier", - "type": "RecordIdentifier| type: string" - } - ], - "return": { - "description": "", - "type": "AttributesSchema" - }, - "class": "SchemaService", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/schema-service.ts", - "line": 112, - "description": "

Returns definitions for all properties of the specified resource\nthat are considered "relationships". Generally these are properties\nthat represent a linkage to another resource.

\n

The return value should be a dictionary of key:value pairs\nwhere the key is the relationship or property's name and value\nis an object with at least the following properties:

\n
    \n
  • name which should also match the key used in the dictionary.

    \n
  • \n
  • kind which should be either belongsTo or hasMany

    \n
  • \n
  • type which should be the related resource's string "type"

    \n
  • \n
  • options which should be a dictionary allowing any key but with\n at least the below keys present.

    \n
  • \n
  • options.async a boolean representing whether data for this relationship is\n typically loaded on-demand.

    \n
  • \n
  • options.inverse a string or null representing the field name / key of the

    \n
    \n
    \n
    \n \n \n \n \n \n \n \n
    1\n
    corresponding relationship on the inverse resource.
    \n
    \n
    \n
  • \n
\n

Additionally the following options properties are optional. See Polymorphic Relationships

\n
    \n
  • options.polymorphic a boolean representing whether multiple resource types\n can be used to satisfy this relationship.
  • \n
  • options.as a string representing the abstract type that the concrete side of\n a relationship must specify when fulfilling a polymorphic inverse.
  • \n
\n

For example, the following Model using @ember-data/model would generate this relationships\ndefinition by default:

\n

```js\nclass User extends Model {

\n", - "belongsto": "('user', { async: false, inverse: null }) bestFriend;", - "hasmany": "('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;\n}\n```\n\nWhich would be returned as\n\n```js\n{\n bestFriend: {\n name: 'bestFriend',\n kind: 'belongsTo',\n type: 'user',\n options: {\n async: false,\n inverse: null\n }\n },\n friends: {\n name: 'friends',\n kind: 'hasMany',\n type: 'user',\n options: {\n async: true,\n inverse: 'friends'\n }\n },\n pets: {\n name: 'pets',\n kind: 'hasMany',\n type: 'pet',\n options: {\n async: false,\n polymorphic: true,\n inverse: 'owner'\n }\n },\n}\n```", - "itemtype": "method", - "name": "relationshipsDefinitionFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "}", - "description": "identifier", - "type": "RecordIdentifier| type: string" - } - ], - "return": { - "description": "", - "type": "RelationshipsSchema" - }, - "class": "SchemaService", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ServerError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ServerError.json deleted file mode 100644 index dc72440e6..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-ServerError.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-ServerError", - "type": "class", - "attributes": { - "name": "ServerError", - "shortname": "ServerError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 332, - "description": "

A ServerError equates to a HTTP 500 Internal Server Error response\nstatus. It is used by the adapter to indicate that a request has failed\nbecause of an error in the external API.

\n", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-SnapshotRecordArray.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-SnapshotRecordArray.json deleted file mode 100644 index c3350f9d8..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-SnapshotRecordArray.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-SnapshotRecordArray", - "type": "class", - "attributes": { - "name": "SnapshotRecordArray", - "shortname": "SnapshotRecordArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/legacy-compat", - "namespace": "", - "file": "../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 12, - "description": "

SnapshotRecordArray is not directly instantiable.\nInstances are provided to consuming application's\nadapters for certain requests.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 29, - "description": "

SnapshotRecordArray is not directly instantiable.\nInstances are provided to consuming application's\nadapters and serializers for certain requests.

\n", - "itemtype": "method", - "name": "constructor", - "access": "private", - "tagname": "", - "is_constructor": 1, - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "String" - }, - { - "name": "options", - "description": "" - } - ], - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 141, - "description": "

Get snapshots of the underlying record array

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport 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 \n", - "itemtype": "method", - "name": "snapshots", - "access": "public", - "tagname": "", - "return": { - "description": "Array of snapshots", - "type": "Array" - }, - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 43, - "description": "

An array of snapshots

\n", - "access": "private", - "tagname": "", - "itemtype": "property", - "name": "_snapshots", - "type": "{Array}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 51, - "description": "

The modelName of the underlying records for the snapshots in the array, as a Model

\n", - "itemtype": "property", - "name": "modelName", - "access": "public", - "tagname": "", - "type": "{Model}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 59, - "description": "

A hash of adapter options passed into the store method for this request.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n  findAll(store, type, sinceToken, snapshotRecordArray) {\n    if (snapshotRecordArray.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n}
\n
\n
\n \n", - "itemtype": "property", - "name": "adapterOptions", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 83, - "description": "

The relationships to include for this request.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import Adapter from '@ember-data/adapter';\n\nexport 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 \n", - "itemtype": "property", - "name": "include", - "access": "public", - "tagname": "", - "type": "{String|Array}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 107, - "description": "

An array of records

\n", - "itemtype": "property", - "name": "_recordArray", - "access": "private", - "tagname": "", - "type": "{Array}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 118, - "description": "

Number of records in the array

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class PostAdapter extends JSONAPIAdapter {\n  shouldReloadAll(store, snapshotRecordArray) {\n    return !snapshotRecordArray.length;\n  }\n});
\n
\n
\n \n", - "itemtype": "property", - "name": "length", - "access": "public", - "tagname": "", - "type": "{Number}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/legacy-compat", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-StableRecordIdentifier.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-StableRecordIdentifier.json deleted file mode 100644 index 426fa8cd3..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-StableRecordIdentifier.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-StableRecordIdentifier", - "type": "class", - "attributes": { - "name": "StableRecordIdentifier", - "shortname": "StableRecordIdentifier", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../../ember-data-types/q/identifier.ts", - "line": 85, - "description": "

A referentially stable object with a unique string (lid) that can be used\nas a reference to data in the cache.

\n

Every record instance has a unique identifier, and identifiers may refer\nto data that has never been loaded (for instance, in an async relationship).

\n", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [ - { - "file": "../ember-data-types/q/identifier.ts", - "line": 96, - "description": "

A string representing a unique identity.

\n", - "itemtype": "property", - "name": "lid", - "type": "String", - "access": "public", - "tagname": "", - "class": "StableRecordIdentifier", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 102, - "description": "

the primary resource type or modelName this identity belongs to.

\n", - "itemtype": "property", - "name": "type", - "type": "String", - "access": "public", - "tagname": "", - "class": "StableRecordIdentifier", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 108, - "description": "

the primary id for the record this identity belongs to. null\nif not yet assigned an id.

\n", - "itemtype": "property", - "name": "id", - "type": "String | null", - "access": "public", - "tagname": "", - "class": "StableRecordIdentifier", - "module": "@ember-data/store" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Store.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Store.json deleted file mode 100644 index 208d58caa..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Store.json +++ /dev/null @@ -1,758 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Store", - "type": "class", - "attributes": { - "name": "Store", - "shortname": "Store", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/store-service.ts", - "line": 83, - "description": "

A Store coordinates interaction between your application, a Cache,\nand sources of data (such as your API or a local persistence layer)\naccessed via a RequestManager.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/services/store.js
1\n2\n3\n
import Store from '@ember-data/store';\n\nexport default class extends Store {}
\n
\n
\n \n

Most Ember applications will only have a single Store configured as a Service\nin this manner. However, setting up multiple stores is possible, including using\neach as a unique service.

\n", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 243, - "itemtype": "method", - "name": "init", - "access": "private", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 317, - "description": "

Retrieve the RequestStateService instance\nassociated with this Store.

\n

This can be used to query the status of requests\nthat have been initiated for a given identifier.

\n", - "itemtype": "method", - "name": "getRequestStateService", - "return": { - "description": "", - "type": "RequestStateService" - }, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 349, - "description": "

Issue a request via the configured RequestManager,\ninserting the response into the cache and handing\nback a Future which resolves to a ResponseDocument

\n

Resource data is always updated in the cache.

\n

Only GET requests have the request result and document\ncached by default when a cache key is present.

\n

The cache key used is requestConfig.cacheOptions.key\nif present, falling back to requestconfig.url.

\n

Params are not serialized as part of the cache-key, so\neither ensure they are already in the url or utilize\nrequestConfig.cacheOptions.key. For queries issued\nvia the POST method requestConfig.cacheOptions.key\nMUST be supplied for the document to be cached.

\n", - "itemtype": "method", - "name": "request", - "params": [ - { - "name": "requestConfig", - "description": "", - "type": "StoreRequestInfo" - } - ], - "return": { - "description": "", - "type": "Future" - }, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 426, - "description": "

A hook which an app or addon may implement. Called when\nthe Store is attempting to create a Record Instance for\na resource.

\n

This hook can be used to select or instantiate any desired\nmechanism of presentating cache data to the ui for access\nmutation, and interaction.

\n", - "itemtype": "method", - "name": "instantiateRecord (hook)", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "createRecordArgs", - "description": "" - }, - { - "name": "recordDataFor", - "description": "deprecated use this.cache" - }, - { - "name": "notificationManager", - "description": "deprecated use this.notifications" - } - ], - "return": { - "description": "A record instance" - }, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 470, - "description": "

A hook which an app or addon may implement. Called when\nthe Store is destroying a Record Instance. This hook should\nbe used to teardown any custom record instances instantiated\nwith instantiateRecord.

\n", - "itemtype": "method", - "name": "teardownRecord (hook)", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 492, - "description": "

Provides access to the SchemaDefinitionService instance\nfor this Store instance.

\n

The SchemaDefinitionService can be used to query for\ninformation about the schema of a resource.

\n", - "itemtype": "method", - "name": "getSchemaDefinitionService", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 514, - "description": "

DEPRECATED - Use registerSchema instead.

\n

Allows an app to register a custom SchemaService\nfor use when information about a resource's schema needs\nto be queried.

\n

This method can only be called more than once, but only one schema\ndefinition service may exist. Therefore if you wish to chain services\nyou must lookup the existing service and close over it with the new\nservice by accessing store.schema prior to registration.

\n

For Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
import Store from '@ember-data/store';\n\nclass SchemaDelegator {\n  constructor(schema) {\n    this._schema = schema;\n  }\n\n  doesTypeExist(type: string): boolean {\n    if (AbstractSchemas.has(type)) {\n      return true;\n    }\n    return this._schema.doesTypeExist(type);\n  }\n\n  attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {\n    return this._schema.attributesDefinitionFor(identifier);\n  }\n\n  relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {\n    const schema = AbstractSchemas.get(identifier.type);\n    return schema || this._schema.relationshipsDefinitionFor(identifier);\n  }\n}\n\nexport default class extends Store {\n  constructor(...args) {\n    super(...args);\n\n    const schema = this.schema;\n    this.registerSchemaDefinitionService(new SchemaDelegator(schema));\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "registerSchemaDefinitionService", - "params": [ - { - "name": "schema", - "description": "", - "type": "SchemaService" - } - ], - "deprecated": true, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 571, - "description": "

Allows an app to register a custom SchemaService\nfor use when information about a resource's schema needs\nto be queried.

\n

This method can only be called more than once, but only one schema\ndefinition service may exist. Therefore if you wish to chain services\nyou must lookup the existing service and close over it with the new\nservice by accessing store.schema prior to registration.

\n

For Example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n
import Store from '@ember-data/store';\n\nclass SchemaDelegator {\n  constructor(schema) {\n    this._schema = schema;\n  }\n\n  doesTypeExist(type: string): boolean {\n    if (AbstractSchemas.has(type)) {\n      return true;\n    }\n    return this._schema.doesTypeExist(type);\n  }\n\n  attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {\n    return this._schema.attributesDefinitionFor(identifier);\n  }\n\n  relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {\n    const schema = AbstractSchemas.get(identifier.type);\n    return schema || this._schema.relationshipsDefinitionFor(identifier);\n  }\n}\n\nexport default class extends Store {\n  constructor(...args) {\n    super(...args);\n\n    const schema = this.schema;\n    this.registerSchema(new SchemaDelegator(schema));\n  }\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "registerSchema", - "params": [ - { - "name": "schema", - "description": "", - "type": "SchemaService" - } - ], - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 626, - "description": "

Returns the schema for a particular modelName.

\n

When used with Model from @ember-data/model the return is the model class,\nbut this is not guaranteed.

\n

If looking to query attribute or relationship information it is\nrecommended to use getSchemaDefinitionService instead. This method\nshould be considered legacy and exists primarily to continue to support\nAdapter/Serializer APIs which expect it's return value in their method\nsignatures.

\n

The class of a model might be useful if you want to get a list of all the\nrelationship names of the model, see\nrelationshipNames\nfor example.

\n", - "itemtype": "method", - "name": "modelFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Subclass of Model | ShimModelClass" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 685, - "description": "

Create a new record in the current store. The properties passed\nto this method are set on the newly created record.

\n

To create a new instance of a Post:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.createRecord('post', {\n  title: 'Ember is awesome!'\n});
\n
\n
\n \n

To create a new instance of a Post that has a relationship with a User record:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let user = this.store.peekRecord('user', 1);\nstore.createRecord('post', {\n  title: 'Ember is awesome!',\n  user: user\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "inputProperties", - "description": "a hash of properties to set on the\n newly created record.", - "type": "Object" - } - ], - "return": { - "description": "record", - "type": "Model" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 775, - "description": "

For symmetry, a record can be deleted via the store.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let post = store.createRecord('post', {\n  title: 'Ember is awesome!'\n});\n\nstore.deleteRecord(post);
\n
\n
\n \n", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 811, - "description": "

For symmetry, a record can be unloaded via the store.\nThis will cause the record to be destroyed and freed up for garbage collection.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.findRecord('post', 1).then(function(post) {\n  store.unloadRecord(post);\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 837, - "description": "

This method returns a record for a given identifier or type and id combination.

\n

The findRecord method will always resolve its promise with the same\nobject for a given identifier or type and id.

\n

The findRecord method will always return a promise that will be\nresolved with the record.

\n

Example 1

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n  model({ post_id }) {\n    return this.store.findRecord('post', post_id);\n  }\n}
\n
\n
\n \n

Example 2

\n

findRecord can be called with a single identifier argument instead of the combination\nof type (modelName) and id as separate arguments. You may recognize this combo as\nthe typical pairing from JSON:API

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n  model({ post_id: id }) {\n    return this.store.findRecord({ type: 'post', id });\n  }\n}
\n
\n
\n \n

Example 3

\n

If you have previously received an lid via an Identifier for this record, and the record\nhas already been assigned an id, you can find the record again using just the lid.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n
store.findRecord({ lid });
\n
\n
\n \n

If the record is not yet available, the store will ask the adapter's findRecord\nmethod to retrieve and supply the necessary data. If the record is already present\nin the store, it depends on the reload behavior when the returned promise\nresolves.

\n

Preloading

\n

You can optionally preload specific attributes and relationships that you know of\nby passing them via the passed options.

\n

For example, if your Ember route looks like /posts/1/comments/2 and your API route\nfor the comment also looks like /posts/1/comments/2 if you want to fetch the comment\nwithout also fetching the post you can pass in the post to the findRecord call:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
comments.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n  model({ post_id, comment_id: id }) {\n    return this.store.findRecord({ type: 'comment', id, { preload: { post: post_id }} });\n  }\n}
\n
\n
\n \n

In your adapter you can then access this id without triggering a network request via the\nsnapshot:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import EmberObject from '@ember/object';\n\nexport default class Adapter extends EmberObject {\n\n  findRecord(store, schema, id, snapshot) {\n    let type = schema.modelName;\n\n    if (type === 'comment')\n      let postId = snapshot.belongsTo('post', { id: true });\n\n      return fetch(`./posts/${postId}/comments/${id}`)\n        .then(response => response.json())\n    }\n  }\n}
\n
\n
\n \n

This could also be achieved by supplying the post id to the adapter via the adapterOptions\nproperty on the options hash.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
comments.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n  model({ post_id, comment_id: id }) {\n    return this.store.findRecord({ type: 'comment', id, { adapterOptions: { post: post_id }} });\n  }\n}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import EmberObject from '@ember/object';\n\nexport default class Adapter extends EmberObject {\n\n  findRecord(store, schema, id, snapshot) {\n    let type = schema.modelName;\n\n    if (type === 'comment')\n      let postId = snapshot.adapterOptions.post;\n\n      return fetch(`./posts/${postId}/comments/${id}`)\n        .then(response => response.json())\n    }\n  }\n}
\n
\n
\n \n

If you have access to the post model you can also pass the model itself to preload:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
let post = await store.findRecord('post', 1);\nlet comment = await store.findRecord('comment', 2, { post: myPostModel });
\n
\n
\n \n

Reloading

\n

The reload behavior is configured either via the passed options hash or\nthe result of the adapter's shouldReloadRecord.

\n

If { reload: true } is passed or adapter.shouldReloadRecord evaluates\nto true, then the returned promise resolves once the adapter returns\ndata, regardless if the requested record is already in the store:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
store.push({\n  data: {\n    id: 1,\n    type: 'post',\n    revision: 1\n  }\n});\n\n// adapter#findRecord resolves with\n// [\n//   {\n//     id: 1,\n//     type: 'post',\n//     revision: 2\n//   }\n// ]\nstore.findRecord('post', 1, { reload: true }).then(function(post) {\n  post.revision; // 2\n});
\n
\n
\n \n

If no reload is indicated via the above mentioned ways, then the promise\nimmediately resolves with the cached version in the store.

\n

Background Reloading

\n

Optionally, if adapter.shouldBackgroundReloadRecord evaluates to true,\nthen a background reload is started, which updates the records' data, once\nit is available:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n
// app/adapters/post.js\nimport ApplicationAdapter from "./application";\n\nexport default class PostAdapter extends ApplicationAdapter {\n  shouldReloadRecord(store, snapshot) {\n    return false;\n  },\n\n  shouldBackgroundReloadRecord(store, snapshot) {\n    return true;\n  }\n});\n\n// ...\n\nstore.push({\n  data: {\n    id: 1,\n    type: 'post',\n    revision: 1\n  }\n});\n\nlet blogPost = store.findRecord('post', 1).then(function(post) {\n  post.revision; // 1\n});\n\n// later, once adapter#findRecord resolved with\n// [\n//   {\n//     id: 1,\n//     type: 'post',\n//     revision: 2\n//   }\n// ]\n\nblogPost.revision; // 2
\n
\n
\n \n

If you would like to force or prevent background reloading, you can set a\nboolean value for backgroundReload in the options object for\nfindRecord.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post/edit.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostEditRoute extends Route {\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { backgroundReload: false });\n  }\n}
\n
\n
\n \n

If you pass an object on the adapterOptions property of the options\nargument it will be passed to your adapter via the snapshot

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post/edit.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import Route from '@ember/routing/route';\n\nexport default class PostEditRoute extends Route {\n  model(params) {\n    return this.store.findRecord('post', params.post_id, {\n      adapterOptions: { subscribe: false }\n    });\n  }\n}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n  findRecord(store, type, id, snapshot) {\n    if (snapshot.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n}
\n
\n
\n \n

See peekRecord to get the cached version of a record.

\n\n

If you use an adapter such as Ember's default\nJSONAPIAdapter\nthat supports the JSON API specification and if your server\nendpoint supports the use of an\n'include' query parameter,\nyou can use findRecord() or findAll() to automatically retrieve additional records related to\nthe one you request by supplying an include parameter in the options object.

\n

For example, given a post model that has a hasMany relationship with a comment\nmodel, when we retrieve a specific post we can have the server also return that post's\ncomments in the same request:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { include: 'comments' });\n  }\n}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import EmberObject from '@ember/object';\n\nexport default class Adapter extends EmberObject {\n\n  findRecord(store, schema, id, snapshot) {\n    let type = schema.modelName;\n\n    if (type === 'post')\n      let includes = snapshot.adapterOptions.include;\n\n      return fetch(`./posts/${postId}?include=${includes}`)\n        .then(response => response.json())\n    }\n  }\n}
\n
\n
\n \n

In this case, the post's comments would then be available in your template as\nmodel.comments.

\n

Multiple relationships can be requested using an include parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the post's\ncomments and the authors of those comments the request would look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });\n  }\n}
\n
\n
\n \n

Retrieving Specific Fields by Type

\n

If your server endpoint supports the use of a 'fields' query parameter,\nyou can use pass those fields through to your server. At this point in time, this requires a few manual steps on your part.

\n
    \n
  1. Implement buildQuery in your adapter.
  2. \n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
buildQuery(snapshot) {\n  let query = super.buildQuery(...arguments);\n\n  let { fields } = snapshot.adapterOptions;\n\n  if (fields) {\n    query.fields = fields;\n  }\n\n  return query;\n}
\n
\n
\n \n
    \n
  1. Then pass through the applicable fields to your findRecord request.
  2. \n
\n

Given a post model with attributes body, title, publishDate and meta, you can retrieve a filtered list of attributes.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n
import Route from '@ember/routing/route';\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title' } });\n  }\n});
\n
\n
\n \n

Moreover, you can filter attributes on related models as well. If a post has a belongsTo relationship to a user,\njust include the relationship key and attributes.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post.js
1\n2\n3\n4\n5\n6\n
import Route from '@ember/routing/route';\nexport default Route.extend({\n  model(params) {\n    return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title', user: 'name,email' } });\n  }\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "findRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "- either a string representing the modelName 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", - "type": "String|object" - }, - { - "name": "id", - "description": "- 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", - "type": "(String|Integer|Object)" - }, - { - "name": "options", - "description": "- if the first param is a string this will be the optional options for the request. See examples for available options.", - "type": "Object", - "optional": true - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1260, - "description": "

Get the reference for the specified record.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n
let userRef = store.getReference('user', 1);\n\n// check if the user is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === 'id') {\nlet id = userRef.id();\n}\n\n// load user (via store.find)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({ id: 1, username: '@user' }).then(function(user) {\n  userRef.value() === user;\n});
\n
\n
\n \n", - "itemtype": "method", - "name": "getReference", - "access": "public", - "tagname": "", - "params": [ - { - "name": "resource", - "description": "- modelName (string) or Identifier (object)", - "type": "String|object" - }, - { - "name": "id", - "description": "", - "type": "String|Integer" - } - ], - "since": "2.5.0", - "return": { - "description": "", - "type": "RecordReference" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1323, - "description": "

Get a record by a given type and ID without triggering a fetch.

\n

This method will synchronously return the record if it is available in the store,\notherwise it will return null. A record is available if it has been fetched earlier, or\npushed manually into the store.

\n

See findRecord if you would like to request this record from the backend.

\n

Note: This is a synchronous method and does not return a promise.

\n

Example 1

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
let post = store.peekRecord('post', 1);\n\npost.id; // 1
\n
\n
\n \n

peekRecord can be called with a single identifier argument instead of the combination\nof type (modelName) and id as separate arguments. You may recognize this combo as\nthe typical pairing from JSON:API

\n

Example 2

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
let post = store.peekRecord({ type: 'post', id });\npost.id; // 1
\n
\n
\n \n

If you have previously received an lid from an Identifier for this record, you can lookup the record again using\njust the lid.

\n

Example 3

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
let post = store.peekRecord({ lid });\npost.id; // 1
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "peekRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "- either a string representing the modelName 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", - "type": "String|object" - }, - { - "name": "id", - "description": "- optional only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved.", - "type": "String|Integer" - } - ], - "return": { - "description": "record", - "type": "Model|null" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1401, - "description": "

This method delegates a query to the adapter. This is the one place where\nadapter-level semantics are exposed to the application.

\n

Each time this method is called a new request is made through the adapter.

\n

Exposing queries this way seems preferable to creating an abstract query\nlanguage for all server-side queries, and then require all adapters to\nimplement them.

\n
\n

If you do something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('person', { page: 1 });
\n
\n
\n \n

The request made to the server will look something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
GET "/api/v1/person?page=1"
\n
\n
\n
\n

If you do something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
store.query('person', { ids: [1, 2, 3] });
\n
\n
\n \n

The request made to the server will look something like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
GET "/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3"\ndecoded: "/api/v1/person?ids[]=1&ids[]=2&ids[]=3"
\n
\n
\n

This method returns a promise, which is resolved with a\nCollection\nonce the server returns.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "query", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "an opaque query to be used by the adapter", - "type": "Any" - }, - { - "name": "options", - "description": "optional, may include `adapterOptions` hash which will be passed to adapter.query", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1480, - "description": "

This method makes a request for one record, where the id is not known\nbeforehand (if the id is known, use findRecord\ninstead).

\n

This method can be used when it is certain that the server will return a\nsingle object for the primary data.

\n

Each time this method is called a new request is made through the adapter.

\n

Let's assume our API provides an endpoint for the currently logged in user\nvia:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
// GET /api/current_user\n{\n  user: {\n    id: 1234,\n    username: 'admin'\n  }\n}
\n
\n
\n

Since the specific id of the user is not known beforehand, we can use\nqueryRecord to get the user:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
store.queryRecord('user', {}).then(function(user) {\n  let username = user.username;\n  // do thing\n});
\n
\n
\n \n

The request is made through the adapters' queryRecord:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/user.js
1\n2\n3\n4\n5\n6\n7\n8\n
import Adapter from '@ember-data/adapter';\nimport $ from 'jquery';\n\nexport default class UserAdapter extends Adapter {\n  queryRecord(modelName, query) {\n    return $.getJSON('/api/current_user');\n  }\n}
\n
\n
\n \n

Note: the primary use case for store.queryRecord is when a single record\nis queried and the id is not known beforehand. In all other cases\nstore.query and using the first item of the array is likely the preferred\nway:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
// GET /users?username=unique\n{\n  data: [{\n    id: 1234,\n    type: 'user',\n    attributes: {\n      username: "unique"\n    }\n  }]\n}
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
store.query('user', { username: 'unique' }).then(function(users) {\n  return users.firstObject;\n}).then(function(user) {\n  let id = user.id;\n});
\n
\n
\n \n

This method returns a promise, which resolves with the found record.

\n

If the adapter returns no data for the primary data of the payload, then\nqueryRecord resolves with null:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
// GET /users?username=unique\n{\n  data: null\n}
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
store.queryRecord('user', { username: 'unique' }).then(function(user) {\n   // user is null\n});
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "queryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "an opaque query to be used by the adapter", - "type": "Any" - }, - { - "name": "options", - "description": "optional, may include `adapterOptions` hash which will be passed to adapter.queryRecord", - "type": "Object" - } - ], - "return": { - "description": "promise which resolves with the found record or `null`", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1602, - "description": "

findAll asks the adapter's findAll method to find the records for the\ngiven type, and returns a promise which will resolve with all records of\nthis type present in the store, even if the adapter only returns a subset\nof them.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/authors.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class AuthorsRoute extends Route {\n  model(params) {\n    return this.store.findAll('author');\n  }\n}
\n
\n
\n \n

When the returned promise resolves depends on the reload behavior,\nconfigured via the passed options hash and the result of the adapter's\nshouldReloadAll method.

\n

Reloading

\n

If { reload: true } is passed or adapter.shouldReloadAll evaluates to\ntrue, then the returned promise resolves once the adapter returns data,\nregardless if there are already records in the store:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
store.push({\n  data: {\n    id: 'first',\n    type: 'author'\n  }\n});\n\n// adapter#findAll resolves with\n// [\n//   {\n//     id: 'second',\n//     type: 'author'\n//   }\n// ]\nstore.findAll('author', { reload: true }).then(function(authors) {\n  authors.getEach('id'); // ['first', 'second']\n});
\n
\n
\n \n

If no reload is indicated via the above mentioned ways, then the promise\nimmediately resolves with all the records currently loaded in the store.

\n

Background Reloading

\n

Optionally, if adapter.shouldBackgroundReloadAll evaluates to true,\nthen a background reload is started. Once this resolves, the array with\nwhich the promise resolves, is updated automatically so it contains all the\nrecords in the store:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n
import Adapter from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter {\n  shouldReloadAll(store, snapshotsArray) {\n    return false;\n  },\n\n  shouldBackgroundReloadAll(store, snapshotsArray) {\n    return true;\n  }\n});\n\n// ...\n\nstore.push({\n  data: {\n    id: 'first',\n    type: 'author'\n  }\n});\n\nlet allAuthors;\nstore.findAll('author').then(function(authors) {\n  authors.getEach('id'); // ['first']\n\n  allAuthors = authors;\n});\n\n// later, once adapter#findAll resolved with\n// [\n//   {\n//     id: 'second',\n//     type: 'author'\n//   }\n// ]\n\nallAuthors.getEach('id'); // ['first', 'second']
\n
\n
\n \n

If you would like to force or prevent background reloading, you can set a\nboolean value for backgroundReload in the options object for\nfindAll.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/post/edit.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostEditRoute extends Route {\n  model() {\n    return this.store.findAll('post', { backgroundReload: false });\n  }\n}
\n
\n
\n \n

If you pass an object on the adapterOptions property of the options\nargument it will be passed to you adapter via the snapshotRecordArray

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/posts.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import Route from '@ember/routing/route';\n\nexport default class PostsRoute extends Route {\n  model(params) {\n    return this.store.findAll('post', {\n      adapterOptions: { subscribe: false }\n    });\n  }\n}
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/post.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import MyCustomAdapter from './custom-adapter';\n\nexport default class UserAdapter extends MyCustomAdapter {\n  findAll(store, type, sinceToken, snapshotRecordArray) {\n    if (snapshotRecordArray.adapterOptions.subscribe) {\n      // ...\n    }\n    // ...\n  }\n}
\n
\n
\n \n

See peekAll to get an array of current records in the\nstore, without waiting until a reload is finished.

\n\n

If you use an adapter such as Ember's default\nJSONAPIAdapter\nthat supports the JSON API specification and if your server\nendpoint supports the use of an\n'include' query parameter,\nyou can use findAll() to automatically retrieve additional records related to\nthose requested by supplying an include parameter in the options object.

\n

For example, given a post model that has a hasMany relationship with a comment\nmodel, when we retrieve all of the post records we can have the server also return\nall of the posts' comments in the same request:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/posts.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostsRoute extends Route {\n  model() {\n    return this.store.findAll('post', { include: 'comments' });\n  }\n}
\n
\n
\n \n

Multiple relationships can be requested using an include parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the posts'\ncomments and the authors of those comments the request would look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/posts.js
1\n2\n3\n4\n5\n6\n7\n
import Route from '@ember/routing/route';\n\nexport default class PostsRoute extends Route {\n  model() {\n    return this.store.findAll('post', { include: 'comments,comments.author' });\n  }\n}
\n
\n
\n \n

See query to only get a subset of records from the server.

\n", - "since": "1.13.0", - "itemtype": "method", - "name": "findAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1812, - "description": "

This method returns a filtered array that contains all of the\nknown records for a given type in the store.

\n

Note that because it's just a filter, the result will contain any\nlocally created records of the type, however, it will not make a\nrequest to the backend to retrieve additional records. If you\nwould like to request all the records from the backend please use\nstore.findAll.

\n

Also note that multiple calls to peekAll for a given type will always\nreturn the same RecordArray.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
let localPosts = store.peekAll('post');
\n
\n
\n \n", - "since": "1.13.0", - "itemtype": "method", - "name": "peekAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "RecordArray" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1851, - "description": "

This method unloads all records in the store.\nIt schedules unloading to happen during the next run loop.

\n

Optionally you can pass a type which unload all records for a given type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.unloadAll();\nstore.unloadAll('post');
\n
\n
\n \n", - "itemtype": "method", - "name": "unloadAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1898, - "description": "

Push some data for a given type into the store.

\n

This method expects normalized JSON API document. This means you have to follow JSON API specification with few minor adjustments:

\n
    \n
  • record's type should always be in singular, dasherized form
  • \n
  • members (properties) should be camelCased
  • \n
\n

Your primary data should be wrapped inside data property:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
store.push({\n  data: {\n    // primary data for single record of type `Person`\n    id: '1',\n    type: 'person',\n    attributes: {\n      firstName: 'Daniel',\n      lastName: 'Kmak'\n    }\n  }\n});
\n
\n
\n \n

Demo.

\n

data property can also hold an array (of records):

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n
store.push({\n  data: [\n    // an array of records\n    {\n      id: '1',\n      type: 'person',\n      attributes: {\n        firstName: 'Daniel',\n        lastName: 'Kmak'\n      }\n    },\n    {\n      id: '2',\n      type: 'person',\n      attributes: {\n        firstName: 'Tom',\n        lastName: 'Dale'\n      }\n    }\n  ]\n});
\n
\n
\n \n

Demo.

\n

There are some typical properties for JSONAPI payload:

\n
    \n
  • id - mandatory, unique record's key
  • \n
  • type - mandatory string which matches model's dasherized name in singular form
  • \n
  • attributes - object which holds data for record attributes - attr's declared in model
  • \n
  • relationships - object which must contain any of the following properties under each relationships' respective key (example path is relationships.achievements.data):
      \n
    • links
    • \n
    • data - place for primary data
    • \n
    • meta - object which contains meta-information about relationship
    • \n
    \n
  • \n
\n

For this model:

\n

```app/models/person.js\nimport Model, { attr, hasMany } from '@ember-data/model';

\n

export default class PersonRoute extends Route {

\n", - "attr": "('string') lastName;", - "hasmany": "('person') children;\n}\n```\n\nTo represent the children as IDs:\n\n```js\n{\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n data: [\n {\n id: '2',\n type: 'person'\n },\n {\n id: '3',\n type: 'person'\n },\n {\n id: '4',\n type: 'person'\n }\n ]\n }\n }\n }\n}\n```\n\n[Demo.](http://ember-twiddle.com/343e1735e034091f5bde)\n\nTo represent the children relationship as a URL:\n\n```js\n{\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n links: {\n related: '/people/1/children'\n }\n }\n }\n }\n}\n```\n\nIf you're streaming data or implementing an adapter, make sure\nthat you have converted the incoming data into this form. The\nstore's [normalize](../methods/normalize?anchor=normalize) method is a convenience\nhelper for converting a json payload into the form Ember Data\nexpects.\n\n```js\nstore.push(store.normalize('person', data));\n```\n\nThis method can be used both to push in brand new\nrecords, as well as to update existing records.", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "data", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "the record(s) that was created or\n updated." - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2070, - "description": "

Push some data in the form of a json-api document into the store,\nwithout creating materialized records.

\n", - "itemtype": "method", - "name": "_push", - "access": "private", - "tagname": "", - "params": [ - { - "name": "jsonApiDoc", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "identifiers for the primary records that had data loaded", - "type": "StableRecordIdentifier|Array" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2109, - "description": "

Push some raw data into the store.

\n

This method can be used both to push in brand new\nrecords, as well as to update existing records. You\ncan push in more than one type of object at once.\nAll objects should be in the format expected by the\nserializer.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n
import RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer;
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\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\nstore.pushPayload(pushData);
\n
\n
\n \n

By default, the data will be deserialized using a default\nserializer (the application serializer if it exists).

\n

Alternatively, pushPayload will accept a model type which\nwill determine which serializer will process the payload.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n
import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/post.js
1\n2\n3\n
import JSONSerializer from '@ember-data/serializer/json';\n\nexport default JSONSerializer;
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n
store.pushPayload(pushData); // Will use the application serializer\nstore.pushPayload('post', pushData); // Will use the post serializer
\n
\n
\n \n", - "itemtype": "method", - "name": "pushPayload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "Optionally, a model type used to determine which serializer will be used", - "type": "String" - }, - { - "name": "inputPayload", - "description": "", - "type": "Object" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2212, - "description": "

Trigger a save for a Record.

\n", - "itemtype": "method", - "name": "saveRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "RecordInstance" - }, - { - "name": "options", - "description": "" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2273, - "description": "

Instantiation hook allowing applications or addons to configure the store\nto utilize a custom Cache implementation.

\n

This hook should not be called directly by consuming applications or libraries.\nUse Store.cache to access the Cache instance.

\n", - "itemtype": "method", - "name": "createCache (hook)", - "access": "public", - "tagname": "", - "params": [ - { - "name": "storeWrapper", - "description": "" - } - ], - "return": { - "description": "", - "type": "Cache" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2315, - "description": "

normalize converts a json payload into the normalized form that\npush expects.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\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 \n", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "The name of the model type for this payload", - "type": "String" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "The normalized payload", - "type": "Object" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2355, - "description": "

Returns an instance of the adapter for a given type. For\nexample, adapterFor('person') will return an instance of\nthe adapter located at app/adapters/person.js

\n

If no person adapter is found, this method will look\nfor an application adapter (the default adapter for\nyour entire application).

\n", - "itemtype": "method", - "name": "adapterFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "Adapter" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2406, - "description": "

Returns an instance of the serializer for a given type. For\nexample, serializerFor('person') will return an instance of\nApp.PersonSerializer.

\n

If no App.PersonSerializer is found, this method will look\nfor an App.ApplicationSerializer (the default serializer for\nyour entire application).

\n

If a serializer cannot be found on the adapter, it will fall back\nto an instance of JSONSerializer.

\n", - "itemtype": "method", - "name": "serializerFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "the record to serialize", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Serializer" - }, - "class": "Store", - "module": "@ember-data/store" - } - ], - "events": [], - "properties": [ - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 111, - "description": "

Provides access to the NotificationManager associated\nwith this Store instance.

\n

The NotificationManager can be used to subscribe to\nchanges to the cache.

\n", - "itemtype": "property", - "name": "notifications", - "type": "NotificationManager", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 123, - "description": "

Provides access to the SchemaService instance\nfor this Store instance.

\n

The SchemaService can be used to query for\ninformation about the schema of a resource.

\n", - "itemtype": "property", - "name": "schema", - "type": "SchemaService", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 138, - "description": "

Provides access to the IdentifierCache instance\nfor this store.

\n

The IdentifierCache can be used to generate or\nretrieve a stable unique identifier for any resource.

\n", - "itemtype": "property", - "name": "identifierCache", - "type": "IdentifierCache", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 149, - "description": "

Provides access to the requestManager instance associated\nwith this Store instance.

\n

When using ember-data this property is automatically\nset to an instance of RequestManager. When not using ember-data\nyou must configure this property yourself, either by declaring\nit as a service or by initializing it.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Store, { CacheHandler } from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember/data/request/fetch';\n\nclass extends Store {\n  constructor() {\n    super(...arguments);\n    this.requestManager = new RequestManager();\n    this.requestManager.use([Fetch]);\n    this.requestManager.useCache(CacheHandler);\n  }\n}
\n
\n
\n \n", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "requestManager", - "type": "RequestManager", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 178, - "description": "

A Property which an App may set to provide a Lifetimes Service\nto control when a cached request becomes stale.

\n

Note, when defined, these methods will only be invoked if a\ncache key exists for the request, either because the request\ncontains cacheOptions.key or because the IdentifierCache\nwas able to generate a key for the request using the configured\ngeneration method.

\n

isSoftExpired will only be invoked if isHardExpired returns false.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
store.lifetimes = {\n  // make the request and ignore the current cache state\n  isHardExpired(identifier: StableDocumentIdentifier): boolean {\n    return false;\n  }\n\n  // make the request in the background if true, return cache state\n  isSoftExpired(identifier: StableDocumentIdentifier): boolean {\n    return false;\n  }\n}
\n
\n
\n \n", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "lifetimes", - "type": "LivetimesService|undefined", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2297, - "description": "

Returns the cache instance associated to this Store, instantiates the Cache\nif necessary via Store.createCache

\n", - "itemtype": "property", - "name": "cache", - "type": "Cache", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - } - ] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-StringTransform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-StringTransform.json deleted file mode 100644 index 37265eedd..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-StringTransform.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-StringTransform", - "type": "class", - "attributes": { - "name": "StringTransform", - "shortname": "StringTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/string.js", - "line": 5, - "description": "

The StringTransform class is used to serialize and deserialize\nstring attributes on Ember Data record objects. This transform is\nused when string is passed as the type parameter to the\nattr function.

\n

Usage

\n

```app/models/user.js\nimport Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "attr": "('string') email;\n}\n```", - "access": "public", - "tagname": "", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-TimeoutError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-TimeoutError.json deleted file mode 100644 index e25f7a9c7..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-TimeoutError.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-TimeoutError", - "type": "class", - "attributes": { - "name": "TimeoutError", - "shortname": "TimeoutError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 183, - "description": "

A TimeoutError is used by an adapter to signal that a request\nto the external API has timed out. I.e. no response was received from\nthe external API within an allowed time period.

\n

An example use case would be to warn the user to check their internet\nconnection if an adapter operation has timed out:

\n

```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { TimeoutError } from '@ember-data/adapter/error';\nimport { action } from '@ember/object';

\n

export default class ApplicationRoute extends Route {

\n", - "action": "error(error, transition) {\n if (error instanceof TimeoutError) {\n // alert the user\n alert('Are you still connected to the Internet?');\n return;\n }\n\n // ...other error handling logic\n }\n}\n```", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Transform.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Transform.json deleted file mode 100644 index 4630a9f15..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-Transform.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-Transform", - "type": "class", - "attributes": { - "name": "Transform", - "shortname": "Transform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/transform.js", - "line": 5, - "description": "

The Transform class is used to serialize and deserialize model\nattributes when they are saved or loaded from an\nadapter. Subclassing Transform is useful for creating custom\nattributes. All subclasses of Transform must implement a\nserialize and a deserialize method.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/transforms/temperature.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
// Converts centigrade in the JSON to fahrenheit in the app\nexport default class TemperatureTransform {\n  deserialize(serialized, options) {\n    return (serialized *  1.8) + 32;\n  }\n\n  serialize(deserialized, options) {\n    return (deserialized - 32) / 1.8;\n  }\n\n  static create() {\n    return new this();\n  }\n}
\n
\n
\n \n

Usage

\n

```app/models/requirement.js\nimport Model, { attr } from '@ember-data/model';

\n

export default class RequirementModel extends Model {

\n", - "attr": "('markdown', {\n markdown: {\n gfm: false,\n sanitize: true\n }\n })\n markdown;\n}\n```\n\n```app/transforms/markdown.js\nexport default class MarkdownTransform {\n serialize(deserialized, options) {\n return deserialized.raw;\n }\n\n deserialize(serialized, options) {\n let markdownOptions = options.markdown || {};\n\n return marked(serialized, markdownOptions);\n }\n\n static create() {\n return new this();\n }\n}\n```", - "access": "public", - "tagname": "", - "methods": [ - { - "file": "../packages/serializer/src/-private/transforms/transform.js", - "line": 82, - "description": "

When given a deserialized value from a record attribute this\nmethod must return the serialized value.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
serialize(deserialized, options) {\n  return deserialized ? null : Number(deserialized);\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "deserialized", - "description": "The deserialized value" - }, - { - "name": "options", - "description": "hash of options passed to `attr`" - } - ], - "return": { - "description": "The serialized value" - }, - "class": "Transform", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/-private/transforms/transform.js", - "line": 100, - "description": "

When given a serialized value from a JSON object this method must\nreturn the deserialized value for the record attribute.

\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
deserialize(serialized, options) {\n  return empty(serialized) ? null : Number(serialized);\n}
\n
\n
\n \n", - "itemtype": "method", - "name": "deserialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "serialized", - "description": "The serialized value" - }, - { - "name": "options", - "description": "hash of options passed to `attr`" - } - ], - "return": { - "description": "The deserialized value" - }, - "class": "Transform", - "module": "@ember-data/serializer" - } - ], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": null - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-UnauthorizedError.json b/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-UnauthorizedError.json deleted file mode 100644 index f9eeb779c..000000000 --- a/json-docs/ember-data/2.18.5/classes/ember-data-2.18.5-UnauthorizedError.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-UnauthorizedError", - "type": "class", - "attributes": { - "name": "UnauthorizedError", - "shortname": "UnauthorizedError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 230, - "description": "

A UnauthorizedError equates to a HTTP 401 Unauthorized response\nstatus. It is used by an adapter to signal that a request to the external\nAPI was rejected because authorization is required and has failed or has not\nyet been provided.

\n

An example use case would be to redirect the user to a login route if a\nrequest is unauthorized:

\n

```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { UnauthorizedError } from '@ember-data/adapter/error';\nimport { action } from '@ember/object';

\n

export default class ApplicationRoute extends Route {

\n", - "action": "error(error, transition) {\n if (error instanceof UnauthorizedError) {\n // go to the login route\n this.transitionTo('login');\n return;\n }\n\n // ...other error handling logic\n }\n}\n```", - "access": "public", - "tagname": "", - "extends": "AdapterError", - "methods": [], - "events": [], - "properties": [] - }, - "relationships": { - "parent-class": { - "data": { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - } - }, - "descendants": { - "data": [] - }, - "module": { - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - } - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/missings/DataAdapter.json b/json-docs/ember-data/2.18.5/missings/DS.Reference.json similarity index 55% rename from json-docs/ember-data/2.18.5/missings/DataAdapter.json rename to json-docs/ember-data/2.18.5/missings/DS.Reference.json index b350f7009..f7e8ac0ea 100644 --- a/json-docs/ember-data/2.18.5/missings/DataAdapter.json +++ b/json-docs/ember-data/2.18.5/missings/DS.Reference.json @@ -1,9 +1,9 @@ { "data": { - "id": "DataAdapter", + "id": "DS.Reference", "type": "missing", "attributes": { - "name": "DataAdapter" + "name": "DS.Reference" } } } \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/missings/Reference.json b/json-docs/ember-data/2.18.5/missings/Ember.Object.json similarity index 55% rename from json-docs/ember-data/2.18.5/missings/Reference.json rename to json-docs/ember-data/2.18.5/missings/Ember.Object.json index 5b519c15e..efd697bf7 100644 --- a/json-docs/ember-data/2.18.5/missings/Reference.json +++ b/json-docs/ember-data/2.18.5/missings/Ember.Object.json @@ -1,9 +1,9 @@ { "data": { - "id": "Reference", + "id": "Ember.Object", "type": "missing", "attributes": { - "name": "Reference" + "name": "Ember.Object" } } } \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/missings/Ember.EmberObject.json b/json-docs/ember-data/2.18.5/missings/Ember.ObjectProxy.json similarity index 51% rename from json-docs/ember-data/2.18.5/missings/Ember.EmberObject.json rename to json-docs/ember-data/2.18.5/missings/Ember.ObjectProxy.json index 6c6b54047..c4535682c 100644 --- a/json-docs/ember-data/2.18.5/missings/Ember.EmberObject.json +++ b/json-docs/ember-data/2.18.5/missings/Ember.ObjectProxy.json @@ -1,9 +1,9 @@ { "data": { - "id": "Ember.EmberObject", + "id": "Ember.ObjectProxy", "type": "missing", "attributes": { - "name": "Ember.EmberObject" + "name": "Ember.ObjectProxy" } } } \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/missings/Promise.json b/json-docs/ember-data/2.18.5/missings/Ember.Service.json similarity index 54% rename from json-docs/ember-data/2.18.5/missings/Promise.json rename to json-docs/ember-data/2.18.5/missings/Ember.Service.json index fd2d61585..5ef2babfc 100644 --- a/json-docs/ember-data/2.18.5/missings/Promise.json +++ b/json-docs/ember-data/2.18.5/missings/Ember.Service.json @@ -1,9 +1,9 @@ { "data": { - "id": "Promise", + "id": "Ember.Service", "type": "missing", "attributes": { - "name": "Promise" + "name": "Ember.Service" } } } \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/missings/PromiseObject.json b/json-docs/ember-data/2.18.5/missings/PromiseObject.json deleted file mode 100644 index 211e1cf61..000000000 --- a/json-docs/ember-data/2.18.5/missings/PromiseObject.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "data": { - "id": "PromiseObject", - "type": "missing", - "attributes": { - "name": "PromiseObject" - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter.json deleted file mode 100644 index f974f8ab4..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter", - "type": "module", - "attributes": { - "name": "@ember-data/adapter", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/index.ts", - "line": 197, - "description": "

Overview

\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

In order to properly fetch and update data, EmberData\nneeds to understand how to connect to your API.

\n

Adapters accept various kinds of requests from the store\nand manage fulfillment of the request from your API.

\n

Request Flow

\n

When the store decides it needs to issue a request it uses the\nfollowing flow to manage the request and process the data.

\n
    \n
  • find the appropriate adapter
  • \n
  • issue the request to the adapter
  • \n
  • await the adapter's response
      \n
    • if an error occurs reject with the error
    • \n
    • if no error
        \n
      • if there is response data
          \n
        • pass the response data to the appropriate serializer
        • \n
        • update the cache using the JSON:API formatted data from the serializer's response
        • \n
        \n
      • \n
      • return the primary record(s) associated with the request
      • \n
      \n
    • \n
    \n
  • \n
\n

Request Errors

\n

When a request errors and your adapter does not have the ability to recover from the error,\nyou may either reject the promise returned by your adapter method with the error or simply\nthrow the error.

\n

If the request was for a createRecord updateRecord or deleteRecord special rules\napply to how this error will affect the state of the store and additional properties on\nthe Error class may be used. See the documentation for these methods in\n Adapter for more information.

\n

Implementing an Adapter

\n

There are seven required adapter methods, one for each of\nthe primary request types that EmberData issues.

\n

They are:

\n
    \n
  • findRecord
  • \n
  • findAll
  • \n
  • queryRecord
  • \n
  • query
  • \n
  • createRecord
  • \n
  • updateRecord
  • \n
  • deleteRecord
  • \n
\n

Each of these request types has a matching store method that triggers it\nand matching requestType that is passed to the serializer's\nnormalizeResponse method.

\n

If your app only reads data but never writes data, it is not necessary\nto implement the methods for create, update, and delete. This extends to\nall of the store's find methods with the exception of findRecord (findAll,\nquery, queryRecord): if you do not use the store method in your app then\nyour Adapter does not need the method.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import EmberObject from '@ember/object';\n\nasync function fetchData(url, options = {}) {\n  let response = await fetch(url, options);\n  return response.toJSON();\n}\n\nexport default class ApplicationAdapter extends EmberObject {\n  findRecord(_, { modelName }, id) {\n    return fetchData(`./${modelName}s/${id}`);\n  }\n}
\n
\n
\n \n

Adapter Resolution

\n

store.adapterFor(name) will lookup adapters defined in app/adapters/ and\nreturn an instance.

\n

adapterFor first attempts to find an adapter with an exact match on name,\nthen falls back to checking for the presence of an adapter named application.

\n

If no adapter is found, an error will be thrown.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
store.adapterFor('author');\n\n// lookup paths (in order) =>\n//   app/adapters/author.js\n//   app/adapters/application.js
\n
\n
\n \n

Most requests in EmberData are made with respect to a particular type (or modelName)\n(e.g., "get me the full collection of books" or "get me the employee whose id is 37"). We\nrefer to this as the primary resource type.

\n

adapterFor is used by the store to find an adapter with a name matching that of the primary\nresource type for the request, which then falls back to the application adapter.

\n

It is recommended that applications define only a single application adapter and serializer\nwhere possible, only implementing an adapter specific to the type when absolutely necessary.

\n

If you need to support multiple API versions for the same type, the per-type strategy for\ndefining adapters might not be adequate.

\n

If you have multiple APIs or multiple API versions and the single application adapter and per-type\nstrategy does not suite your needs, one strategy is to write an application adapter and serializer\nthat make use of options to specify the desired format when making a request, then forwards to the\nrequest to the desired adapter or serializer as needed.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n
export default class Adapter extends EmberObject {\n  findRecord(store, schema, id, snapshot) {\n    let { apiVersion } = snapshot.adapterOptions;\n    return this.adapterFor(`-api-${apiVersion}`).findRecord(store, schema, id, snapshot);\n  }\n}
\n
\n
\n \n

Overriding Store.adapterFor

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import Store from '@ember-data/store';\nimport Adapter from '@ember-data/adapter/json-api';\n\nclass extends Store {\n  #adapter = new Adapter();\n\n  adapterFor() {\n    return this.#adapter;\n  }\n}
\n
\n
\n \n

Note: If you are using Ember and would like to make use of service injections in your adapter, you will want to additionally setOwner for the Adapter.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n
import Store from '@ember-data/store';\nimport Adapter from '@ember-data/adapter/json-api';\nimport { getOwner, setOwner } from '@ember/application';\n\nclass extends Store {\n  #adapter = null;\n\n  adapterFor() {\n    let adapter = this.#adapter;\n    if (!adapter) {\n      const owner = getOwner(this);\n      adapter = new Adapter();\n      setOwner(adapter, owner);\n      this.#adapter = adapter;\n    }\n\n    return adapter;\n  }\n}
\n
\n
\n \n

By default when using with Ember you only need to implement this hook if you want your adapter usage to be statically analyzeable. Ember**Data** will attempt to resolve adapters using Ember's resolver. To provide a single Adapter for your application like the above you would provide it as the default export of the file app/adapters/application.{js/ts}

\n

Using an Adapter

\n

Any adapter in app/adapters/ can be looked up by name using store.adapterFor(name).

\n

Default Adapters

\n

Applications whose API's structure endpoint URLs very close to or exactly the REST\nor JSON:API convention, the @ember-data/adapter package contains implementations\nthese applications can extend.

\n

Many applications will find writing their own adapter to be allow greater flexibility,\ncustomization, and maintenance than attempting to override methods in these adapters.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "BuildURLMixin", - "Adapter" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/error.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/error.json deleted file mode 100644 index fd19b8dd3..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/error.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module", - "attributes": { - "name": "@ember-data/adapter/error", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/error.js", - "line": 332, - "description": "

Overview

\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

An AdapterError is used by an adapter to signal that an error occurred\nduring a request to an external API. It indicates a generic error, and\nsubclasses are used to indicate specific error states.

\n

To create a custom error to signal a specific error state in communicating\nwith an external API, extend the AdapterError. For example, if the\nexternal API exclusively used HTTP 503 Service Unavailable to indicate\nit was closed for maintenance:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
error.js
1\n2\n3\n
import AdapterError from '@ember-data/adapter/error';\n\nexport default AdapterError.extend({ message: "Down for maintenance." });
\n
\n
\n \n

This error would then be returned by an adapter's handleResponse method:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\nimport MaintenanceError from './maintenance-error';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  handleResponse(status) {\n    if (503 === status) {\n      return new MaintenanceError();\n    }\n\n    return super.handleResponse(...arguments);\n  }\n}
\n
\n
\n \n

And can then be detected in an application and used to send the user to an\nunder-maintenance route:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/routes/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import Route from '@ember/routing/route';\nimport MaintenanceError from '../adapters/maintenance-error';\n\nexport default class ApplicationRoute extends Route {\n  actions: {\n    error(error, transition) {\n      if (error instanceof MaintenanceError) {\n        this.transitionTo('under-maintenance');\n        return;\n      }\n\n      // ...other error handling logic\n    }\n  }\n}
\n
\n
\n \n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "AdapterError", - "InvalidError", - "TimeoutError", - "AbortError", - "UnauthorizedError", - "ForbiddenError", - "NotFoundError", - "ConflictError", - "ServerError" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/json-api.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/json-api.json deleted file mode 100644 index 1dc5c0b02..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/json-api.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/json-api", - "type": "module", - "attributes": { - "name": "@ember-data/adapter/json-api", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/json-api.ts", - "line": 18, - "description": "

Overview

\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

The JSONAPIAdapter is an adapter whichtransforms the store's\nrequests into HTTP requests that follow the JSON API format.

\n

JSON API Conventions

\n

The JSONAPIAdapter uses JSON API conventions for building the URL\nfor a record and selecting the HTTP verb to use with a request. The\nactions you can take on a record map onto the following URLs in the\nJSON API adapter:

\n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n
\n Action\n \n HTTP Verb\n \n URL\n
\n `store.findRecord('post', 123)`\n \n GET\n \n /posts/123\n
\n `store.findAll('post')`\n \n GET\n \n /posts\n
\n Update `postRecord.save()`\n \n PATCH\n \n /posts/123\n
\n Create `store.createRecord('post').save()`\n \n POST\n \n /posts\n
\n Delete `postRecord.destroyRecord()`\n \n DELETE\n \n /posts/123\n
\n\n

Success and failure

\n

The JSONAPIAdapter will consider a success any response with a\nstatus code of the 2xx family ("Success"), as well as 304 ("Not\nModified"). Any other status code will be considered a failure.

\n

On success, the request promise will be resolved with the full\nresponse payload.

\n

Failed responses with status code 422 ("Unprocessable Entity") will\nbe considered "invalid". The response will be discarded, except for\nthe errors key. The request promise will be rejected with a\nInvalidError. This error object will encapsulate the saved\nerrors value.

\n

Any other status codes will be treated as an adapter error. The\nrequest promise will be rejected, similarly to the invalid case,\nbut with an instance of AdapterError instead.

\n

Endpoint path customization

\n

Endpoint paths can be prefixed with a namespace by setting the\nnamespace property on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  namespace = 'api/1';\n}
\n
\n
\n \n

Requests for the person model would now target /api/1/people/1.

\n

Host customization

\n

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n  host = 'https://api.example.com';\n}
\n
\n
\n \n

Requests for the person model would now target\nhttps://api.example.com/people/1.

\n", - "since": "1.13.0", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "JSONAPIAdapter" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/rest.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/rest.json deleted file mode 100644 index 6f7030251..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/adapter/rest.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/adapter/rest", - "type": "module", - "attributes": { - "name": "@ember-data/adapter/rest", - "submodules": {}, - "elements": {}, - "fors": { - "@ember-data/adapter/rest": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/rest.ts", - "line": 68, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

The REST adapter allows your store to communicate with an HTTP server by\n transmitting JSON via XHR.

\n

This adapter is designed around the idea that the JSON exchanged with\n the server should be conventional. It builds URLs in a manner that follows\n the structure of most common REST-style web services.

\n

Success and failure

\n

The REST adapter will consider a success any response with a status code\n of the 2xx family ("Success"), as well as 304 ("Not Modified"). Any other\n status code will be considered a failure.

\n

On success, the request promise will be resolved with the full response\n payload.

\n

Failed responses with status code 422 ("Unprocessable Entity") will be\n considered "invalid". The response will be discarded, except for the\n errors key. The request promise will be rejected with a InvalidError.\n This error object will encapsulate the saved errors value.

\n

Any other status codes will be treated as an "adapter error". The request\n promise will be rejected, similarly to the "invalid" case, but with\n an instance of AdapterError instead.

\n

JSON Structure

\n

The REST adapter expects the JSON returned from your server to follow\n these conventions.

\n

Object Root

\n

The JSON payload should be an object that contains the record inside a\n root property. For example, in response to a GET request for\n /posts/1, the JSON should look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n
 {\n   "posts": {\n     "id": 1,\n     "title": "I'm Running to Reform the W3C's Tag",\n     "author": "Yehuda Katz"\n   }\n }
\n
\n
\n \n

Similarly, in response to a GET request for /posts, the JSON should\n look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n
 {\n   "posts": [\n     {\n       "id": 1,\n       "title": "I'm Running to Reform the W3C's Tag",\n       "author": "Yehuda Katz"\n     },\n     {\n       "id": 2,\n       "title": "Rails is omakase",\n       "author": "D2H"\n     }\n   ]\n }
\n
\n
\n \n

Note that the object root can be pluralized for both a single-object response\n and an array response: the REST adapter is not strict on this. Further, if the\n HTTP server responds to a GET request to /posts/1 (e.g. the response to a\n findRecord query) with more than one object in the array, Ember Data will\n only display the object with the matching ID.

\n

Conventional Names

\n

Attribute names in your JSON payload should be the camelCased versions of\n the attributes in your Ember.js models.

\n

For example, if you have a Person model:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/person.js
1\n2\n3\n4\n5\n6\n7\n
 import Model, { attr } from '@ember-data/model';\n\n export default Model.extend({\n   firstName: attr('string'),\n   lastName: attr('string'),\n   occupation: attr('string')\n });
\n
\n
\n \n

The JSON returned should look like this:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
 {\n   "people": {\n     "id": 5,\n     "firstName": "Zaphod",\n     "lastName": "Beeblebrox",\n     "occupation": "President"\n   }\n }
\n
\n
\n \n

Relationships

\n

Relationships are usually represented by ids to the record in the\n relationship. The related records can then be sideloaded in the\n response under a key for the type.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
 {\n   "posts": {\n     "id": 5,\n     "title": "I'm Running to Reform the W3C's Tag",\n     "author": "Yehuda Katz",\n     "comments": [1, 2]\n   },\n   "comments": [{\n     "id": 1,\n     "author": "User 1",\n     "message": "First!",\n   }, {\n     "id": 2,\n     "author": "User 2",\n     "message": "Good Luck!",\n   }]\n }
\n
\n
\n \n

If the records in the relationship are not known when the response\n is serialized it's also possible to represent the relationship as a\n URL using the links key in the response. Ember Data will fetch\n this URL to resolve the relationship when it is accessed for the\n first time.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
 {\n   "posts": {\n     "id": 5,\n     "title": "I'm Running to Reform the W3C's Tag",\n     "author": "Yehuda Katz",\n     "links": {\n       "comments": "/posts/5/comments"\n     }\n   }\n }
\n
\n
\n \n

Errors

\n

If a response is considered a failure, the JSON payload is expected to include\n a top-level key errors, detailing any specific issues. For example:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
 {\n   "errors": {\n     "msg": "Something went wrong"\n   }\n }
\n
\n
\n \n

This adapter does not make any assumptions as to the format of the errors\n object. It will simply be passed along as is, wrapped in an instance\n of InvalidError or AdapterError. The serializer can interpret it\n afterwards.

\n

Customization

\n

Endpoint path customization

\n

Endpoint paths can be prefixed with a namespace by setting the namespace\n property on the adapter:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
 import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   namespace = 'api/1';\n }
\n
\n
\n \n

Requests for the Person model would now target /api/1/people/1.

\n

Host customization

\n

An adapter can target other hosts by setting the host property.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n
 import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   host = 'https://api.example.com';\n }
\n
\n
\n \n

Headers customization

\n

Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary\n headers can be set as key/value pairs on the RESTAdapter's headers\n object and Ember Data will send them along with each ajax request.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
 import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   headers: computed(function() {\n     return {\n       'API_KEY': 'secret key',\n       'ANOTHER_HEADER': 'Some header value'\n     };\n   }\n }
\n
\n
\n \n

headers can also be used as a computed property to support dynamic\n headers. In the example below, the session object has been\n injected into an adapter by Ember's container.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
 import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   headers: computed('session.authToken', function() {\n     return {\n       'API_KEY': this.session.authToken,\n       'ANOTHER_HEADER': 'Some header value'\n     };\n   })\n }
\n
\n
\n \n

In some cases, your dynamic headers may require data from some\n object outside of Ember's observer system (for example\n document.cookie). You can use the\n volatile\n function to set the property into a non-cached mode causing the headers to\n be recomputed with every request.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/adapters/application.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
 import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n   headers: computed(function() {\n     return {\n       'API_KEY': document.cookie.match(/apiKey\\=([^;]*)/)['1'],\n       'ANOTHER_HEADER': 'Some header value'\n     };\n   }).volatile()\n }
\n
\n
\n \n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "RESTAdapter" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/canary-features.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/canary-features.json deleted file mode 100644 index a80c7b888..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/canary-features.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/canary-features", - "type": "module", - "attributes": { - "name": "@ember-data/canary-features", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../private-build-infra/virtual-packages/canary-features.js", - "line": 76, - "description": "

Canary Features

\n

EmberData allows users to test features that are implemented but not yet\navailable even in canary.

\n

Typically these features represent work that might introduce a new concept,\nnew API, change an API, or risk an unintended change in behavior to consuming\napplications.

\n

Such features have their implementations guarded by a "feature flag", and the\nflag is only activated once the core-data team is prepared to ship the work\nin a canary release.

\n

Installing Canary

\n

To test a feature you MUST be using a canary build. Canary builds are published\nto npm and can be installed using a precise tag (such as ember-data@3.16.0-alpha.1)\nor by installing the latest dist-tag published to the canary channel using your javascript\npackage manager of choice. For instance with pnpm

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
 pnpm add ember-data@canary
\n
\n
\n \n

Activating a Canary Feature

\n

Once you have installed canary, feature-flags can be activated at build-time

\n

by setting an environment variable:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
# Activate a single flag\nEMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG ember build\n\n# Activate multiple flags by separating with commas\nEMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build\n\n# Activate all flags\nEMBER_DATA_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build
\n
\n
\n \n

or by setting the appropriate flag in your ember-cli-build file:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let app = new EmberApp(defaults, {\n  emberData: {\n    features: {\n      SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature\n      OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior\n    }\n  }\n})
\n
\n
\n \n

The "off" branch of feature-flagged code is always stripped from production builds.

\n

The list of available feature-flags is located here

\n

Preparing a Project to use a Canary Feature

\n

For most projects, simple version detection should be enough.\nUsing the provided version compatibility helpers from embroider-macros\nthe following can be done:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
if (macroCondition(dependencySatisfies('@ember-data/store', '5.0'))) {\n  // do thing\n}
\n
\n
\n \n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "CanaryFeatureFlags" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/debug.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/debug.json deleted file mode 100644 index a4221e862..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/debug.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/debug", - "type": "module", - "attributes": { - "name": "@ember-data/debug", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../private-build-infra/virtual-packages/debugging.js", - "line": 4, - "description": "

Overview

\n

This package provides the DataAdapter which the Ember Inspector\nuses to subscribe and retrieve information for the data tab in the inspector.

\n

This package adds roughly .6 KB when minified and compressed to your application in production; however,\nyou can opt out of shipping this addon in production via options in ember-cli-build.js

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let app = new EmberApp(defaults, {\n  emberData: {\n    includeDataAdapterInProduction: false\n  }\n});
\n
\n
\n \n

When using ember-data as a dependency of your app, the default is to ship the inspector support to production.

\n

When not using ember-data as a dependency but instead using EmberData via declaring specific @ember-data/<package>\ndependencies the default is to not ship to production.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "DebugLogging" - ], - "privateclasses": [ - "InspectorDataAdapter" - ], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/deprecations.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/deprecations.json deleted file mode 100644 index b8ebf9dc5..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/deprecations.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/deprecations", - "type": "module", - "attributes": { - "name": "@ember-data/deprecations", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../private-build-infra/virtual-packages/deprecations.js", - "line": 61, - "description": "

Deprecations

\n

EmberData allows users to opt-in and remove code that exists to support deprecated\nbehaviors.

\n

If your app has resolved all deprecations present in a given version,\nyou may specify that version as your "compatibility" version to remove\nthe code that supported the deprecated behavior from your app.

\n

For instance, if a deprecation was introduced in 3.13, and the app specifies\n3.13 as its minimum version compatibility, any deprecations introduced before\nor during 3.13 would be stripped away.

\n

An app can use a different version than what it specifies as it's compatibility\nversion. For instance, an App could be using 3.16 while specifying compatibility\nwith 3.12. This would remove any deprecations that were present in or before 3.12\nbut keep support for anything deprecated in or above 3.13.

\n

Configuring Compatibility

\n

To configure your compatibility version, set the compatWith to the version you\nare compatible with on the emberData config in your ember-cli-build.js file.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let app = new EmberApp(defaults, {\n  emberData: {\n    compatWith: '3.12',\n  },\n});
\n
\n
\n \n

Alternatively, individual deprecations can be resolved (and thus have its support stripped)\nvia one of the flag names listed below. For instance, given a flag named DEPRECATE_FOO_BEHAVIOR.

\n

This capability is interopable with compatWith. You may set compatWith and then selectively resolve\nadditional deprecations, or set compatWith and selectively un-resolve specific deprecations.

\n

Note: EmberData does not test against permutations of deprecations being stripped, our tests run against\n"all deprecated code included" and "all deprecated code removed". Unspecified behavior may sometimes occur\nwhen removing code for only some deprecations associated to a version number.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
let app = new EmberApp(defaults, {\n  emberData: {\n    deprecations: {\n      DEPRECATE_FOO_BEHAVIOR: false // set to false to strip this code\n      DEPRECATE_BAR_BEHAVIOR: true // force to true to not strip this code\n    }\n  }\n})
\n
\n
\n \n

The complete list of which versions specific deprecations will be removed in\ncan be found here

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "CurrentDeprecations" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/graph.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/graph.json deleted file mode 100644 index 1425121f6..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/graph.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/graph", - "type": "module", - "attributes": { - "name": "@ember-data/graph", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../graph/src/-private.ts", - "line": 3, - "description": "

\n \"EmberData\"\n

\n\n

Provides a performance tuned normalized graph for intelligently managing relationships between resources based on identity

\n\n

While this Graph is abstract, it currently is a private implementation required as a peer-dependency by the JSON:API Cache Implementation.

\n

We intend to make this Graph public API after some additional iteration during the 5.x timeframe, until then all APIs should be considered experimental and unstable, not fit for direct application or 3rd party library usage.

\n

Installation

\n

Install using your javascript package manager of choice. For instance with pnpm

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
pnpm add @ember-data/graph
\n
\n
\n \n", - "itemtype": "main", - "parent": null, - "publicclasses": [], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/json-api.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/json-api.json deleted file mode 100644 index ef72e7ece..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/json-api.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/json-api", - "type": "module", - "attributes": { - "name": "@ember-data/json-api", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../json-api/src/-private/cache.ts", - "line": 84, - "description": "

\n \"EmberData\"\n

\n\n

This package provides an in-memory JSON:API document and resource Ember**Data** Cache implementation.

\n

Installation

\n

Install using your javascript package manager of choice. For instance with pnpm

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
pnpm add @ember-data/json-api
\n
\n
\n \n

🚀 Setup

\n
\n

Note When using ember-data the below\nconfiguration is handled for you automatically.

\n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Store from '@ember-data/store';\nimport Cache from '@ember-data/json-api';\n\nexport default class extends Store {\n createCache(wrapper) {\n   return new Cache(wrapper);\n }\n}
\n
\n
\n \n

Usage

\n

Usually you will directly interact with the cache only if implementing a presentation class. Below we\ngive an example of a read-only record (mutations never written back to the cache). More typically cache\ninteractions are something that the Store coordinates as part of the request/response lifecycle.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n
import Store, { recordIdentifierFor } from '@ember-data/store';\nimport Cache from '@ember-data/json-api';\nimport { TrackedObject } from 'tracked-built-ins';\n\nclass extends Store {\n createCache(wrapper) {\n   return new Cache(wrapper);\n }\n\n instantiateRecord(identifier) {\n   const { cache, notifications } = this;\n   const { type, id } = identifier;\n\n   // create a TrackedObject with our attributes, id and type\n   const attrs = cache.peek(identifier).attributes;\n   const data = Object.assign({}, attrs, { type, id });\n   const record = new TrackedObject(data);\n\n   // update the TrackedObject whenever attributes change\n   const token = notifications.subscribe(identifier, (_, change) => {\n     if (change === 'attributes') {\n       Object.assign(record, cache.peek(identifier).attributes);\n     }\n   });\n\n   // setup the ability to teardown the subscription when the\n   // record is no longer needed\n   record.destroy = () => {\n     this.notifications.unsubscribe(token);\n   };\n\n   return record;\n }\n\n teardownRecord(record: FakeRecord) {\n   record.destroy();\n }\n}
\n
\n
\n \n

For the full list of APIs available read the code documentation for Ember**Data** Cache

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "Cache" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/legacy-compat.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/legacy-compat.json deleted file mode 100644 index 3e322fafa..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/legacy-compat.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/legacy-compat", - "type": "module", - "attributes": { - "name": "@ember-data/legacy-compat", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 12, - "description": "

Utilities - often temporary - for maintaining backwards compatibility with\nolder parts of EmberData.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "SnapshotRecordArray" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/model.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/model.json deleted file mode 100644 index d3824bc52..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/model.json +++ /dev/null @@ -1,589 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module", - "attributes": { - "name": "@ember-data/model", - "submodules": {}, - "elements": {}, - "fors": { - "@ember-data/model": 1, - "Model": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../model/src/-private/promise-many-array.ts", - "line": 20, - "description": "

This package provides a Presentation Model for resource data in an EmberData Cache.

\n

Models are defined as classes extending from import Model from '@ember-data/model'; and the\nattributes and relationships on these classes are parsed at runtime to supply static "schema"\nto EmberData's SchemaService.

\n

Resource data for individual resources fetched from your API is presented to the UI via instances\nof the Models you define. An instantiated Model is referred to as a record.

\n

When we refer to the ModelClass as opposed to a Model or Record we are referring\n specifically to the class definition and the static schema methods present on it.

\n

When we refer to a record we refer to a specific class instance presenting\n the resource data for a given type and id.

\n

Defining a Model

\n

```app/models/person.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

\n

export default class PersonModel extends Model {

\n", - "attr": "name;", - "belongsto": "('pet', { inverse: 'owners', async: false }) dog;", - "hasmany": "('person', { inverse: 'friends', async: true }) friends;\n }\n ```\n\n ### modelName convention\n\n By convention, the name of a given model (its `type`) matches the name\n of the file in the `app/models` folder and should be lowercase, singular\n and dasherized.", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "BelongsToReference", - "HasManyReference", - "Errors", - "Model", - "PromiseManyArray" - ], - "privateclasses": [ - "PromiseBelongsTo" - ], - "staticfunctions": { - "@ember-data/model": [ - { - "file": "../packages/model/src/-private/attr.js", - "line": 14, - "description": "`attr` defines an attribute on a [Model](/ember-data/release/classes/Model).\nBy default, attributes are passed through as-is, however you can specify an\noptional type to have the value automatically transformed.\nEmber Data ships with four basic transform types: `string`, `number`,\n`boolean` and `date`. You can define your own transforms by subclassing\n[Transform](/ember-data/release/classes/Transform).\n\nNote that you cannot use `attr` to define an attribute of `id`.\n\n`attr` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `defaultValue`: Pass a string or a function to be called to set the attribute\nto a default value if and only if the key is absent from the payload response.\n\nExample\n\n```app/models/user.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "attr": "('text', {\n uppercase: true\n })\n text;\n}\n```\n\n```app/transforms/text.js\nexport default class TextTransform {\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n }\n\n deserialize(value) {\n return value;\n }\n\n static create() {\n return new this();\n }\n}\n```", - "itemtype": "method", - "name": "attr", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "the attribute type", - "type": "String|Object" - }, - { - "name": "options", - "description": "a hash of options", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Attribute" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/belongs-to.js", - "line": 17, - "description": "`belongsTo` is used to define One-To-One and One-To-Many\nrelationships on a [Model](/ember-data/release/classes/Model).\n\n\n`belongsTo` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n- `inverse`: A string used to identify the inverse property on a\n related model in a One-To-Many relationship. See [Explicit Inverses](#explicit-inverses)\n- `polymorphic` A boolean value to mark the relationship as polymorphic\n\n#### One-To-One\nTo declare a one-to-one relationship between two models, use\n`belongsTo`:\n\n```app/models/user.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "belongsto": "('post', {\n async: false,\n inverse: null\n })\n post;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return the record (Model instance) for the existing\nlocal resource, or null. But it will error on access when\na related resource is known to exist and it has not been loaded.\n\n```\nlet post = comment.post;\n\n```", - "hasmany": "('comment', { async: false, inverse: 'post' }) comments;\n}\n```\n\n```app/models/comment.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "itemtype": "method", - "name": "belongsTo", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "modelName", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/has-many.js", - "line": 20, - "description": "`hasMany` is used to define One-To-Many and Many-To-Many\nrelationships on a [Model](/ember-data/release/classes/Model).\n\n`hasMany` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n- `inverse`: A string used to identify the inverse property on a related model.\n- `polymorphic` A boolean value to mark the relationship as polymorphic\n\n#### One-To-Many\nTo declare a one-to-many relationship between two models, use\n`belongsTo` in combination with `hasMany`, like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', {\n async: false\n })\n comments;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return a [ManyArray](/ember-data/release/classes/ManyArray) instance\ncontaining the existing local resources. But it will error on access\nwhen any of the known related resources have not been loaded.\n\n```\npost.comments.forEach((comment) => {\n\n});\n\n```\n\nIf you are using `links` with sync relationships, you have to use\n`ref.reload` to fetch the resources.", - "belongsto": "('post') bluePost;\n}\n```\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "itemtype": "method", - "name": "hasMany", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - } - ], - "Model": [ - { - "file": "../packages/model/src/-private/model.js", - "line": 2001, - "description": "Iterates through the attributes of the model, calling the passed function on each\nattribute.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, meta);\n```\n\n- `name` the name of the current property in the iteration\n- `meta` the meta object for the attribute property in the iteration\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport Model, { attr } from '@ember-data/model';\n\nclass PersonModel extends Model {", - "attr": "('date') birthday;\n }\n\nPersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", - "itemtype": "method", - "name": "eachAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1828, - "description": "Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.", - "itemtype": "method", - "name": "eachRelatedType", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1806, - "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.", - "itemtype": "method", - "name": "eachRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2056, - "description": "Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, type);\n```\n\n- `name` the name of the current property in the iteration\n- `type` a string containing the name of the type of transformed\napplied to the attribute\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport Model, { attr } from '@ember-data/model';\n\nlet Person = Model.extend({\n firstName: attr(),\n lastName: attr('string'),\n birthday: attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n // do thing\n });\n\n// prints:\n// lastName string\n// birthday date\n```", - "itemtype": "method", - "name": "eachTransformedAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1291, - "description": "Find the relationship which is the inverse of the one asked for.\n\nFor example, if you define models like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('message') comments;\n }\n```\n\n```app/models/message.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class MessageModel extends Model {", - "belongsto": "('post') owner;\n }\n```\n\n``` js\nstore.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }\n```", - "itemtype": "method", - "name": "inverseFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "", - "type": "Store" - } - ], - "return": { - "description": "the inverse relationship, or null", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2112, - "description": "Returns the name of the model class.", - "itemtype": "method", - "name": "toString", - "access": "public", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1250, - "description": "For a given relationship name, returns the model type of the relationship.\n\nFor example, if you define a model like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment') comments;\n}\n```\n\nCalling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.", - "itemtype": "method", - "name": "typeForRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "an instance of Store", - "type": "Store" - } - ], - "return": { - "description": "the type of the relationship, or undefined", - "type": "Model" - }, - "class": "Model", - "module": "@ember-data/model" - } - ] - }, - "allstaticfunctions": { - "@ember-data/model": [ - { - "file": "../packages/model/src/-private/attr.js", - "line": 14, - "description": "`attr` defines an attribute on a [Model](/ember-data/release/classes/Model).\nBy default, attributes are passed through as-is, however you can specify an\noptional type to have the value automatically transformed.\nEmber Data ships with four basic transform types: `string`, `number`,\n`boolean` and `date`. You can define your own transforms by subclassing\n[Transform](/ember-data/release/classes/Transform).\n\nNote that you cannot use `attr` to define an attribute of `id`.\n\n`attr` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `defaultValue`: Pass a string or a function to be called to set the attribute\nto a default value if and only if the key is absent from the payload response.\n\nExample\n\n```app/models/user.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "attr": "('text', {\n uppercase: true\n })\n text;\n}\n```\n\n```app/transforms/text.js\nexport default class TextTransform {\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n }\n\n deserialize(value) {\n return value;\n }\n\n static create() {\n return new this();\n }\n}\n```", - "itemtype": "method", - "name": "attr", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "the attribute type", - "type": "String|Object" - }, - { - "name": "options", - "description": "a hash of options", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Attribute" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/belongs-to.js", - "line": 17, - "description": "`belongsTo` is used to define One-To-One and One-To-Many\nrelationships on a [Model](/ember-data/release/classes/Model).\n\n\n`belongsTo` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n- `inverse`: A string used to identify the inverse property on a\n related model in a One-To-Many relationship. See [Explicit Inverses](#explicit-inverses)\n- `polymorphic` A boolean value to mark the relationship as polymorphic\n\n#### One-To-One\nTo declare a one-to-one relationship between two models, use\n`belongsTo`:\n\n```app/models/user.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "belongsto": "('post', {\n async: false,\n inverse: null\n })\n post;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return the record (Model instance) for the existing\nlocal resource, or null. But it will error on access when\na related resource is known to exist and it has not been loaded.\n\n```\nlet post = comment.post;\n\n```", - "hasmany": "('comment', { async: false, inverse: 'post' }) comments;\n}\n```\n\n```app/models/comment.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "itemtype": "method", - "name": "belongsTo", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "modelName", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/has-many.js", - "line": 20, - "description": "`hasMany` is used to define One-To-Many and Many-To-Many\nrelationships on a [Model](/ember-data/release/classes/Model).\n\n`hasMany` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n- `inverse`: A string used to identify the inverse property on a related model.\n- `polymorphic` A boolean value to mark the relationship as polymorphic\n\n#### One-To-Many\nTo declare a one-to-many relationship between two models, use\n`belongsTo` in combination with `hasMany`, like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', {\n async: false\n })\n comments;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return a [ManyArray](/ember-data/release/classes/ManyArray) instance\ncontaining the existing local resources. But it will error on access\nwhen any of the known related resources have not been loaded.\n\n```\npost.comments.forEach((comment) => {\n\n});\n\n```\n\nIf you are using `links` with sync relationships, you have to use\n`ref.reload` to fetch the resources.", - "belongsto": "('post') bluePost;\n}\n```\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "itemtype": "method", - "name": "hasMany", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - } - ], - "Model": [ - { - "file": "../packages/model/src/-private/model.js", - "line": 1189, - "description": "Create should only ever be called by the store. To create an instance of a\n`Model` in a dirty state use `store.createRecord`.\n\n To create instances of `Model` in a clean state, use `store.push`", - "itemtype": "method", - "name": "create", - "access": "private", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2001, - "description": "Iterates through the attributes of the model, calling the passed function on each\nattribute.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, meta);\n```\n\n- `name` the name of the current property in the iteration\n- `meta` the meta object for the attribute property in the iteration\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport Model, { attr } from '@ember-data/model';\n\nclass PersonModel extends Model {", - "attr": "('date') birthday;\n }\n\nPersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", - "itemtype": "method", - "name": "eachAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1828, - "description": "Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.", - "itemtype": "method", - "name": "eachRelatedType", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1806, - "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.", - "itemtype": "method", - "name": "eachRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2056, - "description": "Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, type);\n```\n\n- `name` the name of the current property in the iteration\n- `type` a string containing the name of the type of transformed\napplied to the attribute\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport Model, { attr } from '@ember-data/model';\n\nlet Person = Model.extend({\n firstName: attr(),\n lastName: attr('string'),\n birthday: attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n // do thing\n });\n\n// prints:\n// lastName string\n// birthday date\n```", - "itemtype": "method", - "name": "eachTransformedAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1291, - "description": "Find the relationship which is the inverse of the one asked for.\n\nFor example, if you define models like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('message') comments;\n }\n```\n\n```app/models/message.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class MessageModel extends Model {", - "belongsto": "('post') owner;\n }\n```\n\n``` js\nstore.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }\n```", - "itemtype": "method", - "name": "inverseFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "", - "type": "Store" - } - ], - "return": { - "description": "the inverse relationship, or null", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2112, - "description": "Returns the name of the model class.", - "itemtype": "method", - "name": "toString", - "access": "public", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1250, - "description": "For a given relationship name, returns the model type of the relationship.\n\nFor example, if you define a model like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment') comments;\n}\n```\n\nCalling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.", - "itemtype": "method", - "name": "typeForRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "an instance of Store", - "type": "Store" - } - ], - "return": { - "description": "the type of the relationship, or undefined", - "type": "Model" - }, - "class": "Model", - "module": "@ember-data/model" - } - ] - }, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/request.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/request.json deleted file mode 100644 index 6793e5450..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/request.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/request", - "type": "module", - "attributes": { - "name": "@ember-data/request", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../request/src/-private/types.ts", - "line": 202, - "description": "

\n \"EmberData\n

\n\n

⚡️ a simple abstraction over fetch to enable easy management of request/response flows

\n\n

This package provides EmberData's RequestManager, a framework agnostic library that can be integrated with any Javascript application to make fetch happen.

\n

Installation

\n

Install using your javascript package manager of choice. For instance with pnpm

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
pnpm add @ember-data/request
\n
\n
\n \n

🚀 Basic Usage

\n

A RequestManager provides a request/response flow in which configured handlers are successively given the opportunity to handle, modify, or pass-along a request.

\n

The RequestManager on its own does not know how to fulfill requests. For this we must register at least one handler. A basic Fetch handler is provided that will take the request options provided and execute fetch.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\nimport { apiUrl } from './config';\n\n// ... create manager and add our Fetch handler\nconst manager = new RequestManager();\nmanager.use([Fetch]);\n\n// ... execute a request\nconst response = await manager.request({\n  url: `${apiUrl}/users`\n});
\n
\n
\n \n

🪜 Architecture

\n

A RequestManager receives a request and manages fulfillment via configured handlers. It may be used standalone from the rest of EmberData and is not specific to any library or framework.

\n

Each handler may choose to fulfill the request using some source of data or to pass the request along to other handlers.

\n

The same or a separate instance of a RequestManager may also be used to fulfill requests issued by EmberData{Store}

\n

When the same instance is used by both this allows for simple coordination throughout the application. Requests issued by the Store will use the in-memory cache\nand return hydrated responses, requests issued directly to the RequestManager\nwill skip the in-memory cache and return raw responses.

\n

Usage

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
const userList = await manager.request({\n  url: `/api/v1/users.list`\n});\n\nconst users = userList.content;
\n
\n
\n \n
\n Making Requests\n\n

RequestManager has a single asyncronous method as it's API: request

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
class RequestManager {\n  request<T>(req: RequestInfo): Future<T>;\n}
\n
\n
\n \n

manager.request(<RequestInfo>) accepts an object containing the information\nnecessary for the request to be handled successfully.

\n

These options extend the options provided to fetch, and can accept a Request. All properties accepted by Request options and fetch options are valid.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
interface RequestInfo extends FetchOptions {\n  op?: string;\n  store?: Store;\nurl: string;\n   // data that a handler should convert into\n   // the query (GET) or body (POST)\n  data?: Record<string, unknown>;\n// options specifically intended for handlers\n  // to utilize to process the request\n  options?: Record<string, unknown>;\n}
\n
\n
\n \n
\n

note: providing a signal is unnecessary as an AbortController is automatically provided if none is present.

\n
\n
\n
\n Using the Response
\n\n

manager.request returns a Future, which allows access to limited information about the request while it is still pending and fulfills with the final state when the request completes and the response has been read.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
const usersFuture = manager.request({\n  url: `/api/v1/users.list`\n});
\n
\n
\n \n

A Future is cancellable via abort.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
usersFuture.abort();
\n
\n
\n \n

Handlers may optionally expose a ReadableStream to the Future for streaming data; however, when doing so the handler should not resolve until it has fully read the response stream itself.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n
interface Future<T> extends Promise<StructuredDocument<T>> {\n  abort(): void;\nasync getStream(): ReadableStream | null;\n}
\n
\n
\n \n

A Future resolves or rejects with a StructuredDocument.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
interface StructuredDocument<T> {\n  request: RequestInfo;\n  response: ResponseInfo | null;\n  content?: T;\n  error?: Error;\n}
\n
\n
\n \n

The RequestInfo specified by document.request is the same as originally provided to manager.request. If any handler fulfilled this request using different request info it is not represented here. This contract helps to ensure that retry and caching are possible since the original arguments are correctly preserved. This also allows handlers to "fork" the request or fulfill from multiple sources without the details of fulfillment muddying the original request.

\n

The ResponseInfo is a serializable fulfilled subset of a Response if set via setResponse. If no response was ever set this will be null.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
interface ResponseInfo {\n  headers?: Record<string, string>;\n  ok?: boolean;\n  redirected?: boolean;\n  status?: HTTPStatusCode;\n  statusText?: string;\n  type?: 'basic' | 'cors';\n  url?: string;\n}
\n
\n
\n \n
\n\n

Handling Requests

\n
\n { request(context, next): Promise | Future; }
\n\n

Requests are fulfilled by handlers. A handler receives the request context\nas well as a next function with which to pass along a request to the next\nhandler if it so chooses.

\n

A handler may be any object with a request method. This allows both stateful and non-stateful\nhandlers to be utilized.

\n

If a handler calls next, it receives a Future which resolves to a StructuredDocument\nthat it can then compose how it sees fit with its own response.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n
\ntype NextFn<P> = (req: RequestInfo) => Future<P>;\n\ninterface Handler {\n  async request<T>(context: RequestContext, next: NextFn<P>): T;\n}
\n
\n
\n \n

RequestContext contains a readonly version of the RequestInfo as well as a few methods for building up the StructuredDocument and Future that will be part of the response.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
interface RequestContext<T> {\n  readonly request: RequestInfo;\nsetStream(stream: ReadableStream | Promise<ReadableStream>): void;\n  setResponse(response: Response | ResponseInfo): void;\n}
\n
\n
\n \n

A basic fetch handler with support for streaming content updates while\nthe download is still underway might look like the following, where we use\nresponse.clone() to tee the ReadableStream into two streams.

\n

A more efficient handler might read from the response stream, building up the\nresponse content before passing along the chunk downstream.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
const FetchHandler = {\n  async request(context) {\n    const response = await fetch(context.request);\n    context.setResponse(reponse);\n    context.setStream(response.clone().body);\n  return response.json();\n  }\n}
\n
\n
\n \n

Request handlers are registered by configuring the manager via use

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
manager.use([Handler1, Handler2])
\n
\n
\n \n

Handlers will be invoked in the order they are registered ("fifo", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.

\n
\n\n\n
\n Error Handling
\nEach handler in the chain can catch errors from upstream and choose to\n either handle the error, re-throw the error, or throw a new error.\n```ts\n const MAX_RETRIES = 5;\nconst Handler = {\n async request(context, next) {\n let attempts = 0;\n while (attempts < MAX_RETRIES) {\n attempts++;\n try {\n const response = await next(context.request);\n return response;\n } catch (e) {\n if (isTimeoutError(e) && attempts < MAX_RETRIES) {\n // retry request\n continue;\n }\n // rethrow if it is not a timeout error\n throw e;\n }\n }\n }\n }\n ```\n
\n\n
\n Handling Abort
\nAborting a request will reject the current handler in the chain. However,\n every handler can potentially catch this error. If your handler needs to\n separate AbortError from other Error types, it is recommended to check\n `context.request.signal.aborted` (or if a custom controller was supplied `controller.signal.aborted`).\nIn this manner it is possible for a request to recover from an abort and\n still proceed; however, as a best practice this should be used for necessary\n cleanup only and the original AbortError rethrown if the abort signal comes\n from the root controller.\n\n

AbortControllers are Always Present and Always Entangled*\nIf the initial request does not supply an AbortController, one will be generated.\nThe signal for this controller is automatically added to the request passed into the first handler.\nEach handler has the option to supply a new controller to the request when calling next. If a new controller is provided it will be automatically\n entangled with the root controller. If the root controller aborts, so will\n any entangled controllers.\nIf an entangled controller aborts, the root controller will not abort. This\n allows for advanced request-flow scenarios to abort subsections of the request tree without aborting the entire request.

\n
\n\n\n
\n Stream Currying
\n\n

RequestManager.request and next differ from fetch in one crucial detail in that the outer Promise resolves only once the response stream has been processed.

\n

For context, it helps to understand a few of the use-cases that RequestManager\nis intended to allow.

\n
    \n
  • to manage and return streaming content (such as video files)
  • \n
  • to fulfill a request from multiple sources or by splitting one request into multiple requests
      \n
    • for instance one API call for a user and another for the user's friends
    • \n
    • or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB\netc.) and the rest from another source (a different API, a WebWorker, etc.)
    • \n
    \n
  • \n
  • to coalesce multiple requests
  • \n
  • to decorate a request with additional info
      \n
    • e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.
    • \n
    \n
  • \n
\n

await fetch(<req>) resolves at the moment headers are received. This allows for the body of the request to be processed as a stream by application\ncode while chunks are still being received by the browser.

\n

When an app chooses to await response.json() what occurs is the browser reads the stream to completion and then returns the result. Additionally, this stream may only be read once.

\n

The RequestManager preserves this ability to subscribe to and utilize the stream by either the application or the handler – thereby delivering the full power and flexibility of native APIs – without restricting developers in ways that lead to complicated workarounds.

\n

Each handler may call setStream only once, but may do so at any time until the promise that the handler returns has resolved. The associated promise returned by calling future.getStream will resolve with the stream set by setStream if that method is called, or null if that method\nhas not been called by the time that the handler's request method has resolved.

\n

Handlers that do not create a stream of their own, but which call next, should defensively pipe the stream forward. While this is not required (see automatic currying below) it is better to do so in most cases as otherwise the stream may not become available to downstream handlers or the application until the upstream handler has fully read it.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
context.setStream(future.getStream());
\n
\n
\n \n

Handlers that either call next multiple times or otherwise have reason to create multiple fetch requests should either choose to return no stream, meaningfully combine the streams, or select a single prioritized stream.

\n

Of course, any handler may choose to read and handle the stream, and return either no stream or a different stream in the process.

\n
\n\n
\n Automatic Currying of Stream and Response
\n\n

In order to simplify the common case for handlers which decorate a request, if next is called only a single time and setResponse was never called by the handler, the response set by the next handler in the chain will be applied to that handler's outcome. For instance, this makes the following pattern possible return (await next(<req>)).content;.

\n

Similarly, if next is called only a single time and neither setStream nor getStream was called, we automatically curry the stream from the future returned by next onto the future returned by the handler.

\n

Finally, if the return value of a handler is a Future, we curry content and errors as well, thus enabling the simplest form return next(<req>).

\n

In the case of the Future being returned, Stream proxying is automatic and immediate and does not wait for the Future to resolve.

\n
\n\n

Using as a Service

\n

Most applications will desire to have a single RequestManager instance, which can be achieved using module-state patterns for singletons, or for Ember applications by exporting the manager as a service.

\n

services/request.ts*

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n
import RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\nimport Auth from 'ember-simple-auth/ember-data-handler';\n\nexport default class extends RequestManager {\n  constructor(createArgs) {\n    super(createArgs);\n    this.use([Auth, Fetch]);\n  }\n}
\n
\n
\n \n

Using with @ember-data/store

\n

To have a request service unique to a Store:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Store, { CacheHandler } from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\n\nclass extends Store {\n  requestManager = new RequestManager();\nconstructor(args) {\n    super(args);\n    this.requestManager.use([Fetch]);\n    this.requestManager.useCache(CacheHandler);\n  }\n}
\n
\n
\n \n

Using with ember-data

\n

If using the package ember-data, the following configuration will automatically be done in order to preserve the legacy Adapter and Serializer behavior. Additional handlers or a service injection like the above would need to be done by the consuming application in order to make broader use of RequestManager.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n
import Store, { CacheHandler } from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport { LegacyNetworkHandler } from '@ember-data/legacy-compat';\n\nexport default class extends Store {\n  requestManager = new RequestManager();\nconstructor(args) {\n    super(args);\n    this.requestManager.use([LegacyNetworkHandler]);\n    this.requestManager.useCache(CacheHandler);\n  }\n}
\n
\n
\n \n

Because the application's store service (if present) will override the store supplied by ember-data, all that is required to define your own ordering and handlers is to supply a store service extending from @ember-data/store and configure as shown above.

\n

For usage of the store's requestManager via store.request(<req>) see the Store documentation.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "RequestManager", - "Future", - " Handler" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/request/fetch.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/request/fetch.json deleted file mode 100644 index 45e4e0096..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/request/fetch.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/request/fetch", - "type": "module", - "attributes": { - "name": "@ember-data/request/fetch", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../request/src/fetch.ts", - "line": 25, - "description": "

A basic Fetch Handler which converts a request into a\nfetch call presuming the response to be json.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n
import Fetch from '@ember-data/request/fetch';\n\nmanager.use([Fetch]);
\n
\n
\n \n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "Fetch" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer.json deleted file mode 100644 index 1021d4dff..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module", - "attributes": { - "name": "@ember-data/serializer", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/index.ts", - "line": 115, - "description": "

Overview

\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new serializer, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

In order to properly manage and present your data, EmberData\nneeds to understand the structure of data it receives.

\n

Serializers convert data between the server's API format and\nthe format EmberData understands.

\n

Data received from an API response is normalized into\nJSON:API (the format used internally\nby EmberData), while data sent to an API is serialized\ninto the format the API expects.

\n

Implementing a Serializer

\n

There are only two required serializer methods, one for\nnormalizing data from the server API format into JSON:API, and\nanother for serializing records via Snapshots into the expected\nserver API format.

\n

To implement a serializer, export a class that conforms to the structure\ndescribed by Serializer\nfrom the app/serializers/ directory. An example is below.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n
import EmberObject from '@ember/object';\n\nexport default class ApplicationSerializer extends EmberObject {\n  normalizeResponse(store, schema, rawPayload) {\n    return rawPayload;\n  }\n\n  serialize(snapshot, options) {\n    const serializedResource = {\n      id: snapshot.id,\n      type: snapshot.modelName,\n      attributes: snapshot.attributes()\n    };\n\n    return serializedResource;\n  }\n}
\n
\n
\n \n

Serializer Resolution

\n

store.serializerFor(name) will lookup serializers defined in\napp/serializers/ and return an instance. If no serializer is found, an\nerror will be thrown.

\n

serializerFor first attempts to find a serializer with an exact match on name,\nthen falls back to checking for the presence of a serializer named application.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
store.serializerFor('author');\n\n// lookup paths (in order) =>\n//   app/serializers/author.js\n//   app/serializers/application.js
\n
\n
\n \n

Most requests in EmberData are made with respect to a particular type (or modelName)\n(e.g., "get me the full collection of books" or "get me the employee whose id is 37"). We\nrefer to this as the primary resource type.

\n

Typically serializerFor will be used to find a serializer with a name matching that of the primary\nresource type for the request, falling back to the application serializer for those types that\ndo not have a defined serializer. This is often described as a per-model or per-type strategy\nfor defining serializers. However, because APIs rarely format payloads per-type but rather\nper-API-version, this may not be a desired strategy.

\n

It is recommended that applications define only a single application adapter and serializer\nwhere possible.

\n

If you have multiple API formats and the per-type strategy is not viable, one strategy is to\nwrite an application adapter and serializer that make use of options to specify the desired\nformat when making a request.

\n

Using a Serializer

\n

Any serializer in app/serializers/ can be looked up by name using store.serializerFor(name).

\n

Default Serializers

\n

For applications whose APIs are very close to or exactly the REST format or JSON:API\nformat the @ember-data/serializer package contains implementations these applications can\nextend. It also contains a simple JSONSerializer for serializing to/from very basic JSON objects.

\n

Many applications will find writing their own serializer to be more performant and less\ncomplex than extending these classes even when their API format is very close to that expected\nby these serializers.

\n

It is recommended that apps write their own serializer to best suit the needs of their API and\napplication.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "BooleanTransform", - "DateTransform", - "NumberTransform", - "StringTransform", - "Transform", - "Serializer" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/json-api.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/json-api.json deleted file mode 100644 index 73d85664a..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/json-api.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/json-api", - "type": "module", - "attributes": { - "name": "@ember-data/serializer/json-api", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/json-api.js", - "line": 13, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.

\n

JSONAPISerializer supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.

\n

This serializer normalizes a JSON API payload that looks like:

\n

```app/models/player.js\n import Model, { attr, belongsTo } from '@ember-data/model';

\n

export default class Player extends Model {

\n", - "attr": "('string') location;", - "belongsto": "('club') club;\n }\n ```\n\n ```app/models/club.js\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Club extends Model {", - "hasmany": "('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "JSONAPISerializer" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/json.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/json.json deleted file mode 100644 index 7e9335bea..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/json.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/json", - "type": "module", - "attributes": { - "name": "@ember-data/serializer/json", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/json.js", - "line": 16, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.

\n

By default, EmberData uses and recommends the JSONAPISerializer.

\n

JSONSerializer is useful for simpler or legacy backends that may\n not support the http://jsonapi.org/ spec.

\n

For example, given the following User model and JSON payload:

\n

```app/models/user.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

\n

export default class UserModel extends Model {

\n", - "hasmany": "('user') friends;", - "belongsto": "('location') house;", - "attr": "('string') name;\n }\n ```\n\n ```js\n {\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n }\n ```\n\n `JSONSerializer` will normalize the JSON payload to the JSON API format that the\n Ember Data store expects.\n\n You can customize how JSONSerializer processes its payload by passing options in\n the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\n The `JSONSerializer` normalization process follows these steps:\n\n 1. `normalizeResponse`\n - entry method to the serializer.\n 2. `normalizeCreateRecordResponse`\n - a `normalizeResponse` for a specific operation is called.\n 3. `normalizeSingleResponse`|`normalizeArrayResponse`\n - for methods like `createRecord` we expect a single record back, while for methods like `findAll` we expect multiple records back.\n 4. `normalize`\n - `normalizeArrayResponse` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n 5. `extractId` | `extractAttributes` | `extractRelationships`\n - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "JSONSerializer" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/rest.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/rest.json deleted file mode 100644 index e614386e3..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/serializer/rest.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/serializer/rest", - "type": "module", - "attributes": { - "name": "@ember-data/serializer/rest", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/rest.js", - "line": 18, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n

Normally, applications will use the RESTSerializer by implementing\n the normalize method.

\n

This allows you to do whatever kind of munging you need and is\n especially useful if your server is inconsistent and you need to\n do munging differently for many different kinds of responses.

\n

See the normalize documentation for more information.

\n

Across the Board Normalization

\n

There are also a number of hooks that you might find useful to define\n across-the-board rules for your payload. These rules will be useful\n if your server is consistent, or if you're building an adapter for\n an infrastructure service, like Firebase, and want to encode service\n conventions.

\n

For example, if all of your keys are underscored and all-caps, but\n otherwise consistent with the names you use in your models, you\n can implement across-the-board rules for how to convert an attribute\n name in your model to a key in your JSON.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/serializers/application.js
1\n2\n3\n4\n5\n6\n7\n8\n
 import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends RESTSerializer {\n   keyForAttribute(attr, method) {\n     return underscore(attr).toUpperCase();\n   }\n }
\n
\n
\n \n

You can also implement keyForRelationship, which takes the name\n of the relationship as the first parameter, the kind of\n relationship (hasMany or belongsTo) as the second parameter, and\n the method (serialize or deserialize) as the third parameter.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "EmbeddedRecordsMixin", - "RESTSerializer" - ], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/store.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/store.json deleted file mode 100644 index a0e481498..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/store.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module", - "attributes": { - "name": "@ember-data/store", - "submodules": {}, - "elements": {}, - "fors": { - "@ember-data/store": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../store/src/-private/store-service.ts", - "line": 83, - "description": "

\n \"EmberData\n

\n\n

This package provides Ember**Data**'s Store class.

\n

A Store coordinates interaction between your application, a Cache,\nand sources of data (such as your API or a local persistence layer) accessed via a RequestManager.

\n

Optionally, a Store can be configured to hydrate the response data into rich presentation classes.

\n

Installation

\n

If you have installed ember-data then you already have this package installed.\nOtherwise you can install it using your javascript package manager of choice.\nFor instance with pnpm

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
pnpm add @ember-data/store
\n
\n
\n

After installing you will want to configure your first Store. Read more below\nfor how to create and configure stores for your application.

\n

🔨 Creating A Store

\n

To use a Store we will need to do few things: add a Cache\nto store data in-memory, add a Handler to fetch data from a source,\nand implement instantiateRecord to tell the store how to display the data for individual resources.

\n
\n

Note If you are using the package ember-data then a JSON:API cache, RequestManager, LegacyNetworkHandler,\nand instantiateRecord are configured for you by default.

\n
\n

Configuring A Cache

\n

To start, let's install a JSON:API cache. If your app uses GraphQL or REST other\ncaches may better fit your data. You can author your own cache by creating one that\nconforms to the spec.

\n

The package @ember-data/json-api provides a JSON:API cache we can use.\nAfter installing it, we can configure the store to use this cache.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n
import Store from '@ember-data/store';\nimport Cache from '@ember-data/json-api';\n\nclass extends Store {\n  createCache(storeWrapper) {\n    return new Cache(storeWrapper);\n  }\n}
\n
\n
\n \n

Now that we have a cache let's setup something to handle fetching\nand saving data via our API.

\n
\n

Note The ember-data package automatically includes and configures\nthe @ember-data/json-api cache for you.

\n
\n

Handling Requests

\n

When Ember**Data** needs to fetch or save data it will pass that request to your application's RequestManager for fulfillment. How this fulfillment occurs (in-memory, device storage, via single or multiple API requests, etc.) is then up to the registered request handlers.

\n

To start, let's install the RequestManager from @ember-data/request and the basic Fetch handler from ``@ember-data/request/fetch`.

\n
\n

Note If your app uses GraphQL, REST or different conventions for JSON:API than your cache expects, other handlers may better fit your data. You can author your own handler by creating one that conforms to the handler interface.

\n
\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import Store from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\n\nexport default class extends Store {\n  constructor() {\n    super(...arguments);\n    this.requestManager = new RequestManager();\n    this.requestManager.use([Fetch]);\n  }\n}
\n
\n
\n \n

Using RequestManager as a Service

\n

Alternatively if you have configured the RequestManager to be a service you may re-use it.

\n

app/services/request.js

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
import RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\n\nexport default class extends RequestManager {\n  constructor(createArgs) {\n    super(createArgs);\n    this.use([Fetch]);\n  }\n}
\n
\n
\n \n

app/services/store.js

\n

```ts\nimport Store from '@ember-data/store';\nimport { service } from '@ember/service';

\n

export default class extends Store {

\n", - "service": "('request') requestManager\n}\n```\n\n\n### Presenting Data from the Cache\n\nNow that we have a source and a cach for our data, we need to configure how\nthe Store delivers that data back to our application. We do this via the hook\n[instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),\nwhich allows us to transform the data for a resource before handing it to the application.\n\nA naive way to present the data would be to return it as JSON. Typically instead\nthis hook will be used to add reactivity and make each unique resource a singleton,\nensuring that if the cache updates our presented data will reflect the new state.\n\nBelow is an example of using the hooks `instantiateRecord` and a `teardownRecord`\nto provide minimal read-only reactive state for simple resources.\n\n```ts\nimport Store, { recordIdentifierFor } from '@ember-data/store';\nimport { TrackedObject } from 'tracked-built-ins';\n\nclass extends Store {\n instantiateRecord(identifier) {\n const { cache, notifications } = this;\n\n // create a TrackedObject with our attributes, id and type\n const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));\n record.type = identifier.type;\n record.id = identifier.id;\n\n notifications.subscribe(identifier, (_, change) => {\n if (change === 'attributes') {\n Object.assign(record, cache.peek(identifier));\n }\n });\n\n return record;\n }\n}\n```\n\nBecause `instantiateRecord` is opaque to the nature of the record, an implementation\ncan be anything from a fairly simple object to a robust proxy that intelligently links\ntogether associated records through relationships.\n\nThis also enables creating a record that separates `edit` flows from `create` flows\nentirely. A record class might choose to implement a `checkout`method that gives access\nto an editable instance while the primary record continues to be read-only and reflect\nonly persisted (non-mutated) state.\n\nTypically you will choose an existing record implementation such as `@ember-data/model`\nfor your application.\n\nBecause of the boundaries around instantiation and the cache, record implementations\nshould be capable of interop both with each other and with any `Cache`. Due to this,\nif needed an application can utilize multiple record implementations and multiple cache\nimplementations either to support enhanced features for only a subset of records or to\nbe able to incrementally migrate from one record/cache to another record or cache.\n\n> **Note:** The `ember-data` package automatically includes the `@ember-data/model`\n> package and configures it for you.", - "itemtype": "main", - "parent": null, - "publicclasses": [ - "CacheStoreWrapper", - "StableRecordIdentifier", - "SchemaService", - "Snapshot", - "ManyArray", - "IdentifierCache", - "RecordReference", - "CacheManager", - "NotificationManager", - "RequestStateService", - "RecordArray", - "Store" - ], - "privateclasses": [], - "staticfunctions": { - "@ember-data/store": [ - { - "file": "../packages/store/src/-private/caches/instance-cache.ts", - "line": 48, - "description": "Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)\nassigned to the given record instance.\n```js\nimport { recordIdentifierFor } from \"@ember-data/store\";\n// ... gain access to a record, for instance with peekRecord or findRecord\nconst record = store.peekRecord(\"user\", \"1\");\n// get the identifier for the record (see docs for StableRecordIdentifier)\nconst identifier = recordIdentifierFor(record);\n// access the identifier's properties.\nconst { id, type, lid } = identifier;\n```", - "itemtype": "method", - "name": "recordIdentifierFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "record", - "description": "a record instance previously obstained from the store.", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 239, - "description": "Configure a callback for when the identifier cache is going to release an identifier.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierForgetMethod } from '@ember-data/store';\n```\n\nTakes method which can expect to receive an existing `Identifier` that should be eliminated\nfrom any secondary lookup tables or caches that the user has populated for it.", - "itemtype": "method", - "name": "setIdentifierForgetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 117, - "description": "Configures how unique identifier lid strings are generated by @ember-data/store.\n\nThis configuration MUST occur prior to the store instance being created.\n\nTakes a method which can expect to receive various data as its first argument\nand the name of a bucket as its second argument.\n\nCurrently there are two buckets, 'record' and 'document'.\n\n### Resource (`Record`) Identity\n\nIf the bucket is `record` the method must return a unique (to at-least\nthe given bucket) string identifier for the given data as a string to be\nused as the `lid` of an `Identifier` token.\n\nThis method will only be called by either `getOrCreateRecordIdentifier` or\n`createIdentifierForNewRecord` when an identifier for the supplied data\nis not already known via `lid` or `type + id` combo and one needs to be\ngenerated or retrieved from a proprietary cache.\n\n`data` will be the same data argument provided to `getOrCreateRecordIdentifier`\nand in the `createIdentifierForNewRecord` case will be an object with\nonly `type` as a key.\n\n```ts\nimport { setIdentifierGenerationMethod } from '@ember-data/store';\n\nexport function initialize(applicationInstance) {\n // note how `count` here is now scoped to the application instance\n // for our generation method by being inside the closure provided\n // by the initialize function\n let count = 0;\n\n setIdentifierGenerationMethod((resource, bucket) => {\n return resource.lid || `my-key-${count++}`;\n });\n}\n\nexport default {\n name: 'configure-ember-data-identifiers',\n initialize\n};\n```\n\n### Document Identity\n\nIf the bucket is `document` the method will receive the associated\nimmutable `request` passed to `store.request` as its first argument\nand should return a unique string for the given request if the document\nshould be cached, and `null` if it should not be cached.\n\nNote, the request result will still be passed to the cache via `Cache.put`,\nbut caches should take this as a signal that the document should not itself\nbe cached, while its contents may still be used to update other cache state.\n\nThe presence of `cacheOptions.key` on the request will take precedence\nfor the document cache key, and this method will not be called if it is\npresent.\n\nThe default method implementation for this bucket is to return `null`\nfor all requests whose method is not `GET`, and to return the `url` for\nthose where it is.\n\nThis means that queries via `POST` MUST provide `cacheOptions.key` or\nimplement this hook.\n\n⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`", - "itemtype": "method", - "name": "setIdentifierGenerationMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 259, - "description": "Configure a callback for when the identifier cache is being torn down.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierResetMethod } from '@ember-data/store';\n```\n\nTakes a method which can expect to be called when the parent application is destroyed.\n\nIf you have properly used a WeakMap to encapsulate the state of your customization\nto the application instance, you may not need to implement the `resetMethod`.", - "itemtype": "method", - "name": "setIdentifierResetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 198, - "description": "Configure a callback for when the identifier cache encounters new resource\ndata for an existing resource.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierUpdateMethod } from '@ember-data/store';\n```\n\nTakes a method which can expect to receive an existing `Identifier` alongside\nsome new data to consider as a second argument. This is an opportunity\nfor secondary lookup tables and caches associated with the identifier\nto be amended.\n\nThis method is called everytime `updateRecordIdentifier` is called and\n with the same arguments. It provides the opportunity to update secondary\n lookup tables for existing identifiers.\n\nIt will always be called after an identifier created with `createIdentifierForNewRecord`\n has been committed, or after an update to the `record` a `RecordIdentifier`\n is assigned to has been committed. Committed here meaning that the server\n has acknowledged the update (for instance after a call to `.save()`)\n\nIf `id` has not previously existed, it will be assigned to the `Identifier`\n prior to this `UpdateMethod` being called; however, calls to the parent method\n `updateRecordIdentifier` that attempt to change the `id` or calling update\n without providing an `id` when one is missing will throw an error.", - "itemtype": "method", - "name": "setIdentifierUpdateMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - } - ] - }, - "allstaticfunctions": { - "@ember-data/store": [ - { - "file": "../packages/store/src/-private/caches/instance-cache.ts", - "line": 48, - "description": "Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)\nassigned to the given record instance.\n```js\nimport { recordIdentifierFor } from \"@ember-data/store\";\n// ... gain access to a record, for instance with peekRecord or findRecord\nconst record = store.peekRecord(\"user\", \"1\");\n// get the identifier for the record (see docs for StableRecordIdentifier)\nconst identifier = recordIdentifierFor(record);\n// access the identifier's properties.\nconst { id, type, lid } = identifier;\n```", - "itemtype": "method", - "name": "recordIdentifierFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "record", - "description": "a record instance previously obstained from the store.", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 239, - "description": "Configure a callback for when the identifier cache is going to release an identifier.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierForgetMethod } from '@ember-data/store';\n```\n\nTakes method which can expect to receive an existing `Identifier` that should be eliminated\nfrom any secondary lookup tables or caches that the user has populated for it.", - "itemtype": "method", - "name": "setIdentifierForgetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 117, - "description": "Configures how unique identifier lid strings are generated by @ember-data/store.\n\nThis configuration MUST occur prior to the store instance being created.\n\nTakes a method which can expect to receive various data as its first argument\nand the name of a bucket as its second argument.\n\nCurrently there are two buckets, 'record' and 'document'.\n\n### Resource (`Record`) Identity\n\nIf the bucket is `record` the method must return a unique (to at-least\nthe given bucket) string identifier for the given data as a string to be\nused as the `lid` of an `Identifier` token.\n\nThis method will only be called by either `getOrCreateRecordIdentifier` or\n`createIdentifierForNewRecord` when an identifier for the supplied data\nis not already known via `lid` or `type + id` combo and one needs to be\ngenerated or retrieved from a proprietary cache.\n\n`data` will be the same data argument provided to `getOrCreateRecordIdentifier`\nand in the `createIdentifierForNewRecord` case will be an object with\nonly `type` as a key.\n\n```ts\nimport { setIdentifierGenerationMethod } from '@ember-data/store';\n\nexport function initialize(applicationInstance) {\n // note how `count` here is now scoped to the application instance\n // for our generation method by being inside the closure provided\n // by the initialize function\n let count = 0;\n\n setIdentifierGenerationMethod((resource, bucket) => {\n return resource.lid || `my-key-${count++}`;\n });\n}\n\nexport default {\n name: 'configure-ember-data-identifiers',\n initialize\n};\n```\n\n### Document Identity\n\nIf the bucket is `document` the method will receive the associated\nimmutable `request` passed to `store.request` as its first argument\nand should return a unique string for the given request if the document\nshould be cached, and `null` if it should not be cached.\n\nNote, the request result will still be passed to the cache via `Cache.put`,\nbut caches should take this as a signal that the document should not itself\nbe cached, while its contents may still be used to update other cache state.\n\nThe presence of `cacheOptions.key` on the request will take precedence\nfor the document cache key, and this method will not be called if it is\npresent.\n\nThe default method implementation for this bucket is to return `null`\nfor all requests whose method is not `GET`, and to return the `url` for\nthose where it is.\n\nThis means that queries via `POST` MUST provide `cacheOptions.key` or\nimplement this hook.\n\n⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`", - "itemtype": "method", - "name": "setIdentifierGenerationMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 259, - "description": "Configure a callback for when the identifier cache is being torn down.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierResetMethod } from '@ember-data/store';\n```\n\nTakes a method which can expect to be called when the parent application is destroyed.\n\nIf you have properly used a WeakMap to encapsulate the state of your customization\nto the application instance, you may not need to implement the `resetMethod`.", - "itemtype": "method", - "name": "setIdentifierResetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 198, - "description": "Configure a callback for when the identifier cache encounters new resource\ndata for an existing resource.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierUpdateMethod } from '@ember-data/store';\n```\n\nTakes a method which can expect to receive an existing `Identifier` alongside\nsome new data to consider as a second argument. This is an opportunity\nfor secondary lookup tables and caches associated with the identifier\nto be amended.\n\nThis method is called everytime `updateRecordIdentifier` is called and\n with the same arguments. It provides the opportunity to update secondary\n lookup tables for existing identifiers.\n\nIt will always be called after an identifier created with `createIdentifierForNewRecord`\n has been committed, or after an update to the `record` a `RecordIdentifier`\n is assigned to has been committed. Committed here meaning that the server\n has acknowledged the update (for instance after a call to `.save()`)\n\nIf `id` has not previously existed, it will be assigned to the `Identifier`\n prior to this `UpdateMethod` being called; however, calls to the parent method\n `updateRecordIdentifier` that attempt to change the `id` or calling update\n without providing an `id` when one is missing will throw an error.", - "itemtype": "method", - "name": "setIdentifierUpdateMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - } - ] - }, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/tracking.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/tracking.json deleted file mode 100644 index 86460e2e4..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-@ember-data/tracking.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-@ember-data/tracking", - "type": "module", - "attributes": { - "name": "@ember-data/tracking", - "submodules": {}, - "elements": {}, - "fors": { - "@ember-data/tracking": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../tracking/src/-private.ts", - "line": 1, - "description": "

This package provides primitives that allow powerful low-level\nadjustments to change tracking notification behaviors.

\n

Typically you want to use these primitives when you want to divorce\nproperty accesses on EmberData provided objects from the current\ntracking context. Typically this sort of thing occurs when serializing\ntracked data to send in a request: the data itself is often ancillary\nto the thing which triggered the request in the first place and you\nwould not want to re-trigger the request for any update to the data.

\n", - "itemtype": "main", - "parent": null, - "publicclasses": [], - "privateclasses": [], - "staticfunctions": { - "@ember-data/tracking": [ - { - "file": "../packages/tracking/src/-private.ts", - "line": 138, - "description": "A helpful utility for creating a new function that\nalways runs in a transaction. E.G. this \"memoizes\"\ncalling `transact(fn)`, currying args as necessary.", - "itemtype": "method", - "name": "memoTransact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "a function that will invoke method in a transaction with any provided args and return its result" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 115, - "description": "Run the method, subscribing to any tracked properties\nmanaged by EmberData that were accessed or written during\nthe method's execution as per-normal but while allowing\ninterleaving of reads and writes.\n\nThis is useful when for instance you want to perform\na mutation based on existing state that must be read first.", - "itemtype": "method", - "name": "transact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 92, - "description": "Run `method` without subscribing to any tracked properties\ncontrolled by EmberData.\n\nThis should rarely be used except by libraries that really\nknow what they are doing. It is most useful for wrapping\ncertain kinds of fetch/query logic from within a `Resource`\n`hook` or other similar pattern.", - "itemtype": "method", - "name": "untracked", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - } - ] - }, - "allstaticfunctions": { - "@ember-data/tracking": [ - { - "file": "../packages/tracking/src/-private.ts", - "line": 138, - "description": "A helpful utility for creating a new function that\nalways runs in a transaction. E.G. this \"memoizes\"\ncalling `transact(fn)`, currying args as necessary.", - "itemtype": "method", - "name": "memoTransact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "a function that will invoke method in a transaction with any provided args and return its result" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 115, - "description": "Run the method, subscribing to any tracked properties\nmanaged by EmberData that were accessed or written during\nthe method's execution as per-normal but while allowing\ninterleaving of reads and writes.\n\nThis is useful when for instance you want to perform\na mutation based on existing state that must be read first.", - "itemtype": "method", - "name": "transact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 92, - "description": "Run `method` without subscribing to any tracked properties\ncontrolled by EmberData.\n\nThis should rarely be used except by libraries that really\nknow what they are doing. It is most useful for wrapping\ncertain kinds of fetch/query logic from within a `Resource`\n`hook` or other similar pattern.", - "itemtype": "method", - "name": "untracked", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - } - ] - }, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-ember-data-overview.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-ember-data-overview.json deleted file mode 100644 index e1f03f04e..000000000 --- a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-ember-data-overview.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "data": { - "id": "ember-data-2.18.5-ember-data-overview", - "type": "module", - "attributes": { - "name": "ember-data-overview", - "submodules": {}, - "elements": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../-ember-data/addon/index.js", - "line": 1, - "description": "

\n \"EmberData\"\n

\n\n

The lightweight reactive data library for JavaScript applications

\n\n
\n

Wrangle your application's data management with scalable patterns for developer productivity.

\n
    \n
  • ⚡️ Committed to Best-In-Class Performance
  • \n
  • 🌲 Focused on being as svelte as possible
  • \n
  • 🚀 SSR Ready
  • \n
  • 🔜 Typescript Support
  • \n
  • 🐹 Built with ♥️ by Ember
  • \n
  • ⚛️ Supports any API: GraphQL JSON:API REST tRPC ...bespoke or a mix
  • \n
\n

📖 On This Page

\n\n

Overview

\n

EmberData is a lightweight reactive data library for JavaScript applications that provides composable primitives for ordering query/mutation/peek flows, managing network and cache, and reducing data for presentation.

\n

🪜 Architecture

\n

The core of EmberData is the Store, which coordinates interaction between your application, the Cache, and sources of data (such as your API or a local persistence layer).\nOptionally, the Store can be configured to hydrate the response data into rich presentation classes.

\n

EmberData is both resource centric and document centric in it's approach to caching, requesting and presenting data. Your application's configuration and usage drives which is important and when.

\n

The Store is a coordinator. When using a Store you configure what cache to use, how cache data should be presented to the UI, and where it should look for requested data when it is not available in the cache.

\n

This coordination is handled opaquely to the nature of the requests issued and the format of the data being handled. This approach gives applications broad flexibility to configure EmberData to best suite their needs. This makes EmberData a powerful solution for applications regardless of their size and complexity.

\n

EmberData is designed to scale, with a religious focus on performance and asset-size to keep its footprint small but speedy while still being able to handle large complex APIs in huge data-driven applications with no additional code and no added application complexity. It's goal is to prevent applications from writing code to manage data that is difficult to maintain or reason about.

\n

EmberData's power comes not from specific features, data formats, or adherence to specific API specs such as JSON:API trpc or GraphQL, but from solid conventions around requesting and mutating data developed over decades of experience scaling developer productivity.

\n

Basic Installation

\n

Install using your javascript package manager of choice. For instance with pnpm

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n
pnpm add ember-data
\n
\n
\n \n

ember-data is installed by default for new applications generated with ember-cli. You can check what version is installed by looking in the devDependencies hash of your project's package.json file.

\n

If you have generated a new Ember application using ember-cli but do\nnot wish to use ember-data, remove ember-data from your project's package.json file and run your package manager's install command to update your lockfile.

\n

Advanced Installation

\n

EmberData is organized into primitives that compose together via public APIs.

\n
    \n
  • @ember-data/store is the core and handles coordination
  • \n
  • @ember-data/json-api provides a resource cache for JSON:API structured data. It integrates with the store via the hook createCache
  • \n
  • @ember-data/model is a presentation layer, it integrates with the store via the hooks instantiateRecord and teardownRecord.
  • \n
  • @ember-data/adapter provides various network API integrations for APIS built over specific REST or JSON:API conventions.
  • \n
  • @ember-data/serializer pairs with @ember-data/adapter to normalize and serialize data to and from an API format into the JSON:API format understood by @ember-data/json-api.
  • \n
  • @ember-data/debug provides debugging support for the ember-inspector.
  • \n
  • ember-data is a "meta" package which bundles all of these together for convenience
  • \n
\n

The packages interop with each other through well defined public API boundaries. The core\nof the library is the store provided by @ember-data/store, while each of the other libraries plugs into the store when installed. Because these packages interop via fully\npublic APIs, other libraries or applications may provide their own implementations. For instance, ember-m3 is a commonly used presentation and cache implementation suitable for complex resource objects and graphs.

\n

Configuration

\n

Deprecation Stripping

\n

EmberData allows users to opt-in and remove code that exists to support deprecated behaviors.

\n

If your app has resolved all deprecations present in a given version, you may specify that version as your "compatibility" version to remove the code that supported the deprecated behavior from your app.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let app = new EmberApp(defaults, {\n emberData: {\n   compatWith: '4.8',\n },\n});
\n
\n
\n \n\n

randomUUID polyfill

\n

EmberData uses UUID V4 by default to generate identifiers for new data created on the client. Identifier generation is configurable, but we also for convenience will polyfill\nthe necessary feature if your browser support or deployment environment demands it. To\nactivate this polyfill:

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n
let app = new EmberApp(defaults, {\n '@embroider/macros': {\n   setConfig: {\n     '@ember-data/store': {\n       polyfillUUID: true\n     },\n   },\n },\n});
\n
\n
\n \n

removing inspector support in production

\n

If you do not with to ship inspector support in your production application, you can specify\nthat all support for it should be stripped from the build.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n
let app = new EmberApp(defaults, {\n emberData: {\n   includeDataAdapterInProduction: false\n }\n});
\n
\n
\n \n\n

Debugging

\n

Many portions of the internals are helpfully instrumented with logging that can be activated\nat build time. This instrumentation is always removed from production builds or any builds\nthat has not explicitly activated it. To activate it set the appropriate flag to true.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
 let app = new EmberApp(defaults, {\n   emberData: {\n     debug: {\n         LOG_PAYLOADS: false, // data store received to update cache with\n         LOG_OPERATIONS: false, // updates to cache remote state\n         LOG_MUTATIONS: false, // updates to cache local state\n         LOG_NOTIFICATIONS: false,\n         LOG_REQUESTS: false, // log Requests issued via the request manager\n         LOG_REQUEST_STATUS: false,\n         LOG_IDENTIFIERS: false,\n         LOG_GRAPH: false,\n         LOG_INSTANCE_CACHE: false,\n     }\n   }\n });
\n
\n
\n \n", - "itemtype": "main", - "parent": null, - "publicclasses": [], - "privateclasses": [], - "staticfunctions": {}, - "allstaticfunctions": {}, - "version": "2.18.5" - }, - "relationships": { - "classes": { - "data": [] - }, - "project-version": { - "data": { - "id": "ember-data-2.18.5", - "type": "project-version" - } - } - } - } -} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-ember-data.json b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-ember-data.json new file mode 100644 index 000000000..f43391b89 --- /dev/null +++ b/json-docs/ember-data/2.18.5/modules/ember-data-2.18.5-ember-data.json @@ -0,0 +1,255 @@ +{ + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module", + "attributes": { + "name": "ember-data", + "submodules": {}, + "elements": {}, + "fors": { + "DS.Model": 1, + "DS": 1, + "String": 1, + "DS.String": 1, + "Ember.HTMLBars.helpers": 1 + }, + "namespaces": { + "DS": 1, + "Ember": 1 + }, + "tag": "main", + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 32, + "description": "

Ember Data

\n", + "itemtype": "main", + "parent": null, + "publicclasses": [ + "DS.BuildURLMixin", + "DS.AdapterError", + "DS.InvalidError", + "DS.TimeoutError", + "DS.AbortError", + "DS.UnauthorizedError", + "DS.ForbiddenError", + "DS.NotFoundError", + "DS.ConflictError", + "DS.ServerError", + "DS.Errors", + "DS.Model", + "DS.RootState", + "DS.AdapterPopulatedRecordArray", + "DS.FilteredRecordArray", + "DS.RecordArray", + "DS.BelongsToReference", + "DS.HasManyReference", + "DS.RecordReference", + "DS.ManyArray", + "DS.PromiseArray", + "DS.PromiseObject", + "DS.PromiseManyArray", + "DS.Store", + "DS.JSONAPIAdapter", + "DS.RESTAdapter", + "DS.EmbeddedRecordsMixin", + "DS.JSONAPISerializer", + "DS.JSONSerializer", + "DS.RESTSerializer", + "DS.BooleanTransform", + "DS.DateTransform", + "DS.NumberTransform", + "DS.StringTransform", + "DS.Transform", + "DS.Adapter", + "DS.Serializer", + "Ember.Inflector" + ], + "privateclasses": [ + "RelationshipPayloadsManager", + "RelationshipPayloads", + "IdentityMap", + "InternalModelMap", + "DS.RecordArrayManager", + "DS.SnapshotRecordArray", + "DS.Snapshot" + ], + "staticfunctions": {}, + "allstaticfunctions": { + "DS.Model": [ + { + "file": "addon/-private/system/model/model.js", + "line": 1153, + "description": "Override the class' `create()` method to raise an error. This\nprevents end users from inadvertently calling `create()` instead\nof `createRecord()`. The store is still able to create instances\nby calling the `_create()` method. To create an instance of a\n`DS.Model` use [store.createRecord](DS.Store.html#method_createRecord).", + "itemtype": "method", + "name": "create", + "access": "private", + "tagname": "", + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1741, + "description": "Iterates through the attributes of the model, calling the passed function on each\nattribute.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, meta);\n```\n\n- `name` the name of the current property in the iteration\n- `meta` the meta object for the attribute property in the iteration\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport DS from 'ember-data';\n\nlet Person = DS.Model.extend({\n firstName: DS.attr('string'),\n lastName: DS.attr('string'),\n birthday: DS.attr('date')\n });\n\nPerson.eachAttribute(function(name, meta) {\n console.log(name, meta);\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", + "itemtype": "method", + "name": "eachAttribute", + "params": [ + { + "name": "callback", + "description": "The callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1597, + "description": "Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.", + "itemtype": "method", + "name": "eachRelatedType", + "static": 1, + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1581, + "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.", + "itemtype": "method", + "name": "eachRelationship", + "static": 1, + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1790, + "description": "Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, type);\n```\n\n- `name` the name of the current property in the iteration\n- `type` a string containing the name of the type of transformed\napplied to the attribute\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport DS from 'ember-data';\n\nlet Person = DS.Model.extend({\n firstName: DS.attr(),\n lastName: DS.attr('string'),\n birthday: DS.attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n console.log(name, type);\n });\n\n// prints:\n// lastName string\n// birthday date\n```", + "itemtype": "method", + "name": "eachTransformedAttribute", + "params": [ + { + "name": "callback", + "description": "The callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1242, + "description": "Find the relationship which is the inverse of the one asked for.\n\nFor example, if you define models like this:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('message')\n });\n```\n\n```app/models/message.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n owner: DS.belongsTo('post')\n });\n```\n\n``` js\nstore.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }\n```", + "itemtype": "method", + "name": "inverseFor", + "static": 1, + "params": [ + { + "name": "name", + "description": "the name of the relationship", + "type": "String" + }, + { + "name": "store", + "description": "", + "type": "DS.Store" + } + ], + "return": { + "description": "the inverse relationship, or null", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1212, + "description": "For a given relationship name, returns the model type of the relationship.\n\nFor example, if you define a model like this:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('comment')\n });\n```\n\nCalling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.", + "itemtype": "method", + "name": "typeForRelationship", + "static": 1, + "params": [ + { + "name": "name", + "description": "the name of the relationship", + "type": "String" + }, + { + "name": "store", + "description": "an instance of DS.Store", + "type": "Store" + } + ], + "return": { + "description": "the type of the relationship, or undefined", + "type": "DS.Model" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + } + ] + }, + "version": "2.18.5" + }, + "relationships": { + "classes": { + "data": [] + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/namespaces/ember-data-2.18.5-DS.json b/json-docs/ember-data/2.18.5/namespaces/ember-data-2.18.5-DS.json new file mode 100644 index 000000000..bf054400e --- /dev/null +++ b/json-docs/ember-data/2.18.5/namespaces/ember-data-2.18.5-DS.json @@ -0,0 +1,195 @@ +{ + "data": { + "id": "ember-data-2.18.5-DS", + "type": "namespace", + "attributes": { + "name": "DS", + "shortname": "DS", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/core.js", + "line": 8, + "description": "

All Ember Data classes, methods and functions are defined inside of this namespace.

\n", + "static": 1, + "methods": [ + { + "file": "addon/-private/adapters/errors.js", + "line": 325, + "description": "

Convert an hash of errors into an array with errors in JSON-API format.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n
import DS from 'ember-data';\n\nconst { errorsHashToArray } = DS;\n\nlet errors = {\n  base: 'Invalid attributes on saving this record',\n  name: 'Must be present',\n  age: ['Must be present', 'Must be a number']\n};\n\nlet errorsArray = errorsHashToArray(errors);\n// [\n//   {\n//     title: "Invalid Document",\n//     detail: "Invalid attributes on saving this record",\n//     source: { pointer: "/data" }\n//   },\n//   {\n//     title: "Invalid Attribute",\n//     detail: "Must be present",\n//     source: { pointer: "/data/attributes/name" }\n//   },\n//   {\n//     title: "Invalid Attribute",\n//     detail: "Must be present",\n//     source: { pointer: "/data/attributes/age" }\n//   },\n//   {\n//     title: "Invalid Attribute",\n//     detail: "Must be a number",\n//     source: { pointer: "/data/attributes/age" }\n//   }\n// ]
\n
\n
\n \n", + "itemtype": "method", + "name": "errorsHashToArray", + "access": "public", + "tagname": "", + "params": [ + { + "name": "errors", + "description": "hash with errors as properties", + "type": "Object" + } + ], + "return": { + "description": "array of errors in JSON-API format", + "type": "Array" + }, + "class": "DS" + }, + { + "file": "addon/-private/adapters/errors.js", + "line": 398, + "description": "

Convert an array of errors in JSON-API format into an object.

\n
\n
\n
\n \n \n \n \n \n \n \n
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n
import DS from 'ember-data';\n\nconst { errorsArrayToHash } = DS;\n\nlet errorsArray = [\n  {\n    title: 'Invalid Attribute',\n    detail: 'Must be present',\n    source: { pointer: '/data/attributes/name' }\n  },\n  {\n    title: 'Invalid Attribute',\n    detail: 'Must be present',\n    source: { pointer: '/data/attributes/age' }\n  },\n  {\n    title: 'Invalid Attribute',\n    detail: 'Must be a number',\n    source: { pointer: '/data/attributes/age' }\n  }\n];\n\nlet errors = errorsArrayToHash(errorsArray);\n// {\n//   "name": ["Must be present"],\n//   "age":  ["Must be present", "must be a number"]\n// }
\n
\n
\n \n", + "itemtype": "method", + "name": "errorsArrayToHash", + "access": "public", + "tagname": "", + "params": [ + { + "name": "errors", + "description": "array of errors in JSON-API format", + "type": "Array" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS" + }, + { + "file": "addon/-private/system/relationships/belongs-to.js", + "line": 5, + "description": "

DS.belongsTo is used to define One-To-One and One-To-Many\nrelationships on a DS.Model.

\n

DS.belongsTo takes an optional hash as a second parameter, currently\nsupported options are:

\n
    \n
  • async: A boolean value used to explicitly declare this to be an async relationship.
  • \n
  • inverse: A string used to identify the inverse property on a\nrelated model in a One-To-Many relationship. See Explicit Inverses
  • \n
\n

One-To-One

\n

To declare a one-to-one relationship between two models, use\nDS.belongsTo:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  profile: DS.belongsTo('profile')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/profile.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  user: DS.belongsTo('user')\n});
\n
\n
\n \n

One-To-Many

\n

To declare a one-to-many relationship between two models, use\nDS.belongsTo in combination with DS.hasMany, like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  comments: DS.hasMany('comment')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  post: DS.belongsTo('post')\n});
\n
\n
\n \n

You can avoid passing a string as the first parameter. In that case Ember Data\nwill infer the type from the key name.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  post: DS.belongsTo()\n});
\n
\n
\n \n

will lookup for a Post type.

\n", + "itemtype": "method", + "name": "belongsTo", + "params": [ + { + "name": "modelName", + "description": "(optional) type of the relationship", + "type": "String" + }, + { + "name": "options", + "description": "(optional) a hash of options", + "type": "Object" + } + ], + "return": { + "description": "relationship", + "type": "Ember.computed" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/has-many.js", + "line": 12, + "description": "

DS.hasMany is used to define One-To-Many and Many-To-Many\nrelationships on a DS.Model.

\n

DS.hasMany takes an optional hash as a second parameter, currently\nsupported options are:

\n
    \n
  • async: A boolean value used to explicitly declare this to be an async relationship.
  • \n
  • inverse: A string used to identify the inverse property on a related model.
  • \n
\n

One-To-Many

\n

To declare a one-to-many relationship between two models, use\nDS.belongsTo in combination with DS.hasMany, like this:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  comments: DS.hasMany('comment')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  post: DS.belongsTo('post')\n});
\n
\n
\n \n

Many-To-Many

\n

To declare a many-to-many relationship between two models, use\nDS.hasMany:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  tags: DS.hasMany('tag')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/tag.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  posts: DS.hasMany('post')\n});
\n
\n
\n \n

You can avoid passing a string as the first parameter. In that case Ember Data\nwill infer the type from the singularized key name.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  tags: DS.hasMany()\n});
\n
\n
\n \n

will lookup for a Tag type.

\n

Explicit Inverses

\n

Ember Data will do its best to discover which relationships map to\none another. In the one-to-many code above, for example, Ember Data\ncan figure out that changing the comments relationship should update\nthe post relationship on the inverse because post is the only\nrelationship to that model.

\n

However, sometimes you may have multiple belongsTo/hasMany for the\nsame type. You can specify which property on the related model is\nthe inverse using DS.hasMany's inverse option:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/comment.js
1\n2\n3\n4\n5\n6\n7\n8\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  onePost: DS.belongsTo('post'),\n  twoPost: DS.belongsTo('post'),\n  redPost: DS.belongsTo('post'),\n  bluePost: DS.belongsTo('post')\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  comments: DS.hasMany('comment', {\n    inverse: 'redPost'\n  })\n});
\n
\n
\n \n

You can also specify an inverse on a belongsTo, which works how\nyou'd expect.

\n", + "itemtype": "method", + "name": "hasMany", + "params": [ + { + "name": "type", + "description": "(optional) type of the relationship", + "type": "String" + }, + { + "name": "options", + "description": "(optional) a hash of options", + "type": "Object" + } + ], + "return": { + "description": "relationship", + "type": "Ember.computed" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/-private/system/normalize-model-name.js", + "line": 6, + "description": "

This method normalizes a modelName into the format Ember Data uses\ninternally.

\n", + "itemtype": "method", + "name": "normalizeModelName", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalizedModelName", + "type": "String" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/attr.js", + "line": 38, + "description": "

DS.attr defines an attribute on a DS.Model.\nBy default, attributes are passed through as-is, however you can specify an\noptional type to have the value automatically transformed.\nEmber Data ships with four basic transform types: string, number,\nboolean and date. You can define your own transforms by subclassing\nDS.Transform.

\n

Note that you cannot use attr to define an attribute of id.

\n

DS.attr takes an optional hash as a second parameter, currently\nsupported options are:

\n
    \n
  • defaultValue: Pass a string or a function to be called to set the attribute
    \n
    \n
    \n \n \n \n \n \n \n \n
    1\n
                to a default value if none is supplied.
    \n
    \n
    \n
  • \n
\n

Example

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  username: DS.attr('string'),\n  email: DS.attr('string'),\n  verified: DS.attr('boolean', { defaultValue: false })\n});
\n
\n
\n \n

Default value can also be a function. This is useful it you want to return\na new object for each attribute.

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/user.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  username: DS.attr('string'),\n  email: DS.attr('string'),\n  settings: DS.attr({\n    defaultValue() {\n      return {};\n    }\n  })\n});
\n
\n
\n \n

The options hash is passed as second argument to a transforms'\nserialize and deserialize method. This allows to configure a\ntransformation and adapt the corresponding value, based on the config:

\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/models/post.js
1\n2\n3\n4\n5\n6\n7\n
import DS from 'ember-data';\n\nexport default DS.Model.extend({\n  text: DS.attr('text', {\n    uppercase: true\n  })\n});
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n
app/transforms/text.js
1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n
import DS from 'ember-data';\n\nexport default DS.Transform.extend({\n  serialize(value, options) {\n    if (options.uppercase) {\n      return value.toUpperCase();\n    }\n\n    return value;\n  },\n\n  deserialize(value) {\n    return value;\n  }\n})
\n
\n
\n \n", + "itemtype": "method", + "name": "attr", + "params": [ + { + "name": "type", + "description": "the attribute type", + "type": "String|Object" + }, + { + "name": "options", + "description": "a hash of options", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Attribute" + }, + "class": "DS", + "module": "ember-data" + } + ], + "events": [], + "properties": [ + { + "file": "addon/-private/core.js", + "line": 15, + "itemtype": "property", + "name": "VERSION", + "type": "String", + "static": 1, + "class": "DS", + "module": "ember-data" + } + ] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/namespaces/ember-data-2.18.5-Ember.Date.json b/json-docs/ember-data/2.18.5/namespaces/ember-data-2.18.5-Ember.Date.json new file mode 100644 index 000000000..809d7d420 --- /dev/null +++ b/json-docs/ember-data/2.18.5/namespaces/ember-data-2.18.5-Ember.Date.json @@ -0,0 +1,45 @@ +{ + "data": { + "id": "ember-data-2.18.5-Ember.Date", + "type": "namespace", + "attributes": { + "name": "Ember.Date", + "shortname": "Ember.Date", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "Ember", + "file": "addon/transforms/date.js", + "line": 7, + "description": "

Date.parse with progressive enhancement for ISO 8601 https://github.com/csnover/js-iso8601

\n

© 2011 Colin Snover http://zetafleet.com

\n

Released under MIT license.

\n", + "static": 1, + "deprecated": true, + "methods": [], + "events": [], + "properties": [] + }, + "relationships": { + "parent-class": { + "data": null + }, + "descendants": { + "data": [] + }, + "module": { + "data": { + "id": "ember-data-2.18.5-ember-data", + "type": "module" + } + }, + "project-version": { + "data": { + "id": "ember-data-2.18.5", + "type": "project-version" + } + } + } + } +} \ No newline at end of file diff --git a/json-docs/ember-data/2.18.5/project-versions/ember-data-2.18.5.json b/json-docs/ember-data/2.18.5/project-versions/ember-data-2.18.5.json index 16c4afb3a..98674a176 100644 --- a/json-docs/ember-data/2.18.5/project-versions/ember-data-2.18.5.json +++ b/json-docs/ember-data/2.18.5/project-versions/ember-data-2.18.5.json @@ -9,310 +9,203 @@ "classes": { "data": [ { - "id": "ember-data-2.18.5- Cache", + "id": "ember-data-2.18.5-DS.BuildURLMixin", "type": "class" }, { - "id": "ember-data-2.18.5-CacheStoreWrapper", + "id": "ember-data-2.18.5-DS.AdapterError", "type": "class" }, { - "id": "ember-data-2.18.5-StableRecordIdentifier", + "id": "ember-data-2.18.5-DS.InvalidError", "type": "class" }, { - "id": "ember-data-2.18.5- Adapter", + "id": "ember-data-2.18.5-DS.TimeoutError", "type": "class" }, { - "id": "ember-data-2.18.5- Serializer", + "id": "ember-data-2.18.5-DS.AbortError", "type": "class" }, { - "id": "ember-data-2.18.5-SchemaService", + "id": "ember-data-2.18.5-DS.UnauthorizedError", "type": "class" }, { - "id": "ember-data-2.18.5-BuildURLMixin", + "id": "ember-data-2.18.5-DS.ForbiddenError", "type": "class" }, { - "id": "ember-data-2.18.5-AdapterError", + "id": "ember-data-2.18.5-DS.NotFoundError", "type": "class" }, { - "id": "ember-data-2.18.5-InvalidError", + "id": "ember-data-2.18.5-DS.ConflictError", "type": "class" }, { - "id": "ember-data-2.18.5-TimeoutError", + "id": "ember-data-2.18.5-DS.ServerError", "type": "class" }, { - "id": "ember-data-2.18.5-AbortError", + "id": "ember-data-2.18.5-DS.Errors", "type": "class" }, { - "id": "ember-data-2.18.5-UnauthorizedError", + "id": "ember-data-2.18.5-DS.Model", "type": "class" }, { - "id": "ember-data-2.18.5-ForbiddenError", + "id": "ember-data-2.18.5-DS.RootState", "type": "class" }, { - "id": "ember-data-2.18.5-NotFoundError", + "id": "ember-data-2.18.5-DS.AdapterPopulatedRecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-ConflictError", + "id": "ember-data-2.18.5-DS.FilteredRecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-ServerError", + "id": "ember-data-2.18.5-DS.RecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-Adapter", + "id": "ember-data-2.18.5-DS.BelongsToReference", "type": "class" }, { - "id": "ember-data-2.18.5-JSONAPIAdapter", + "id": "ember-data-2.18.5-DS.HasManyReference", "type": "class" }, { - "id": "ember-data-2.18.5-RESTAdapter", + "id": "ember-data-2.18.5-DS.RecordReference", "type": "class" }, { - "id": "ember-data-2.18.5-InspectorDataAdapter", + "id": "ember-data-2.18.5-RelationshipPayloadsManager", "type": "class" }, { - "id": "ember-data-2.18.5-Cache", + "id": "ember-data-2.18.5-RelationshipPayloads", "type": "class" }, { - "id": "ember-data-2.18.5-SnapshotRecordArray", + "id": "ember-data-2.18.5-IdentityMap", "type": "class" }, { - "id": "ember-data-2.18.5-Snapshot", + "id": "ember-data-2.18.5-InternalModelMap", "type": "class" }, { - "id": "ember-data-2.18.5-BelongsToReference", + "id": "ember-data-2.18.5-DS.ManyArray", "type": "class" }, { - "id": "ember-data-2.18.5-HasManyReference", + "id": "ember-data-2.18.5-DS.PromiseArray", "type": "class" }, { - "id": "ember-data-2.18.5-Errors", + "id": "ember-data-2.18.5-DS.PromiseObject", "type": "class" }, { - "id": "ember-data-2.18.5-ManyArray", + "id": "ember-data-2.18.5-DS.PromiseManyArray", "type": "class" }, { - "id": "ember-data-2.18.5-Model", + "id": "ember-data-2.18.5-DS.RecordArrayManager", "type": "class" }, { - "id": "ember-data-2.18.5-PromiseBelongsTo", + "id": "ember-data-2.18.5-DS.SnapshotRecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-PromiseManyArray", + "id": "ember-data-2.18.5-DS.Snapshot", "type": "class" }, { - "id": "ember-data-2.18.5-CanaryFeatureFlags", + "id": "ember-data-2.18.5-DS.Store", "type": "class" }, { - "id": "ember-data-2.18.5-DebugLogging", + "id": "ember-data-2.18.5-DS.JSONAPIAdapter", "type": "class" }, { - "id": "ember-data-2.18.5-CurrentDeprecations", + "id": "ember-data-2.18.5-DS.RESTAdapter", "type": "class" }, { - "id": "ember-data-2.18.5-RequestManager", + "id": "ember-data-2.18.5-DS.EmbeddedRecordsMixin", "type": "class" }, { - "id": "ember-data-2.18.5-Future", + "id": "ember-data-2.18.5-DS.JSONAPISerializer", "type": "class" }, { - "id": "ember-data-2.18.5- Handler", + "id": "ember-data-2.18.5-DS.JSONSerializer", "type": "class" }, { - "id": "ember-data-2.18.5-Fetch", + "id": "ember-data-2.18.5-DS.RESTSerializer", "type": "class" }, { - "id": "ember-data-2.18.5-BooleanTransform", + "id": "ember-data-2.18.5-DS.BooleanTransform", "type": "class" }, { - "id": "ember-data-2.18.5-DateTransform", + "id": "ember-data-2.18.5-DS.DateTransform", "type": "class" }, { - "id": "ember-data-2.18.5-NumberTransform", + "id": "ember-data-2.18.5-DS.NumberTransform", "type": "class" }, { - "id": "ember-data-2.18.5-StringTransform", + "id": "ember-data-2.18.5-DS.StringTransform", "type": "class" }, { - "id": "ember-data-2.18.5-Transform", + "id": "ember-data-2.18.5-DS.Transform", "type": "class" }, { - "id": "ember-data-2.18.5-EmbeddedRecordsMixin", + "id": "ember-data-2.18.5-DS.Adapter", "type": "class" }, { - "id": "ember-data-2.18.5-Serializer", + "id": "ember-data-2.18.5-DS.Serializer", "type": "class" }, { - "id": "ember-data-2.18.5-JSONAPISerializer", - "type": "class" - }, - { - "id": "ember-data-2.18.5-JSONSerializer", - "type": "class" - }, - { - "id": "ember-data-2.18.5-RESTSerializer", - "type": "class" - }, - { - "id": "ember-data-2.18.5-IdentifierCache", - "type": "class" - }, - { - "id": "ember-data-2.18.5-RecordReference", - "type": "class" - }, - { - "id": "ember-data-2.18.5-CacheManager", - "type": "class" - }, - { - "id": "ember-data-2.18.5-NotificationManager", - "type": "class" - }, - { - "id": "ember-data-2.18.5-RequestStateService", - "type": "class" - }, - { - "id": "ember-data-2.18.5-RecordArray", - "type": "class" - }, - { - "id": "ember-data-2.18.5-Store", + "id": "ember-data-2.18.5-Ember.Inflector", "type": "class" } ] }, "namespaces": { - "data": [] - }, - "modules": { "data": [ { - "id": "ember-data-2.18.5-@ember-data/experimental-preview-types", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - }, - { - "id": "ember-data-2.18.5-ember-data-overview", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter/json-api", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter/rest", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/debug", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/graph", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/json-api", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/legacy-compat", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/canary-features", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/deprecations", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/request", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/request/fetch", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer/rest", - "type": "module" + "id": "ember-data-2.18.5-DS", + "type": "namespace" }, { - "id": "ember-data-2.18.5-@ember-data/serializer/json-api", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer/json", - "type": "module" - }, + "id": "ember-data-2.18.5-Ember.Date", + "type": "namespace" + } + ] + }, + "modules": { + "data": [ { - "id": "ember-data-2.18.5-@ember-data/tracking", + "id": "ember-data-2.18.5-ember-data", "type": "module" } ] @@ -326,232 +219,206 @@ "private-classes": { "data": [ { - "id": "ember-data-2.18.5-InspectorDataAdapter", + "id": "ember-data-2.18.5-RelationshipPayloadsManager", "type": "class" }, { - "id": "ember-data-2.18.5-PromiseBelongsTo", - "type": "class" - } - ] - }, - "public-classes": { - "data": [ - { - "id": "ember-data-2.18.5- Cache", + "id": "ember-data-2.18.5-RelationshipPayloads", "type": "class" }, { - "id": "ember-data-2.18.5-CacheStoreWrapper", + "id": "ember-data-2.18.5-IdentityMap", "type": "class" }, { - "id": "ember-data-2.18.5-StableRecordIdentifier", + "id": "ember-data-2.18.5-InternalModelMap", "type": "class" }, { - "id": "ember-data-2.18.5- Adapter", + "id": "ember-data-2.18.5-DS.RecordArrayManager", "type": "class" }, { - "id": "ember-data-2.18.5- Serializer", + "id": "ember-data-2.18.5-DS.SnapshotRecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-SchemaService", + "id": "ember-data-2.18.5-DS.Snapshot", "type": "class" - }, - { - "id": "ember-data-2.18.5-BuildURLMixin", - "type": "class" - }, - { - "id": "ember-data-2.18.5-AdapterError", - "type": "class" - }, - { - "id": "ember-data-2.18.5-InvalidError", - "type": "class" - }, - { - "id": "ember-data-2.18.5-TimeoutError", - "type": "class" - }, - { - "id": "ember-data-2.18.5-AbortError", - "type": "class" - }, - { - "id": "ember-data-2.18.5-UnauthorizedError", - "type": "class" - }, - { - "id": "ember-data-2.18.5-ForbiddenError", - "type": "class" - }, - { - "id": "ember-data-2.18.5-NotFoundError", - "type": "class" - }, + } + ] + }, + "public-classes": { + "data": [ { - "id": "ember-data-2.18.5-ConflictError", + "id": "ember-data-2.18.5-DS.BuildURLMixin", "type": "class" }, { - "id": "ember-data-2.18.5-ServerError", + "id": "ember-data-2.18.5-DS.AdapterError", "type": "class" }, { - "id": "ember-data-2.18.5-Adapter", + "id": "ember-data-2.18.5-DS.InvalidError", "type": "class" }, { - "id": "ember-data-2.18.5-JSONAPIAdapter", + "id": "ember-data-2.18.5-DS.TimeoutError", "type": "class" }, { - "id": "ember-data-2.18.5-RESTAdapter", + "id": "ember-data-2.18.5-DS.AbortError", "type": "class" }, { - "id": "ember-data-2.18.5-Cache", + "id": "ember-data-2.18.5-DS.UnauthorizedError", "type": "class" }, { - "id": "ember-data-2.18.5-SnapshotRecordArray", + "id": "ember-data-2.18.5-DS.ForbiddenError", "type": "class" }, { - "id": "ember-data-2.18.5-Snapshot", + "id": "ember-data-2.18.5-DS.NotFoundError", "type": "class" }, { - "id": "ember-data-2.18.5-BelongsToReference", + "id": "ember-data-2.18.5-DS.ConflictError", "type": "class" }, { - "id": "ember-data-2.18.5-HasManyReference", + "id": "ember-data-2.18.5-DS.ServerError", "type": "class" }, { - "id": "ember-data-2.18.5-Errors", + "id": "ember-data-2.18.5-DS.Errors", "type": "class" }, { - "id": "ember-data-2.18.5-ManyArray", + "id": "ember-data-2.18.5-DS.Model", "type": "class" }, { - "id": "ember-data-2.18.5-Model", + "id": "ember-data-2.18.5-DS.RootState", "type": "class" }, { - "id": "ember-data-2.18.5-PromiseManyArray", + "id": "ember-data-2.18.5-DS.AdapterPopulatedRecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-CanaryFeatureFlags", + "id": "ember-data-2.18.5-DS.FilteredRecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-DebugLogging", + "id": "ember-data-2.18.5-DS.RecordArray", "type": "class" }, { - "id": "ember-data-2.18.5-CurrentDeprecations", + "id": "ember-data-2.18.5-DS.BelongsToReference", "type": "class" }, { - "id": "ember-data-2.18.5-RequestManager", + "id": "ember-data-2.18.5-DS.HasManyReference", "type": "class" }, { - "id": "ember-data-2.18.5-Future", + "id": "ember-data-2.18.5-DS.RecordReference", "type": "class" }, { - "id": "ember-data-2.18.5- Handler", + "id": "ember-data-2.18.5-DS.ManyArray", "type": "class" }, { - "id": "ember-data-2.18.5-Fetch", + "id": "ember-data-2.18.5-DS.PromiseArray", "type": "class" }, { - "id": "ember-data-2.18.5-BooleanTransform", + "id": "ember-data-2.18.5-DS.PromiseObject", "type": "class" }, { - "id": "ember-data-2.18.5-DateTransform", + "id": "ember-data-2.18.5-DS.PromiseManyArray", "type": "class" }, { - "id": "ember-data-2.18.5-NumberTransform", + "id": "ember-data-2.18.5-DS.Store", "type": "class" }, { - "id": "ember-data-2.18.5-StringTransform", + "id": "ember-data-2.18.5-DS.JSONAPIAdapter", "type": "class" }, { - "id": "ember-data-2.18.5-Transform", + "id": "ember-data-2.18.5-DS.RESTAdapter", "type": "class" }, { - "id": "ember-data-2.18.5-EmbeddedRecordsMixin", + "id": "ember-data-2.18.5-DS.EmbeddedRecordsMixin", "type": "class" }, { - "id": "ember-data-2.18.5-Serializer", + "id": "ember-data-2.18.5-DS.JSONAPISerializer", "type": "class" }, { - "id": "ember-data-2.18.5-JSONAPISerializer", + "id": "ember-data-2.18.5-DS.JSONSerializer", "type": "class" }, { - "id": "ember-data-2.18.5-JSONSerializer", + "id": "ember-data-2.18.5-DS.RESTSerializer", "type": "class" }, { - "id": "ember-data-2.18.5-RESTSerializer", + "id": "ember-data-2.18.5-DS.BooleanTransform", "type": "class" }, { - "id": "ember-data-2.18.5-IdentifierCache", + "id": "ember-data-2.18.5-DS.DateTransform", "type": "class" }, { - "id": "ember-data-2.18.5-RecordReference", + "id": "ember-data-2.18.5-DS.NumberTransform", "type": "class" }, { - "id": "ember-data-2.18.5-CacheManager", + "id": "ember-data-2.18.5-DS.StringTransform", "type": "class" }, { - "id": "ember-data-2.18.5-NotificationManager", + "id": "ember-data-2.18.5-DS.Transform", "type": "class" }, { - "id": "ember-data-2.18.5-RequestStateService", + "id": "ember-data-2.18.5-DS.Adapter", "type": "class" }, { - "id": "ember-data-2.18.5-RecordArray", + "id": "ember-data-2.18.5-DS.Serializer", "type": "class" }, { - "id": "ember-data-2.18.5-Store", + "id": "ember-data-2.18.5-Ember.Inflector", "type": "class" } ] }, "private-namespaces": { - "data": [] + "data": [ + { + "id": "ember-data-2.18.5-Ember.Date", + "type": "namespace" + } + ] }, "public-namespaces": { - "data": [] + "data": [ + { + "id": "ember-data-2.18.5-DS", + "type": "namespace" + } + ] }, "private-modules": { "data": [] @@ -559,87 +426,7 @@ "public-modules": { "data": [ { - "id": "ember-data-2.18.5-@ember-data/experimental-preview-types", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/store", - "type": "module" - }, - { - "id": "ember-data-2.18.5-ember-data-overview", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter/error", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter/json-api", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/adapter/rest", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/debug", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/graph", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/json-api", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/legacy-compat", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/model", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/canary-features", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/deprecations", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/request", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/request/fetch", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer/rest", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer/json-api", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/serializer/json", - "type": "module" - }, - { - "id": "ember-data-2.18.5-@ember-data/tracking", + "id": "ember-data-2.18.5-ember-data", "type": "module" } ] diff --git a/rev-index/ember-data-2.18.5.json b/rev-index/ember-data-2.18.5.json index 31ac817c5..48cfd8b9e 100644 --- a/rev-index/ember-data-2.18.5.json +++ b/rev-index/ember-data-2.18.5.json @@ -1 +1 @@ -{"data":{"id":"ember-data-2.18.5","type":"project-version","attributes":{"version":"2.18.5"},"relationships":{"classes":{"data":[{"id":"ember-data-2.18.5- Cache","type":"class"},{"id":"ember-data-2.18.5-CacheStoreWrapper","type":"class"},{"id":"ember-data-2.18.5-StableRecordIdentifier","type":"class"},{"id":"ember-data-2.18.5- Adapter","type":"class"},{"id":"ember-data-2.18.5- Serializer","type":"class"},{"id":"ember-data-2.18.5-SchemaService","type":"class"},{"id":"ember-data-2.18.5-BuildURLMixin","type":"class"},{"id":"ember-data-2.18.5-AdapterError","type":"class"},{"id":"ember-data-2.18.5-InvalidError","type":"class"},{"id":"ember-data-2.18.5-TimeoutError","type":"class"},{"id":"ember-data-2.18.5-AbortError","type":"class"},{"id":"ember-data-2.18.5-UnauthorizedError","type":"class"},{"id":"ember-data-2.18.5-ForbiddenError","type":"class"},{"id":"ember-data-2.18.5-NotFoundError","type":"class"},{"id":"ember-data-2.18.5-ConflictError","type":"class"},{"id":"ember-data-2.18.5-ServerError","type":"class"},{"id":"ember-data-2.18.5-Adapter","type":"class"},{"id":"ember-data-2.18.5-JSONAPIAdapter","type":"class"},{"id":"ember-data-2.18.5-RESTAdapter","type":"class"},{"id":"ember-data-2.18.5-InspectorDataAdapter","type":"class"},{"id":"ember-data-2.18.5-Cache","type":"class"},{"id":"ember-data-2.18.5-SnapshotRecordArray","type":"class"},{"id":"ember-data-2.18.5-Snapshot","type":"class"},{"id":"ember-data-2.18.5-BelongsToReference","type":"class"},{"id":"ember-data-2.18.5-HasManyReference","type":"class"},{"id":"ember-data-2.18.5-Errors","type":"class"},{"id":"ember-data-2.18.5-ManyArray","type":"class"},{"id":"ember-data-2.18.5-Model","type":"class"},{"id":"ember-data-2.18.5-PromiseBelongsTo","type":"class"},{"id":"ember-data-2.18.5-PromiseManyArray","type":"class"},{"id":"ember-data-2.18.5-CanaryFeatureFlags","type":"class"},{"id":"ember-data-2.18.5-DebugLogging","type":"class"},{"id":"ember-data-2.18.5-CurrentDeprecations","type":"class"},{"id":"ember-data-2.18.5-RequestManager","type":"class"},{"id":"ember-data-2.18.5-Future","type":"class"},{"id":"ember-data-2.18.5- Handler","type":"class"},{"id":"ember-data-2.18.5-Fetch","type":"class"},{"id":"ember-data-2.18.5-BooleanTransform","type":"class"},{"id":"ember-data-2.18.5-DateTransform","type":"class"},{"id":"ember-data-2.18.5-NumberTransform","type":"class"},{"id":"ember-data-2.18.5-StringTransform","type":"class"},{"id":"ember-data-2.18.5-Transform","type":"class"},{"id":"ember-data-2.18.5-EmbeddedRecordsMixin","type":"class"},{"id":"ember-data-2.18.5-Serializer","type":"class"},{"id":"ember-data-2.18.5-JSONAPISerializer","type":"class"},{"id":"ember-data-2.18.5-JSONSerializer","type":"class"},{"id":"ember-data-2.18.5-RESTSerializer","type":"class"},{"id":"ember-data-2.18.5-IdentifierCache","type":"class"},{"id":"ember-data-2.18.5-RecordReference","type":"class"},{"id":"ember-data-2.18.5-CacheManager","type":"class"},{"id":"ember-data-2.18.5-NotificationManager","type":"class"},{"id":"ember-data-2.18.5-RequestStateService","type":"class"},{"id":"ember-data-2.18.5-RecordArray","type":"class"},{"id":"ember-data-2.18.5-Store","type":"class"}]},"namespaces":{"data":[]},"modules":{"data":[{"id":"ember-data-2.18.5-@ember-data/experimental-preview-types","type":"module"},{"id":"ember-data-2.18.5-@ember-data/store","type":"module"},{"id":"ember-data-2.18.5-ember-data-overview","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter/error","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter/json-api","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter/rest","type":"module"},{"id":"ember-data-2.18.5-@ember-data/debug","type":"module"},{"id":"ember-data-2.18.5-@ember-data/graph","type":"module"},{"id":"ember-data-2.18.5-@ember-data/json-api","type":"module"},{"id":"ember-data-2.18.5-@ember-data/legacy-compat","type":"module"},{"id":"ember-data-2.18.5-@ember-data/model","type":"module"},{"id":"ember-data-2.18.5-@ember-data/canary-features","type":"module"},{"id":"ember-data-2.18.5-@ember-data/deprecations","type":"module"},{"id":"ember-data-2.18.5-@ember-data/request","type":"module"},{"id":"ember-data-2.18.5-@ember-data/request/fetch","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer/rest","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer/json-api","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer/json","type":"module"},{"id":"ember-data-2.18.5-@ember-data/tracking","type":"module"}]},"project":{"data":{"id":"ember-data","type":"project"}},"private-classes":{"data":[{"id":"ember-data-2.18.5-InspectorDataAdapter","type":"class"},{"id":"ember-data-2.18.5-PromiseBelongsTo","type":"class"}]},"public-classes":{"data":[{"id":"ember-data-2.18.5- Cache","type":"class"},{"id":"ember-data-2.18.5-CacheStoreWrapper","type":"class"},{"id":"ember-data-2.18.5-StableRecordIdentifier","type":"class"},{"id":"ember-data-2.18.5- Adapter","type":"class"},{"id":"ember-data-2.18.5- Serializer","type":"class"},{"id":"ember-data-2.18.5-SchemaService","type":"class"},{"id":"ember-data-2.18.5-BuildURLMixin","type":"class"},{"id":"ember-data-2.18.5-AdapterError","type":"class"},{"id":"ember-data-2.18.5-InvalidError","type":"class"},{"id":"ember-data-2.18.5-TimeoutError","type":"class"},{"id":"ember-data-2.18.5-AbortError","type":"class"},{"id":"ember-data-2.18.5-UnauthorizedError","type":"class"},{"id":"ember-data-2.18.5-ForbiddenError","type":"class"},{"id":"ember-data-2.18.5-NotFoundError","type":"class"},{"id":"ember-data-2.18.5-ConflictError","type":"class"},{"id":"ember-data-2.18.5-ServerError","type":"class"},{"id":"ember-data-2.18.5-Adapter","type":"class"},{"id":"ember-data-2.18.5-JSONAPIAdapter","type":"class"},{"id":"ember-data-2.18.5-RESTAdapter","type":"class"},{"id":"ember-data-2.18.5-Cache","type":"class"},{"id":"ember-data-2.18.5-SnapshotRecordArray","type":"class"},{"id":"ember-data-2.18.5-Snapshot","type":"class"},{"id":"ember-data-2.18.5-BelongsToReference","type":"class"},{"id":"ember-data-2.18.5-HasManyReference","type":"class"},{"id":"ember-data-2.18.5-Errors","type":"class"},{"id":"ember-data-2.18.5-ManyArray","type":"class"},{"id":"ember-data-2.18.5-Model","type":"class"},{"id":"ember-data-2.18.5-PromiseManyArray","type":"class"},{"id":"ember-data-2.18.5-CanaryFeatureFlags","type":"class"},{"id":"ember-data-2.18.5-DebugLogging","type":"class"},{"id":"ember-data-2.18.5-CurrentDeprecations","type":"class"},{"id":"ember-data-2.18.5-RequestManager","type":"class"},{"id":"ember-data-2.18.5-Future","type":"class"},{"id":"ember-data-2.18.5- Handler","type":"class"},{"id":"ember-data-2.18.5-Fetch","type":"class"},{"id":"ember-data-2.18.5-BooleanTransform","type":"class"},{"id":"ember-data-2.18.5-DateTransform","type":"class"},{"id":"ember-data-2.18.5-NumberTransform","type":"class"},{"id":"ember-data-2.18.5-StringTransform","type":"class"},{"id":"ember-data-2.18.5-Transform","type":"class"},{"id":"ember-data-2.18.5-EmbeddedRecordsMixin","type":"class"},{"id":"ember-data-2.18.5-Serializer","type":"class"},{"id":"ember-data-2.18.5-JSONAPISerializer","type":"class"},{"id":"ember-data-2.18.5-JSONSerializer","type":"class"},{"id":"ember-data-2.18.5-RESTSerializer","type":"class"},{"id":"ember-data-2.18.5-IdentifierCache","type":"class"},{"id":"ember-data-2.18.5-RecordReference","type":"class"},{"id":"ember-data-2.18.5-CacheManager","type":"class"},{"id":"ember-data-2.18.5-NotificationManager","type":"class"},{"id":"ember-data-2.18.5-RequestStateService","type":"class"},{"id":"ember-data-2.18.5-RecordArray","type":"class"},{"id":"ember-data-2.18.5-Store","type":"class"}]},"private-namespaces":{"data":[]},"public-namespaces":{"data":[]},"private-modules":{"data":[]},"public-modules":{"data":[{"id":"ember-data-2.18.5-@ember-data/experimental-preview-types","type":"module"},{"id":"ember-data-2.18.5-@ember-data/store","type":"module"},{"id":"ember-data-2.18.5-ember-data-overview","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter/error","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter/json-api","type":"module"},{"id":"ember-data-2.18.5-@ember-data/adapter/rest","type":"module"},{"id":"ember-data-2.18.5-@ember-data/debug","type":"module"},{"id":"ember-data-2.18.5-@ember-data/graph","type":"module"},{"id":"ember-data-2.18.5-@ember-data/json-api","type":"module"},{"id":"ember-data-2.18.5-@ember-data/legacy-compat","type":"module"},{"id":"ember-data-2.18.5-@ember-data/model","type":"module"},{"id":"ember-data-2.18.5-@ember-data/canary-features","type":"module"},{"id":"ember-data-2.18.5-@ember-data/deprecations","type":"module"},{"id":"ember-data-2.18.5-@ember-data/request","type":"module"},{"id":"ember-data-2.18.5-@ember-data/request/fetch","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer/rest","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer/json-api","type":"module"},{"id":"ember-data-2.18.5-@ember-data/serializer/json","type":"module"},{"id":"ember-data-2.18.5-@ember-data/tracking","type":"module"}]}}},"meta":{"class":{"ember-data-2.18.5- Cache":"ember-data-2.18.5- Cache","ember-data-2.18.5-CacheStoreWrapper":"ember-data-2.18.5-CacheStoreWrapper","ember-data-2.18.5-StableRecordIdentifier":"ember-data-2.18.5-StableRecordIdentifier","ember-data-2.18.5- Adapter":"ember-data-2.18.5- Adapter","ember-data-2.18.5- Serializer":"ember-data-2.18.5- Serializer","ember-data-2.18.5-SchemaService":"ember-data-2.18.5-SchemaService","ember-data-2.18.5-BuildURLMixin":"ember-data-2.18.5-BuildURLMixin","ember-data-2.18.5-AdapterError":"ember-data-2.18.5-AdapterError","ember-data-2.18.5-InvalidError":"ember-data-2.18.5-InvalidError","ember-data-2.18.5-TimeoutError":"ember-data-2.18.5-TimeoutError","ember-data-2.18.5-AbortError":"ember-data-2.18.5-AbortError","ember-data-2.18.5-UnauthorizedError":"ember-data-2.18.5-UnauthorizedError","ember-data-2.18.5-ForbiddenError":"ember-data-2.18.5-ForbiddenError","ember-data-2.18.5-NotFoundError":"ember-data-2.18.5-NotFoundError","ember-data-2.18.5-ConflictError":"ember-data-2.18.5-ConflictError","ember-data-2.18.5-ServerError":"ember-data-2.18.5-ServerError","ember-data-2.18.5-Adapter":"ember-data-2.18.5-Adapter","ember-data-2.18.5-JSONAPIAdapter":"ember-data-2.18.5-JSONAPIAdapter","ember-data-2.18.5-RESTAdapter":"ember-data-2.18.5-RESTAdapter","ember-data-2.18.5-InspectorDataAdapter":"ember-data-2.18.5-InspectorDataAdapter","ember-data-2.18.5-Cache":"ember-data-2.18.5-Cache","ember-data-2.18.5-SnapshotRecordArray":"ember-data-2.18.5-SnapshotRecordArray","ember-data-2.18.5-Snapshot":"ember-data-2.18.5-Snapshot","ember-data-2.18.5-BelongsToReference":"ember-data-2.18.5-BelongsToReference","ember-data-2.18.5-HasManyReference":"ember-data-2.18.5-HasManyReference","ember-data-2.18.5-Errors":"ember-data-2.18.5-Errors","ember-data-2.18.5-ManyArray":"ember-data-2.18.5-ManyArray","ember-data-2.18.5-Model":"ember-data-2.18.5-Model","ember-data-2.18.5-PromiseBelongsTo":"ember-data-2.18.5-PromiseBelongsTo","ember-data-2.18.5-PromiseManyArray":"ember-data-2.18.5-PromiseManyArray","ember-data-2.18.5-CanaryFeatureFlags":"ember-data-2.18.5-CanaryFeatureFlags","ember-data-2.18.5-DebugLogging":"ember-data-2.18.5-DebugLogging","ember-data-2.18.5-CurrentDeprecations":"ember-data-2.18.5-CurrentDeprecations","ember-data-2.18.5-RequestManager":"ember-data-2.18.5-RequestManager","ember-data-2.18.5-Future":"ember-data-2.18.5-Future","ember-data-2.18.5- Handler":"ember-data-2.18.5- Handler","ember-data-2.18.5-Fetch":"ember-data-2.18.5-Fetch","ember-data-2.18.5-BooleanTransform":"ember-data-2.18.5-BooleanTransform","ember-data-2.18.5-DateTransform":"ember-data-2.18.5-DateTransform","ember-data-2.18.5-NumberTransform":"ember-data-2.18.5-NumberTransform","ember-data-2.18.5-StringTransform":"ember-data-2.18.5-StringTransform","ember-data-2.18.5-Transform":"ember-data-2.18.5-Transform","ember-data-2.18.5-EmbeddedRecordsMixin":"ember-data-2.18.5-EmbeddedRecordsMixin","ember-data-2.18.5-Serializer":"ember-data-2.18.5-Serializer","ember-data-2.18.5-JSONAPISerializer":"ember-data-2.18.5-JSONAPISerializer","ember-data-2.18.5-JSONSerializer":"ember-data-2.18.5-JSONSerializer","ember-data-2.18.5-RESTSerializer":"ember-data-2.18.5-RESTSerializer","ember-data-2.18.5-IdentifierCache":"ember-data-2.18.5-IdentifierCache","ember-data-2.18.5-RecordReference":"ember-data-2.18.5-RecordReference","ember-data-2.18.5-CacheManager":"ember-data-2.18.5-CacheManager","ember-data-2.18.5-NotificationManager":"ember-data-2.18.5-NotificationManager","ember-data-2.18.5-RequestStateService":"ember-data-2.18.5-RequestStateService","ember-data-2.18.5-RecordArray":"ember-data-2.18.5-RecordArray","ember-data-2.18.5-Store":"ember-data-2.18.5-Store","ember-data-2.18.5-@ember-data/adapter/rest":"ember-data-2.18.5-@ember-data/adapter/rest","ember-data-2.18.5-@ember-data/model":"ember-data-2.18.5-@ember-data/model","ember-data-2.18.5-@ember-data/store":"ember-data-2.18.5-@ember-data/store","ember-data-2.18.5-@ember-data/tracking":"ember-data-2.18.5-@ember-data/tracking"},"module":{"ember-data-2.18.5-@ember-data/experimental-preview-types":"","ember-data-2.18.5-@ember-data/store":"ember-data-2.18.5-@ember-data/store","ember-data-2.18.5-ember-data-overview":"ember-data-2.18.5-ember-data-overview","ember-data-2.18.5-@ember-data/adapter":"ember-data-2.18.5-@ember-data/adapter","ember-data-2.18.5-@ember-data/adapter/error":"ember-data-2.18.5-@ember-data/adapter/error","ember-data-2.18.5-@ember-data/adapter/json-api":"ember-data-2.18.5-@ember-data/adapter/json-api","ember-data-2.18.5-@ember-data/adapter/rest":"ember-data-2.18.5-@ember-data/adapter/rest","ember-data-2.18.5-@ember-data/debug":"ember-data-2.18.5-@ember-data/debug","ember-data-2.18.5-@ember-data/graph":"ember-data-2.18.5-@ember-data/graph","ember-data-2.18.5-@ember-data/json-api":"ember-data-2.18.5-@ember-data/json-api","ember-data-2.18.5-@ember-data/legacy-compat":"ember-data-2.18.5-@ember-data/legacy-compat","ember-data-2.18.5-@ember-data/model":"ember-data-2.18.5-@ember-data/model","ember-data-2.18.5-@ember-data/canary-features":"ember-data-2.18.5-@ember-data/canary-features","ember-data-2.18.5-@ember-data/deprecations":"ember-data-2.18.5-@ember-data/deprecations","ember-data-2.18.5-@ember-data/request":"ember-data-2.18.5-@ember-data/request","ember-data-2.18.5-@ember-data/request/fetch":"ember-data-2.18.5-@ember-data/request/fetch","ember-data-2.18.5-@ember-data/serializer":"ember-data-2.18.5-@ember-data/serializer","ember-data-2.18.5-@ember-data/serializer/rest":"ember-data-2.18.5-@ember-data/serializer/rest","ember-data-2.18.5-@ember-data/serializer/json-api":"ember-data-2.18.5-@ember-data/serializer/json-api","ember-data-2.18.5-@ember-data/serializer/json":"ember-data-2.18.5-@ember-data/serializer/json","ember-data-2.18.5-@ember-data/tracking":"ember-data-2.18.5-@ember-data/tracking"},"missing":{"DataAdapter":"DataAdapter","Ember.ArrayProxy":"Ember.ArrayProxy","Ember.EmberObject":"Ember.EmberObject","Promise":"Promise","PromiseObject":"PromiseObject","Reference":"Reference"}}} \ No newline at end of file +{"data":{"id":"ember-data-2.18.5","type":"project-version","attributes":{"version":"2.18.5"},"relationships":{"classes":{"data":[{"id":"ember-data-2.18.5-DS.BuildURLMixin","type":"class"},{"id":"ember-data-2.18.5-DS.AdapterError","type":"class"},{"id":"ember-data-2.18.5-DS.InvalidError","type":"class"},{"id":"ember-data-2.18.5-DS.TimeoutError","type":"class"},{"id":"ember-data-2.18.5-DS.AbortError","type":"class"},{"id":"ember-data-2.18.5-DS.UnauthorizedError","type":"class"},{"id":"ember-data-2.18.5-DS.ForbiddenError","type":"class"},{"id":"ember-data-2.18.5-DS.NotFoundError","type":"class"},{"id":"ember-data-2.18.5-DS.ConflictError","type":"class"},{"id":"ember-data-2.18.5-DS.ServerError","type":"class"},{"id":"ember-data-2.18.5-DS.Errors","type":"class"},{"id":"ember-data-2.18.5-DS.Model","type":"class"},{"id":"ember-data-2.18.5-DS.RootState","type":"class"},{"id":"ember-data-2.18.5-DS.AdapterPopulatedRecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.FilteredRecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.RecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.BelongsToReference","type":"class"},{"id":"ember-data-2.18.5-DS.HasManyReference","type":"class"},{"id":"ember-data-2.18.5-DS.RecordReference","type":"class"},{"id":"ember-data-2.18.5-RelationshipPayloadsManager","type":"class"},{"id":"ember-data-2.18.5-RelationshipPayloads","type":"class"},{"id":"ember-data-2.18.5-IdentityMap","type":"class"},{"id":"ember-data-2.18.5-InternalModelMap","type":"class"},{"id":"ember-data-2.18.5-DS.ManyArray","type":"class"},{"id":"ember-data-2.18.5-DS.PromiseArray","type":"class"},{"id":"ember-data-2.18.5-DS.PromiseObject","type":"class"},{"id":"ember-data-2.18.5-DS.PromiseManyArray","type":"class"},{"id":"ember-data-2.18.5-DS.RecordArrayManager","type":"class"},{"id":"ember-data-2.18.5-DS.SnapshotRecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.Snapshot","type":"class"},{"id":"ember-data-2.18.5-DS.Store","type":"class"},{"id":"ember-data-2.18.5-DS.JSONAPIAdapter","type":"class"},{"id":"ember-data-2.18.5-DS.RESTAdapter","type":"class"},{"id":"ember-data-2.18.5-DS.EmbeddedRecordsMixin","type":"class"},{"id":"ember-data-2.18.5-DS.JSONAPISerializer","type":"class"},{"id":"ember-data-2.18.5-DS.JSONSerializer","type":"class"},{"id":"ember-data-2.18.5-DS.RESTSerializer","type":"class"},{"id":"ember-data-2.18.5-DS.BooleanTransform","type":"class"},{"id":"ember-data-2.18.5-DS.DateTransform","type":"class"},{"id":"ember-data-2.18.5-DS.NumberTransform","type":"class"},{"id":"ember-data-2.18.5-DS.StringTransform","type":"class"},{"id":"ember-data-2.18.5-DS.Transform","type":"class"},{"id":"ember-data-2.18.5-DS.Adapter","type":"class"},{"id":"ember-data-2.18.5-DS.Serializer","type":"class"},{"id":"ember-data-2.18.5-Ember.Inflector","type":"class"}]},"namespaces":{"data":[{"id":"ember-data-2.18.5-DS","type":"namespace"},{"id":"ember-data-2.18.5-Ember.Date","type":"namespace"}]},"modules":{"data":[{"id":"ember-data-2.18.5-ember-data","type":"module"}]},"project":{"data":{"id":"ember-data","type":"project"}},"private-classes":{"data":[{"id":"ember-data-2.18.5-RelationshipPayloadsManager","type":"class"},{"id":"ember-data-2.18.5-RelationshipPayloads","type":"class"},{"id":"ember-data-2.18.5-IdentityMap","type":"class"},{"id":"ember-data-2.18.5-InternalModelMap","type":"class"},{"id":"ember-data-2.18.5-DS.RecordArrayManager","type":"class"},{"id":"ember-data-2.18.5-DS.SnapshotRecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.Snapshot","type":"class"}]},"public-classes":{"data":[{"id":"ember-data-2.18.5-DS.BuildURLMixin","type":"class"},{"id":"ember-data-2.18.5-DS.AdapterError","type":"class"},{"id":"ember-data-2.18.5-DS.InvalidError","type":"class"},{"id":"ember-data-2.18.5-DS.TimeoutError","type":"class"},{"id":"ember-data-2.18.5-DS.AbortError","type":"class"},{"id":"ember-data-2.18.5-DS.UnauthorizedError","type":"class"},{"id":"ember-data-2.18.5-DS.ForbiddenError","type":"class"},{"id":"ember-data-2.18.5-DS.NotFoundError","type":"class"},{"id":"ember-data-2.18.5-DS.ConflictError","type":"class"},{"id":"ember-data-2.18.5-DS.ServerError","type":"class"},{"id":"ember-data-2.18.5-DS.Errors","type":"class"},{"id":"ember-data-2.18.5-DS.Model","type":"class"},{"id":"ember-data-2.18.5-DS.RootState","type":"class"},{"id":"ember-data-2.18.5-DS.AdapterPopulatedRecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.FilteredRecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.RecordArray","type":"class"},{"id":"ember-data-2.18.5-DS.BelongsToReference","type":"class"},{"id":"ember-data-2.18.5-DS.HasManyReference","type":"class"},{"id":"ember-data-2.18.5-DS.RecordReference","type":"class"},{"id":"ember-data-2.18.5-DS.ManyArray","type":"class"},{"id":"ember-data-2.18.5-DS.PromiseArray","type":"class"},{"id":"ember-data-2.18.5-DS.PromiseObject","type":"class"},{"id":"ember-data-2.18.5-DS.PromiseManyArray","type":"class"},{"id":"ember-data-2.18.5-DS.Store","type":"class"},{"id":"ember-data-2.18.5-DS.JSONAPIAdapter","type":"class"},{"id":"ember-data-2.18.5-DS.RESTAdapter","type":"class"},{"id":"ember-data-2.18.5-DS.EmbeddedRecordsMixin","type":"class"},{"id":"ember-data-2.18.5-DS.JSONAPISerializer","type":"class"},{"id":"ember-data-2.18.5-DS.JSONSerializer","type":"class"},{"id":"ember-data-2.18.5-DS.RESTSerializer","type":"class"},{"id":"ember-data-2.18.5-DS.BooleanTransform","type":"class"},{"id":"ember-data-2.18.5-DS.DateTransform","type":"class"},{"id":"ember-data-2.18.5-DS.NumberTransform","type":"class"},{"id":"ember-data-2.18.5-DS.StringTransform","type":"class"},{"id":"ember-data-2.18.5-DS.Transform","type":"class"},{"id":"ember-data-2.18.5-DS.Adapter","type":"class"},{"id":"ember-data-2.18.5-DS.Serializer","type":"class"},{"id":"ember-data-2.18.5-Ember.Inflector","type":"class"}]},"private-namespaces":{"data":[{"id":"ember-data-2.18.5-Ember.Date","type":"namespace"}]},"public-namespaces":{"data":[{"id":"ember-data-2.18.5-DS","type":"namespace"}]},"private-modules":{"data":[]},"public-modules":{"data":[{"id":"ember-data-2.18.5-ember-data","type":"module"}]}}},"meta":{"class":{"ember-data-2.18.5-DS.BuildURLMixin":"ember-data-2.18.5-DS.BuildURLMixin","ember-data-2.18.5-DS.AdapterError":"ember-data-2.18.5-DS.AdapterError","ember-data-2.18.5-DS.InvalidError":"ember-data-2.18.5-DS.InvalidError","ember-data-2.18.5-DS.TimeoutError":"ember-data-2.18.5-DS.TimeoutError","ember-data-2.18.5-DS.AbortError":"ember-data-2.18.5-DS.AbortError","ember-data-2.18.5-DS.UnauthorizedError":"ember-data-2.18.5-DS.UnauthorizedError","ember-data-2.18.5-DS.ForbiddenError":"ember-data-2.18.5-DS.ForbiddenError","ember-data-2.18.5-DS.NotFoundError":"ember-data-2.18.5-DS.NotFoundError","ember-data-2.18.5-DS.ConflictError":"ember-data-2.18.5-DS.ConflictError","ember-data-2.18.5-DS.ServerError":"ember-data-2.18.5-DS.ServerError","ember-data-2.18.5-DS.Errors":"ember-data-2.18.5-DS.Errors","ember-data-2.18.5-DS.Model":"ember-data-2.18.5-DS.Model","ember-data-2.18.5-DS.RootState":"ember-data-2.18.5-DS.RootState","ember-data-2.18.5-DS.AdapterPopulatedRecordArray":"ember-data-2.18.5-DS.AdapterPopulatedRecordArray","ember-data-2.18.5-DS.FilteredRecordArray":"ember-data-2.18.5-DS.FilteredRecordArray","ember-data-2.18.5-DS.RecordArray":"ember-data-2.18.5-DS.RecordArray","ember-data-2.18.5-DS.BelongsToReference":"ember-data-2.18.5-DS.BelongsToReference","ember-data-2.18.5-DS.HasManyReference":"ember-data-2.18.5-DS.HasManyReference","ember-data-2.18.5-DS.RecordReference":"ember-data-2.18.5-DS.RecordReference","ember-data-2.18.5-RelationshipPayloadsManager":"ember-data-2.18.5-RelationshipPayloadsManager","ember-data-2.18.5-RelationshipPayloads":"ember-data-2.18.5-RelationshipPayloads","ember-data-2.18.5-IdentityMap":"ember-data-2.18.5-IdentityMap","ember-data-2.18.5-InternalModelMap":"ember-data-2.18.5-InternalModelMap","ember-data-2.18.5-DS.ManyArray":"ember-data-2.18.5-DS.ManyArray","ember-data-2.18.5-DS.PromiseArray":"ember-data-2.18.5-DS.PromiseArray","ember-data-2.18.5-DS.PromiseObject":"ember-data-2.18.5-DS.PromiseObject","ember-data-2.18.5-DS.PromiseManyArray":"ember-data-2.18.5-DS.PromiseManyArray","ember-data-2.18.5-DS.RecordArrayManager":"ember-data-2.18.5-DS.RecordArrayManager","ember-data-2.18.5-DS.SnapshotRecordArray":"ember-data-2.18.5-DS.SnapshotRecordArray","ember-data-2.18.5-DS.Snapshot":"ember-data-2.18.5-DS.Snapshot","ember-data-2.18.5-DS.Store":"ember-data-2.18.5-DS.Store","ember-data-2.18.5-DS.JSONAPIAdapter":"ember-data-2.18.5-DS.JSONAPIAdapter","ember-data-2.18.5-DS.RESTAdapter":"ember-data-2.18.5-DS.RESTAdapter","ember-data-2.18.5-DS.EmbeddedRecordsMixin":"ember-data-2.18.5-DS.EmbeddedRecordsMixin","ember-data-2.18.5-DS.JSONAPISerializer":"ember-data-2.18.5-DS.JSONAPISerializer","ember-data-2.18.5-DS.JSONSerializer":"ember-data-2.18.5-DS.JSONSerializer","ember-data-2.18.5-DS.RESTSerializer":"ember-data-2.18.5-DS.RESTSerializer","ember-data-2.18.5-DS.BooleanTransform":"ember-data-2.18.5-DS.BooleanTransform","ember-data-2.18.5-DS.DateTransform":"ember-data-2.18.5-DS.DateTransform","ember-data-2.18.5-DS.NumberTransform":"ember-data-2.18.5-DS.NumberTransform","ember-data-2.18.5-DS.StringTransform":"ember-data-2.18.5-DS.StringTransform","ember-data-2.18.5-DS.Transform":"ember-data-2.18.5-DS.Transform","ember-data-2.18.5-DS.Adapter":"ember-data-2.18.5-DS.Adapter","ember-data-2.18.5-DS.Serializer":"ember-data-2.18.5-DS.Serializer","ember-data-2.18.5-Ember.Inflector":"ember-data-2.18.5-Ember.Inflector","ember-data-2.18.5-DS.Ember.HTMLBars.helpers":"ember-data-2.18.5-DS.Ember.HTMLBars.helpers","ember-data-2.18.5-DS.String":"ember-data-2.18.5-DS.String","ember-data-2.18.5-Ember.HTMLBars.helpers":"ember-data-2.18.5-Ember.HTMLBars.helpers"},"namespace":{"ember-data-2.18.5-DS":"ember-data-2.18.5-DS","ember-data-2.18.5-Ember.Date":"ember-data-2.18.5-Ember.Date"},"module":{"ember-data-2.18.5-ember-data":"ember-data-2.18.5-ember-data"},"missing":{"DS.Reference":"DS.Reference","Ember.ArrayProxy":"Ember.ArrayProxy","Ember.Object":"Ember.Object","Ember.ObjectProxy":"Ember.ObjectProxy","Ember.Service":"Ember.Service"}}} diff --git a/rev-index/ember-data.json b/rev-index/ember-data.json index 3d14edce7..5d872e142 100644 --- a/rev-index/ember-data.json +++ b/rev-index/ember-data.json @@ -1,313 +1 @@ -{ - "data": { - "id": "ember-data", - "type": "project", - "attributes": { "github-url": "https://github.com/emberjs/ember.js" }, - "relationships": { - "project-versions": { - "data": [ - { "id": "ember-data-2.18.5", "type": "project-version" }, - { "id": "ember-data-5.3.0", "type": "project-version" }, - { "id": "ember-data-5.2.0", "type": "project-version" }, - { "id": "ember-data-5.1.2", "type": "project-version" }, - { "id": "ember-data-1.13.13", "type": "project-version" }, - { "id": "ember-data-1.13.14", "type": "project-version" }, - { "id": "ember-data-1.13.15", "type": "project-version" }, - { "id": "ember-data-1.13.16", "type": "project-version" }, - { "id": "ember-data-2.0.1", "type": "project-version" }, - { "id": "ember-data-2.1.0", "type": "project-version" }, - { "id": "ember-data-2.2.1", "type": "project-version" }, - { "id": "ember-data-2.3.3", "type": "project-version" }, - { "id": "ember-data-2.4.3", "type": "project-version" }, - { "id": "ember-data-2.5.5", "type": "project-version" }, - { "id": "ember-data-2.6.2", "type": "project-version" }, - { "id": "ember-data-2.7.0", "type": "project-version" }, - { "id": "ember-data-2.8.1", "type": "project-version" }, - { "id": "ember-data-2.9.0", "type": "project-version" }, - { "id": "ember-data-2.10.0", "type": "project-version" }, - { "id": "ember-data-2.11.3", "type": "project-version" }, - { "id": "ember-data-2.12.2", "type": "project-version" }, - { "id": "ember-data-2.13.2", "type": "project-version" }, - { "id": "ember-data-2.14.10", "type": "project-version" }, - { "id": "ember-data-2.15.4", "type": "project-version" }, - { "id": "ember-data-2.16.0", "type": "project-version" }, - { "id": "ember-data-2.17.0", "type": "project-version" }, - { "id": "ember-data-2.18.0", "type": "project-version" }, - { "id": "ember-data-3.0.3", "type": "project-version" }, - { "id": "ember-data-3.1.1", "type": "project-version" }, - { "id": "ember-data-3.2.2", "type": "project-version" }, - { "id": "ember-data-3.3.2", "type": "project-version" }, - { "id": "ember-data-3.4.4", "type": "project-version" }, - { "id": "ember-data-3.5.2", "type": "project-version" }, - { "id": "ember-data-3.6.0", "type": "project-version" }, - { "id": "ember-data-3.7.0", "type": "project-version" }, - { "id": "ember-data-3.8.1", "type": "project-version" }, - { "id": "ember-data-3.9.3", "type": "project-version" }, - { "id": "ember-data-3.10.0", "type": "project-version" }, - { "id": "ember-data-3.11.5", "type": "project-version" }, - { "id": "ember-data-3.12.6", "type": "project-version" }, - { "id": "ember-data-3.13.3", "type": "project-version" }, - { "id": "ember-data-3.14.1", "type": "project-version" }, - { "id": "ember-data-3.15.1", "type": "project-version" }, - { "id": "ember-data-3.16.9", "type": "project-version" }, - { "id": "ember-data-3.17.1", "type": "project-version" }, - { "id": "ember-data-3.18.0", "type": "project-version" }, - { "id": "ember-data-3.19.0", "type": "project-version" }, - { "id": "ember-data-3.20.5", "type": "project-version" }, - { "id": "ember-data-3.21.2", "type": "project-version" }, - { "id": "ember-data-3.22.1", "type": "project-version" }, - { "id": "ember-data-3.23.0", "type": "project-version" }, - { "id": "ember-data-3.24.2", "type": "project-version" }, - { "id": "ember-data-3.25.0", "type": "project-version" }, - { "id": "ember-data-3.26.0", "type": "project-version" }, - { "id": "ember-data-3.27.1", "type": "project-version" }, - { "id": "ember-data-3.28.13", "type": "project-version" }, - { "id": "ember-data-4.0.2", "type": "project-version" }, - { "id": "ember-data-4.1.0", "type": "project-version" }, - { "id": "ember-data-4.2.0", "type": "project-version" }, - { "id": "ember-data-4.3.0", "type": "project-version" }, - { "id": "ember-data-4.4.2", "type": "project-version" }, - { "id": "ember-data-4.5.0", "type": "project-version" }, - { "id": "ember-data-4.6.4", "type": "project-version" }, - { "id": "ember-data-4.7.3", "type": "project-version" }, - { "id": "ember-data-4.8.8", "type": "project-version" }, - { "id": "ember-data-4.9.1", "type": "project-version" }, - { "id": "ember-data-4.10.0", "type": "project-version" }, - { "id": "ember-data-4.11.3", "type": "project-version" }, - { "id": "ember-data-4.12.3", "type": "project-version" }, - { "id": "ember-data-5.0.1", "type": "project-version" }, - { "id": "ember-data-2.0.0", "type": "project-version" }, - { "id": "ember-data-2.3.2", "type": "project-version" }, - { "id": "ember-data-2.4.1", "type": "project-version" }, - { "id": "ember-data-2.5.4", "type": "project-version" }, - { "id": "ember-data-2.6.1", "type": "project-version" }, - { "id": "ember-data-2.8.0", "type": "project-version" }, - { "id": "ember-data-2.11.2", "type": "project-version" }, - { "id": "ember-data-2.12.1", "type": "project-version" }, - { "id": "ember-data-2.13.1", "type": "project-version" }, - { "id": "ember-data-2.14.9", "type": "project-version" }, - { "id": "ember-data-2.15.3", "type": "project-version" }, - { "id": "ember-data-3.0.0", "type": "project-version" }, - { "id": "ember-data-3.1.0", "type": "project-version" }, - { "id": "ember-data-3.2.0", "type": "project-version" }, - { "id": "ember-data-3.3.1", "type": "project-version" }, - { "id": "ember-data-3.4.3", "type": "project-version" }, - { "id": "ember-data-3.5.1", "type": "project-version" }, - { "id": "ember-data-3.8.0", "type": "project-version" }, - { "id": "ember-data-3.9.2", "type": "project-version" }, - { "id": "ember-data-3.11.4", "type": "project-version" }, - { "id": "ember-data-3.12.5", "type": "project-version" }, - { "id": "ember-data-3.13.2", "type": "project-version" }, - { "id": "ember-data-3.14.0", "type": "project-version" }, - { "id": "ember-data-3.15.0", "type": "project-version" }, - { "id": "ember-data-3.16.8", "type": "project-version" }, - { "id": "ember-data-3.17.0", "type": "project-version" }, - { "id": "ember-data-3.20.4", "type": "project-version" }, - { "id": "ember-data-3.21.1", "type": "project-version" }, - { "id": "ember-data-3.22.0", "type": "project-version" }, - { "id": "ember-data-3.24.1", "type": "project-version" }, - { "id": "ember-data-3.27.0", "type": "project-version" }, - { "id": "ember-data-3.28.12", "type": "project-version" }, - { "id": "ember-data-4.0.1", "type": "project-version" }, - { "id": "ember-data-4.6.3", "type": "project-version" }, - { "id": "ember-data-4.7.2", "type": "project-version" }, - { "id": "ember-data-4.8.7", "type": "project-version" }, - { "id": "ember-data-4.9.0", "type": "project-version" }, - { "id": "ember-data-4.11.2", "type": "project-version" }, - { "id": "ember-data-2.3.0", "type": "project-version" }, - { "id": "ember-data-2.4.0", "type": "project-version" }, - { "id": "ember-data-2.5.3", "type": "project-version" }, - { "id": "ember-data-2.6.0", "type": "project-version" }, - { "id": "ember-data-2.11.1", "type": "project-version" }, - { "id": "ember-data-2.13.0", "type": "project-version" }, - { "id": "ember-data-2.14.8", "type": "project-version" }, - { "id": "ember-data-2.15.2", "type": "project-version" }, - { "id": "ember-data-3.3.0", "type": "project-version" }, - { "id": "ember-data-3.4.2", "type": "project-version" }, - { "id": "ember-data-3.5.0", "type": "project-version" }, - { "id": "ember-data-3.9.1", "type": "project-version" }, - { "id": "ember-data-3.11.3", "type": "project-version" }, - { "id": "ember-data-3.12.4", "type": "project-version" }, - { "id": "ember-data-3.13.1", "type": "project-version" }, - { "id": "ember-data-3.16.7", "type": "project-version" }, - { "id": "ember-data-3.20.3", "type": "project-version" }, - { "id": "ember-data-3.21.0", "type": "project-version" }, - { "id": "ember-data-3.24.0", "type": "project-version" }, - { "id": "ember-data-3.28.11", "type": "project-version" }, - { "id": "ember-data-4.0.0", "type": "project-version" }, - { "id": "ember-data-4.6.2", "type": "project-version" }, - { "id": "ember-data-4.7.1", "type": "project-version" }, - { "id": "ember-data-4.8.6", "type": "project-version" }, - { "id": "ember-data-4.11.1", "type": "project-version" }, - { "id": "ember-data-2.5.2", "type": "project-version" }, - { "id": "ember-data-2.11.0", "type": "project-version" }, - { "id": "ember-data-2.14.7", "type": "project-version" }, - { "id": "ember-data-2.15.1", "type": "project-version" }, - { "id": "ember-data-3.4.1", "type": "project-version" }, - { "id": "ember-data-3.11.2", "type": "project-version" }, - { "id": "ember-data-3.12.3", "type": "project-version" }, - { "id": "ember-data-3.13.0", "type": "project-version" }, - { "id": "ember-data-3.16.6", "type": "project-version" }, - { "id": "ember-data-3.20.2", "type": "project-version" }, - { "id": "ember-data-3.28.10", "type": "project-version" }, - { "id": "ember-data-4.6.1", "type": "project-version" }, - { "id": "ember-data-4.7.0", "type": "project-version" }, - { "id": "ember-data-4.8.4", "type": "project-version" }, - { "id": "ember-data-4.11.0", "type": "project-version" } - ] - } - } - }, - "meta": { - "availableVersions": [ - "2.18.5", - "5.3.0", - "5.2.0", - "5.1.2", - "1.13.13", - "1.13.14", - "1.13.15", - "1.13.16", - "2.0.1", - "2.1.0", - "2.2.1", - "2.3.3", - "2.4.3", - "2.5.5", - "2.6.2", - "2.7.0", - "2.8.1", - "2.9.0", - "2.10.0", - "2.11.3", - "2.12.2", - "2.13.2", - "2.14.10", - "2.15.4", - "2.16.0", - "2.17.0", - "2.18.0", - "3.0.3", - "3.1.1", - "3.2.2", - "3.3.2", - "3.4.4", - "3.5.2", - "3.6.0", - "3.7.0", - "3.8.1", - "3.9.3", - "3.10.0", - "3.11.5", - "3.12.6", - "3.13.3", - "3.14.1", - "3.15.1", - "3.16.9", - "3.17.1", - "3.18.0", - "3.19.0", - "3.20.5", - "3.21.2", - "3.22.1", - "3.23.0", - "3.24.2", - "3.25.0", - "3.26.0", - "3.27.1", - "3.28.13", - "4.0.2", - "4.1.0", - "4.2.0", - "4.3.0", - "4.4.2", - "4.5.0", - "4.6.4", - "4.7.3", - "4.8.8", - "4.9.1", - "4.10.0", - "4.11.3", - "4.12.3", - "5.0.1", - "2.0.0", - "2.3.2", - "2.4.1", - "2.5.4", - "2.6.1", - "2.8.0", - "2.11.2", - "2.12.1", - "2.13.1", - "2.14.9", - "2.15.3", - "3.0.0", - "3.1.0", - "3.2.0", - "3.3.1", - "3.4.3", - "3.5.1", - "3.8.0", - "3.9.2", - "3.11.4", - "3.12.5", - "3.13.2", - "3.14.0", - "3.15.0", - "3.16.8", - "3.17.0", - "3.20.4", - "3.21.1", - "3.22.0", - "3.24.1", - "3.27.0", - "3.28.12", - "4.0.1", - "4.6.3", - "4.7.2", - "4.8.7", - "4.9.0", - "4.11.2", - "2.3.0", - "2.4.0", - "2.5.3", - "2.6.0", - "2.11.1", - "2.13.0", - "2.14.8", - "2.15.2", - "3.3.0", - "3.4.2", - "3.5.0", - "3.9.1", - "3.11.3", - "3.12.4", - "3.13.1", - "3.16.7", - "3.20.3", - "3.21.0", - "3.24.0", - "3.28.11", - "4.0.0", - "4.6.2", - "4.7.1", - "4.8.6", - "4.11.1", - "2.5.2", - "2.11.0", - "2.14.7", - "2.15.1", - "3.4.1", - "3.11.2", - "3.12.3", - "3.13.0", - "3.16.6", - "3.20.2", - "3.28.10", - "4.6.1", - "4.7.0", - "4.8.4", - "4.11.0" - ] - } -} +{"data":{"id":"ember-data","type":"project","attributes":{"github-url":"https://github.com/emberjs/ember.js"},"relationships":{"project-versions":{"data":[{"id":"ember-data-2.18.5","type":"project-version"},{"id":"ember-data-5.3.0","type":"project-version"},{"id":"ember-data-5.2.0","type":"project-version"},{"id":"ember-data-5.1.2","type":"project-version"},{"id":"ember-data-1.13.13","type":"project-version"},{"id":"ember-data-1.13.14","type":"project-version"},{"id":"ember-data-1.13.15","type":"project-version"},{"id":"ember-data-1.13.16","type":"project-version"},{"id":"ember-data-2.0.1","type":"project-version"},{"id":"ember-data-2.1.0","type":"project-version"},{"id":"ember-data-2.2.1","type":"project-version"},{"id":"ember-data-2.3.3","type":"project-version"},{"id":"ember-data-2.4.3","type":"project-version"},{"id":"ember-data-2.5.5","type":"project-version"},{"id":"ember-data-2.6.2","type":"project-version"},{"id":"ember-data-2.7.0","type":"project-version"},{"id":"ember-data-2.8.1","type":"project-version"},{"id":"ember-data-2.9.0","type":"project-version"},{"id":"ember-data-2.10.0","type":"project-version"},{"id":"ember-data-2.11.3","type":"project-version"},{"id":"ember-data-2.12.2","type":"project-version"},{"id":"ember-data-2.13.2","type":"project-version"},{"id":"ember-data-2.14.10","type":"project-version"},{"id":"ember-data-2.15.4","type":"project-version"},{"id":"ember-data-2.16.0","type":"project-version"},{"id":"ember-data-2.17.0","type":"project-version"},{"id":"ember-data-2.18.5","type":"project-version"},{"id":"ember-data-3.0.3","type":"project-version"},{"id":"ember-data-3.1.1","type":"project-version"},{"id":"ember-data-3.2.2","type":"project-version"},{"id":"ember-data-3.3.2","type":"project-version"},{"id":"ember-data-3.4.4","type":"project-version"},{"id":"ember-data-3.5.2","type":"project-version"},{"id":"ember-data-3.6.0","type":"project-version"},{"id":"ember-data-3.7.0","type":"project-version"},{"id":"ember-data-3.8.1","type":"project-version"},{"id":"ember-data-3.9.3","type":"project-version"},{"id":"ember-data-3.10.0","type":"project-version"},{"id":"ember-data-3.11.5","type":"project-version"},{"id":"ember-data-3.12.6","type":"project-version"},{"id":"ember-data-3.13.3","type":"project-version"},{"id":"ember-data-3.14.1","type":"project-version"},{"id":"ember-data-3.15.1","type":"project-version"},{"id":"ember-data-3.16.9","type":"project-version"},{"id":"ember-data-3.17.1","type":"project-version"},{"id":"ember-data-3.18.0","type":"project-version"},{"id":"ember-data-3.19.0","type":"project-version"},{"id":"ember-data-3.20.5","type":"project-version"},{"id":"ember-data-3.21.2","type":"project-version"},{"id":"ember-data-3.22.1","type":"project-version"},{"id":"ember-data-3.23.0","type":"project-version"},{"id":"ember-data-3.24.2","type":"project-version"},{"id":"ember-data-3.25.0","type":"project-version"},{"id":"ember-data-3.26.0","type":"project-version"},{"id":"ember-data-3.27.1","type":"project-version"},{"id":"ember-data-3.28.13","type":"project-version"},{"id":"ember-data-4.0.2","type":"project-version"},{"id":"ember-data-4.1.0","type":"project-version"},{"id":"ember-data-4.2.0","type":"project-version"},{"id":"ember-data-4.3.0","type":"project-version"},{"id":"ember-data-4.4.2","type":"project-version"},{"id":"ember-data-4.5.0","type":"project-version"},{"id":"ember-data-4.6.4","type":"project-version"},{"id":"ember-data-4.7.3","type":"project-version"},{"id":"ember-data-4.8.8","type":"project-version"},{"id":"ember-data-4.9.1","type":"project-version"},{"id":"ember-data-4.10.0","type":"project-version"},{"id":"ember-data-4.11.3","type":"project-version"},{"id":"ember-data-4.12.3","type":"project-version"},{"id":"ember-data-5.0.1","type":"project-version"},{"id":"ember-data-2.0.0","type":"project-version"},{"id":"ember-data-2.3.2","type":"project-version"},{"id":"ember-data-2.4.1","type":"project-version"},{"id":"ember-data-2.5.4","type":"project-version"},{"id":"ember-data-2.6.1","type":"project-version"},{"id":"ember-data-2.8.0","type":"project-version"},{"id":"ember-data-2.11.2","type":"project-version"},{"id":"ember-data-2.12.1","type":"project-version"},{"id":"ember-data-2.13.1","type":"project-version"},{"id":"ember-data-2.14.9","type":"project-version"},{"id":"ember-data-2.15.3","type":"project-version"},{"id":"ember-data-3.0.0","type":"project-version"},{"id":"ember-data-3.1.0","type":"project-version"},{"id":"ember-data-3.2.0","type":"project-version"},{"id":"ember-data-3.3.1","type":"project-version"},{"id":"ember-data-3.4.3","type":"project-version"},{"id":"ember-data-3.5.1","type":"project-version"},{"id":"ember-data-3.8.0","type":"project-version"},{"id":"ember-data-3.9.2","type":"project-version"},{"id":"ember-data-3.11.4","type":"project-version"},{"id":"ember-data-3.12.5","type":"project-version"},{"id":"ember-data-3.13.2","type":"project-version"},{"id":"ember-data-3.14.0","type":"project-version"},{"id":"ember-data-3.15.0","type":"project-version"},{"id":"ember-data-3.16.8","type":"project-version"},{"id":"ember-data-3.17.0","type":"project-version"},{"id":"ember-data-3.20.4","type":"project-version"},{"id":"ember-data-3.21.1","type":"project-version"},{"id":"ember-data-3.22.0","type":"project-version"},{"id":"ember-data-3.24.1","type":"project-version"},{"id":"ember-data-3.27.0","type":"project-version"},{"id":"ember-data-3.28.12","type":"project-version"},{"id":"ember-data-4.0.1","type":"project-version"},{"id":"ember-data-4.6.3","type":"project-version"},{"id":"ember-data-4.7.2","type":"project-version"},{"id":"ember-data-4.8.7","type":"project-version"},{"id":"ember-data-4.9.0","type":"project-version"},{"id":"ember-data-4.11.2","type":"project-version"},{"id":"ember-data-2.3.0","type":"project-version"},{"id":"ember-data-2.4.0","type":"project-version"},{"id":"ember-data-2.5.3","type":"project-version"},{"id":"ember-data-2.6.0","type":"project-version"},{"id":"ember-data-2.11.1","type":"project-version"},{"id":"ember-data-2.13.0","type":"project-version"},{"id":"ember-data-2.14.8","type":"project-version"},{"id":"ember-data-2.15.2","type":"project-version"},{"id":"ember-data-3.3.0","type":"project-version"},{"id":"ember-data-3.4.2","type":"project-version"},{"id":"ember-data-3.5.0","type":"project-version"},{"id":"ember-data-3.9.1","type":"project-version"},{"id":"ember-data-3.11.3","type":"project-version"},{"id":"ember-data-3.12.4","type":"project-version"},{"id":"ember-data-3.13.1","type":"project-version"},{"id":"ember-data-3.16.7","type":"project-version"},{"id":"ember-data-3.20.3","type":"project-version"},{"id":"ember-data-3.21.0","type":"project-version"},{"id":"ember-data-3.24.0","type":"project-version"},{"id":"ember-data-3.28.11","type":"project-version"},{"id":"ember-data-4.0.0","type":"project-version"},{"id":"ember-data-4.6.2","type":"project-version"},{"id":"ember-data-4.7.1","type":"project-version"},{"id":"ember-data-4.8.6","type":"project-version"},{"id":"ember-data-4.11.1","type":"project-version"},{"id":"ember-data-2.5.2","type":"project-version"},{"id":"ember-data-2.11.0","type":"project-version"},{"id":"ember-data-2.14.7","type":"project-version"},{"id":"ember-data-2.15.1","type":"project-version"},{"id":"ember-data-3.4.1","type":"project-version"},{"id":"ember-data-3.11.2","type":"project-version"},{"id":"ember-data-3.12.3","type":"project-version"},{"id":"ember-data-3.13.0","type":"project-version"},{"id":"ember-data-3.16.6","type":"project-version"},{"id":"ember-data-3.20.2","type":"project-version"},{"id":"ember-data-3.28.10","type":"project-version"},{"id":"ember-data-4.6.1","type":"project-version"},{"id":"ember-data-4.7.0","type":"project-version"},{"id":"ember-data-4.8.4","type":"project-version"},{"id":"ember-data-4.11.0","type":"project-version"}]}}},"meta":{"availableVersions":["2.18.5","5.3.0","5.2.0","5.1.2","1.13.13","1.13.14","1.13.15","1.13.16","2.0.1","2.1.0","2.2.1","2.3.3","2.4.3","2.5.5","2.6.2","2.7.0","2.8.1","2.9.0","2.10.0","2.11.3","2.12.2","2.13.2","2.14.10","2.15.4","2.16.0","2.17.0","2.18.5","3.0.3","3.1.1","3.2.2","3.3.2","3.4.4","3.5.2","3.6.0","3.7.0","3.8.1","3.9.3","3.10.0","3.11.5","3.12.6","3.13.3","3.14.1","3.15.1","3.16.9","3.17.1","3.18.0","3.19.0","3.20.5","3.21.2","3.22.1","3.23.0","3.24.2","3.25.0","3.26.0","3.27.1","3.28.13","4.0.2","4.1.0","4.2.0","4.3.0","4.4.2","4.5.0","4.6.4","4.7.3","4.8.8","4.9.1","4.10.0","4.11.3","4.12.3","5.0.1","2.0.0","2.3.2","2.4.1","2.5.4","2.6.1","2.8.0","2.11.2","2.12.1","2.13.1","2.14.9","2.15.3","3.0.0","3.1.0","3.2.0","3.3.1","3.4.3","3.5.1","3.8.0","3.9.2","3.11.4","3.12.5","3.13.2","3.14.0","3.15.0","3.16.8","3.17.0","3.20.4","3.21.1","3.22.0","3.24.1","3.27.0","3.28.12","4.0.1","4.6.3","4.7.2","4.8.7","4.9.0","4.11.2","2.3.0","2.4.0","2.5.3","2.6.0","2.11.1","2.13.0","2.14.8","2.15.2","3.3.0","3.4.2","3.5.0","3.9.1","3.11.3","3.12.4","3.13.1","3.16.7","3.20.3","3.21.0","3.24.0","3.28.11","4.0.0","4.6.2","4.7.1","4.8.6","4.11.1","2.5.2","2.11.0","2.14.7","2.15.1","3.4.1","3.11.2","3.12.3","3.13.0","3.16.6","3.20.2","3.28.10","4.6.1","4.7.0","4.8.4","4.11.0"]}} diff --git a/s3-docs/v2.18.5/ember-data-docs.json b/s3-docs/v2.18.5/ember-data-docs.json index 3be4d52e2..3a0eb8661 100644 --- a/s3-docs/v2.18.5/ember-data-docs.json +++ b/s3-docs/v2.18.5/ember-data-docs.json @@ -1,13866 +1,9444 @@ { - "project": { - "name": "EmberData Documentation", - "description": "Documentation for EmberData: a lightweight reactive data library for JavaScript applications.", - "url": "https://github.com/emberjs/data", - "version": "5.2.0+92f5f666" - }, - "files": { - "../../ember-data-types/cache/cache.ts": { - "name": "../../ember-data-types/cache/cache.ts", - "modules": {}, - "classes": { - " Cache": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/cache-store-wrapper.ts": { - "name": "../../ember-data-types/q/cache-store-wrapper.ts", - "modules": {}, - "classes": { - "CacheStoreWrapper": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/cache.ts": { - "name": "../../ember-data-types/q/cache.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/ember-data-json-api.ts": { - "name": "../../ember-data-types/q/ember-data-json-api.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/identifier.ts": { - "name": "../../ember-data-types/q/identifier.ts", - "modules": {}, - "classes": { - "StableRecordIdentifier": 1 - }, - "fors": { - "@ember-data/store": 1 - }, - "namespaces": {} - }, - "../../ember-data-types/q/minimum-adapter-interface.ts": { - "name": "../../ember-data-types/q/minimum-adapter-interface.ts", - "modules": {}, - "classes": { - " Adapter": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/minimum-serializer-interface.ts": { - "name": "../../ember-data-types/q/minimum-serializer-interface.ts", - "modules": {}, - "classes": { - " Serializer": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/record-data-json-api.ts": { - "name": "../../ember-data-types/q/record-data-json-api.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/record-data-schemas.ts": { - "name": "../../ember-data-types/q/record-data-schemas.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/record-instance.ts": { - "name": "../../ember-data-types/q/record-instance.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/q/schema-service.ts": { - "name": "../../ember-data-types/q/schema-service.ts", - "modules": {}, - "classes": { - "SchemaService": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../../ember-data-types/overview.ts": { - "name": "../../ember-data-types/overview.ts", - "modules": { - "@ember-data/experimental-preview-types": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../-ember-data/addon/index.js": { - "name": "../-ember-data/addon/index.js", - "modules": { - "ember-data-overview": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../adapter/src/-private/build-url-mixin.ts": { - "name": "../adapter/src/-private/build-url-mixin.ts", - "modules": {}, - "classes": { - "BuildURLMixin": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../adapter/src/-private.ts": { - "name": "../adapter/src/-private.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../adapter/src/error.js": { - "name": "../adapter/src/error.js", - "modules": { - "@ember-data/adapter/error": 1 - }, - "classes": { - "AdapterError": 1, - "InvalidError": 1, - "TimeoutError": 1, - "AbortError": 1, - "UnauthorizedError": 1, - "ForbiddenError": 1, - "NotFoundError": 1, - "ConflictError": 1, - "ServerError": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../adapter/src/index.ts": { - "name": "../adapter/src/index.ts", - "modules": { - "@ember-data/adapter": 1 - }, - "classes": { - "Adapter": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../adapter/src/json-api.ts": { - "name": "../adapter/src/json-api.ts", - "modules": { - "@ember-data/adapter/json-api": 1 - }, - "classes": { - "JSONAPIAdapter": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../adapter/src/rest.ts": { - "name": "../adapter/src/rest.ts", - "modules": { - "@ember-data/adapter/rest": 1 - }, - "classes": { - "RESTAdapter": 1 - }, - "fors": { - "@ember-data/adapter/rest": 1 - }, - "namespaces": {} - }, - "../debug/addon/index.js": { - "name": "../debug/addon/index.js", - "modules": { - "@ember-data/debug": 1 - }, - "classes": { - "InspectorDataAdapter": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../graph/src/-private/graph/-edge-definition.ts": { - "name": "../graph/src/-private/graph/-edge-definition.ts", - "modules": {}, - "classes": { - "UpgradedMeta": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../graph/src/-private.ts": { - "name": "../graph/src/-private.ts", - "modules": { - "@ember-data/graph": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../json-api/src/-private/cache.ts": { - "name": "../json-api/src/-private/cache.ts", - "modules": {}, - "classes": { - "Cache": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../json-api/src/index.ts": { - "name": "../json-api/src/index.ts", - "modules": { - "@ember-data/json-api": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../legacy-compat/src/legacy-network-handler/fetch-manager.ts": { - "name": "../legacy-compat/src/legacy-network-handler/fetch-manager.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../legacy-compat/src/legacy-network-handler/serializer-response.ts": { - "name": "../legacy-compat/src/legacy-network-handler/serializer-response.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts": { - "name": "../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "modules": {}, - "classes": { - "SnapshotRecordArray": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../legacy-compat/src/legacy-network-handler/snapshot.ts": { - "name": "../legacy-compat/src/legacy-network-handler/snapshot.ts", - "modules": {}, - "classes": { - "Snapshot": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../legacy-compat/src/index.ts": { - "name": "../legacy-compat/src/index.ts", - "modules": { - "@ember-data/legacy-compat": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/references/belongs-to.ts": { - "name": "../model/src/-private/references/belongs-to.ts", - "modules": {}, - "classes": { - "BelongsToReference": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/references/has-many.ts": { - "name": "../model/src/-private/references/has-many.ts", - "modules": {}, - "classes": { - "HasManyReference": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/attr.js": { - "name": "../model/src/-private/attr.js", - "modules": {}, - "classes": {}, - "fors": { - "@ember-data/model": 1 - }, - "namespaces": {} - }, - "../model/src/-private/belongs-to.js": { - "name": "../model/src/-private/belongs-to.js", - "modules": {}, - "classes": {}, - "fors": { - "@ember-data/model": 1 - }, - "namespaces": {} - }, - "../model/src/-private/errors.ts": { - "name": "../model/src/-private/errors.ts", - "modules": {}, - "classes": { - "Errors": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/has-many.js": { - "name": "../model/src/-private/has-many.js", - "modules": {}, - "classes": {}, - "fors": { - "@ember-data/model": 1 - }, - "namespaces": {} - }, - "../model/src/-private/many-array.ts": { - "name": "../model/src/-private/many-array.ts", - "modules": {}, - "classes": { - "ManyArray": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/model.js": { - "name": "../model/src/-private/model.js", - "modules": {}, - "classes": { - "Model": 1 - }, - "fors": { - "Model": 1 - }, - "namespaces": {} - }, - "../model/src/-private/promise-belongs-to.ts": { - "name": "../model/src/-private/promise-belongs-to.ts", - "modules": {}, - "classes": { - "PromiseBelongsTo": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/promise-many-array.ts": { - "name": "../model/src/-private/promise-many-array.ts", - "modules": {}, - "classes": { - "PromiseManyArray": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../model/src/-private/record-state.ts": { - "name": "../model/src/-private/record-state.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../model/src/index.ts": { - "name": "../model/src/index.ts", - "modules": { - "@ember-data/model": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../private-build-infra/virtual-packages/canary-features.js": { - "name": "../private-build-infra/virtual-packages/canary-features.js", - "modules": { - "@ember-data/canary-features": 1 - }, - "classes": { - "CanaryFeatureFlags": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../private-build-infra/virtual-packages/debugging.js": { - "name": "../private-build-infra/virtual-packages/debugging.js", - "modules": {}, - "classes": { - "DebugLogging": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../private-build-infra/virtual-packages/deprecations.js": { - "name": "../private-build-infra/virtual-packages/deprecations.js", - "modules": { - "@ember-data/deprecations": 1 - }, - "classes": { - "CurrentDeprecations": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../request/src/-private/manager.ts": { - "name": "../request/src/-private/manager.ts", - "modules": { - "@ember-data/request": 1 - }, - "classes": { - "RequestManager": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../request/src/-private/types.ts": { - "name": "../request/src/-private/types.ts", - "modules": {}, - "classes": { - "Future": 1, - " Handler": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../request/src/fetch.ts": { - "name": "../request/src/fetch.ts", - "modules": { - "@ember-data/request/fetch": 1 - }, - "classes": { - "Fetch": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private/transforms/boolean.js": { - "name": "../serializer/src/-private/transforms/boolean.js", - "modules": {}, - "classes": { - "BooleanTransform": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private/transforms/date.js": { - "name": "../serializer/src/-private/transforms/date.js", - "modules": {}, - "classes": { - "DateTransform": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private/transforms/number.js": { - "name": "../serializer/src/-private/transforms/number.js", - "modules": {}, - "classes": { - "NumberTransform": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private/transforms/string.js": { - "name": "../serializer/src/-private/transforms/string.js", - "modules": {}, - "classes": { - "StringTransform": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private/transforms/transform.js": { - "name": "../serializer/src/-private/transforms/transform.js", - "modules": {}, - "classes": { - "Transform": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private/embedded-records-mixin.js": { - "name": "../serializer/src/-private/embedded-records-mixin.js", - "modules": {}, - "classes": { - "EmbeddedRecordsMixin": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/-private.ts": { - "name": "../serializer/src/-private.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/index.ts": { - "name": "../serializer/src/index.ts", - "modules": { - "@ember-data/serializer": 1 - }, - "classes": { - "Serializer": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/json-api.js": { - "name": "../serializer/src/json-api.js", - "modules": { - "@ember-data/serializer/json-api": 1 - }, - "classes": { - "JSONAPISerializer": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/json.js": { - "name": "../serializer/src/json.js", - "modules": { - "@ember-data/serializer/json": 1 - }, - "classes": { - "JSONSerializer": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/rest.js": { - "name": "../serializer/src/rest.js", - "modules": { - "@ember-data/serializer/rest": 1 - }, - "classes": { - "RESTSerializer": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../serializer/src/transform.js": { - "name": "../serializer/src/transform.js", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/caches/identifier-cache.ts": { - "name": "../store/src/-private/caches/identifier-cache.ts", - "modules": {}, - "classes": { - "IdentifierCache": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/caches/instance-cache.ts": { - "name": "../store/src/-private/caches/instance-cache.ts", - "modules": {}, - "classes": {}, - "fors": { - "@ember-data/store": 1 - }, - "namespaces": {} - }, - "../store/src/-private/legacy-model-support/record-reference.ts": { - "name": "../store/src/-private/legacy-model-support/record-reference.ts", - "modules": {}, - "classes": { - "RecordReference": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/managers/cache-manager.ts": { - "name": "../store/src/-private/managers/cache-manager.ts", - "modules": {}, - "classes": { - "CacheManager": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/managers/cache-store-wrapper.ts": { - "name": "../store/src/-private/managers/cache-store-wrapper.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/managers/notification-manager.ts": { - "name": "../store/src/-private/managers/notification-manager.ts", - "modules": {}, - "classes": { - "NotificationManager": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/managers/record-array-manager.ts": { - "name": "../store/src/-private/managers/record-array-manager.ts", - "modules": {}, - "classes": { - "RecordArrayManager": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/network/request-cache.ts": { - "name": "../store/src/-private/network/request-cache.ts", - "modules": {}, - "classes": { - "RequestStateService": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/record-arrays/identifier-array.ts": { - "name": "../store/src/-private/record-arrays/identifier-array.ts", - "modules": {}, - "classes": { - "RecordArray": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/utils/coerce-id.ts": { - "name": "../store/src/-private/utils/coerce-id.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/utils/uuid-polyfill.ts": { - "name": "../store/src/-private/utils/uuid-polyfill.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/index.ts": { - "name": "../store/src/-private/index.ts", - "modules": {}, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../store/src/-private/store-service.ts": { - "name": "../store/src/-private/store-service.ts", - "modules": {}, - "classes": { - "Store": 1 - }, - "fors": {}, - "namespaces": {} - }, - "../store/src/index.ts": { - "name": "../store/src/index.ts", - "modules": { - "@ember-data/store": 1 - }, - "classes": {}, - "fors": {}, - "namespaces": {} - }, - "../tracking/src/-private.ts": { - "name": "../tracking/src/-private.ts", - "modules": { - "@ember-data/tracking": 1 - }, - "classes": {}, - "fors": { - "@ember-data/tracking": 1 - }, - "namespaces": {} - } - }, - "modules": { - "@ember-data/experimental-preview-types": { - "name": "@ember-data/experimental-preview-types", - "submodules": {}, - "elements": {}, - "classes": { - " Cache": 1, - " Adapter": 1, - " Serializer": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../../ember-data-types/q/minimum-serializer-interface.ts", - "line": 26, - "description": "Many parts of EmberData are interface-driven,\nmeaning that no specific base-class is necessary\nto implement an interopable module of your own\nutilizing only public APIs.\n\nExamples of primitives in EmberData that are interface-driven\ninclude Adapters, Serializers, Request Handlers, and the Cache.\n\nThese **Not Yet Installable** Typescript Types\nDocument key interfaces that libraries and\napplications interfacing with EmberData would need\nto conform to.", - "itemtype": "main" - }, - "@ember-data/store": { - "name": "@ember-data/store", - "submodules": {}, - "elements": {}, - "classes": { - "CacheStoreWrapper": 1, - "StableRecordIdentifier": 1, - "@ember-data/store": 1, - "SchemaService": 1, - "Snapshot": 1, - "ManyArray": 1, - "IdentifierCache": 1, - "RecordReference": 1, - "CacheManager": 1, - "NotificationManager": 1, - "RequestStateService": 1, - "RecordArray": 1, - "Store": 1 - }, - "fors": { - "@ember-data/store": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../store/src/-private/store-service.ts", - "line": 83, - "description": "

\n \n

\n\nThis package provides [*Ember***Data**](https://github.com/emberjs/data/)'s `Store` class.\n\nA [Store](https://api.emberjs.com/ember-data/release/classes/Store) coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),\nand sources of data (such as your API or a local persistence layer) accessed via a [RequestManager](https://github.com/emberjs/data/tree/main/packages/request).\n\nOptionally, a Store can be configured to hydrate the response data into rich presentation classes.\n\n## Installation\n\nIf you have installed `ember-data` then you already have this package installed.\nOtherwise you can install it using your javascript package manager of choice.\nFor instance with [pnpm](https://pnpm.io/)\n\n```\npnpm add @ember-data/store\n```\n\nAfter installing you will want to configure your first `Store`. Read more below\nfor how to create and configure stores for your application.\n\n\n## 🔨 Creating A Store\n\nTo use a `Store` we will need to do few things: add a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache)\nto store data **in-memory**, add a [Handler](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache) to fetch data from a source,\nand implement `instantiateRecord` to tell the store how to display the data for individual resources.\n\n> **Note** If you are using the package `ember-data` then a JSON:API cache, RequestManager, LegacyNetworkHandler,\n> and `instantiateRecord` are configured for you by default.\n\n### Configuring A Cache\n\nTo start, let's install a [JSON:API](https://jsonapi.org/) cache. If your app uses `GraphQL` or `REST` other\ncaches may better fit your data. You can author your own cache by creating one that\nconforms to the [spec](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache).\n\nThe package `@ember-data/json-api` provides a [JSON:API](https://jsonapi.org/) cache we can use.\nAfter installing it, we can configure the store to use this cache.\n\n```js\nimport Store from '@ember-data/store';\nimport Cache from '@ember-data/json-api';\n\nclass extends Store {\n createCache(storeWrapper) {\n return new Cache(storeWrapper);\n }\n}\n```\n\nNow that we have a `cache` let's setup something to handle fetching\nand saving data via our API.\n\n> **Note** The `ember-data` package automatically includes and configures\n> the `@ember-data/json-api` cache for you.\n\n### Handling Requests\n\nWhen *Ember***Data** needs to fetch or save data it will pass that request to your application's `RequestManager` for fulfillment. How this fulfillment occurs (in-memory, device storage, via single or multiple API requests, etc.) is then up to the registered request handlers.\n\nTo start, let's install the `RequestManager` from `@ember-data/request` and the basic `Fetch` handler from ``@ember-data/request/fetch`.\n\n> **Note** If your app uses `GraphQL`, `REST` or different conventions for `JSON:API` than your cache expects, other handlers may better fit your data. You can author your own handler by creating one that conforms to the [handler interface](https://github.com/emberjs/data/tree/main/packages/request#handling-requests).\n\n```ts\nimport Store from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\n\nexport default class extends Store {\n constructor() {\n super(...arguments);\n this.requestManager = new RequestManager();\n this.requestManager.use([Fetch]);\n }\n}\n```\n\n**Using RequestManager as a Service**\n\nAlternatively if you have configured the `RequestManager` to be a service you may re-use it.\n\n*app/services/request.js*\n```ts\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\n\nexport default class extends RequestManager {\n constructor(createArgs) {\n super(createArgs);\n this.use([Fetch]);\n }\n}\n```\n\n*app/services/store.js*\n```ts\nimport Store from '@ember-data/store';\nimport { service } from '@ember/service';\n\nexport default class extends Store {", - "service": "('request') requestManager\n}\n```\n\n\n### Presenting Data from the Cache\n\nNow that we have a source and a cach for our data, we need to configure how\nthe Store delivers that data back to our application. We do this via the hook\n[instantiateRecord](https://api.emberjs.com/ember-data/release/classes/Store/methods/instantiateRecord%20(hook)?anchor=instantiateRecord%20(hook)),\nwhich allows us to transform the data for a resource before handing it to the application.\n\nA naive way to present the data would be to return it as JSON. Typically instead\nthis hook will be used to add reactivity and make each unique resource a singleton,\nensuring that if the cache updates our presented data will reflect the new state.\n\nBelow is an example of using the hooks `instantiateRecord` and a `teardownRecord`\nto provide minimal read-only reactive state for simple resources.\n\n```ts\nimport Store, { recordIdentifierFor } from '@ember-data/store';\nimport { TrackedObject } from 'tracked-built-ins';\n\nclass extends Store {\n instantiateRecord(identifier) {\n const { cache, notifications } = this;\n\n // create a TrackedObject with our attributes, id and type\n const record = new TrackedObject(Object.assign({}, cache.peek(identifier)));\n record.type = identifier.type;\n record.id = identifier.id;\n\n notifications.subscribe(identifier, (_, change) => {\n if (change === 'attributes') {\n Object.assign(record, cache.peek(identifier));\n }\n });\n\n return record;\n }\n}\n```\n\nBecause `instantiateRecord` is opaque to the nature of the record, an implementation\ncan be anything from a fairly simple object to a robust proxy that intelligently links\ntogether associated records through relationships.\n\nThis also enables creating a record that separates `edit` flows from `create` flows\nentirely. A record class might choose to implement a `checkout`method that gives access\nto an editable instance while the primary record continues to be read-only and reflect\nonly persisted (non-mutated) state.\n\nTypically you will choose an existing record implementation such as `@ember-data/model`\nfor your application.\n\nBecause of the boundaries around instantiation and the cache, record implementations\nshould be capable of interop both with each other and with any `Cache`. Due to this,\nif needed an application can utilize multiple record implementations and multiple cache\nimplementations either to support enhanced features for only a subset of records or to\nbe able to incrementally migrate from one record/cache to another record or cache.\n\n> **Note:** The `ember-data` package automatically includes the `@ember-data/model`\n> package and configures it for you.", - "itemtype": "main" - }, - "ember-data-overview": { - "name": "ember-data-overview", - "submodules": {}, - "elements": {}, - "classes": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../-ember-data/addon/index.js", - "line": 1, - "description": "

\n \n

\n\n

The lightweight reactive data library for JavaScript applications

\n\n---\n\nWrangle your application's data management with scalable patterns for developer productivity.\n\n- ⚡️ Committed to Best-In-Class Performance\n- 🌲 Focused on being as svelte as possible\n- 🚀 SSR Ready\n- 🔜 Typescript Support\n- 🐹 Built with ♥️ by [Ember](https://emberjs.com)\n- ⚛️ Supports any API: `GraphQL` `JSON:API` `REST` `tRPC` ...bespoke or a mix\n\n### 📖 On This Page\n\n- [Overview](./#overview)\n - [Architecture](#🪜-architecture)\n - [Basic Installation](#basic-installation)\n - [Advanced Installation](#advanced-installation)\n- [Configuration](#configuration)\n - [Deprecation Stripping](#deprecation-stripping)\n - [randomUUID polyfill](#randomuuid-polyfill)\n - [Removing inspector support in production](#removing-inspector-support-in-production)\n - [Debugging](#debugging)\n\n\n# Overview\n\n*Ember*‍**Data** is a lightweight reactive data library for JavaScript applications that provides composable primitives for ordering query/mutation/peek flows, managing network and cache, and reducing data for presentation.\n\n## 🪜 Architecture\n\nThe core of *Ember*‍**Data** is the `Store`, which coordinates interaction between your application, the `Cache`, and sources of data (such as your `API` or a local persistence layer).\nOptionally, the Store can be configured to hydrate the response data into rich presentation classes.\n\n*Ember*‍**Data** is both resource centric and document centric in it's approach to caching, requesting and presenting data. Your application's configuration and usage drives which is important and when.\n\nThe `Store` is a **coordinator**. When using a `Store` you configure what cache to use, how cache data should be presented to the UI, and where it should look for requested data when it is not available in the cache.\n\nThis coordination is handled opaquely to the nature of the requests issued and the format of the data being handled. This approach gives applications broad flexibility to configure *Ember*‍**Data** to best suite their needs. This makes *Ember*‍**Data** a powerful solution for applications regardless of their size and complexity.\n\n*Ember*‍**Data** is designed to scale, with a religious focus on performance and asset-size to keep its footprint small but speedy while still being able to handle large complex APIs in huge data-driven applications with no additional code and no added application complexity. It's goal is to prevent applications from writing code to manage data that is difficult to maintain or reason about.\n\n*Ember*‍**Data**'s power comes not from specific features, data formats, or adherence to specific API specs such as `JSON:API` `trpc` or `GraphQL`, but from solid conventions around requesting and mutating data developed over decades of experience scaling developer productivity.\n\n## Basic Installation\n\nInstall using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n```no-highlight\npnpm add ember-data\n```\n\n`ember-data` is installed by default for new applications generated with `ember-cli`. You can check what version is installed by looking in the `devDependencies` hash of your project's [package.json](https://docs.npmjs.com/cli/v8/configuring-npm/package-json) file.\n\nIf you have generated a new `Ember` application using `ember-cli` but do\nnot wish to use `ember-data`, remove `ember-data` from your project's `package.json` file and run your package manager's install command to update your lockfile.\n\n## Advanced Installation\n\n*Ember*‍**Data** is organized into primitives that compose together via public APIs.\n\n- [@ember-data/store](/ember-data/release/modules/@ember-data%2Fstore) is the core and handles coordination\n- [@ember-data/json-api](/ember-data/release/modules/@ember-data%2Fjson-api) provides a resource cache for JSON:API structured data. It integrates with the store via the hook `createCache`\n- [@ember-data/model](/ember-data/release/modules/@ember-data%2Fmodel) is a presentation layer, it integrates with the store via the hooks `instantiateRecord` and `teardownRecord`.\n- [@ember-data/adapter](/ember-data/release/modules/@ember-data%2Fadapter) provides various network API integrations for APIS built over specific REST or JSON:API conventions.\n- [@ember-data/serializer](/ember-data/release/modules/@ember-data%2Fserializer) pairs with `@ember-data/adapter` to normalize and serialize data to and from an API format into the `JSON:API` format understood by `@ember-data/json-api`.\n- [@ember-data/debug](/ember-data/release/modules/@ember-data%2Fdebug) provides debugging support for the `ember-inspector`.\n- **ember-data** is a \"meta\" package which bundles all of these together for convenience\n\nThe packages interop with each other through well defined public API boundaries. The core\nof the library is the store provided by `@ember-data/store`, while each of the other libraries plugs into the store when installed. Because these packages interop via fully\npublic APIs, other libraries or applications may provide their own implementations. For instance, [ember-m3](https://github.com/hjdivad/ember-m3) is a commonly used presentation and cache implementation suitable for complex resource objects and graphs.\n\n## Configuration\n\n### Deprecation Stripping\n\n*Ember*‍**Data** allows users to opt-in and remove code that exists to support deprecated behaviors.\n\nIf your app has resolved all deprecations present in a given version, you may specify that version as your \"compatibility\" version to remove the code that supported the deprecated behavior from your app.\n\n```ts\nlet app = new EmberApp(defaults, {\n emberData: {\n compatWith: '4.8',\n },\n});\n```\n\n- [Full Documentation](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fdeprecations)\n\n### randomUUID polyfill\n\n*Ember*‍**Data** uses `UUID V4` by default to generate identifiers for new data created on the client. Identifier generation is configurable, but we also for convenience will polyfill\nthe necessary feature if your browser support or deployment environment demands it. To\nactivate this polyfill:\n\n```ts\nlet app = new EmberApp(defaults, {\n '@embroider/macros': {\n setConfig: {\n '@ember-data/store': {\n polyfillUUID: true\n },\n },\n },\n});\n```\n\n### removing inspector support in production\n\nIf you do not with to ship inspector support in your production application, you can specify\nthat all support for it should be stripped from the build.\n\n```ts\nlet app = new EmberApp(defaults, {\n emberData: {\n includeDataAdapterInProduction: false\n }\n});\n```\n\n- [Full Documentation](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fdebug)\n\n### Debugging\n\nMany portions of the internals are helpfully instrumented with logging that can be activated\nat build time. This instrumentation is always removed from production builds or any builds\nthat has not explicitly activated it. To activate it set the appropriate flag to `true`.\n\n```ts\n let app = new EmberApp(defaults, {\n emberData: {\n debug: {\n LOG_PAYLOADS: false, // data store received to update cache with\n LOG_OPERATIONS: false, // updates to cache remote state\n LOG_MUTATIONS: false, // updates to cache local state\n LOG_NOTIFICATIONS: false,\n LOG_REQUESTS: false, // log Requests issued via the request manager\n LOG_REQUEST_STATUS: false,\n LOG_IDENTIFIERS: false,\n LOG_GRAPH: false,\n LOG_INSTANCE_CACHE: false,\n }\n }\n });\n ```", - "itemtype": "main" - }, - "@ember-data/adapter": { - "name": "@ember-data/adapter", - "submodules": {}, - "elements": {}, - "classes": { - "BuildURLMixin": 1, - "Adapter": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/index.ts", - "line": 197, - "description": "## Overview\n\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\nIn order to properly fetch and update data, EmberData\nneeds to understand how to connect to your API.\n\n`Adapters` accept various kinds of requests from the store\nand manage fulfillment of the request from your API.\n\n### Request Flow\n\nWhen the store decides it needs to issue a request it uses the\nfollowing flow to manage the request and process the data.\n\n- find the appropriate adapter\n- issue the request to the adapter\n- await the adapter's response\n - if an error occurs reject with the error\n - if no error\n - if there is response data\n - pass the response data to the appropriate serializer\n - update the cache using the JSON:API formatted data from the serializer's response\n - return the primary record(s) associated with the request\n\n### Request Errors\n\nWhen a request errors and your adapter does not have the ability to recover from the error,\nyou may either reject the promise returned by your adapter method with the error or simply\nthrow the error.\n\nIf the request was for a `createRecord` `updateRecord` or `deleteRecord` special rules\napply to how this error will affect the state of the store and additional properties on\nthe `Error` class may be used. See the documentation for these methods in\n[ Adapter](/ember-data/release/classes/%3CInterface%3E%20Adapter) for more information.\n\n### Implementing an Adapter\n\nThere are seven required adapter methods, one for each of\nthe primary request types that EmberData issues.\n\nThey are:\n\n- findRecord\n- findAll\n- queryRecord\n- query\n- createRecord\n- updateRecord\n- deleteRecord\n\nEach of these request types has a matching store method that triggers it\nand matching `requestType` that is passed to the serializer's\n`normalizeResponse` method.\n\nIf your app only reads data but never writes data, it is not necessary\nto implement the methods for create, update, and delete. This extends to\nall of the store's find methods with the exception of `findRecord` (`findAll`,\n`query`, `queryRecord`): if you do not use the store method in your app then\nyour Adapter does not need the method.\n\n```ts\nimport EmberObject from '@ember/object';\n\nasync function fetchData(url, options = {}) {\n let response = await fetch(url, options);\n return response.toJSON();\n}\n\nexport default class ApplicationAdapter extends EmberObject {\n findRecord(_, { modelName }, id) {\n return fetchData(`./${modelName}s/${id}`);\n }\n}\n```\n\n### Adapter Resolution\n\n`store.adapterFor(name)` will lookup adapters defined in `app/adapters/` and\nreturn an instance.\n\n`adapterFor` first attempts to find an adapter with an exact match on `name`,\nthen falls back to checking for the presence of an adapter named `application`.\n\nIf no adapter is found, an error will be thrown.\n\n```ts\nstore.adapterFor('author');\n\n// lookup paths (in order) =>\n// app/adapters/author.js\n// app/adapters/application.js\n```\n\nMost requests in EmberData are made with respect to a particular `type` (or `modelName`)\n(e.g., \"get me the full collection of **books**\" or \"get me the **employee** whose id is 37\"). We\nrefer to this as the **primary** resource `type`.\n\n`adapterFor` is used by the store to find an adapter with a name matching that of the primary\nresource `type` for the request, which then falls back to the `application` adapter.\n\nIt is recommended that applications define only a single `application` adapter and serializer\nwhere possible, only implementing an adapter specific to the `type` when absolutely necessary.\n\nIf you need to support multiple API versions for the same type, the per-type strategy for\ndefining adapters might not be adequate.\n\nIf you have multiple APIs or multiple API versions and the single application adapter and per-type\nstrategy does not suite your needs, one strategy is to write an `application` adapter and serializer\nthat make use of `options` to specify the desired format when making a request, then forwards to the\nrequest to the desired adapter or serializer as needed.\n\n```app/adapters/application.js\nexport default class Adapter extends EmberObject {\n findRecord(store, schema, id, snapshot) {\n let { apiVersion } = snapshot.adapterOptions;\n return this.adapterFor(`-api-${apiVersion}`).findRecord(store, schema, id, snapshot);\n }\n}\n```\n\n### Overriding `Store.adapterFor`\n\n```js\nimport Store from '@ember-data/store';\nimport Adapter from '@ember-data/adapter/json-api';\n\nclass extends Store {\n #adapter = new Adapter();\n\n adapterFor() {\n return this.#adapter;\n }\n}\n```\n\n\nNote: If you are using Ember and would like to make use of `service` injections in your adapter, you will want to additionally `setOwner` for the Adapter.\n\n```js\nimport Store from '@ember-data/store';\nimport Adapter from '@ember-data/adapter/json-api';\nimport { getOwner, setOwner } from '@ember/application';\n\nclass extends Store {\n #adapter = null;\n\n adapterFor() {\n let adapter = this.#adapter;\n if (!adapter) {\n const owner = getOwner(this);\n adapter = new Adapter();\n setOwner(adapter, owner);\n this.#adapter = adapter;\n }\n\n return adapter;\n }\n}\n```\n\nBy default when using with Ember you only need to implement this hook if you want your adapter usage to be statically analyzeable. *Ember***Data** will attempt to resolve adapters using Ember's resolver. To provide a single Adapter for your application like the above you would provide it as the default export of the file `app/adapters/application.{js/ts}`\n\n### Using an Adapter\n\nAny adapter in `app/adapters/` can be looked up by `name` using `store.adapterFor(name)`.\n\n### Default Adapters\n\nApplications whose API's structure endpoint URLs *very close to* or *exactly* the **REST**\nor **JSON:API** convention, the `@ember-data/adapter` package contains implementations\nthese applications can extend.\n\nMany applications will find writing their own adapter to be allow greater flexibility,\ncustomization, and maintenance than attempting to override methods in these adapters.", - "itemtype": "main" - }, - "@ember-data/adapter/error": { - "name": "@ember-data/adapter/error", - "submodules": {}, - "elements": {}, - "classes": { - "AdapterError": 1, - "InvalidError": 1, - "TimeoutError": 1, - "AbortError": 1, - "UnauthorizedError": 1, - "ForbiddenError": 1, - "NotFoundError": 1, - "ConflictError": 1, - "ServerError": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/error.js", - "line": 332, - "description": "## Overview\n\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\nAn `AdapterError` is used by an adapter to signal that an error occurred\nduring a request to an external API. It indicates a generic error, and\nsubclasses are used to indicate specific error states.\n\nTo create a custom error to signal a specific error state in communicating\nwith an external API, extend the `AdapterError`. For example, if the\nexternal API exclusively used HTTP `503 Service Unavailable` to indicate\nit was closed for maintenance:\n\n```app/adapters/maintenance-error.js\nimport AdapterError from '@ember-data/adapter/error';\n\nexport default AdapterError.extend({ message: \"Down for maintenance.\" });\n```\n\nThis error would then be returned by an adapter's `handleResponse` method:\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\nimport MaintenanceError from './maintenance-error';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n handleResponse(status) {\n if (503 === status) {\n return new MaintenanceError();\n }\n\n return super.handleResponse(...arguments);\n }\n}\n```\n\nAnd can then be detected in an application and used to send the user to an\n`under-maintenance` route:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport MaintenanceError from '../adapters/maintenance-error';\n\nexport default class ApplicationRoute extends Route {\n actions: {\n error(error, transition) {\n if (error instanceof MaintenanceError) {\n this.transitionTo('under-maintenance');\n return;\n }\n\n // ...other error handling logic\n }\n }\n}\n```", - "itemtype": "main" - }, - "@ember-data/adapter/json-api": { - "name": "@ember-data/adapter/json-api", - "submodules": {}, - "elements": {}, - "classes": { - "JSONAPIAdapter": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/json-api.ts", - "line": 18, - "description": "## Overview\n\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\nThe `JSONAPIAdapter` is an adapter whichtransforms the store's\nrequests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).\n\n## JSON API Conventions\n\nThe JSONAPIAdapter uses JSON API conventions for building the URL\nfor a record and selecting the HTTP verb to use with a request. The\nactions you can take on a record map onto the following URLs in the\nJSON API adapter:\n\n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n
\n Action\n \n HTTP Verb\n \n URL\n
\n `store.findRecord('post', 123)`\n \n GET\n \n /posts/123\n
\n `store.findAll('post')`\n \n GET\n \n /posts\n
\n Update `postRecord.save()`\n \n PATCH\n \n /posts/123\n
\n Create `store.createRecord('post').save()`\n \n POST\n \n /posts\n
\n Delete `postRecord.destroyRecord()`\n \n DELETE\n \n /posts/123\n
\n\n## Success and failure\n\nThe JSONAPIAdapter will consider a success any response with a\nstatus code of the 2xx family (\"Success\"), as well as 304 (\"Not\nModified\"). Any other status code will be considered a failure.\n\nOn success, the request promise will be resolved with the full\nresponse payload.\n\nFailed responses with status code 422 (\"Unprocessable Entity\") will\nbe considered \"invalid\". The response will be discarded, except for\nthe `errors` key. The request promise will be rejected with a\n`InvalidError`. This error object will encapsulate the saved\n`errors` value.\n\nAny other status codes will be treated as an adapter error. The\nrequest promise will be rejected, similarly to the invalid case,\nbut with an instance of `AdapterError` instead.\n\n### Endpoint path customization\n\nEndpoint paths can be prefixed with a `namespace` by setting the\nnamespace property on the adapter:\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n namespace = 'api/1';\n}\n```\nRequests for the `person` model would now target `/api/1/people/1`.\n\n### Host customization\n\nAn adapter can target other hosts by setting the `host` property.\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n host = 'https://api.example.com';\n}\n```\n\nRequests for the `person` model would now target\n`https://api.example.com/people/1`.", - "since": "1.13.0", - "itemtype": "main" - }, - "@ember-data/adapter/rest": { - "name": "@ember-data/adapter/rest", - "submodules": {}, - "elements": {}, - "classes": { - "RESTAdapter": 1, - "@ember-data/adapter/rest": 1 - }, - "fors": { - "@ember-data/adapter/rest": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../adapter/src/rest.ts", - "line": 68, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n The REST adapter allows your store to communicate with an HTTP server by\n transmitting JSON via XHR.\n\n This adapter is designed around the idea that the JSON exchanged with\n the server should be conventional. It builds URLs in a manner that follows\n the structure of most common REST-style web services.\n\n ## Success and failure\n\n The REST adapter will consider a success any response with a status code\n of the 2xx family (\"Success\"), as well as 304 (\"Not Modified\"). Any other\n status code will be considered a failure.\n\n On success, the request promise will be resolved with the full response\n payload.\n\n Failed responses with status code 422 (\"Unprocessable Entity\") will be\n considered \"invalid\". The response will be discarded, except for the\n `errors` key. The request promise will be rejected with a `InvalidError`.\n This error object will encapsulate the saved `errors` value.\n\n Any other status codes will be treated as an \"adapter error\". The request\n promise will be rejected, similarly to the \"invalid\" case, but with\n an instance of `AdapterError` instead.\n\n ## JSON Structure\n\n The REST adapter expects the JSON returned from your server to follow\n these conventions.\n\n ### Object Root\n\n The JSON payload should be an object that contains the record inside a\n root property. For example, in response to a `GET` request for\n `/posts/1`, the JSON should look like this:\n\n ```js\n {\n \"posts\": {\n \"id\": 1,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\"\n }\n }\n ```\n\n Similarly, in response to a `GET` request for `/posts`, the JSON should\n look like this:\n\n ```js\n {\n \"posts\": [\n {\n \"id\": 1,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\"\n },\n {\n \"id\": 2,\n \"title\": \"Rails is omakase\",\n \"author\": \"D2H\"\n }\n ]\n }\n ```\n\n Note that the object root can be pluralized for both a single-object response\n and an array response: the REST adapter is not strict on this. Further, if the\n HTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a\n `findRecord` query) with more than one object in the array, Ember Data will\n only display the object with the matching ID.\n\n ### Conventional Names\n\n Attribute names in your JSON payload should be the camelCased versions of\n the attributes in your Ember.js models.\n\n For example, if you have a `Person` model:\n\n ```app/models/person.js\n import Model, { attr } from '@ember-data/model';\n\n export default Model.extend({\n firstName: attr('string'),\n lastName: attr('string'),\n occupation: attr('string')\n });\n ```\n\n The JSON returned should look like this:\n\n ```js\n {\n \"people\": {\n \"id\": 5,\n \"firstName\": \"Zaphod\",\n \"lastName\": \"Beeblebrox\",\n \"occupation\": \"President\"\n }\n }\n ```\n\n #### Relationships\n\n Relationships are usually represented by ids to the record in the\n relationship. The related records can then be sideloaded in the\n response under a key for the type.\n\n ```js\n {\n \"posts\": {\n \"id\": 5,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\",\n \"comments\": [1, 2]\n },\n \"comments\": [{\n \"id\": 1,\n \"author\": \"User 1\",\n \"message\": \"First!\",\n }, {\n \"id\": 2,\n \"author\": \"User 2\",\n \"message\": \"Good Luck!\",\n }]\n }\n ```\n\n If the records in the relationship are not known when the response\n is serialized it's also possible to represent the relationship as a\n URL using the `links` key in the response. Ember Data will fetch\n this URL to resolve the relationship when it is accessed for the\n first time.\n\n ```js\n {\n \"posts\": {\n \"id\": 5,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\",\n \"links\": {\n \"comments\": \"/posts/5/comments\"\n }\n }\n }\n ```\n\n ### Errors\n\n If a response is considered a failure, the JSON payload is expected to include\n a top-level key `errors`, detailing any specific issues. For example:\n\n ```js\n {\n \"errors\": {\n \"msg\": \"Something went wrong\"\n }\n }\n ```\n\n This adapter does not make any assumptions as to the format of the `errors`\n object. It will simply be passed along as is, wrapped in an instance\n of `InvalidError` or `AdapterError`. The serializer can interpret it\n afterwards.\n\n ## Customization\n\n ### Endpoint path customization\n\n Endpoint paths can be prefixed with a `namespace` by setting the namespace\n property on the adapter:\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n namespace = 'api/1';\n }\n ```\n Requests for the `Person` model would now target `/api/1/people/1`.\n\n ### Host customization\n\n An adapter can target other hosts by setting the `host` property.\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n host = 'https://api.example.com';\n }\n ```\n\n ### Headers customization\n\n Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary\n headers can be set as key/value pairs on the `RESTAdapter`'s `headers`\n object and Ember Data will send them along with each ajax request.\n\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n headers: computed(function() {\n return {\n 'API_KEY': 'secret key',\n 'ANOTHER_HEADER': 'Some header value'\n };\n }\n }\n ```\n\n `headers` can also be used as a computed property to support dynamic\n headers. In the example below, the `session` object has been\n injected into an adapter by Ember's container.\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n headers: computed('session.authToken', function() {\n return {\n 'API_KEY': this.session.authToken,\n 'ANOTHER_HEADER': 'Some header value'\n };\n })\n }\n ```\n\n In some cases, your dynamic headers may require data from some\n object outside of Ember's observer system (for example\n `document.cookie`). You can use the\n [volatile](/api/classes/Ember.ComputedProperty.html?anchor=volatile)\n function to set the property into a non-cached mode causing the headers to\n be recomputed with every request.\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n headers: computed(function() {\n return {\n 'API_KEY': document.cookie.match(/apiKey\\=([^;]*)/)['1'],\n 'ANOTHER_HEADER': 'Some header value'\n };\n }).volatile()\n }\n ```", - "itemtype": "main" - }, - "@ember-data/debug": { - "name": "@ember-data/debug", - "submodules": {}, - "elements": {}, - "classes": { - "InspectorDataAdapter": 1, - "DebugLogging": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../private-build-infra/virtual-packages/debugging.js", - "line": 4, - "description": "# Overview\n\nThis package provides the `DataAdapter` which the [Ember Inspector](https://github.com/emberjs/ember-inspector)\nuses to subscribe and retrieve information for the `data` tab in the inspector.\n\nThis package adds roughly .6 KB when minified and compressed to your application in production; however,\nyou can opt out of shipping this addon in production via options in `ember-cli-build.js`\n\n```js\nlet app = new EmberApp(defaults, {\n emberData: {\n includeDataAdapterInProduction: false\n }\n});\n```\n\nWhen using `ember-data` as a dependency of your app, the default is to ship the inspector support to production.\n\nWhen not using `ember-data` as a dependency but instead using EmberData via declaring specific `@ember-data/`\ndependencies the default is to not ship to production.", - "itemtype": "main" - }, - "@ember-data/graph": { - "name": "@ember-data/graph", - "submodules": {}, - "elements": {}, - "classes": {}, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../graph/src/-private.ts", - "line": 3, - "description": "

\n \n

\n\n

Provides a performance tuned normalized graph for intelligently managing relationships between resources based on identity

\n\nWhile this Graph is abstract, it currently is a private implementation required as a peer-dependency by the [JSON:API Cache Implementation](https://github.com/emberjs/data/tree/main/packages/json-api).\n\nWe intend to make this Graph public API after some additional iteration during the 5.x timeframe, until then all APIs should be considered experimental and unstable, not fit for direct application or 3rd party library usage.\n\n## Installation\n\nInstall using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n```no-highlight\npnpm add @ember-data/graph\n```", - "itemtype": "main" - }, - "@ember-data/json-api": { - "name": "@ember-data/json-api", - "submodules": {}, - "elements": {}, - "classes": { - "Cache": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../json-api/src/-private/cache.ts", - "line": 84, - "description": "

\n \n

\n\nThis package provides an in-memory [JSON:API](https://jsonapi.org/) document and resource [*Ember***Data** Cache](https://github.com/emberjs/data/blob/main/ember-data-types/cache/cache.ts) implementation.\n\n## Installation\n\nInstall using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n```no-highlight\npnpm add @ember-data/json-api\n```\n\n## 🚀 Setup\n\n> **Note** When using [ember-data](https://github.com/emberjs/data/blob/main/packages/-ember-data) the below\n> configuration is handled for you automatically.\n\n```ts\nimport Store from '@ember-data/store';\nimport Cache from '@ember-data/json-api';\n\nexport default class extends Store {\n createCache(wrapper) {\n return new Cache(wrapper);\n }\n}\n```\n\n\n## Usage\n\nUsually you will directly interact with the cache only if implementing a presentation class. Below we\ngive an example of a read-only record (mutations never written back to the cache). More typically cache\ninteractions are something that the `Store` coordinates as part of the `request/response` lifecycle.\n\n```ts\nimport Store, { recordIdentifierFor } from '@ember-data/store';\nimport Cache from '@ember-data/json-api';\nimport { TrackedObject } from 'tracked-built-ins';\n\nclass extends Store {\n createCache(wrapper) {\n return new Cache(wrapper);\n }\n\n instantiateRecord(identifier) {\n const { cache, notifications } = this;\n const { type, id } = identifier;\n\n // create a TrackedObject with our attributes, id and type\n const attrs = cache.peek(identifier).attributes;\n const data = Object.assign({}, attrs, { type, id });\n const record = new TrackedObject(data);\n\n // update the TrackedObject whenever attributes change\n const token = notifications.subscribe(identifier, (_, change) => {\n if (change === 'attributes') {\n Object.assign(record, cache.peek(identifier).attributes);\n }\n });\n\n // setup the ability to teardown the subscription when the\n // record is no longer needed\n record.destroy = () => {\n this.notifications.unsubscribe(token);\n };\n\n return record;\n }\n\n teardownRecord(record: FakeRecord) {\n record.destroy();\n }\n}\n```\n\nFor the full list of APIs available read the code documentation for [*Ember***Data** Cache](https://github.com/emberjs/data/blob/main/ember-data-types/cache/cache.ts)", - "itemtype": "main" - }, - "@ember-data/legacy-compat": { - "name": "@ember-data/legacy-compat", - "submodules": {}, - "elements": {}, - "classes": { - "SnapshotRecordArray": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 12, - "description": "Utilities - often temporary - for maintaining backwards compatibility with\nolder parts of EmberData.", - "itemtype": "main" - }, - "@ember-data/model": { - "name": "@ember-data/model", - "submodules": {}, - "elements": {}, - "classes": { - "BelongsToReference": 1, - "HasManyReference": 1, - "@ember-data/model": 1, - "Errors": 1, - "Model": 1, - "PromiseBelongsTo": 1, - "PromiseManyArray": 1 - }, - "fors": { - "@ember-data/model": 1, - "Model": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../model/src/-private/promise-many-array.ts", - "line": 20, - "description": "This package provides a Presentation Model for resource data in an EmberData Cache.\n\nModels are defined as classes extending from `import Model from '@ember-data/model';` and the\nattributes and relationships on these classes are parsed at runtime to supply static \"schema\"\nto EmberData's SchemaService.\n\nResource data for individual resources fetched from your API is presented to the UI via instances\nof the `Model`s you define. An instantiated `Model` is referred to as a `record`.\n\n When we refer to the `ModelClass` as opposed to a `Model` or `Record` we are referring\n specifically to the class definition and the static schema methods present on it.\n\n When we refer to a `record` we refer to a specific class instance presenting\n the resource data for a given `type` and `id`.\n\n ### Defining a Model\n\n ```app/models/person.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\n export default class PersonModel extends Model {", - "attr": "name;", - "belongsto": "('pet', { inverse: 'owners', async: false }) dog;", - "hasmany": "('person', { inverse: 'friends', async: true }) friends;\n }\n ```\n\n ### modelName convention\n\n By convention, the name of a given model (its `type`) matches the name\n of the file in the `app/models` folder and should be lowercase, singular\n and dasherized.", - "itemtype": "main" - }, - "@ember-data/canary-features": { - "name": "@ember-data/canary-features", - "submodules": {}, - "elements": {}, - "classes": { - "CanaryFeatureFlags": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../private-build-infra/virtual-packages/canary-features.js", - "line": 76, - "description": "## Canary Features\n\nEmberData allows users to test features that are implemented but not yet\navailable even in canary.\n\nTypically these features represent work that might introduce a new concept,\nnew API, change an API, or risk an unintended change in behavior to consuming\napplications.\n\nSuch features have their implementations guarded by a \"feature flag\", and the\nflag is only activated once the core-data team is prepared to ship the work\nin a canary release.\n\n### Installing Canary\n\nTo test a feature you MUST be using a canary build. Canary builds are published\nto `npm` and can be installed using a precise tag (such as `ember-data@3.16.0-alpha.1`)\nor by installing the latest dist-tag published to the `canary` channel using your javascript\npackage manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n ```cli\n pnpm add ember-data@canary\n ```\n\n### Activating a Canary Feature\n\nOnce you have installed canary, feature-flags can be activated at build-time\n\nby setting an environment variable:\n\n```cli\n# Activate a single flag\nEMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG ember build\n\n# Activate multiple flags by separating with commas\nEMBER_DATA_FEATURE_OVERRIDE=SOME_FLAG,OTHER_FLAG ember build\n\n# Activate all flags\nEMBER_DATA_FEATURE_OVERRIDE=ENABLE_ALL_OPTIONAL ember build\n```\n\nor by setting the appropriate flag in your `ember-cli-build` file:\n\n```ts\nlet app = new EmberApp(defaults, {\n emberData: {\n features: {\n SAMPLE_FEATURE_FLAG: false // utliize existing behavior, strip code for the new feature\n OTHER_FEATURE_FLAG: true // utilize this new feature, strip code for the older behavior\n }\n }\n})\n```\n\n**The \"off\" branch of feature-flagged code is always stripped from production builds.**\n\nThe list of available feature-flags is located [here](https://github.com/emberjs/data/tree/main/packages/private-build-infra/virtual-packages/canary-features.js \"List of EmberData FeatureFlags\")\n\n\n### Preparing a Project to use a Canary Feature\n\nFor most projects, simple version detection should be enough.\nUsing the provided version compatibility helpers from [embroider-macros](https://github.com/embroider-build/embroider/tree/main/packages/macros#readme)\nthe following can be done:\n\n```js\nif (macroCondition(dependencySatisfies('@ember-data/store', '5.0'))) {\n // do thing\n}\n```", - "itemtype": "main" - }, - "@ember-data/deprecations": { - "name": "@ember-data/deprecations", - "submodules": {}, - "elements": {}, - "classes": { - "CurrentDeprecations": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../private-build-infra/virtual-packages/deprecations.js", - "line": 61, - "description": "## Deprecations\n\nEmberData allows users to opt-in and remove code that exists to support deprecated\nbehaviors.\n\nIf your app has resolved all deprecations present in a given version,\nyou may specify that version as your \"compatibility\" version to remove\nthe code that supported the deprecated behavior from your app.\n\nFor instance, if a deprecation was introduced in 3.13, and the app specifies\n3.13 as its minimum version compatibility, any deprecations introduced before\nor during 3.13 would be stripped away.\n\nAn app can use a different version than what it specifies as it's compatibility\nversion. For instance, an App could be using `3.16` while specifying compatibility\nwith `3.12`. This would remove any deprecations that were present in or before `3.12`\nbut keep support for anything deprecated in or above `3.13`.\n\n### Configuring Compatibility\n\nTo configure your compatibility version, set the `compatWith` to the version you\nare compatible with on the `emberData` config in your `ember-cli-build.js` file.\n\n```js\nlet app = new EmberApp(defaults, {\n emberData: {\n compatWith: '3.12',\n },\n});\n```\n\nAlternatively, individual deprecations can be resolved (and thus have its support stripped)\nvia one of the flag names listed below. For instance, given a flag named `DEPRECATE_FOO_BEHAVIOR`.\n\nThis capability is interopable with `compatWith`. You may set `compatWith` and then selectively resolve\nadditional deprecations, or set compatWith and selectively un-resolve specific deprecations.\n\nNote: EmberData does not test against permutations of deprecations being stripped, our tests run against\n\"all deprecated code included\" and \"all deprecated code removed\". Unspecified behavior may sometimes occur\nwhen removing code for only some deprecations associated to a version number.\n\n```js\nlet app = new EmberApp(defaults, {\n emberData: {\n deprecations: {\n DEPRECATE_FOO_BEHAVIOR: false // set to false to strip this code\n DEPRECATE_BAR_BEHAVIOR: true // force to true to not strip this code\n }\n }\n})\n```\n\nThe complete list of which versions specific deprecations will be removed in\ncan be found [here](https://github.com/emberjs/data/blob/main/packages/private-build-infra/virtual-packages/deprecations.js \"List of EmberData Deprecations\")", - "itemtype": "main" - }, - "@ember-data/request": { - "name": "@ember-data/request", - "submodules": {}, - "elements": {}, - "classes": { - "RequestManager": 1, - "Future": 1, - " Handler": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../request/src/-private/types.ts", - "line": 202, - "description": "

\n \n

\n\n

⚡️ a simple abstraction over fetch to enable easy management of request/response flows

\n\nThis package provides [*Ember*‍**Data**](https://github.com/emberjs/data/)'s `RequestManager`, a framework agnostic library that can be integrated with any Javascript application to make [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) happen.\n\n## Installation\n\nInstall using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/)\n\n```no-highlight\npnpm add @ember-data/request\n```\n\n## 🚀 Basic Usage\n\nA `RequestManager` provides a request/response flow in which configured handlers are successively given the opportunity to handle, modify, or pass-along a request.\n\nThe RequestManager on its own does not know how to fulfill requests. For this we must register at least one handler. A basic `Fetch` handler is provided that will take the request options provided and execute `fetch`.\n\n```ts\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\nimport { apiUrl } from './config';\n\n// ... create manager and add our Fetch handler\nconst manager = new RequestManager();\nmanager.use([Fetch]);\n\n// ... execute a request\nconst response = await manager.request({\n url: `${apiUrl}/users`\n});\n```\n\n\n## 🪜 Architecture\n\nA `RequestManager` receives a request and manages fulfillment via configured handlers. It may be used standalone from the rest of *Ember*‍**Data** and is not specific to any library or framework.\n\nEach handler may choose to fulfill the request using some source of data or to pass the request along to other handlers.\n\nThe same or a separate instance of a `RequestManager` may also be used to fulfill requests issued by [*Ember*‍**Data**{Store}](https://github.com/emberjs/data/tree/main/packages/store)\n\nWhen the same instance is used by both this allows for simple coordination throughout the application. Requests issued by the Store will use the in-memory cache\nand return hydrated responses, requests issued directly to the RequestManager\nwill skip the in-memory cache and return raw responses.\n\n## Usage\n\n```ts\nconst userList = await manager.request({\n url: `/api/v1/users.list`\n});\n\nconst users = userList.content;\n```\n\n
\n Making Requests\n\n`RequestManager` has a single asyncronous method as it's API: `request`\n\n```ts\nclass RequestManager {\n request(req: RequestInfo): Future;\n}\n```\n\n`manager.request()` accepts an object containing the information\nnecessary for the request to be handled successfully.\n\nThese options extend the [options](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters) provided to `fetch`, and can accept a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). All properties accepted by Request options and fetch options are valid.\n\n```ts\ninterface RequestInfo extends FetchOptions {\n op?: string;\n store?: Store;\nurl: string;\n // data that a handler should convert into\n // the query (GET) or body (POST)\n data?: Record;\n// options specifically intended for handlers\n // to utilize to process the request\n options?: Record;\n}\n```\n\n> **note:** providing a `signal` is unnecessary as an `AbortController` is automatically provided if none is present.\n\n
\n
\n Using the Response
\n\n`manager.request` returns a `Future`, which allows access to limited information about the request while it is still pending and fulfills with the final state when the request completes and the response has been read.\n\n```ts\nconst usersFuture = manager.request({\n url: `/api/v1/users.list`\n});\n```\n\nA `Future` is cancellable via `abort`.\n\n```ts\nusersFuture.abort();\n```\n\nHandlers may *optionally* expose a ReadableStream to the `Future` for streaming data; however, when doing so the handler should not resolve until it has fully read the response stream itself.\n\n```ts\ninterface Future extends Promise> {\n abort(): void;\nasync getStream(): ReadableStream | null;\n}\n```\n\nA Future resolves or rejects with a `StructuredDocument`.\n\n```ts\ninterface StructuredDocument {\n request: RequestInfo;\n response: ResponseInfo | null;\n content?: T;\n error?: Error;\n}\n```\n\nThe `RequestInfo` specified by `document.request` is the same as originally provided to `manager.request`. If any handler fulfilled this request using different request info it is not represented here. This contract helps to ensure that `retry` and `caching` are possible since the original arguments are correctly preserved. This also allows handlers to \"fork\" the request or fulfill from multiple sources without the details of fulfillment muddying the original request.\n\nThe `ResponseInfo` is a serializable fulfilled subset of a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) if set via `setResponse`. If no response was ever set this will be `null`.\n\n```ts\ninterface ResponseInfo {\n headers?: Record;\n ok?: boolean;\n redirected?: boolean;\n status?: HTTPStatusCode;\n statusText?: string;\n type?: 'basic' | 'cors';\n url?: string;\n}\n```\n\n
\n\n

Handling Requests

\n
\n { request(context, next): Promise | Future; }
\n\nRequests are fulfilled by handlers. A handler receives the request context\nas well as a `next` function with which to pass along a request to the next\nhandler if it so chooses.\n\nA handler may be any object with a `request` method. This allows both stateful and non-stateful\nhandlers to be utilized.\n\nIf a handler calls `next`, it receives a `Future` which resolves to a `StructuredDocument`\nthat it can then compose how it sees fit with its own response.\n\n```ts\n\ntype NextFn

= (req: RequestInfo) => Future

;\n\ninterface Handler {\n async request(context: RequestContext, next: NextFn

): T;\n}\n```\n\n`RequestContext` contains a readonly version of the RequestInfo as well as a few methods for building up the `StructuredDocument` and `Future` that will be part of the response.\n\n```ts\ninterface RequestContext {\n readonly request: RequestInfo;\nsetStream(stream: ReadableStream | Promise): void;\n setResponse(response: Response | ResponseInfo): void;\n}\n```\n\nA basic `fetch` handler with support for streaming content updates while\nthe download is still underway might look like the following, where we use\n[`response.clone()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/clone) to `tee` the `ReadableStream` into two streams.\n\nA more efficient handler might read from the response stream, building up the\nresponse content before passing along the chunk downstream.\n\n```ts\nconst FetchHandler = {\n async request(context) {\n const response = await fetch(context.request);\n context.setResponse(reponse);\n context.setStream(response.clone().body);\n return response.json();\n }\n}\n```\n\nRequest handlers are registered by configuring the manager via `use`\n\n```ts\nmanager.use([Handler1, Handler2])\n```\n\nHandlers will be invoked in the order they are registered (\"fifo\", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.\n\n

\n\n\n
\n Error Handling
\nEach handler in the chain can catch errors from upstream and choose to\n either handle the error, re-throw the error, or throw a new error.\n```ts\n const MAX_RETRIES = 5;\nconst Handler = {\n async request(context, next) {\n let attempts = 0;\n while (attempts < MAX_RETRIES) {\n attempts++;\n try {\n const response = await next(context.request);\n return response;\n } catch (e) {\n if (isTimeoutError(e) && attempts < MAX_RETRIES) {\n // retry request\n continue;\n }\n // rethrow if it is not a timeout error\n throw e;\n }\n }\n }\n }\n ```\n
\n\n
\n Handling Abort
\nAborting a request will reject the current handler in the chain. However,\n every handler can potentially catch this error. If your handler needs to\n separate AbortError from other Error types, it is recommended to check\n `context.request.signal.aborted` (or if a custom controller was supplied `controller.signal.aborted`).\nIn this manner it is possible for a request to recover from an abort and\n still proceed; however, as a best practice this should be used for necessary\n cleanup only and the original AbortError rethrown if the abort signal comes\n from the root controller.\n\n*AbortControllers are Always Present and Always Entangled**\nIf the initial request does not supply an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController), one will be generated.\nThe [signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) for this controller is automatically added to the request passed into the first handler.\nEach handler has the option to supply a new controller to the request when calling `next`. If a new controller is provided it will be automatically\n entangled with the root controller. If the root controller aborts, so will\n any entangled controllers.\nIf an entangled controller aborts, the root controller will not abort. This\n allows for advanced request-flow scenarios to abort subsections of the request tree without aborting the entire request.\n\n
\n\n\n
\n Stream Currying
\n\n`RequestManager.request` and `next` differ from `fetch` in one **crucial detail** in that the outer Promise resolves only once the response stream has been processed.\n\nFor context, it helps to understand a few of the use-cases that RequestManager\nis intended to allow.\n\n- to manage and return streaming content (such as video files)\n- to fulfill a request from multiple sources or by splitting one request into multiple requests\n - for instance one API call for a user and another for the user's friends\n - or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB\n etc.) and the rest from another source (a different API, a WebWorker, etc.)\n- to coalesce multiple requests\n- to decorate a request with additional info\n - e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.\n\n\n`await fetch()` resolves at the moment headers are received. This allows for the body of the request to be processed as a stream by application\ncode *while chunks are still being received by the browser*.\n\nWhen an app chooses to `await response.json()` what occurs is the browser reads the stream to completion and then returns the result. Additionally, this stream may only be read **once**.\n\nThe `RequestManager` preserves this ability to subscribe to and utilize the stream by either the application or the handler – thereby delivering the full power and flexibility of native APIs – without restricting developers in ways that lead to complicated workarounds.\n\nEach handler may call `setStream` only once, but may do so *at any time* until the promise that the handler returns has resolved. The associated promise returned by calling `future.getStream` will resolve with the stream set by `setStream` if that method is called, or `null` if that method\nhas not been called by the time that the handler's request method has resolved.\n\nHandlers that do not create a stream of their own, but which call `next`, should defensively pipe the stream forward. While this is not required (see automatic currying below) it is better to do so in most cases as otherwise the stream may not become available to downstream handlers or the application until the upstream handler has fully read it.\n\n```ts\ncontext.setStream(future.getStream());\n```\n\nHandlers that either call `next` multiple times or otherwise have reason to create multiple fetch requests should either choose to return no stream, meaningfully combine the streams, or select a single prioritized stream.\n\nOf course, any handler may choose to read and handle the stream, and return either no stream or a different stream in the process.\n\n
\n\n
\n Automatic Currying of Stream and Response
\n\nIn order to simplify the common case for handlers which decorate a request, if `next` is called only a single time and `setResponse` was never called by the handler, the response set by the next handler in the chain will be applied to that handler's outcome. For instance, this makes the following pattern possible `return (await next()).content;`.\n\nSimilarly, if `next` is called only a single time and neither `setStream` nor `getStream` was called, we automatically curry the stream from the future returned by `next` onto the future returned by the handler.\n\nFinally, if the return value of a handler is a `Future`, we curry `content` and `errors` as well, thus enabling the simplest form `return next()`.\n\nIn the case of the `Future` being returned, `Stream` proxying is automatic and immediate and does not wait for the `Future` to resolve.\n\n
\n\n### Using as a Service\n\nMost applications will desire to have a single `RequestManager` instance, which can be achieved using module-state patterns for singletons, or for [Ember](https://emberjs.com) applications by exporting the manager as a [service](https://guides.emberjs.com/release/services/).\n\nservices/request.ts*\n```ts\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\nimport Auth from 'ember-simple-auth/ember-data-handler';\n\nexport default class extends RequestManager {\n constructor(createArgs) {\n super(createArgs);\n this.use([Auth, Fetch]);\n }\n}\n```\n\n### Using with `@ember-data/store`\n\nTo have a request service unique to a Store:\n\n```ts\nimport Store, { CacheHandler } from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\n\nclass extends Store {\n requestManager = new RequestManager();\nconstructor(args) {\n super(args);\n this.requestManager.use([Fetch]);\n this.requestManager.useCache(CacheHandler);\n }\n}\n```\n\n### Using with `ember-data`\n\nIf using the package [ember-data](https://github.com/emberjs/data/tree/main/packages/-ember-data), the following configuration will automatically be done in order to preserve the legacy [Adapter](https://github.com/emberjs/data/tree/main/packages/adapter) and [Serializer](https://github.com/emberjs/data/tree/main/packages/serializer) behavior. Additional handlers or a service injection like the above would need to be done by the consuming application in order to make broader use of `RequestManager`.\n\n```ts\nimport Store, { CacheHandler } from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport { LegacyNetworkHandler } from '@ember-data/legacy-compat';\n\nexport default class extends Store {\n requestManager = new RequestManager();\nconstructor(args) {\n super(args);\n this.requestManager.use([LegacyNetworkHandler]);\n this.requestManager.useCache(CacheHandler);\n }\n}\n```\n\nBecause the application's store service (if present) will override the store supplied by `ember-data`, all that is required to define your own ordering and handlers is to supply a store service extending from `@ember-data/store` and configure as shown above.\n\nFor usage of the store's `requestManager` via `store.request()` see the [Store](https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fstore) documentation.", - "itemtype": "main" - }, - "@ember-data/request/fetch": { - "name": "@ember-data/request/fetch", - "submodules": {}, - "elements": {}, - "classes": { - "Fetch": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../request/src/fetch.ts", - "line": 25, - "description": "A basic Fetch Handler which converts a request into a\n`fetch` call presuming the response to be `json`.\n\n```ts\nimport Fetch from '@ember-data/request/fetch';\n\nmanager.use([Fetch]);\n```", - "itemtype": "main" - }, - "@ember-data/serializer": { - "name": "@ember-data/serializer", - "submodules": {}, - "elements": {}, - "classes": { - "BooleanTransform": 1, - "DateTransform": 1, - "NumberTransform": 1, - "StringTransform": 1, - "Transform": 1, - "Serializer": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/index.ts", - "line": 115, - "description": "## Overview\n\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new serializer, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\nIn order to properly manage and present your data, EmberData\nneeds to understand the structure of data it receives.\n\n`Serializers` convert data between the server's API format and\nthe format EmberData understands.\n\nData received from an API response is **normalized** into\n[JSON:API](https://jsonapi.org/) (the format used internally\nby EmberData), while data sent to an API is **serialized**\ninto the format the API expects.\n\n### Implementing a Serializer\n\nThere are only two required serializer methods, one for\nnormalizing data from the server API format into JSON:API, and\nanother for serializing records via `Snapshots` into the expected\nserver API format.\n\nTo implement a serializer, export a class that conforms to the structure\ndescribed by [ Serializer](/ember-data/release/classes/%3CInterface%3E%20Serializer)\nfrom the `app/serializers/` directory. An example is below.\n\n```ts\nimport EmberObject from '@ember/object';\n\nexport default class ApplicationSerializer extends EmberObject {\n normalizeResponse(store, schema, rawPayload) {\n return rawPayload;\n }\n\n serialize(snapshot, options) {\n const serializedResource = {\n id: snapshot.id,\n type: snapshot.modelName,\n attributes: snapshot.attributes()\n };\n\n return serializedResource;\n }\n}\n ```\n\n\n### Serializer Resolution\n\n`store.serializerFor(name)` will lookup serializers defined in\n`app/serializers/` and return an instance. If no serializer is found, an\nerror will be thrown.\n\n`serializerFor` first attempts to find a serializer with an exact match on `name`,\nthen falls back to checking for the presence of a serializer named `application`.\n\n```ts\nstore.serializerFor('author');\n\n// lookup paths (in order) =>\n// app/serializers/author.js\n// app/serializers/application.js\n```\n\nMost requests in EmberData are made with respect to a particular `type` (or `modelName`)\n(e.g., \"get me the full collection of **books**\" or \"get me the **employee** whose id is 37\"). We\nrefer to this as the **primary** resource `type`.\n\nTypically `serializerFor` will be used to find a serializer with a name matching that of the primary\nresource `type` for the request, falling back to the `application` serializer for those types that\ndo not have a defined serializer. This is often described as a `per-model` or `per-type` strategy\nfor defining serializers. However, because APIs rarely format payloads per-type but rather\nper-API-version, this may not be a desired strategy.\n\nIt is recommended that applications define only a single `application` adapter and serializer\nwhere possible.\n\nIf you have multiple API formats and the per-type strategy is not viable, one strategy is to\nwrite an `application` adapter and serializer that make use of `options` to specify the desired\nformat when making a request.\n\n### Using a Serializer\n\nAny serializer in `app/serializers/` can be looked up by `name` using `store.serializerFor(name)`.\n\n### Default Serializers\n\nFor applications whose APIs are *very close to* or *exactly* the **REST** format or **JSON:API**\nformat the `@ember-data/serializer` package contains implementations these applications can\nextend. It also contains a simple `JSONSerializer` for serializing to/from very basic JSON objects.\n\nMany applications will find writing their own serializer to be more performant and less\ncomplex than extending these classes even when their API format is very close to that expected\nby these serializers.\n\nIt is recommended that apps write their own serializer to best suit the needs of their API and\napplication.", - "itemtype": "main" - }, - "@ember-data/serializer/rest": { - "name": "@ember-data/serializer/rest", - "submodules": {}, - "elements": {}, - "classes": { - "EmbeddedRecordsMixin": 1, - "RESTSerializer": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/rest.js", - "line": 18, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n Normally, applications will use the `RESTSerializer` by implementing\n the `normalize` method.\n\n This allows you to do whatever kind of munging you need and is\n especially useful if your server is inconsistent and you need to\n do munging differently for many different kinds of responses.\n\n See the `normalize` documentation for more information.\n\n ## Across the Board Normalization\n\n There are also a number of hooks that you might find useful to define\n across-the-board rules for your payload. These rules will be useful\n if your server is consistent, or if you're building an adapter for\n an infrastructure service, like Firebase, and want to encode service\n conventions.\n\n For example, if all of your keys are underscored and all-caps, but\n otherwise consistent with the names you use in your models, you\n can implement across-the-board rules for how to convert an attribute\n name in your model to a key in your JSON.\n\n ```app/serializers/application.js\n import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '/utils/string-utils';\n\n export default class ApplicationSerializer extends RESTSerializer {\n keyForAttribute(attr, method) {\n return underscore(attr).toUpperCase();\n }\n }\n ```\n\n You can also implement `keyForRelationship`, which takes the name\n of the relationship as the first parameter, the kind of\n relationship (`hasMany` or `belongsTo`) as the second parameter, and\n the method (`serialize` or `deserialize`) as the third parameter.", - "itemtype": "main" - }, - "@ember-data/serializer/json-api": { - "name": "@ember-data/serializer/json-api", - "submodules": {}, - "elements": {}, - "classes": { - "JSONAPISerializer": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/json-api.js", - "line": 13, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.\n\n This serializer normalizes a JSON API payload that looks like:\n\n ```app/models/player.js\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n export default class Player extends Model {", - "attr": "('string') location;", - "belongsto": "('club') club;\n }\n ```\n\n ```app/models/club.js\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Club extends Model {", - "hasmany": "('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```", - "itemtype": "main" - }, - "@ember-data/serializer/json": { - "name": "@ember-data/serializer/json", - "submodules": {}, - "elements": {}, - "classes": { - "JSONSerializer": 1 - }, - "fors": {}, - "namespaces": {}, - "tag": "main", - "file": "../serializer/src/json.js", - "line": 16, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n By default, EmberData uses and recommends the `JSONAPISerializer`.\n\n `JSONSerializer` is useful for simpler or legacy backends that may\n not support the http://jsonapi.org/ spec.\n\n For example, given the following `User` model and JSON payload:\n\n ```app/models/user.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\n export default class UserModel extends Model {", - "hasmany": "('user') friends;", - "belongsto": "('location') house;", - "attr": "('string') name;\n }\n ```\n\n ```js\n {\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n }\n ```\n\n `JSONSerializer` will normalize the JSON payload to the JSON API format that the\n Ember Data store expects.\n\n You can customize how JSONSerializer processes its payload by passing options in\n the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\n The `JSONSerializer` normalization process follows these steps:\n\n 1. `normalizeResponse`\n - entry method to the serializer.\n 2. `normalizeCreateRecordResponse`\n - a `normalizeResponse` for a specific operation is called.\n 3. `normalizeSingleResponse`|`normalizeArrayResponse`\n - for methods like `createRecord` we expect a single record back, while for methods like `findAll` we expect multiple records back.\n 4. `normalize`\n - `normalizeArrayResponse` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n 5. `extractId` | `extractAttributes` | `extractRelationships`\n - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.", - "itemtype": "main" - }, - "@ember-data/tracking": { - "name": "@ember-data/tracking", - "submodules": {}, - "elements": {}, - "classes": { - "@ember-data/tracking": 1 - }, - "fors": { - "@ember-data/tracking": 1 - }, - "namespaces": {}, - "tag": "main", - "file": "../tracking/src/-private.ts", - "line": 1, - "description": "This package provides primitives that allow powerful low-level\nadjustments to change tracking notification behaviors.\n\nTypically you want to use these primitives when you want to divorce\nproperty accesses on EmberData provided objects from the current\ntracking context. Typically this sort of thing occurs when serializing\ntracked data to send in a request: the data itself is often ancillary\nto the thing which triggered the request in the first place and you\nwould not want to re-trigger the request for any update to the data.", - "itemtype": "main" - } - }, - "classes": { - " Cache": { - "name": " Cache", - "shortname": " Cache", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/experimental-preview-types", - "namespace": "", - "file": "../../ember-data-types/cache/cache.ts", - "line": 16, - "description": "The interface for EmberData Caches.\n\nA Cache handles in-memory storage of Document and Resource\ndata.", - "access": "public", - "tagname": "" - }, - "CacheStoreWrapper": { - "name": "CacheStoreWrapper", - "shortname": "CacheStoreWrapper", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../../ember-data-types/q/cache-store-wrapper.ts", - "line": 12, - "description": "CacheStoreWrapper provides encapsulated API access to the minimal\nsubset of the Store's functionality that Cache implementations\nshould interact with. It is provided to the Store's `createRecordDataFor`\nand `createCache` hooks.\n\nCache implementations should not need more than this API provides.\n\nThis class cannot be directly instantiated.", - "access": "public", - "tagname": "" - }, - "StableRecordIdentifier": { - "name": "StableRecordIdentifier", - "shortname": "StableRecordIdentifier", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../../ember-data-types/q/identifier.ts", - "line": 85, - "description": "A referentially stable object with a unique string (lid) that can be used\nas a reference to data in the cache.\n\nEvery record instance has a unique identifier, and identifiers may refer\nto data that has never been loaded (for instance, in an async relationship).", - "access": "public", - "tagname": "" - }, - "@ember-data/store": { - "name": "@ember-data/store", - "shortname": "@ember-data/store", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "" - }, - " Adapter": { - "name": " Adapter", - "shortname": " Adapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/experimental-preview-types", - "namespace": "", - "file": "../../ember-data-types/q/minimum-adapter-interface.ts", - "line": 19, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n The following documentation describes the methods an\n adapter should implement with descriptions around when an\n application might expect these methods to be called.\n\n Methods that are not required are marked as **optional**.", - "access": "public", - "tagname": "" - }, - " Serializer": { - "name": " Serializer", - "shortname": " Serializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/experimental-preview-types", - "namespace": "", - "file": "../../ember-data-types/q/minimum-serializer-interface.ts", - "line": 26, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n The following documentation describes the methods an application\n serializer should implement with descriptions around when an\n application might expect these methods to be called.\n\n Methods that are not required are marked as **optional**.", - "access": "public", - "tagname": "" - }, - "SchemaService": { - "name": "SchemaService", - "shortname": "SchemaService", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../../ember-data-types/q/schema-service.ts", - "line": 8, - "description": "A SchemaDefinitionService implementation provides the ability\nto query for various information about a resource in an abstract manner.\n\nHow an implementation determines this information is left up to the implementation,\nthis means that schema information could be lazily populated, derived-on-demand,\nor progressively enhanced during the course of an application's runtime.\n\nThe implementation provided to work with `@ember-data/model` makes use of the\nstatic schema properties on those classes to respond to these queries; however,\nthat is not a necessary approach. For instance, Schema information could be sideloaded\nor pre-flighted for API calls, resulting in no need to bundle and ship potentially\nlarge and expensive JSON or JS schemas to pull information from.\n\nTo register a custom schema implementation, extend the store service or\nlookup and register the schema service first thing on app-boot. Example below\nshows extending the service.\n\n```ts\nimport Store from '@ember-data/store';\nimport CustomSchemas from './custom-schemas';\n\nexport default class extends Store {\n constructor(...args) {\n super(...args);\n this.registerSchemaDefinitionService(new CustomSchemas());\n }\n}\n```\n\nAt runtime, both the `Store` and the `StoreWrapper` provide\naccess to this service via the `getSchemaDefinitionService()` method.\n\n```ts\nexport default class extends Component {", - "service": "store;\n\n get attributes() {\n return this.store\n .getSchemaDefinitionService()\n .attributesDefinitionFor(this.args.dataType);\n }\n}\n```\n\nThis is not a class and cannot be instantiated.", - "access": "public", - "tagname": "" - }, - "BuildURLMixin": { - "name": "BuildURLMixin", - "shortname": "BuildURLMixin", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [ - "RESTAdapter" - ], - "module": "@ember-data/adapter", - "namespace": "", - "file": "../adapter/src/-private/build-url-mixin.ts", - "line": 119, - "description": "## Using BuildURLMixin\n\nTo use URL building, include the mixin when extending an adapter, and call `buildURL` where needed.\nThe default behaviour is designed for RESTAdapter.\n\n### Example\n\n```javascript\nimport Adapter, { BuildURLMixin } from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n findRecord(store, type, id, snapshot) {\n var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');\n return this.ajax(url, 'GET');\n }\n}\n```\n\n### Attributes\n\nThe `host` and `namespace` attributes will be used if defined, and are optional.", - "access": "public", - "tagname": "" - }, - "AdapterError": { - "name": "AdapterError", - "shortname": "AdapterError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 6, - "description": "## Overview\n\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\nAn `AdapterError` is used by an adapter to signal that an error occurred\nduring a request to an external API. It indicates a generic error, and\nsubclasses are used to indicate specific error states.\n\nTo create a custom error to signal a specific error state in communicating\nwith an external API, extend the `AdapterError`. For example, if the\nexternal API exclusively used HTTP `503 Service Unavailable` to indicate\nit was closed for maintenance:\n\n```app/adapters/maintenance-error.js\nimport AdapterError from '@ember-data/adapter/error';\n\nexport default AdapterError.extend({ message: \"Down for maintenance.\" });\n```\n\nThis error would then be returned by an adapter's `handleResponse` method:\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\nimport MaintenanceError from './maintenance-error';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n handleResponse(status) {\n if (503 === status) {\n return new MaintenanceError();\n }\n\n return super.handleResponse(...arguments);\n }\n}\n```\n\nAnd can then be detected in an application and used to send the user to an\n`under-maintenance` route:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport MaintenanceError from '../adapters/maintenance-error';\n\nexport default class ApplicationRoute extends Route {\n actions: {\n error(error, transition) {\n if (error instanceof MaintenanceError) {\n this.transitionTo('under-maintenance');\n return;\n }\n\n // ...other error handling logic\n }\n }\n}\n```", - "mainName": "@ember-data/adapter/error", - "tag": "main", - "itemtype": "main", - "_main": true, - "access": "public", - "tagname": "" - }, - "InvalidError": { - "name": "InvalidError", - "shortname": "InvalidError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 119, - "description": "A `InvalidError` is used by an adapter to signal the external API\nwas unable to process a request because the content was not\nsemantically correct or meaningful per the API. Usually, this means a\nrecord failed some form of server-side validation. When a promise\nfrom an adapter is rejected with a `InvalidError` the record will\ntransition to the `invalid` state and the errors will be set to the\n`errors` property on the record.\n\nFor Ember Data to correctly map errors to their corresponding\nproperties on the model, Ember Data expects each error to be\na valid JSON-API error object with a `source/pointer` that matches\nthe property name. For example, if you had a Post model that\nlooked like this.\n\n```app/models/post.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "attr": "('string') content;\n}\n```\n\nTo show an error from the server related to the `title` and\n`content` properties your adapter could return a promise that\nrejects with a `InvalidError` object that looks like this:\n\n```app/adapters/post.js\nimport RSVP from 'RSVP';\nimport RESTAdapter from '@ember-data/adapter/rest';\nimport { InvalidError } from '@ember-data/adapter/error';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n updateRecord() {\n // Fictional adapter that always rejects\n return RSVP.reject(new InvalidError([\n {\n detail: 'Must be unique',\n source: { pointer: '/data/attributes/title' }\n },\n {\n detail: 'Must not be blank',\n source: { pointer: '/data/attributes/content'}\n }\n ]));\n }\n}\n```\n\nYour backend may use different property names for your records the\nstore will attempt to extract and normalize the errors using the\nserializer's `extractErrors` method before the errors get added to\nthe model. As a result, it is safe for the `InvalidError` to\nwrap the error payload unaltered.", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "TimeoutError": { - "name": "TimeoutError", - "shortname": "TimeoutError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 183, - "description": "A `TimeoutError` is used by an adapter to signal that a request\nto the external API has timed out. I.e. no response was received from\nthe external API within an allowed time period.\n\nAn example use case would be to warn the user to check their internet\nconnection if an adapter operation has timed out:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { TimeoutError } from '@ember-data/adapter/error';\nimport { action } from '@ember/object';\n\nexport default class ApplicationRoute extends Route {", - "action": "error(error, transition) {\n if (error instanceof TimeoutError) {\n // alert the user\n alert('Are you still connected to the Internet?');\n return;\n }\n\n // ...other error handling logic\n }\n}\n```", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "AbortError": { - "name": "AbortError", - "shortname": "AbortError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 217, - "description": "A `AbortError` is used by an adapter to signal that a request to\nthe external API was aborted. For example, this can occur if the user\nnavigates away from the current page after a request to the external API\nhas been initiated but before a response has been received.", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "UnauthorizedError": { - "name": "UnauthorizedError", - "shortname": "UnauthorizedError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 230, - "description": "A `UnauthorizedError` equates to a HTTP `401 Unauthorized` response\nstatus. It is used by an adapter to signal that a request to the external\nAPI was rejected because authorization is required and has failed or has not\nyet been provided.\n\nAn example use case would be to redirect the user to a login route if a\nrequest is unauthorized:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport { UnauthorizedError } from '@ember-data/adapter/error';\nimport { action } from '@ember/object';\n\nexport default class ApplicationRoute extends Route {", - "action": "error(error, transition) {\n if (error instanceof UnauthorizedError) {\n // go to the login route\n this.transitionTo('login');\n return;\n }\n\n // ...other error handling logic\n }\n}\n```", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "ForbiddenError": { - "name": "ForbiddenError", - "shortname": "ForbiddenError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 265, - "description": "A `ForbiddenError` equates to a HTTP `403 Forbidden` response status.\nIt is used by an adapter to signal that a request to the external API was\nvalid but the server is refusing to respond to it. If authorization was\nprovided and is valid, then the authenticated user does not have the\nnecessary permissions for the request.", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "NotFoundError": { - "name": "NotFoundError", - "shortname": "NotFoundError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 279, - "description": "A `NotFoundError` equates to a HTTP `404 Not Found` response status.\nIt is used by an adapter to signal that a request to the external API\nwas rejected because the resource could not be found on the API.\n\nAn example use case would be to detect if the user has entered a route\nfor a specific model that does not exist. For example:\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\nimport { NotFoundError } from '@ember-data/adapter/error';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\n\nexport default class PostRoute extends Route {", - "service": "store;\n model(params) {\n return this.store.findRecord('post', params.post_id);\n }", - "action": "error(error, transition) {\n if (error instanceof NotFoundError) {\n // redirect to a list of all posts instead\n this.transitionTo('posts');\n } else {\n // otherwise let the error bubble\n return true;\n }\n }\n}\n```", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "ConflictError": { - "name": "ConflictError", - "shortname": "ConflictError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 318, - "description": "A `ConflictError` equates to a HTTP `409 Conflict` response status.\nIt is used by an adapter to indicate that the request could not be processed\nbecause of a conflict in the request. An example scenario would be when\ncreating a record with a client-generated ID but that ID is already known\nto the external API.", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "ServerError": { - "name": "ServerError", - "shortname": "ServerError", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/error", - "namespace": "", - "file": "../adapter/src/error.js", - "line": 332, - "description": "A `ServerError` equates to a HTTP `500 Internal Server Error` response\nstatus. It is used by the adapter to indicate that a request has failed\nbecause of an error in the external API.", - "access": "public", - "tagname": "", - "extends": "AdapterError" - }, - "Adapter": { - "name": "Adapter", - "shortname": "Adapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter", - "namespace": "", - "file": "../adapter/src/index.ts", - "line": 197, - "description": "An adapter is an object that receives requests from a store and\ntranslates them into the appropriate action to take against your\npersistence layer. The persistence layer is usually an HTTP API but\nmay be anything, such as the browser's local storage. Typically the\nadapter is not invoked directly instead its functionality is accessed\nthrough the `store`.\n\n> ⚠️ CAUTION you likely want the docs for [ Adapter](/ember-data/release/classes/%3CInterface%3E%20Adapter)\n> as extending this abstract class is unnecessary.\n\n### Creating an Adapter\n\nCreate a new subclass of `Adapter` in the `app/adapters` folder:\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\n\nexport default Adapter.extend({\n // ...your code here\n});\n```\n\nModel-specific adapters can be created by putting your adapter\nclass in an `app/adapters/` + `model-name` + `.js` file of the application.\n\n```app/adapters/post.js\nimport Adapter from '@ember-data/adapter';\n\nexport default Adapter.extend({\n // ...Post-specific adapter code goes here\n});\n```\n\n`Adapter` is an abstract base class that you should override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:\n\n * `findRecord()`\n * `createRecord()`\n * `updateRecord()`\n * `deleteRecord()`\n * `findAll()`\n * `query()`\n\nTo improve the network performance of your application, you can optimize\nyour adapter by overriding these lower-level methods:\n\n * `findMany()`\n\n\nFor an example of the implementation, see `RESTAdapter`, the\nincluded REST adapter.", - "access": "public", - "tagname": "", - "extends": "Ember.EmberObject" - }, - "JSONAPIAdapter": { - "name": "JSONAPIAdapter", - "shortname": "JSONAPIAdapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/json-api", - "namespace": "", - "file": "../adapter/src/json-api.ts", - "line": 18, - "description": "## Overview\n\n
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\nThe `JSONAPIAdapter` is an adapter whichtransforms the store's\nrequests into HTTP requests that follow the [JSON API format](http://jsonapi.org/format/).\n\n## JSON API Conventions\n\nThe JSONAPIAdapter uses JSON API conventions for building the URL\nfor a record and selecting the HTTP verb to use with a request. The\nactions you can take on a record map onto the following URLs in the\nJSON API adapter:\n\n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n
\n Action\n \n HTTP Verb\n \n URL\n
\n `store.findRecord('post', 123)`\n \n GET\n \n /posts/123\n
\n `store.findAll('post')`\n \n GET\n \n /posts\n
\n Update `postRecord.save()`\n \n PATCH\n \n /posts/123\n
\n Create `store.createRecord('post').save()`\n \n POST\n \n /posts\n
\n Delete `postRecord.destroyRecord()`\n \n DELETE\n \n /posts/123\n
\n\n## Success and failure\n\nThe JSONAPIAdapter will consider a success any response with a\nstatus code of the 2xx family (\"Success\"), as well as 304 (\"Not\nModified\"). Any other status code will be considered a failure.\n\nOn success, the request promise will be resolved with the full\nresponse payload.\n\nFailed responses with status code 422 (\"Unprocessable Entity\") will\nbe considered \"invalid\". The response will be discarded, except for\nthe `errors` key. The request promise will be rejected with a\n`InvalidError`. This error object will encapsulate the saved\n`errors` value.\n\nAny other status codes will be treated as an adapter error. The\nrequest promise will be rejected, similarly to the invalid case,\nbut with an instance of `AdapterError` instead.\n\n### Endpoint path customization\n\nEndpoint paths can be prefixed with a `namespace` by setting the\nnamespace property on the adapter:\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n namespace = 'api/1';\n}\n```\nRequests for the `person` model would now target `/api/1/people/1`.\n\n### Host customization\n\nAn adapter can target other hosts by setting the `host` property.\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n host = 'https://api.example.com';\n}\n```\n\nRequests for the `person` model would now target\n`https://api.example.com/people/1`.", - "since": "1.13.0", - "mainName": "@ember-data/adapter/json-api", - "tag": "main", - "itemtype": "main", - "_main": true, - "access": "public", - "tagname": "", - "is_constructor": 1, - "extends": "RESTAdapter" - }, - "RESTAdapter": { - "name": "RESTAdapter", - "shortname": "RESTAdapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/rest", - "namespace": "", - "file": "../adapter/src/rest.ts", - "line": 68, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n The REST adapter allows your store to communicate with an HTTP server by\n transmitting JSON via XHR.\n\n This adapter is designed around the idea that the JSON exchanged with\n the server should be conventional. It builds URLs in a manner that follows\n the structure of most common REST-style web services.\n\n ## Success and failure\n\n The REST adapter will consider a success any response with a status code\n of the 2xx family (\"Success\"), as well as 304 (\"Not Modified\"). Any other\n status code will be considered a failure.\n\n On success, the request promise will be resolved with the full response\n payload.\n\n Failed responses with status code 422 (\"Unprocessable Entity\") will be\n considered \"invalid\". The response will be discarded, except for the\n `errors` key. The request promise will be rejected with a `InvalidError`.\n This error object will encapsulate the saved `errors` value.\n\n Any other status codes will be treated as an \"adapter error\". The request\n promise will be rejected, similarly to the \"invalid\" case, but with\n an instance of `AdapterError` instead.\n\n ## JSON Structure\n\n The REST adapter expects the JSON returned from your server to follow\n these conventions.\n\n ### Object Root\n\n The JSON payload should be an object that contains the record inside a\n root property. For example, in response to a `GET` request for\n `/posts/1`, the JSON should look like this:\n\n ```js\n {\n \"posts\": {\n \"id\": 1,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\"\n }\n }\n ```\n\n Similarly, in response to a `GET` request for `/posts`, the JSON should\n look like this:\n\n ```js\n {\n \"posts\": [\n {\n \"id\": 1,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\"\n },\n {\n \"id\": 2,\n \"title\": \"Rails is omakase\",\n \"author\": \"D2H\"\n }\n ]\n }\n ```\n\n Note that the object root can be pluralized for both a single-object response\n and an array response: the REST adapter is not strict on this. Further, if the\n HTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a\n `findRecord` query) with more than one object in the array, Ember Data will\n only display the object with the matching ID.\n\n ### Conventional Names\n\n Attribute names in your JSON payload should be the camelCased versions of\n the attributes in your Ember.js models.\n\n For example, if you have a `Person` model:\n\n ```app/models/person.js\n import Model, { attr } from '@ember-data/model';\n\n export default Model.extend({\n firstName: attr('string'),\n lastName: attr('string'),\n occupation: attr('string')\n });\n ```\n\n The JSON returned should look like this:\n\n ```js\n {\n \"people\": {\n \"id\": 5,\n \"firstName\": \"Zaphod\",\n \"lastName\": \"Beeblebrox\",\n \"occupation\": \"President\"\n }\n }\n ```\n\n #### Relationships\n\n Relationships are usually represented by ids to the record in the\n relationship. The related records can then be sideloaded in the\n response under a key for the type.\n\n ```js\n {\n \"posts\": {\n \"id\": 5,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\",\n \"comments\": [1, 2]\n },\n \"comments\": [{\n \"id\": 1,\n \"author\": \"User 1\",\n \"message\": \"First!\",\n }, {\n \"id\": 2,\n \"author\": \"User 2\",\n \"message\": \"Good Luck!\",\n }]\n }\n ```\n\n If the records in the relationship are not known when the response\n is serialized it's also possible to represent the relationship as a\n URL using the `links` key in the response. Ember Data will fetch\n this URL to resolve the relationship when it is accessed for the\n first time.\n\n ```js\n {\n \"posts\": {\n \"id\": 5,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\",\n \"links\": {\n \"comments\": \"/posts/5/comments\"\n }\n }\n }\n ```\n\n ### Errors\n\n If a response is considered a failure, the JSON payload is expected to include\n a top-level key `errors`, detailing any specific issues. For example:\n\n ```js\n {\n \"errors\": {\n \"msg\": \"Something went wrong\"\n }\n }\n ```\n\n This adapter does not make any assumptions as to the format of the `errors`\n object. It will simply be passed along as is, wrapped in an instance\n of `InvalidError` or `AdapterError`. The serializer can interpret it\n afterwards.\n\n ## Customization\n\n ### Endpoint path customization\n\n Endpoint paths can be prefixed with a `namespace` by setting the namespace\n property on the adapter:\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n namespace = 'api/1';\n }\n ```\n Requests for the `Person` model would now target `/api/1/people/1`.\n\n ### Host customization\n\n An adapter can target other hosts by setting the `host` property.\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n\n export default class ApplicationAdapter extends RESTAdapter {\n host = 'https://api.example.com';\n }\n ```\n\n ### Headers customization\n\n Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary\n headers can be set as key/value pairs on the `RESTAdapter`'s `headers`\n object and Ember Data will send them along with each ajax request.\n\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n headers: computed(function() {\n return {\n 'API_KEY': 'secret key',\n 'ANOTHER_HEADER': 'Some header value'\n };\n }\n }\n ```\n\n `headers` can also be used as a computed property to support dynamic\n headers. In the example below, the `session` object has been\n injected into an adapter by Ember's container.\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n headers: computed('session.authToken', function() {\n return {\n 'API_KEY': this.session.authToken,\n 'ANOTHER_HEADER': 'Some header value'\n };\n })\n }\n ```\n\n In some cases, your dynamic headers may require data from some\n object outside of Ember's observer system (for example\n `document.cookie`). You can use the\n [volatile](/api/classes/Ember.ComputedProperty.html?anchor=volatile)\n function to set the property into a non-cached mode causing the headers to\n be recomputed with every request.\n\n ```app/adapters/application.js\n import RESTAdapter from '@ember-data/adapter/rest';\n import { computed } from '@ember/object';\n\n export default class ApplicationAdapter extends RESTAdapter {\n headers: computed(function() {\n return {\n 'API_KEY': document.cookie.match(/apiKey\\=([^;]*)/)['1'],\n 'ANOTHER_HEADER': 'Some header value'\n };\n }).volatile()\n }\n ```", - "mainName": "@ember-data/adapter/rest", - "tag": "main", - "itemtype": "main", - "_main": true, - "access": "public", - "tagname": "", - "is_constructor": 1, - "extends": "Adapter", - "uses": [ - "BuildURLMixin" - ] - }, - "@ember-data/adapter/rest": { - "name": "@ember-data/adapter/rest", - "shortname": "@ember-data/adapter/rest", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/adapter/rest", - "namespace": "" - }, - "InspectorDataAdapter": { - "name": "InspectorDataAdapter", - "shortname": "InspectorDataAdapter", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/debug", - "namespace": "", - "file": "../debug/addon/index.js", - "line": 46, - "description": "Implements `@ember/debug/data-adapter` with for EmberData\nintegration with the ember-inspector.", - "extends": "DataAdapter", - "access": "private", - "tagname": "" - }, - "Cache": { - "name": "Cache", - "shortname": "Cache", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/json-api", - "namespace": "", - "file": "../json-api/src/-private/cache.ts", - "line": 84, - "description": "A JSON:API Cache implementation.\n\nWhat cache the store uses is configurable. Using a different\nimplementation can be achieved by implementing the store's\ncreateCache hook.\n\nThis is the cache implementation used by `ember-data`.\n\n```js\nimport Cache from '@ember-data/json-api';\nimport Store from '@ember-data/store';\n\nexport default class extends Store {\n createCache(wrapper) {\n return new Cache(wrapper);\n }\n}\n```", - "access": "public", - "tagname": "" - }, - "SnapshotRecordArray": { - "name": "SnapshotRecordArray", - "shortname": "SnapshotRecordArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/legacy-compat", - "namespace": "", - "file": "../legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 12, - "description": "SnapshotRecordArray is not directly instantiable.\nInstances are provided to consuming application's\nadapters for certain requests.", - "access": "public", - "tagname": "" - }, - "Snapshot": { - "name": "Snapshot", - "shortname": "Snapshot", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 21, - "description": "Snapshot is not directly instantiable.\nInstances are provided to a consuming application's\nadapters and serializers for certain requests.\n\nSnapshots are only available when using `@ember-data/legacy-compat`\nfor legacy compatibility with adapters and serializers.", - "access": "public", - "tagname": "" - }, - "BelongsToReference": { - "name": "BelongsToReference", - "shortname": "BelongsToReference", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/references/belongs-to.ts", - "line": 42, - "description": "A `BelongsToReference` is a low-level API that allows users and\naddon authors to perform meta-operations on a belongs-to\nrelationship.", - "access": "public", - "tagname": "" - }, - "HasManyReference": { - "name": "HasManyReference", - "shortname": "HasManyReference", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/references/has-many.ts", - "line": 45, - "description": "A `HasManyReference` is a low-level API that allows users and addon\nauthors to perform meta-operations on a has-many relationship.", - "access": "public", - "tagname": "", - "extends": "Reference" - }, - "@ember-data/model": { - "name": "@ember-data/model", - "shortname": "@ember-data/model", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "" - }, - "Errors": { - "name": "Errors", - "shortname": "Errors", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/errors.ts", - "line": 30, - "description": "Holds validation errors for a given record, organized by attribute names.\n\nThis class is not directly instantiable.\n\nEvery `Model` has an `errors` property that is an instance of\n`Errors`. This can be used to display validation error\nmessages returned from the server when a `record.save()` rejects.\n\nFor Example, if you had a `User` model that looked like this:\n\n```app/models/user.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "attr": "('string') email;\n}\n```\nAnd you attempted to save a record that did not validate on the backend:\n\n```javascript\nlet user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n});\nuser.save();\n```\n\nYour backend would be expected to return an error response that described\nthe problem, so that error messages can be generated on the app.\n\nAPI responses will be translated into instances of `Errors` differently,\ndepending on the specific combination of adapter and serializer used. You\nmay want to check the documentation or the source code of the libraries\nthat you are using, to know how they expect errors to be communicated.\n\nErrors can be displayed to the user by accessing their property name\nto get an array of all the error objects for that property. Each\nerror object is a JavaScript object with two keys:\n\n- `message` A string containing the error message from the backend\n- `attribute` The name of the property associated with this error message\n\n```handlebars\n\n{{#each @model.errors.username as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n\n\n{{#each @model.errors.email as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\nYou can also access the special `messages` property on the error\nobject to get an array of all the error strings.\n\n```handlebars\n{{#each @model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", - "access": "public", - "tagname": "", - "extends": "Ember.ArrayProxy" - }, - "ManyArray": { - "name": "ManyArray", - "shortname": "ManyArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../model/src/-private/many-array.ts", - "line": 43, - "description": "A `ManyArray` is a `MutableArray` that represents the contents of a has-many\nrelationship.\n\nThe `ManyArray` is instantiated lazily the first time the relationship is\nrequested.\n\nThis class is not intended to be directly instantiated by consuming applications.\n\n### Inverses\n\nOften, the relationships in Ember Data applications will have\nan inverse. For example, imagine the following models are\ndefined:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment') comments;\n}\n```\n\n```app/models/comment.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "belongsto": "('post') post;\n}\n```\n\nIf you created a new instance of `Post` and added\na `Comment` record to its `comments` has-many\nrelationship, you would expect the comment's `post`\nproperty to be set to the post that contained\nthe has-many.\n\nWe call the record to which a relationship belongs-to the\nrelationship's _owner_.", - "access": "public", - "tagname": "" - }, - "Model": { - "name": "Model", - "shortname": "Model", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/model.js", - "line": 100, - "description": "Base class from which Models can be defined.\n\n```js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class User extends Model {", - "attr": "name;\n}\n```", - "access": "public", - "tagname": "", - "extends": "Ember.EmberObject" - }, - "PromiseBelongsTo": { - "name": "PromiseBelongsTo", - "shortname": "PromiseBelongsTo", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/promise-belongs-to.ts", - "line": 38, - "description": "A PromiseBelongsTo is a PromiseObject that also proxies certain method calls\nto the underlying belongsTo model.\nRight now we proxy:\n * `reload()`", - "extends": "PromiseObject", - "access": "private", - "tagname": "" - }, - "PromiseManyArray": { - "name": "PromiseManyArray", - "shortname": "PromiseManyArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/model", - "namespace": "", - "file": "../model/src/-private/promise-many-array.ts", - "line": 20, - "description": "This class is returned as the result of accessing an async hasMany relationship\non an instance of a Model extending from `@ember-data/model`.\n\nA PromiseManyArray is an iterable proxy that allows templates to consume related\nManyArrays and update once their contents are no longer pending.\n\nIn your JS code you should resolve the promise first.\n\n```js\nconst comments = await post.comments;\n```", - "access": "public", - "tagname": "" - }, - "CanaryFeatureFlags": { - "name": "CanaryFeatureFlags", - "shortname": "CanaryFeatureFlags", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/canary-features", - "namespace": "", - "file": "../private-build-infra/virtual-packages/canary-features.js", - "line": 76, - "description": "This is the current list of features used at build time for canary releases.\nIf empty there are no features currently gated by feature flags.\n\nThe valid values are:\n\n- `true` | The feature is **enabled** at all times, and cannot be disabled.\n- `false` | The feature is **disabled** at all times, and cannot be enabled.\n- `null` | The feature is **disabled by default**, but can be enabled via configuration.", - "access": "public", - "tagname": "" - }, - "DebugLogging": { - "name": "DebugLogging", - "shortname": "DebugLogging", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/debug", - "namespace": "", - "file": "../private-build-infra/virtual-packages/debugging.js", - "line": 4, - "description": "Many portions of the internals are helpfully instrumented with logging that can be activated\nat build time. This instrumentation is always removed from production builds or any builds\nthat has not explicitly activated it. To activate it set the appropriate flag to `true`.\n\n```ts\n let app = new EmberApp(defaults, {\n emberData: {\n debug: {\n LOG_PAYLOADS: false, // data store received to update cache with\n LOG_OPERATIONS: false, // updates to cache remote state\n LOG_MUTATIONS: false, // updates to cache local state\n LOG_NOTIFICATIONS: false,\n LOG_REQUESTS: false,\n LOG_REQUEST_STATUS: false,\n LOG_IDENTIFIERS: false,\n LOG_GRAPH: false,\n LOG_INSTANCE_CACHE: false,\n }\n }\n });\n ```", - "access": "public", - "tagname": "" - }, - "CurrentDeprecations": { - "name": "CurrentDeprecations", - "shortname": "CurrentDeprecations", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/deprecations", - "namespace": "", - "file": "../private-build-infra/virtual-packages/deprecations.js", - "line": 61, - "description": "The following list represents deprecations currently active.\n\nSome deprecation flags guard multiple deprecation IDs. All\nassociated IDs are listed.", - "access": "public", - "tagname": "" - }, - "RequestManager": { - "name": "RequestManager", - "shortname": "RequestManager", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request", - "namespace": "", - "file": "../request/src/-private/manager.ts", - "line": 415, - "description": "```js\nimport RequestManager from '@ember-data/request';\n```\n\nA RequestManager provides a request/response flow in which configured\nhandlers are successively given the opportunity to handle, modify, or\npass-along a request.\n\n```ts\ninterface RequestManager {\n request(req: RequestInfo): Future;\n}\n```\n\nFor example:\n\n```ts\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember-data/request/fetch';\nimport Auth from 'ember-simple-auth/ember-data-handler';\nimport Config from './config';\n\nconst { apiUrl } = Config;\n\n// ... create manager\nconst manager = new RequestManager();\nmanager.use([Auth, Fetch]);\n\n// ... execute a request\nconst response = await manager.request({\n url: `${apiUrl}/users`\n});\n```\n\n### Futures\n\nThe return value of `manager.request` is a `Future`, which allows\naccess to limited information about the request while it is still\npending and fulfills with the final state when the request completes.\n\nA `Future` is cancellable via `abort`.\n\nHandlers may optionally expose a `ReadableStream` to the `Future` for\nstreaming data; however, when doing so the future should not resolve\nuntil the response stream is fully read.\n\n```ts\ninterface Future extends Promise> {\n abort(): void;\n\n async getStream(): ReadableStream | null;\n}\n```\n\n### StructuredDocuments\n\nA Future resolves with a `StructuredDataDocument` or rejects with a `StructuredErrorDocument`.\n\n```ts\ninterface StructuredDataDocument {\n request: ImmutableRequestInfo;\n response: ImmutableResponseInfo;\n content: T;\n}\ninterface StructuredErrorDocument extends Error {\n request: ImmutableRequestInfo;\n response: ImmutableResponseInfo;\n error: string | object;\n}\ntype StructuredDocument = StructuredDataDocument | StructuredErrorDocument;\n```", - "access": "public", - "tagname": "" - }, - "Future": { - "name": "Future", - "shortname": "Future", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request", - "namespace": "", - "file": "../request/src/-private/types.ts", - "line": 63, - "description": "A Future is a Promise which resolves to a StructuredDocument\nwhile providing the ability to `abort` the underlying request,\n`getStream` the response before the outer promise resolves;", - "extends": "Promise", - "access": "public", - "tagname": "" - }, - " Handler": { - "name": " Handler", - "shortname": " Handler", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request", - "namespace": "", - "file": "../request/src/-private/types.ts", - "line": 202, - "description": "Requests are fulfilled by handlers. A handler receives the request context\nas well as a `next` function with which to pass along a request to the next\nhandler if it so chooses.\n\nA handler may be any object with a `request` method. This allows both stateful and non-stateful\nhandlers to be utilized.\n\nIf a handler calls `next`, it receives a `Future` which resolves to a `StructuredDocument`\nthat it can then compose how it sees fit with its own response.\n\n```ts\ntype NextFn

= (req: RequestInfo) => Future

;\n\ninterface Handler {\n async request(context: RequestContext, next: NextFn

): T;\n}\n```\n\n`RequestContext` contains a readonly version of the RequestInfo as well as a few methods for building up the `StructuredDocument` and `Future` that will be part of the response.\n\n```ts\ninterface RequestContext {\n readonly request: RequestInfo;\n\n setStream(stream: ReadableStream | Promise): void;\n setResponse(response: Response | ResponseInfo): void;\n}\n```\n\nA basic `fetch` handler with support for streaming content updates while\nthe download is still underway might look like the following, where we use\n[`response.clone()`](https://developer.mozilla.org/en-US/docs/Web/API/Response/clone) to `tee` the `ReadableStream` into two streams.\n\nA more efficient handler might read from the response stream, building up the\nresponse content before passing along the chunk downstream.\n\n```ts\nconst FetchHandler = {\n async request(context) {\n const response = await fetch(context.request);\n context.setResponse(reponse);\n context.setStream(response.clone().body);\n\n return response.json();\n }\n}\n```\n\n### Stream Currying\n\n`RequestManager.request` and `next` differ from `fetch` in one **crucial detail** in that the outer Promise resolves only once the response stream has been processed.\n\nFor context, it helps to understand a few of the use-cases that RequestManager\nis intended to allow.\n\n- to manage and return streaming content (such as video files)\n- to fulfill a request from multiple sources or by splitting one request into multiple requests\n - for instance one API call for a user and another for the user's friends\n - or e.g. fulfilling part of the request from one source (one API, in-memory, localStorage, IndexedDB etc.) and the rest from another source (a different API, a WebWorker, etc.)\n- to coalesce multiple requests\n- to decorate a request with additional info\n - e.g. an Auth handler that ensures the correct tokens or headers or cookies are attached.\n\n----\n\n`await fetch()` resolves at the moment headers are received. This allows for the body of the request to be processed as a stream by application\ncode *while chunks are still being received by the browser*.\n\nWhen an app chooses to `await response.json()` what occurs is the browser reads the stream to completion and then returns the result. Additionally, this stream may only be read **once**.\n\nThe `RequestManager` preserves this ability to subscribe to and utilize the stream by either the application or the handler – thereby delivering the full power and flexibility of native APIs – without restricting developers in ways that lead to complicated workarounds.\n\nEach handler may call `setStream` only once, but may do so *at any time* until the promise that the handler returns has resolved. The associated promise returned by calling `future.getStream` will resolve with the stream set by `setStream` if that method is called, or `null` if that method\nhas not been called by the time that the handler's request method has resolved.\n\nHandlers that do not create a stream of their own, but which call `next`, should defensively pipe the stream forward. While this is not required (see automatic currying below) it is better to do so in most cases as otherwise the stream may not become available to downstream handlers or the application until the upstream handler has fully read it.\n\n```ts\ncontext.setStream(future.getStream());\n```\n\nHandlers that either call `next` multiple times or otherwise have reason to create multiple fetch requests should either choose to return no stream, meaningfully combine the streams, or select a single prioritized stream.\n\nOf course, any handler may choose to read and handle the stream, and return either no stream or a different stream in the process.\n\n### Automatic Currying of Stream and Response\n\nIn order to simplify the common case for handlers which decorate a request, if `next` is called only a single time and `setResponse` was never called by the handler, the response set by the next handler in the chain will be applied to that handler's outcome. For instance, this makes the following pattern possible `return (await next()).content;`.\n\nSimilarly, if `next` is called only a single time and neither `setStream` nor `getStream` was called, we automatically curry the stream from the future returned by `next` onto the future returned by the handler.\n\nFinally, if the return value of a handler is a `Future`, we curry `content` and `errors` as well, thus enabling the simplest form `return next()`.\n\nIn the case of the `Future` being returned, `Stream` proxying is automatic and immediate and does not wait for the `Future` to resolve.\n\n### Handler Order\n\nRequest handlers are registered by configuring the manager via `use`\n\n```ts\nconst manager = new RequestManager();\n\nmanager.use([Handler1, Handler2]);\n```\n\nHandlers will be invoked in the order they are registered (\"fifo\", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.", - "access": "public", - "tagname": "" - }, - "Fetch": { - "name": "Fetch", - "shortname": "Fetch", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/request/fetch", - "namespace": "", - "file": "../request/src/fetch.ts", - "line": 25, - "description": "A basic handler which converts a request into a\n`fetch` call presuming the response to be `json`.\n\n```ts\nimport Fetch from '@ember-data/request/fetch';\n\nmanager.use([Fetch]);\n```", - "access": "public", - "tagname": "" - }, - "BooleanTransform": { - "name": "BooleanTransform", - "shortname": "BooleanTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/boolean.js", - "line": 5, - "description": "The `BooleanTransform` class is used to serialize and deserialize\nboolean attributes on Ember Data record objects. This transform is\nused when `boolean` is passed as the type parameter to the\n[attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function.\n\nUsage\n\n```app/models/user.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "attr": "('boolean', { allowNull: true }) wantsWeeklyEmail;\n}\n```", - "access": "public", - "tagname": "" - }, - "DateTransform": { - "name": "DateTransform", - "shortname": "DateTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/date.js", - "line": 5, - "description": "The `DateTransform` class is used to serialize and deserialize\ndate attributes on Ember Data record objects. This transform is used\nwhen `date` is passed as the type parameter to the\n[attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)\nstandard.\n\n```app/models/score.js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nexport default class ScoreModel extends Model {", - "attr": "('date') date;\n }\n```", - "belongsto": "('player') player;", - "access": "public", - "tagname": "" - }, - "NumberTransform": { - "name": "NumberTransform", - "shortname": "NumberTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/number.js", - "line": 9, - "description": "The `NumberTransform` class is used to serialize and deserialize\nnumeric attributes on Ember Data record objects. This transform is\nused when `number` is passed as the type parameter to the\n[attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function.\n\nUsage\n\n```app/models/score.js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nexport default class ScoreModel extends Model {", - "attr": "('date') date;\n}\n```", - "belongsto": "('player') player;", - "access": "public", - "tagname": "" - }, - "StringTransform": { - "name": "StringTransform", - "shortname": "StringTransform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/string.js", - "line": 5, - "description": "The `StringTransform` class is used to serialize and deserialize\nstring attributes on Ember Data record objects. This transform is\nused when `string` is passed as the type parameter to the\n[attr](/ember-data/release/functions/@ember-data%2Fmodel/attr) function.\n\nUsage\n\n```app/models/user.js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "attr": "('string') email;\n}\n```", - "access": "public", - "tagname": "" - }, - "Transform": { - "name": "Transform", - "shortname": "Transform", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/-private/transforms/transform.js", - "line": 5, - "description": "The `Transform` class is used to serialize and deserialize model\nattributes when they are saved or loaded from an\nadapter. Subclassing `Transform` is useful for creating custom\nattributes. All subclasses of `Transform` must implement a\n`serialize` and a `deserialize` method.\n\nExample\n\n```app/transforms/temperature.js\n\n// Converts centigrade in the JSON to fahrenheit in the app\nexport default class TemperatureTransform {\n deserialize(serialized, options) {\n return (serialized * 1.8) + 32;\n }\n\n serialize(deserialized, options) {\n return (deserialized - 32) / 1.8;\n }\n\n static create() {\n return new this();\n }\n}\n```\n\nUsage\n\n```app/models/requirement.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class RequirementModel extends Model {", - "attr": "('markdown', {\n markdown: {\n gfm: false,\n sanitize: true\n }\n })\n markdown;\n}\n```\n\n```app/transforms/markdown.js\nexport default class MarkdownTransform {\n serialize(deserialized, options) {\n return deserialized.raw;\n }\n\n deserialize(serialized, options) {\n let markdownOptions = options.markdown || {};\n\n return marked(serialized, markdownOptions);\n }\n\n static create() {\n return new this();\n }\n}\n```", - "access": "public", - "tagname": "" - }, - "EmbeddedRecordsMixin": { - "name": "EmbeddedRecordsMixin", - "shortname": "EmbeddedRecordsMixin", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/rest", - "namespace": "", - "file": "../serializer/src/-private/embedded-records-mixin.js", - "line": 10, - "description": "## Using Embedded Records\n\n`EmbeddedRecordsMixin` supports serializing embedded records.\n\nTo set up embedded records, include the mixin when extending a serializer,\nthen define and configure embedded (model) relationships.\n\nNote that embedded records will serialize with the serializer for their model instead of the serializer in which they are defined.\n\nNote also that this mixin does not work with JSONAPISerializer because the JSON:API specification does not describe how to format embedded resources.\n\nBelow is an example of a per-type serializer (`post` type).\n\n```app/serializers/post.js\nimport RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n author: { embedded: 'always' },\n comments: { serialize: 'ids' }\n }\n}\n```\nNote that this use of `{ embedded: 'always' }` is unrelated to\nthe `{ embedded: 'always' }` that is defined as an option on `attr` as part of\ndefining a model while working with the `ActiveModelSerializer`. Nevertheless,\nusing `{ embedded: 'always' }` as an option to `attr` is not a valid way to set up\nembedded records.\n\nThe `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:\n\n```js\n{\n serialize: 'records',\n deserialize: 'records'\n}\n```\n\n### Configuring Attrs\n\nA resource's `attrs` option may be set to use `ids`, `records` or false for the\n`serialize` and `deserialize` settings.\n\nThe `attrs` property can be set on the `ApplicationSerializer` or a per-type\nserializer.\n\nIn the case where embedded JSON is expected while extracting a payload (reading)\nthe setting is `deserialize: 'records'`, there is no need to use `ids` when\nextracting as that is the default behaviour without this mixin if you are using\nthe vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while\nserializing `serialize: 'records'` is the setting to use. There is an option of\nnot embedding JSON in the serialized payload by using `serialize: 'ids'`. If you\ndo not want the relationship sent at all, you can use `serialize: false`.\n\n\n### EmbeddedRecordsMixin defaults\nIf you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`\nwill behave in the following way:\n\nBelongsTo: `{ serialize: 'id', deserialize: 'id' }`\nHasMany: `{ serialize: false, deserialize: 'ids' }`\n\n### Model Relationships\n\nEmbedded records must have a model defined to be extracted and serialized. Note that\nwhen defining any relationships on your model such as `belongsTo` and `hasMany`, you\nshould not both specify `async: true` and also indicate through the serializer's\n`attrs` attribute that the related model should be embedded for deserialization.\nIf a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),\nthen do not use `async: true`.\n\nTo successfully extract and serialize embedded records the model relationships\nmust be set up correctly. See the\n[defining relationships](https://guides.emberjs.com/current/models/relationships)\nsection of the **Defining Models** guide page.\n\nRecords without an `id` property are not considered embedded records, model\ninstances must have an `id` property to be used with Ember Data.\n\n### Example JSON payloads, Models and Serializers\n\n**When customizing a serializer it is important to grok what the customizations\nare. Please read the docs for the methods this mixin provides, in case you need\nto modify it to fit your specific needs.**\n\nFor example, review the docs for each method of this mixin:\n* [normalize](/ember-data/release/classes/EmbeddedRecordsMixin/methods/normalize?anchor=normalize)\n* [serializeBelongsTo](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeBelongsTo?anchor=serializeBelongsTo)\n* [serializeHasMany](/ember-data/release/classes/EmbeddedRecordsMixin/methods/serializeHasMany?anchor=serializeHasMany)", - "access": "public", - "tagname": "" - }, - "Serializer": { - "name": "Serializer", - "shortname": "Serializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer", - "namespace": "", - "file": "../serializer/src/index.ts", - "line": 115, - "description": "> ⚠️ CAUTION you likely want the docs for [ Serializer](/ember-data/release/classes/%3CInterface%3E%20Serializer)\n> as extending this abstract class is unnecessary.\n\n`Serializer` is an abstract base class that you may override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:\n\n * `normalizeResponse()`\n * `serialize()`\n\nAnd you can optionally override the following methods:\n\n * `normalize()`\n\nFor an example implementation, see\n[JSONSerializer](JSONSerializer), the included JSON serializer.", - "access": "public", - "tagname": "", - "extends": "Ember.EmberObject" - }, - "JSONAPISerializer": { - "name": "JSONAPISerializer", - "shortname": "JSONAPISerializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/json-api", - "namespace": "", - "file": "../serializer/src/json-api.js", - "line": 13, - "description": "

\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.\n\n This serializer normalizes a JSON API payload that looks like:\n\n ```app/models/player.js\n import Model, { attr, belongsTo } from '@ember-data/model';\n\n export default class Player extends Model {", - "attr": "('string') location;", - "belongsto": "('club') club;\n }\n ```\n\n ```app/models/club.js\n import Model, { attr, hasMany } from '@ember-data/model';\n\n export default class Club extends Model {", - "hasmany": "('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```", - "mainName": "@ember-data/serializer/json-api", - "tag": "main", - "itemtype": "main", - "_main": true, - "since": "1.13.0", - "access": "public", - "tagname": "", - "extends": "JSONSerializer" - }, - "JSONSerializer": { - "name": "JSONSerializer", - "shortname": "JSONSerializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/json", - "namespace": "", - "file": "../serializer/src/json.js", - "line": 16, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n By default, EmberData uses and recommends the `JSONAPISerializer`.\n\n `JSONSerializer` is useful for simpler or legacy backends that may\n not support the http://jsonapi.org/ spec.\n\n For example, given the following `User` model and JSON payload:\n\n ```app/models/user.js\n import Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\n export default class UserModel extends Model {", - "hasmany": "('user') friends;", - "belongsto": "('location') house;", - "attr": "('string') name;\n }\n ```\n\n ```js\n {\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n }\n ```\n\n `JSONSerializer` will normalize the JSON payload to the JSON API format that the\n Ember Data store expects.\n\n You can customize how JSONSerializer processes its payload by passing options in\n the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\n The `JSONSerializer` normalization process follows these steps:\n\n 1. `normalizeResponse`\n - entry method to the serializer.\n 2. `normalizeCreateRecordResponse`\n - a `normalizeResponse` for a specific operation is called.\n 3. `normalizeSingleResponse`|`normalizeArrayResponse`\n - for methods like `createRecord` we expect a single record back, while for methods like `findAll` we expect multiple records back.\n 4. `normalize`\n - `normalizeArrayResponse` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n 5. `extractId` | `extractAttributes` | `extractRelationships`\n - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.", - "mainName": "@ember-data/serializer/json", - "tag": "main", - "itemtype": "main", - "_main": true, - "access": "public", - "tagname": "", - "extends": "Serializer" - }, - "RESTSerializer": { - "name": "RESTSerializer", - "shortname": "RESTSerializer", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/serializer/rest", - "namespace": "", - "file": "../serializer/src/rest.js", - "line": 18, - "description": "
\n

\n ⚠️ This is LEGACY documentation for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n Handler instead to be used with the RequestManager\n

\n
\n\n Normally, applications will use the `RESTSerializer` by implementing\n the `normalize` method.\n\n This allows you to do whatever kind of munging you need and is\n especially useful if your server is inconsistent and you need to\n do munging differently for many different kinds of responses.\n\n See the `normalize` documentation for more information.\n\n ## Across the Board Normalization\n\n There are also a number of hooks that you might find useful to define\n across-the-board rules for your payload. These rules will be useful\n if your server is consistent, or if you're building an adapter for\n an infrastructure service, like Firebase, and want to encode service\n conventions.\n\n For example, if all of your keys are underscored and all-caps, but\n otherwise consistent with the names you use in your models, you\n can implement across-the-board rules for how to convert an attribute\n name in your model to a key in your JSON.\n\n ```app/serializers/application.js\n import RESTSerializer from '@ember-data/serializer/rest';\n import { underscore } from '/utils/string-utils';\n\n export default class ApplicationSerializer extends RESTSerializer {\n keyForAttribute(attr, method) {\n return underscore(attr).toUpperCase();\n }\n }\n ```\n\n You can also implement `keyForRelationship`, which takes the name\n of the relationship as the first parameter, the kind of\n relationship (`hasMany` or `belongsTo`) as the second parameter, and\n the method (`serialize` or `deserialize`) as the third parameter.", - "mainName": "@ember-data/serializer/rest", - "tag": "main", - "itemtype": "main", - "_main": true, - "access": "public", - "tagname": "", - "extends": "JSONSerializer" - }, - "IdentifierCache": { - "name": "IdentifierCache", - "shortname": "IdentifierCache", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/caches/identifier-cache.ts", - "line": 143, - "description": "Each instance of {Store} receives a unique instance of a IdentifierCache.\n\nThis cache is responsible for assigning or retrieving the unique identify\nfor arbitrary resource data encountered by the store. Data representing\na unique resource or record should always be represented by the same\nidentifier.\n\nIt can be configured by consuming applications.", - "access": "public", - "tagname": "" - }, - "RecordReference": { - "name": "RecordReference", - "shortname": "RecordReference", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/legacy-model-support/record-reference.ts", - "line": 18, - "description": "A `RecordReference` is a low-level API that allows users and\naddon authors to perform meta-operations on a record.", - "access": "public", - "tagname": "", - "extends": "Reference" - }, - "CacheManager": { - "name": "CacheManager", - "shortname": "CacheManager", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/managers/cache-manager.ts", - "line": 20, - "description": "The CacheManager wraps a Cache enforcing that only\nthe public API surface area is exposed.\n\nHence, it is the value of `Store.cache`, wrapping\nthe cache instance returned by `Store.createCache`.\n\nIt handles translating between cache versions when\nnecessary, for instance when a Store is configured\nto use both a v1 and a v2 cache depending on some\nheuristic.\n\nStarting with the v2 spec, the cache is designed such\nthat it must be implemented as a singleton.", - "access": "public", - "tagname": "" - }, - "NotificationManager": { - "name": "NotificationManager", - "shortname": "NotificationManager", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/managers/notification-manager.ts", - "line": 70, - "description": "The NotificationManager provides the ability to subscribe to\nchanges to Cache state.\n\nThis Feature is what allows EmberData to create subscriptions that\nwork with any framework or change-notification system.", - "access": "public", - "tagname": "" - }, - "RequestStateService": { - "name": "RequestStateService", - "shortname": "RequestStateService", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/network/request-cache.ts", - "line": 31, - "description": "The RequestStateService is used to track the state of requests\nfor fetching or updating known resource identifies that are inflight.", - "access": "public", - "tagname": "" - }, - "RecordArray": { - "name": "RecordArray", - "shortname": "RecordArray", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/record-arrays/identifier-array.ts", - "line": 149, - "description": "A record array is an array that contains records of a certain type (or modelName).\nThe record array materializes records as needed when they are retrieved for the first\ntime. You should not create record arrays yourself. Instead, an instance of\n`RecordArray` or its subclasses will be returned by your application's store\nin response to queries.\n\nThis class should not be imported and instantiated by consuming applications.", - "access": "public", - "tagname": "" - }, - "Store": { - "name": "Store", - "shortname": "Store", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/store", - "namespace": "", - "file": "../store/src/-private/store-service.ts", - "line": 83, - "description": "A Store coordinates interaction between your application, a [Cache](https://api.emberjs.com/ember-data/release/classes/%3CInterface%3E%20Cache),\nand sources of data (such as your API or a local persistence layer)\naccessed via a [RequestManager](https://github.com/emberjs/data/tree/main/packages/request).\n\n```app/services/store.js\nimport Store from '@ember-data/store';\n\nexport default class extends Store {}\n```\n\nMost Ember applications will only have a single `Store` configured as a Service\nin this manner. However, setting up multiple stores is possible, including using\neach as a unique service.", - "access": "public", - "tagname": "" - }, - "@ember-data/tracking": { - "name": "@ember-data/tracking", - "shortname": "@ember-data/tracking", - "classitems": [], - "plugins": [], - "extensions": [], - "plugin_for": [], - "extension_for": [], - "module": "@ember-data/tracking", - "namespace": "" - } - }, - "elements": {}, - "classitems": [ - { - "file": "../ember-data-types/cache/cache.ts", - "line": 26, - "description": "The Cache Version that this implementation implements.", - "type": "{'2'}", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "version", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 38, - "description": "Cache the response to a request\n\nUnlike `store.push` which has UPSERT\nsemantics, `put` has `replace` semantics similar to\nthe `http` method `PUT`\n\nthe individually cacheable resource data it may contain\nshould upsert, but the document data surrounding it should\nfully replace any existing information\n\nNote that in order to support inserting arbitrary data\nto the cache that did not originate from a request `put`\nshould expect to sometimes encounter a document with only\na `content` member and therefor must not assume the existence\nof `request` and `response` on the document.", - "itemtype": "method", - "name": "put", - "params": [ - { - "name": "doc", - "description": "", - "type": "StructuredDocument" - } - ], - "return": { - "description": "", - "type": "ResourceDocument" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 62, - "description": "Update the \"remote\" or \"canonical\" (persisted) state of the Cache\nby merging new information into the existing state.\n\nNote: currently the only valid resource operation is a MergeOperation\nwhich occurs when a collision of identifiers is detected.", - "itemtype": "method", - "name": "patch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "op", - "description": "the operation to perform", - "type": "Operation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 76, - "description": "Update the \"local\" or \"current\" (unpersisted) state of the Cache", - "itemtype": "method", - "name": "mutate", - "params": [ - { - "name": "mutation", - "description": "", - "type": "Mutation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 86, - "description": "Peek resource data from the Cache.\n\nIn development, if the return value\nis JSON the return value\nwill be deep-cloned and deep-frozen\nto prevent mutation thereby enforcing cache\nImmutability.\n\nThis form of peek is useful for implementations\nthat want to feed raw-data from cache to the UI\nor which want to interact with a blob of data\ndirectly from the presentation cache.\n\nAn implementation might want to do this because\nde-referencing records which read from their own\nblob is generally safer because the record does\nnot require retainining connections to the Store\nand Cache to present data on a per-field basis.\n\nThis generally takes the place of `getAttr` as\nan API and may even take the place of `getRelationship`\ndepending on implementation specifics, though this\nlatter usage is less recommended due to the advantages\nof the Graph handling necessary entanglements and\nnotifications for relational data.", - "itemtype": "method", - "name": "peek", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier | StableDocumentIdentifier" - } - ], - "return": { - "description": "the known resource data", - "type": "ResourceDocument | ResourceBlob | null" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 121, - "description": "Peek the Cache for the existing request data associated with\na cacheable request", - "itemtype": "method", - "name": "peekRequest", - "params": [ - { - "name": "UNKNOWN", - "description": "", - "type": "StableDocumentIdentifier" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 132, - "description": "Push resource data from a remote source into the cache for this identifier", - "itemtype": "method", - "name": "upsert", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - }, - { - "name": "hasRecord", - "description": "" - } - ], - "return": { - "description": "if `hasRecord` is true then calculated key changes should be returned", - "type": "Void | string[]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 147, - "description": "Create a fork of the cache from the current state.\n\nApplications should typically not call this method themselves,\npreferring instead to fork at the Store level, which will\nutilize this method to fork the cache.", - "itemtype": "method", - "name": "fork", - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 160, - "description": "Merge a fork back into a parent Cache.\n\nApplications should typically not call this method themselves,\npreferring instead to merge at the Store level, which will\nutilize this method to merge the caches.", - "itemtype": "method", - "name": "merge", - "params": [ - { - "name": "cache", - "description": "", - "type": "Cache" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 174, - "description": "Generate the list of changes applied to all\nrecord in the store.\n\nEach individual resource or document that has\nbeen mutated should be described as an individual\n`Change` entry in the returned array.\n\nA `Change` is described by an object containing up to\nthree properties: (1) the `identifier` of the entity that\nchanged; (2) the `op` code of that change being one of\n`upsert` or `remove`, and if the op is `upsert` a `patch`\ncontaining the data to merge into the cache for the given\nentity.\n\nThis `patch` is opaque to the Store but should be understood\nby the Cache and may expect to be utilized by an Adapter\nwhen generating data during a `save` operation.\n\nIt is generally recommended that the `patch` contain only\nthe updated state, ignoring fields that are unchanged\n\n```ts\ninterface Change {\n identifier: StableRecordIdentifier | StableDocumentIdentifier;\n op: 'upsert' | 'remove';\n patch?: unknown;\n}\n```", - "itemtype": "method", - "name": "diff", - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 212, - "description": "Serialize the entire contents of the Cache into a Stream\nwhich may be fed back into a new instance of the same Cache\nvia `cache.hydrate`.", - "itemtype": "method", - "name": "dump", - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 223, - "description": "hydrate a Cache from a Stream with content previously serialized\nfrom another instance of the same Cache, resolving when hydration\nis complete.\n\nThis method should expect to be called both in the context of restoring\nthe Cache during application rehydration after SSR **AND** at unknown\ntimes during the lifetime of an already booted application when it is\ndesired to bulk-load additional information into the cache. This latter\nbehavior supports optimizing pre/fetching of data for route transitions\nvia data-only SSR modes.", - "itemtype": "method", - "name": "hydrate", - "params": [ - { - "name": "stream", - "description": "", - "type": "ReadableStream" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 245, - "description": "[LIFECYCLE] Signal to the cache that a new record has been instantiated on the client\n\nIt returns properties from options that should be set on the record during the create\nprocess. This return value behavior is deprecated.", - "itemtype": "method", - "name": "clientDidCreate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "createArgs", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 258, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwill be part of a save transaction.", - "itemtype": "method", - "name": "willCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 268, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwas successfully updated as part of a save transaction.", - "itemtype": "method", - "name": "didCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "- the primary identifier that was operated on" - }, - { - "name": "data", - "description": "- a document in the cache format containing any updated data" - } - ], - "return": { - "description": "", - "type": "SingleResourceDataDocument" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 280, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwas update via a save transaction failed.", - "itemtype": "method", - "name": "commitWasRejected", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "errors", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 291, - "description": "[LIFECYCLE] Signals to the cache that all data for a resource\nshould be cleared.\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 306, - "description": "Retrieve the data for an attribute from the cache", - "itemtype": "method", - "name": "getAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "", - "type": "Unknown" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 317, - "description": "Mutate the data for an attribute in the cache\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "setAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - }, - { - "name": "value", - "description": "" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 330, - "description": "Query the cache for the changed attributes of a resource.", - "itemtype": "method", - "name": "changedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": ": [, ]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 340, - "description": "Query the cache for whether any mutated attributes exist", - "itemtype": "method", - "name": "hasChangedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 350, - "description": "Tell the cache to discard any uncommitted mutations to attributes\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "rollbackAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "the names of fields that were restored", - "type": "String[]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 362, - "description": "Query the cache for the current state of a relationship property", - "itemtype": "method", - "name": "getRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "resource relationship object" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 380, - "description": "Update the cache state for the given resource to be marked\nas locally deleted, or remove such a mark.\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "setIsDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "isDeleted", - "description": "", - "type": "Boolean" - } - ], - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 393, - "description": "Query the cache for any validation errors applicable to the given resource.", - "itemtype": "method", - "name": "getErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "JsonApiError[]" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 403, - "description": "Query the cache for whether a given resource has any available data", - "itemtype": "method", - "name": "isEmpty", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 413, - "description": "Query the cache for whether a given resource was created locally and not\nyet persisted.", - "itemtype": "method", - "name": "isNew", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 424, - "description": "Query the cache for whether a given resource is marked as deleted (but not\nnecessarily persisted yet).", - "itemtype": "method", - "name": "isDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/cache/cache.ts", - "line": 435, - "description": "Query the cache for whether a given resource has been deleted and that deletion\nhas also been persisted.", - "itemtype": "method", - "name": "isDeletionCommitted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": " Cache", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 26, - "description": "Provides access to the IdentifierCache instance\nfor this Store instance.\n\nThe IdentifierCache can be used to peek, generate or\nretrieve a stable unique identifier for any resource.", - "itemtype": "property", - "name": "identifierCache", - "type": "IdentifierCache", - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 38, - "description": "Provides access to the SchemaDefinitionService instance\nfor this Store instance.\n\nThe SchemaDefinitionService can be used to query for\ninformation about the schema of a resource.", - "itemtype": "method", - "name": "getSchemaDefinitionService", - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 50, - "description": "Update the `id` for the record corresponding to the identifier\nThis operation can only be done for records whose `id` is `null`.", - "itemtype": "method", - "name": "setRecordId", - "params": [ - { - "name": "identifier;", - "description": "", - "type": "StableRecordIdentifier" - }, - { - "name": "id;", - "description": "", - "type": "String" - } - ], - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 61, - "description": "Signal to the store that the specified record may be considered fully\nremoved from the cache. Generally this means that not only does no\ndata exist for the identified resource, no known relationships still\npoint to it either.", - "itemtype": "method", - "name": "disconnectRecord", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - } - ], - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 73, - "description": "Use this method to determine if the Store has an instantiated record associated\nwith an identifier.", - "itemtype": "method", - "name": "hasRecord", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/cache-store-wrapper.ts", - "line": 84, - "description": "Notify subscribers of the NotificationManager that cache state has changed.\n\n`attributes` and `relationships` do not require a key, but if one is specified it\nis assumed to be the name of the attribute or relationship that has been updated.\n\nNo other namespaces currently expect the `key` argument.", - "itemtype": "method", - "name": "notifyChange", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - }, - { - "name": "namespace", - "description": "", - "type": "'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'" - }, - { - "name": "key", - "description": "", - "type": "String|undefined" - } - ], - "access": "public", - "tagname": "", - "class": "CacheStoreWrapper", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 96, - "description": "A string representing a unique identity.", - "itemtype": "property", - "name": "lid", - "type": "String", - "access": "public", - "tagname": "", - "class": "StableRecordIdentifier", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 102, - "description": "the primary resource `type` or `modelName` this identity belongs to.", - "itemtype": "property", - "name": "type", - "type": "String", - "access": "public", - "tagname": "", - "class": "StableRecordIdentifier", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 108, - "description": "the primary id for the record this identity belongs to. `null`\nif not yet assigned an id.", - "itemtype": "property", - "name": "id", - "type": "String | null", - "access": "public", - "tagname": "", - "class": "StableRecordIdentifier", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 117, - "description": "Configures how unique identifier lid strings are generated by @ember-data/store.\n\nThis configuration MUST occur prior to the store instance being created.\n\nTakes a method which can expect to receive various data as its first argument\nand the name of a bucket as its second argument.\n\nCurrently there are two buckets, 'record' and 'document'.\n\n### Resource (`Record`) Identity\n\nIf the bucket is `record` the method must return a unique (to at-least\nthe given bucket) string identifier for the given data as a string to be\nused as the `lid` of an `Identifier` token.\n\nThis method will only be called by either `getOrCreateRecordIdentifier` or\n`createIdentifierForNewRecord` when an identifier for the supplied data\nis not already known via `lid` or `type + id` combo and one needs to be\ngenerated or retrieved from a proprietary cache.\n\n`data` will be the same data argument provided to `getOrCreateRecordIdentifier`\nand in the `createIdentifierForNewRecord` case will be an object with\nonly `type` as a key.\n\n```ts\nimport { setIdentifierGenerationMethod } from '@ember-data/store';\n\nexport function initialize(applicationInstance) {\n // note how `count` here is now scoped to the application instance\n // for our generation method by being inside the closure provided\n // by the initialize function\n let count = 0;\n\n setIdentifierGenerationMethod((resource, bucket) => {\n return resource.lid || `my-key-${count++}`;\n });\n}\n\nexport default {\n name: 'configure-ember-data-identifiers',\n initialize\n};\n```\n\n### Document Identity\n\nIf the bucket is `document` the method will receive the associated\nimmutable `request` passed to `store.request` as its first argument\nand should return a unique string for the given request if the document\nshould be cached, and `null` if it should not be cached.\n\nNote, the request result will still be passed to the cache via `Cache.put`,\nbut caches should take this as a signal that the document should not itself\nbe cached, while its contents may still be used to update other cache state.\n\nThe presence of `cacheOptions.key` on the request will take precedence\nfor the document cache key, and this method will not be called if it is\npresent.\n\nThe default method implementation for this bucket is to return `null`\nfor all requests whose method is not `GET`, and to return the `url` for\nthose where it is.\n\nThis means that queries via `POST` MUST provide `cacheOptions.key` or\nimplement this hook.\n\n⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`", - "itemtype": "method", - "name": "setIdentifierGenerationMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 198, - "description": "Configure a callback for when the identifier cache encounters new resource\ndata for an existing resource.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierUpdateMethod } from '@ember-data/store';\n```\n\nTakes a method which can expect to receive an existing `Identifier` alongside\nsome new data to consider as a second argument. This is an opportunity\nfor secondary lookup tables and caches associated with the identifier\nto be amended.\n\nThis method is called everytime `updateRecordIdentifier` is called and\n with the same arguments. It provides the opportunity to update secondary\n lookup tables for existing identifiers.\n\nIt will always be called after an identifier created with `createIdentifierForNewRecord`\n has been committed, or after an update to the `record` a `RecordIdentifier`\n is assigned to has been committed. Committed here meaning that the server\n has acknowledged the update (for instance after a call to `.save()`)\n\nIf `id` has not previously existed, it will be assigned to the `Identifier`\n prior to this `UpdateMethod` being called; however, calls to the parent method\n `updateRecordIdentifier` that attempt to change the `id` or calling update\n without providing an `id` when one is missing will throw an error.", - "itemtype": "method", - "name": "setIdentifierUpdateMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 239, - "description": "Configure a callback for when the identifier cache is going to release an identifier.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierForgetMethod } from '@ember-data/store';\n```\n\nTakes method which can expect to receive an existing `Identifier` that should be eliminated\nfrom any secondary lookup tables or caches that the user has populated for it.", - "itemtype": "method", - "name": "setIdentifierForgetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/identifier.ts", - "line": 259, - "description": "Configure a callback for when the identifier cache is being torn down.\n\nThis configuration MUST occur prior to the store instance being created.\n\n```js\nimport { setIdentifierResetMethod } from '@ember-data/store';\n```\n\nTakes a method which can expect to be called when the parent application is destroyed.\n\nIf you have properly used a WeakMap to encapsulate the state of your customization\nto the application instance, you may not need to implement the `resetMethod`.", - "itemtype": "method", - "name": "setIdentifierResetMethod", - "params": [ - { - "name": "method", - "description": "" - } - ], - "access": "public", - "tagname": "", - "static": 1, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 38, - "description": "`adapter.findRecord` takes a request for a resource of a given `type` and `id` combination\nand should return a `Promise` which fulfills with data for a single resource matching that\n`type` and `id`.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method with the\n`requestType` set to `findRecord`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data for the record.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\n`adapter.findRecord` is called whenever the `store` needs to load, reload, or backgroundReload\nthe resource data for a given `type` and `id`.", - "itemtype": "method", - "name": "findRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 67, - "description": "`adapter.findAll` takes a request for resources of a given `type` and should return\n a `Promise` which fulfills with a collection of resource data matching that `type`.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `findAll`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing records for `type`. Existing records for the `type` will not be removed.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\n`adapter.findAll` is called whenever `store.findAll` is asked to reload or backgroundReload.\nThe records in the response are merged with the contents of the store. Existing records for\nthe `type` will not be removed.\n\nSee also `shouldReloadAll` and `shouldBackgroundReloadAll`", - "itemtype": "method", - "name": "findAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" + "project": {}, + "files": { + "addon/-private/adapters/build-url-mixin.js": { + "name": "addon/-private/adapters/build-url-mixin.js", + "modules": {}, + "classes": { + "DS.BuildURLMixin": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/adapters/errors.js": { + "name": "addon/-private/adapters/errors.js", + "modules": {}, + "classes": { + "DS.AdapterError": 1, + "DS.InvalidError": 1, + "DS.TimeoutError": 1, + "DS.AbortError": 1, + "DS.UnauthorizedError": 1, + "DS.ForbiddenError": 1, + "DS.NotFoundError": 1, + "DS.ConflictError": 1, + "DS.ServerError": 1 + }, + "fors": { + "DS": 1 + }, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/debug/debug-adapter.js": { + "name": "addon/-private/system/debug/debug-adapter.js", + "modules": {}, + "classes": {}, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/model/errors.js": { + "name": "addon/-private/system/model/errors.js", + "modules": {}, + "classes": { + "DS.Errors": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/model/internal-model.js": { + "name": "addon/-private/system/model/internal-model.js", + "modules": {}, + "classes": {}, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/model/model.js": { + "name": "addon/-private/system/model/model.js", + "modules": {}, + "classes": { + "DS.Model": 1 + }, + "fors": { + "DS.Model": 1 + }, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/model/states.js": { + "name": "addon/-private/system/model/states.js", + "modules": {}, + "classes": { + "DS.RootState": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/record-arrays/adapter-populated-record-array.js": { + "name": "addon/-private/system/record-arrays/adapter-populated-record-array.js", + "modules": {}, + "classes": { + "DS.AdapterPopulatedRecordArray": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/record-arrays/filtered-record-array.js": { + "name": "addon/-private/system/record-arrays/filtered-record-array.js", + "modules": {}, + "classes": { + "DS.FilteredRecordArray": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/record-arrays/record-array.js": { + "name": "addon/-private/system/record-arrays/record-array.js", + "modules": {}, + "classes": { + "DS.RecordArray": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/references/belongs-to.js": { + "name": "addon/-private/system/references/belongs-to.js", + "modules": {}, + "classes": { + "DS.BelongsToReference": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/references/has-many.js": { + "name": "addon/-private/system/references/has-many.js", + "modules": {}, + "classes": { + "DS.HasManyReference": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/references/record.js": { + "name": "addon/-private/system/references/record.js", + "modules": {}, + "classes": { + "DS.RecordReference": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/relationships/belongs-to.js": { + "name": "addon/-private/system/relationships/belongs-to.js", + "modules": {}, + "classes": {}, + "fors": { + "DS": 1 + }, + "namespaces": {} + }, + "addon/-private/system/relationships/has-many.js": { + "name": "addon/-private/system/relationships/has-many.js", + "modules": {}, + "classes": {}, + "fors": { + "DS": 1 + }, + "namespaces": {} + }, + "addon/-private/system/relationships/relationship-payloads-manager.js": { + "name": "addon/-private/system/relationships/relationship-payloads-manager.js", + "modules": {}, + "classes": { + "RelationshipPayloadsManager": 1 + }, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/relationships/relationship-payloads.js": { + "name": "addon/-private/system/relationships/relationship-payloads.js", + "modules": {}, + "classes": { + "RelationshipPayloads": 1 + }, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/diff-array.js": { + "name": "addon/-private/system/diff-array.js", + "modules": {}, + "classes": {}, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/identity-map.js": { + "name": "addon/-private/system/identity-map.js", + "modules": {}, + "classes": { + "IdentityMap": 1 + }, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/internal-model-map.js": { + "name": "addon/-private/system/internal-model-map.js", + "modules": {}, + "classes": { + "InternalModelMap": 1 + }, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/many-array.js": { + "name": "addon/-private/system/many-array.js", + "modules": {}, + "classes": { + "DS.ManyArray": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/normalize-model-name.js": { + "name": "addon/-private/system/normalize-model-name.js", + "modules": {}, + "classes": {}, + "fors": { + "DS": 1 + }, + "namespaces": {} + }, + "addon/-private/system/promise-proxies.js": { + "name": "addon/-private/system/promise-proxies.js", + "modules": {}, + "classes": { + "DS.PromiseArray": 1, + "DS.PromiseObject": 1, + "DS.PromiseManyArray": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/record-array-manager.js": { + "name": "addon/-private/system/record-array-manager.js", + "modules": {}, + "classes": { + "DS.RecordArrayManager": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/record-arrays.js": { + "name": "addon/-private/system/record-arrays.js", + "modules": {}, + "classes": {}, + "fors": {}, + "namespaces": {} + }, + "addon/-private/system/snapshot-record-array.js": { + "name": "addon/-private/system/snapshot-record-array.js", + "modules": {}, + "classes": { + "DS.SnapshotRecordArray": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/snapshot.js": { + "name": "addon/-private/system/snapshot.js", + "modules": {}, + "classes": { + "DS.Snapshot": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/system/store.js": { + "name": "addon/-private/system/store.js", + "modules": {}, + "classes": { + "DS.Store": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/-private/core.js": { + "name": "addon/-private/core.js", + "modules": {}, + "classes": { + "DS": 1 + }, + "fors": {}, + "namespaces": {} + }, + "addon/adapters/json-api.js": { + "name": "addon/adapters/json-api.js", + "modules": {}, + "classes": { + "DS.JSONAPIAdapter": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/adapters/rest.js": { + "name": "addon/adapters/rest.js", + "modules": {}, + "classes": { + "DS.RESTAdapter": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/serializers/embedded-records-mixin.js": { + "name": "addon/serializers/embedded-records-mixin.js", + "modules": {}, + "classes": { + "DS.EmbeddedRecordsMixin": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/serializers/json-api.js": { + "name": "addon/serializers/json-api.js", + "modules": {}, + "classes": { + "DS.JSONAPISerializer": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/serializers/json.js": { + "name": "addon/serializers/json.js", + "modules": {}, + "classes": { + "DS.JSONSerializer": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/serializers/rest.js": { + "name": "addon/serializers/rest.js", + "modules": {}, + "classes": { + "DS.RESTSerializer": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/transforms/boolean.js": { + "name": "addon/transforms/boolean.js", + "modules": {}, + "classes": { + "DS.BooleanTransform": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/transforms/date.js": { + "name": "addon/transforms/date.js", + "modules": {}, + "classes": { + "Ember.Date": 1, + "DS.DateTransform": 1 + }, + "fors": {}, + "namespaces": { + "Ember": 1, + "DS": 1 + } + }, + "addon/transforms/number.js": { + "name": "addon/transforms/number.js", + "modules": {}, + "classes": { + "DS.NumberTransform": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/transforms/string.js": { + "name": "addon/transforms/string.js", + "modules": {}, + "classes": { + "DS.StringTransform": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/transforms/transform.js": { + "name": "addon/transforms/transform.js", + "modules": {}, + "classes": { + "DS.Transform": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/adapter.js": { + "name": "addon/adapter.js", + "modules": {}, + "classes": { + "DS.Adapter": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "addon/attr.js": { + "name": "addon/attr.js", + "modules": {}, + "classes": {}, + "fors": { + "DS": 1 + }, + "namespaces": {} + }, + "addon/index.js": { + "name": "addon/index.js", + "modules": { + "ember-data": 1 + }, + "classes": {}, + "fors": {}, + "namespaces": {} + }, + "addon/relationships.js": { + "name": "addon/relationships.js", + "modules": {}, + "classes": {}, + "fors": {}, + "namespaces": {} + }, + "addon/serializer.js": { + "name": "addon/serializer.js", + "modules": {}, + "classes": { + "DS.Serializer": 1 + }, + "fors": {}, + "namespaces": { + "DS": 1 + } + }, + "node_modules/ember-inflector/addon/lib/ext/string.js": { + "name": "node_modules/ember-inflector/addon/lib/ext/string.js", + "modules": {}, + "classes": {}, + "fors": { + "String": 1, + "DS.String": 1 + }, + "namespaces": {} + }, + "node_modules/ember-inflector/addon/lib/helpers/pluralize.js": { + "name": "node_modules/ember-inflector/addon/lib/helpers/pluralize.js", + "modules": {}, + "classes": {}, + "fors": { + "Ember.HTMLBars.helpers": 1 + }, + "namespaces": {} + }, + "node_modules/ember-inflector/addon/lib/helpers/singularize.js": { + "name": "node_modules/ember-inflector/addon/lib/helpers/singularize.js", + "modules": {}, + "classes": {}, + "fors": { + "Ember.HTMLBars.helpers": 1 + }, + "namespaces": {} + }, + "node_modules/ember-inflector/addon/lib/system/inflector.js": { + "name": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "modules": {}, + "classes": { + "Ember.Inflector": 1 + }, + "fors": {}, + "namespaces": { + "Ember": 1 + } + } + }, + "modules": { + "ember-data": { + "name": "ember-data", + "submodules": {}, + "elements": {}, + "classes": { + "DS.BuildURLMixin": 1, + "DS.AdapterError": 1, + "DS.InvalidError": 1, + "DS.TimeoutError": 1, + "DS.AbortError": 1, + "DS.UnauthorizedError": 1, + "DS.ForbiddenError": 1, + "DS.NotFoundError": 1, + "DS.ConflictError": 1, + "DS.ServerError": 1, + "DS": 1, + "DS.Errors": 1, + "DS.Model": 1, + "DS.RootState": 1, + "DS.AdapterPopulatedRecordArray": 1, + "DS.FilteredRecordArray": 1, + "DS.RecordArray": 1, + "DS.BelongsToReference": 1, + "DS.HasManyReference": 1, + "DS.RecordReference": 1, + "RelationshipPayloadsManager": 1, + "RelationshipPayloads": 1, + "IdentityMap": 1, + "InternalModelMap": 1, + "DS.ManyArray": 1, + "DS.PromiseArray": 1, + "DS.PromiseObject": 1, + "DS.PromiseManyArray": 1, + "DS.RecordArrayManager": 1, + "DS.SnapshotRecordArray": 1, + "DS.Snapshot": 1, + "DS.Store": 1, + "DS.JSONAPIAdapter": 1, + "DS.RESTAdapter": 1, + "DS.EmbeddedRecordsMixin": 1, + "DS.JSONAPISerializer": 1, + "DS.JSONSerializer": 1, + "DS.RESTSerializer": 1, + "DS.BooleanTransform": 1, + "Ember.Date": 1, + "DS.DateTransform": 1, + "DS.NumberTransform": 1, + "DS.StringTransform": 1, + "DS.Transform": 1, + "DS.Adapter": 1, + "DS.Serializer": 1, + "DS.String": 1, + "DS.Ember.HTMLBars.helpers": 1, + "Ember.HTMLBars.helpers": 1, + "Ember.Inflector": 1 + }, + "fors": { + "DS.Model": 1, + "DS": 1, + "String": 1, + "DS.String": 1, + "Ember.HTMLBars.helpers": 1 + }, + "namespaces": { + "DS": 1, + "Ember": 1 + }, + "tag": "main", + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 32, + "description": "Ember Data", + "itemtype": "main" + } + }, + "classes": { + "DS.BuildURLMixin": { + "name": "DS.BuildURLMixin", + "shortname": "DS.BuildURLMixin", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [ + "DS.RESTAdapter" + ], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 6, + "description": "WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4\n## Using BuildURLMixin\nTo use url building, include the mixin when extending an adapter, and call `buildURL` where needed.\n The default behaviour is designed for RESTAdapter.\n### Example\n```javascript\n export default DS.Adapter.extend(BuildURLMixin, {\n findRecord: function(store, type, id, snapshot) {\n var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');\n return this.ajax(url, 'GET');\n }\n });\n ```\n### Attributes\nThe `host` and `namespace` attributes will be used if defined, and are optional." + }, + "DS.AdapterError": { + "name": "DS.AdapterError", + "shortname": "DS.AdapterError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 10, + "description": "A `DS.AdapterError` is used by an adapter to signal that an error occurred\nduring a request to an external API. It indicates a generic error, and\nsubclasses are used to indicate specific error states. The following\nsubclasses are provided:\n\n- `DS.InvalidError`\n- `DS.TimeoutError`\n- `DS.AbortError`\n- `DS.UnauthorizedError`\n- `DS.ForbiddenError`\n- `DS.NotFoundError`\n- `DS.ConflictError`\n- `DS.ServerError`\n\nTo create a custom error to signal a specific error state in communicating\nwith an external API, extend the `DS.AdapterError`. For example if the\nexternal API exclusively used HTTP `503 Service Unavailable` to indicate\nit was closed for maintenance:\n\n```app/adapters/maintenance-error.js\nimport DS from 'ember-data';\n\nexport default DS.AdapterError.extend({ message: \"Down for maintenance.\" });\n```\n\nThis error would then be returned by an adapter's `handleResponse` method:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport MaintenanceError from './maintenance-error';\n\nexport default DS.JSONAPIAdapter.extend({\n handleResponse(status) {\n if (503 === status) {\n return new MaintenanceError();\n }\n\n return this._super(...arguments);\n }\n});\n```\n\nAnd can then be detected in an application and used to send the user to an\n`under-maintenance` route:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport MaintenanceError from '../adapters/maintenance-error';\n\nexport default Route.extend({\n actions: {\n error(error, transition) {\n if (error instanceof MaintenanceError) {\n this.transitionTo('under-maintenance');\n return;\n }\n\n // ...other error handling logic\n }\n }\n});\n```" + }, + "DS.InvalidError": { + "name": "DS.InvalidError", + "shortname": "DS.InvalidError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 110, + "description": "A `DS.InvalidError` is used by an adapter to signal the external API\nwas unable to process a request because the content was not\nsemantically correct or meaningful per the API. Usually this means a\nrecord failed some form of server side validation. When a promise\nfrom an adapter is rejected with a `DS.InvalidError` the record will\ntransition to the `invalid` state and the errors will be set to the\n`errors` property on the record.\n\nFor Ember Data to correctly map errors to their corresponding\nproperties on the model, Ember Data expects each error to be\na valid json-api error object with a `source/pointer` that matches\nthe property name. For example if you had a Post model that\nlooked like this.\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n title: DS.attr('string'),\n content: DS.attr('string')\n});\n```\n\nTo show an error from the server related to the `title` and\n`content` properties your adapter could return a promise that\nrejects with a `DS.InvalidError` object that looks like this:\n\n```app/adapters/post.js\nimport RSVP from 'RSVP';\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n updateRecord() {\n // Fictional adapter that always rejects\n return RSVP.reject(new DS.InvalidError([\n {\n detail: 'Must be unique',\n source: { pointer: '/data/attributes/title' }\n },\n {\n detail: 'Must not be blank',\n source: { pointer: '/data/attributes/content'}\n }\n ]));\n }\n});\n```\n\nYour backend may use different property names for your records the\nstore will attempt extract and normalize the errors using the\nserializer's `extractErrors` method before the errors get added to\nthe the model. As a result, it is safe for the `InvalidError` to\nwrap the error payload unaltered." + }, + "DS.TimeoutError": { + "name": "DS.TimeoutError", + "shortname": "DS.TimeoutError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 171, + "description": "A `DS.TimeoutError` is used by an adapter to signal that a request\nto the external API has timed out. I.e. no response was received from\nthe external API within an allowed time period.\n\nAn example use case would be to warn the user to check their internet\nconnection if an adapter operation has timed out:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport DS from 'ember-data';\n\nconst { TimeoutError } = DS;\n\nexport default Route.extend({\n actions: {\n error(error, transition) {\n if (error instanceof TimeoutError) {\n // alert the user\n alert('Are you still connected to the internet?');\n return;\n }\n\n // ...other error handling logic\n }\n }\n});\n```" + }, + "DS.AbortError": { + "name": "DS.AbortError", + "shortname": "DS.AbortError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 206, + "description": "A `DS.AbortError` is used by an adapter to signal that a request to\nthe external API was aborted. For example, this can occur if the user\nnavigates away from the current page after a request to the external API\nhas been initiated but before a response has been received." + }, + "DS.UnauthorizedError": { + "name": "DS.UnauthorizedError", + "shortname": "DS.UnauthorizedError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 218, + "description": "A `DS.UnauthorizedError` equates to a HTTP `401 Unauthorized` response\nstatus. It is used by an adapter to signal that a request to the external\nAPI was rejected because authorization is required and has failed or has not\nyet been provided.\n\nAn example use case would be to redirect the user to a log in route if a\nrequest is unauthorized:\n\n```app/routes/application.js\nimport Route from '@ember/routing/route';\nimport DS from 'ember-data';\n\nconst { UnauthorizedError } = DS;\n\nexport default Route.extend({\n actions: {\n error(error, transition) {\n if (error instanceof UnauthorizedError) {\n // go to the sign in route\n this.transitionTo('login');\n return;\n }\n\n // ...other error handling logic\n }\n }\n});\n```" + }, + "DS.ForbiddenError": { + "name": "DS.ForbiddenError", + "shortname": "DS.ForbiddenError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 253, + "description": "A `DS.ForbiddenError` equates to a HTTP `403 Forbidden` response status.\nIt is used by an adapter to signal that a request to the external API was\nvalid but the server is refusing to respond to it. If authorization was\nprovided and is valid, then the authenticated user does not have the\nnecessary permissions for the request." + }, + "DS.NotFoundError": { + "name": "DS.NotFoundError", + "shortname": "DS.NotFoundError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 265, + "description": "A `DS.NotFoundError` equates to a HTTP `404 Not Found` response status.\nIt is used by an adapter to signal that a request to the external API\nwas rejected because the resource could not be found on the API.\n\nAn example use case would be to detect if the user has entered a route\nfor a specific model that does not exist. For example:\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\nimport DS from 'ember-data';\n\nconst { NotFoundError } = DS;\n\nexport default Route.extend({\n model(params) {\n return this.get('store').findRecord('post', params.post_id);\n },\n\n actions: {\n error(error, transition) {\n if (error instanceof NotFoundError) {\n // redirect to a list of all posts instead\n this.transitionTo('posts');\n } else {\n // otherwise let the error bubble\n return true;\n }\n }\n }\n});\n```" + }, + "DS.ConflictError": { + "name": "DS.ConflictError", + "shortname": "DS.ConflictError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 303, + "description": "A `DS.ConflictError` equates to a HTTP `409 Conflict` response status.\nIt is used by an adapter to indicate that the request could not be processed\nbecause of a conflict in the request. An example scenario would be when\ncreating a record with a client generated id but that id is already known\nto the external API." + }, + "DS.ServerError": { + "name": "DS.ServerError", + "shortname": "DS.ServerError", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/adapters/errors.js", + "line": 315, + "description": "A `DS.ServerError` equates to a HTTP `500 Internal Server Error` response\nstatus. It is used by the adapter to indicate that a request has failed\nbecause of an error in the external API." + }, + "DS": { + "name": "DS", + "shortname": "DS", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/core.js", + "line": 8, + "description": "All Ember Data classes, methods and functions are defined inside of this namespace.", + "static": 1 + }, + "DS.Errors": { + "name": "DS.Errors", + "shortname": "DS.Errors", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/model/errors.js", + "line": 14, + "description": "Holds validation errors for a given record, organized by attribute names.\n\nEvery `DS.Model` has an `errors` property that is an instance of\n`DS.Errors`. This can be used to display validation error\nmessages returned from the server when a `record.save()` rejects.\n\nFor Example, if you had a `User` model that looked like this:\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n username: DS.attr('string'),\n email: DS.attr('string')\n});\n```\nAnd you attempted to save a record that did not validate on the backend:\n\n```javascript\nlet user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n});\nuser.save();\n```\n\nYour backend would be expected to return an error response that described\nthe problem, so that error messages can be generated on the app.\n\nAPI responses will be translated into instances of `DS.Errors` differently,\ndepending on the specific combination of adapter and serializer used. You\nmay want to check the documentation or the source code of the libraries\nthat you are using, to know how they expect errors to be communicated.\n\nErrors can be displayed to the user by accessing their property name\nto get an array of all the error objects for that property. Each\nerror object is a JavaScript object with two keys:\n\n- `message` A string containing the error message from the backend\n- `attribute` The name of the property associated with this error message\n\n```handlebars\n\n{{#each model.errors.username as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n\n\n{{#each model.errors.email as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\nYou can also access the special `messages` property on the error\nobject to get an array of all the error strings.\n\n```handlebars\n{{#each model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", + "extends": "Ember.Object", + "uses": [ + "Ember.Enumerable", + "Ember.Evented" + ] + }, + "DS.Model": { + "name": "DS.Model", + "shortname": "DS.Model", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/model/model.js", + "line": 76, + "description": "The model class that all Ember Data records descend from.\n This is the public API of Ember Data models. If you are using Ember Data\n in your application, this is the class you should use.\n If you are working on Ember Data internals, you most likely want to be dealing\n with `InternalModel`", + "extends": "Ember.Object", + "uses": [ + "Ember.Evented" + ] + }, + "DS.RootState": { + "name": "DS.RootState", + "shortname": "DS.RootState", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/model/states.js", + "line": 10, + "description": "### State\n\nEach record has a `currentState` property that explicitly tracks what\nstate a record is in at any given time. For instance, if a record is\nnewly created and has not yet been sent to the adapter to be saved,\nit would be in the `root.loaded.created.uncommitted` state. If a\nrecord has had local modifications made to it that are in the\nprocess of being saved, the record would be in the\n`root.loaded.updated.inFlight` state. (This state paths will be\nexplained in more detail below.)\n\nEvents are sent by the record or its store to the record's\n`currentState` property. How the state reacts to these events is\ndependent on which state it is in. In some states, certain events\nwill be invalid and will cause an exception to be raised.\n\nStates are hierarchical and every state is a substate of the\n`RootState`. For example, a record can be in the\n`root.deleted.uncommitted` state, then transition into the\n`root.deleted.inFlight` state. If a child state does not implement\nan event handler, the state manager will attempt to invoke the event\non all parent states until the root state is reached. The state\nhierarchy of a record is described in terms of a path string. You\ncan determine a record's current state by getting the state's\n`stateName` property:\n\n```javascript\nrecord.get('currentState.stateName');\n//=> \"root.created.uncommitted\"\n ```\n\nThe hierarchy of valid states that ship with ember data looks like\nthis:\n\n```text\n* root\n * deleted\n * saved\n * uncommitted\n * inFlight\n * empty\n * loaded\n * created\n * uncommitted\n * inFlight\n * saved\n * updated\n * uncommitted\n * inFlight\n * loading\n```\n\nThe `DS.Model` states are themselves stateless. What that means is\nthat, the hierarchical states that each of *those* points to is a\nshared data structure. For performance reasons, instead of each\nrecord getting its own copy of the hierarchy of states, each record\npoints to this global, immutable shared instance. How does a state\nknow which record it should be acting on? We pass the record\ninstance into the state's event handlers as the first argument.\n\nThe record passed as the first parameter is where you should stash\nstate about the record if needed; you should never store data on the state\nobject itself.\n\n### Events and Flags\n\nA state may implement zero or more events and flags.\n\n#### Events\n\nEvents are named functions that are invoked when sent to a record. The\nrecord will first look for a method with the given name on the\ncurrent state. If no method is found, it will search the current\nstate's parent, and then its grandparent, and so on until reaching\nthe top of the hierarchy. If the root is reached without an event\nhandler being found, an exception will be raised. This can be very\nhelpful when debugging new features.\n\nHere's an example implementation of a state with a `myEvent` event handler:\n\n```javascript\naState: DS.State.create({\n myEvent: function(manager, param) {\n console.log(\"Received myEvent with\", param);\n }\n})\n```\n\nTo trigger this event:\n\n```javascript\nrecord.send('myEvent', 'foo');\n//=> \"Received myEvent with foo\"\n```\n\nNote that an optional parameter can be sent to a record's `send()` method,\nwhich will be passed as the second parameter to the event handler.\n\nEvents should transition to a different state if appropriate. This can be\ndone by calling the record's `transitionTo()` method with a path to the\ndesired state. The state manager will attempt to resolve the state path\nrelative to the current state. If no state is found at that path, it will\nattempt to resolve it relative to the current state's parent, and then its\nparent, and so on until the root is reached. For example, imagine a hierarchy\nlike this:\n\n * created\n * uncommitted <-- currentState\n * inFlight\n * updated\n * inFlight\n\nIf we are currently in the `uncommitted` state, calling\n`transitionTo('inFlight')` would transition to the `created.inFlight` state,\nwhile calling `transitionTo('updated.inFlight')` would transition to\nthe `updated.inFlight` state.\n\nRemember that *only events* should ever cause a state transition. You should\nnever call `transitionTo()` from outside a state's event handler. If you are\ntempted to do so, create a new event and send that to the state manager.\n\n#### Flags\n\nFlags are Boolean values that can be used to introspect a record's current\nstate in a more user-friendly way than examining its state path. For example,\ninstead of doing this:\n\n```javascript\nvar statePath = record.get('stateManager.currentPath');\nif (statePath === 'created.inFlight') {\n doSomething();\n}\n```\n\nYou can say:\n\n```javascript\nif (record.get('isNew') && record.get('isSaving')) {\n doSomething();\n}\n```\n\nIf your state does not set a value for a given flag, the value will\nbe inherited from its parent (or the first place in the state hierarchy\nwhere it is defined).\n\nThe current set of flags are defined below. If you want to add a new flag,\nin addition to the area below, you will also need to declare it in the\n`DS.Model` class.\n\n\n * [isEmpty](DS.Model.html#property_isEmpty)\n * [isLoading](DS.Model.html#property_isLoading)\n * [isLoaded](DS.Model.html#property_isLoaded)\n * [hasDirtyAttributes](DS.Model.html#property_hasDirtyAttributes)\n * [isSaving](DS.Model.html#property_isSaving)\n * [isDeleted](DS.Model.html#property_isDeleted)\n * [isNew](DS.Model.html#property_isNew)\n * [isValid](DS.Model.html#property_isValid)" + }, + "DS.AdapterPopulatedRecordArray": { + "name": "DS.AdapterPopulatedRecordArray", + "shortname": "DS.AdapterPopulatedRecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-arrays/adapter-populated-record-array.js", + "line": 8, + "description": "Represents an ordered list of records whose order and membership is\ndetermined by the adapter. For example, a query sent to the adapter\nmay trigger a search on the server, whose results would be loaded\ninto an instance of the `AdapterPopulatedRecordArray`.\n\n---\n\nIf you want to update the array and get the latest records from the\nadapter, you can invoke [`update()`](#method_update):\n\nExample\n\n```javascript\n// GET /users?isAdmin=true\nvar admins = store.query('user', { isAdmin: true });\n\nadmins.then(function() {\n console.log(admins.get(\"length\")); // 42\n});\n\n// somewhere later in the app code, when new admins have been created\n// in the meantime\n//\n// GET /users?isAdmin=true\nadmins.update().then(function() {\n admins.get('isUpdating'); // false\n console.log(admins.get(\"length\")); // 123\n});\n\nadmins.get('isUpdating'); // true\n```", + "extends": "DS.RecordArray" + }, + "DS.FilteredRecordArray": { + "name": "DS.FilteredRecordArray", + "shortname": "DS.FilteredRecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-arrays/filtered-record-array.js", + "line": 5, + "description": "Represents a list of records whose membership is determined by the\nstore. As records are created, loaded, or modified, the store\nevaluates them to determine if they should be part of the record\narray.", + "extends": "DS.RecordArray" + }, + "DS.RecordArray": { + "name": "DS.RecordArray", + "shortname": "DS.RecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 13, + "description": "A record array is an array that contains records of a certain modelName. The record\narray materializes records as needed when they are retrieved for the first\ntime. You should not create record arrays yourself. Instead, an instance of\n`DS.RecordArray` or its subclasses will be returned by your application's store\nin response to queries.", + "extends": "Ember.ArrayProxy", + "uses": [ + "Ember.Evented" + ] + }, + "DS.BelongsToReference": { + "name": "DS.BelongsToReference", + "shortname": "DS.BelongsToReference", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/references/belongs-to.js", + "line": 9, + "description": "A BelongsToReference is a low level API that allows users and\naddon author to perform meta-operations on a belongs-to\nrelationship.", + "extends": "DS.Reference" + }, + "DS.HasManyReference": { + "name": "DS.HasManyReference", + "shortname": "DS.HasManyReference", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/references/has-many.js", + "line": 11, + "description": "A HasManyReference is a low level API that allows users and addon\nauthor to perform meta-operations on a has-many relationship." + }, + "DS.RecordReference": { + "name": "DS.RecordReference", + "shortname": "DS.RecordReference", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/references/record.js", + "line": 4, + "description": "An RecordReference is a low level API that allows users and\naddon author to perform meta-operations on a record." + }, + "RelationshipPayloadsManager": { + "name": "RelationshipPayloadsManager", + "shortname": "RelationshipPayloadsManager", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 6, + "description": "Manages relationship payloads for a given store, for uninitialized\nrelationships. Acts as a single source of truth (of payloads) for both sides\nof an uninitialized relationship so they can agree on the most up-to-date\npayload received without needing too much eager processing when those payloads\nare pushed into the store.\n\nThis minimizes the work spent on relationships that are never initialized.\n\nOnce relationships are initialized, their state is managed in a relationship\nstate object (eg BelongsToRelationship or ManyRelationship).", + "example": [ + "\n\n let relationshipPayloadsManager = new RelationshipPayloadsManager(store);\n\n const User = DS.Model.extend({\n hobbies: DS.hasMany('hobby')\n });\n\n const Hobby = DS.Model.extend({\n user: DS.belongsTo('user')\n });\n\n let userPayload = {\n data: {\n id: 1,\n type: 'user',\n relationships: {\n hobbies: {\n data: [{\n id: 2,\n type: 'hobby'\n }]\n }\n }\n },\n };\n relationshipPayloadsManager.push('user', 1, userPayload.data.relationships);\n\n relationshipPayloadsManager.get('hobby', 2, 'user') === {\n {\n data: {\n id: 1,\n type: 'user'\n }\n }\n }" + ], + "access": "private", + "tagname": "" + }, + "RelationshipPayloads": { + "name": "RelationshipPayloads", + "shortname": "RelationshipPayloads", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 37, + "description": "Manages the payloads for both sides of a single relationship, across all model\ninstances.\n\nFor example, with\n\nconst User = DS.Model.extend({\n hobbies: DS.hasMany('hobby')\n });\n\nconst Hobby = DS.Model.extend({\n user: DS.belongsTo('user')\n });\n\nlet relationshipPayloads = new RelationshipPayloads('user', 'hobbies', 'hobby', 'user');\n\nlet userPayload = {\n data: {\n id: 1,\n type: 'user',\n relationships: {\n hobbies: {\n data: [{\n id: 2,\n type: 'hobby',\n }]\n }\n }\n }\n };\n\n// here we expect the payload of the individual relationship\nrelationshipPayloads.push('user', 1, 'hobbies', userPayload.data.relationships.hobbies);\n\nrelationshipPayloads.get('user', 1, 'hobbies');\nrelationshipPayloads.get('hobby', 2, 'user');", + "access": "private", + "tagname": "" + }, + "IdentityMap": { + "name": "IdentityMap", + "shortname": "IdentityMap", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/identity-map.js", + "line": 4, + "description": "`IdentityMap` is a custom storage map for records by modelName\nused by `DS.Store`.", + "access": "private", + "tagname": "" + }, + "InternalModelMap": { + "name": "InternalModelMap", + "shortname": "InternalModelMap", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "", + "file": "addon/-private/system/internal-model-map.js", + "line": 4, + "description": "`InternalModelMap` is a custom storage map for internalModels of a given modelName\nused by `IdentityMap`.\n\nIt was extracted from an implicit pojo based \"internalModel map\" and preserves\nthat interface while we work towards a more official API.", + "access": "private", + "tagname": "" + }, + "DS.ManyArray": { + "name": "DS.ManyArray", + "shortname": "DS.ManyArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/many-array.js", + "line": 14, + "description": "A `ManyArray` is a `MutableArray` that represents the contents of a has-many\nrelationship.\n\nThe `ManyArray` is instantiated lazily the first time the relationship is\nrequested.\n\n### Inverses\n\nOften, the relationships in Ember Data applications will have\nan inverse. For example, imagine the following models are\ndefined:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('comment')\n});\n```\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n post: DS.belongsTo('post')\n});\n```\n\nIf you created a new instance of `App.Post` and added\na `App.Comment` record to its `comments` has-many\nrelationship, you would expect the comment's `post`\nproperty to be set to the post that contained\nthe has-many.\n\nWe call the record to which a relationship belongs the\nrelationship's _owner_.", + "extends": "Ember.Object", + "uses": [ + "Ember.MutableArray", + "Ember.Evented" + ] + }, + "DS.PromiseArray": { + "name": "DS.PromiseArray", + "shortname": "DS.PromiseArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/promise-proxies.js", + "line": 9, + "description": "A `PromiseArray` is an object that acts like both an `Ember.Array`\nand a promise. When the promise is resolved the resulting value\nwill be set to the `PromiseArray`'s `content` property. This makes\nit easy to create data bindings with the `PromiseArray` that will be\nupdated when the promise resolves.\n\nFor more information see the [Ember.PromiseProxyMixin\ndocumentation](/api/classes/Ember.PromiseProxyMixin.html).\n\nExample\n\n```javascript\nlet promiseArray = DS.PromiseArray.create({\n promise: $.getJSON('/some/remote/data.json')\n});\n\npromiseArray.get('length'); // 0\n\npromiseArray.then(function() {\n promiseArray.get('length'); // 100\n});\n```", + "extends": "Ember.ArrayProxy", + "uses": [ + "Ember.PromiseProxyMixin" + ] + }, + "DS.PromiseObject": { + "name": "DS.PromiseObject", + "shortname": "DS.PromiseObject", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/promise-proxies.js", + "line": 42, + "description": "A `PromiseObject` is an object that acts like both an `Ember.Object`\nand a promise. When the promise is resolved, then the resulting value\nwill be set to the `PromiseObject`'s `content` property. This makes\nit easy to create data bindings with the `PromiseObject` that will\nbe updated when the promise resolves.\n\nFor more information see the [Ember.PromiseProxyMixin\ndocumentation](/api/classes/Ember.PromiseProxyMixin.html).\n\nExample\n\n```javascript\nlet promiseObject = DS.PromiseObject.create({\n promise: $.getJSON('/some/remote/data.json')\n});\n\npromiseObject.get('name'); // null\n\npromiseObject.then(function() {\n promiseObject.get('name'); // 'Tomster'\n});\n```", + "extends": "Ember.ObjectProxy", + "uses": [ + "Ember.PromiseProxyMixin" + ] + }, + "DS.PromiseManyArray": { + "name": "DS.PromiseManyArray", + "shortname": "DS.PromiseManyArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/promise-proxies.js", + "line": 85, + "description": "A PromiseManyArray is a PromiseArray that also proxies certain method calls\nto the underlying manyArray.\nRight now we proxy:\n\n * `reload()`\n * `createRecord()`\n * `on()`\n * `one()`\n * `trigger()`\n * `off()`\n * `has()`", + "extends": "Ember.ArrayProxy" + }, + "DS.RecordArrayManager": { + "name": "DS.RecordArrayManager", + "shortname": "DS.RecordArrayManager", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/record-array-manager.js", + "line": 50, + "access": "private", + "tagname": "" + }, + "DS.SnapshotRecordArray": { + "name": "DS.SnapshotRecordArray", + "shortname": "DS.SnapshotRecordArray", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/snapshot-record-array.js", + "line": 5, + "access": "private", + "tagname": "", + "is_constructor": 1, + "params": [ + { + "name": "snapshots", + "description": "An array of snapshots", + "type": "Array" + }, + { + "name": "meta", + "description": "", + "type": "Object" + } + ] + }, + "DS.Snapshot": { + "name": "DS.Snapshot", + "shortname": "DS.Snapshot", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/snapshot.js", + "line": 9, + "access": "private", + "tagname": "", + "is_constructor": 1, + "params": [ + { + "name": "internalModel", + "description": "The model to create a snapshot from", + "type": "DS.Model" + } + ] + }, + "DS.Store": { + "name": "DS.Store", + "shortname": "DS.Store", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/-private/system/store.js", + "line": 125, + "description": "The store contains all of the data for records loaded from the server.\nIt is also responsible for creating instances of `DS.Model` that wrap\nthe individual data for a record, so that they can be bound to in your\nHandlebars templates.\n\nDefine your application's store like this:\n\n```app/services/store.js\nimport DS from 'ember-data';\n\nexport default DS.Store.extend({\n});\n```\n\nMost Ember.js applications will only have a single `DS.Store` that is\nautomatically created by their `Ember.Application`.\n\nYou can retrieve models from the store in several ways. To retrieve a record\nfor a specific id, use `DS.Store`'s `findRecord()` method:\n\n```javascript\nstore.findRecord('person', 123).then(function (person) {\n});\n```\n\nBy default, the store will talk to your backend using a standard\nREST mechanism. You can customize how the store talks to your\nbackend by specifying a custom adapter:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n});\n```\n\nYou can learn more about writing a custom adapter by reading the `DS.Adapter`\ndocumentation.\n\n### Store createRecord() vs. push() vs. pushPayload()\n\nThe store provides multiple ways to create new record objects. They have\nsome subtle differences in their use which are detailed below:\n\n[createRecord](#method_createRecord) is used for creating new\nrecords on the client side. This will return a new record in the\n`created.uncommitted` state. In order to persist this record to the\nbackend you will need to call `record.save()`.\n\n[push](#method_push) is used to notify Ember Data's store of new or\nupdated records that exist in the backend. This will return a record\nin the `loaded.saved` state. The primary use-case for `store#push` is\nto notify Ember Data about record updates (full or partial) that happen\noutside of the normal adapter methods (for example\n[SSE](http://dev.w3.org/html5/eventsource/) or [Web\nSockets](http://www.w3.org/TR/2009/WD-websockets-20091222/)).\n\n[pushPayload](#method_pushPayload) is a convenience wrapper for\n`store#push` that will deserialize payloads if the\nSerializer implements a `pushPayload` method.\n\nNote: When creating a new record using any of the above methods\nEmber Data will update `DS.RecordArray`s such as those returned by\n`store#peekAll()` or `store#findAll()`. This means any\ndata bindings or computed properties that depend on the RecordArray\nwill automatically be synced to include the new or updated record\nvalues.", + "extends": "Ember.Service" + }, + "DS.JSONAPIAdapter": { + "name": "DS.JSONAPIAdapter", + "shortname": "DS.JSONAPIAdapter", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/adapters/json-api.js", + "line": 13, + "description": "The `JSONAPIAdapter` is the default adapter used by Ember Data. It\nis responsible for transforming the store's requests into HTTP\nrequests that follow the [JSON API](http://jsonapi.org/format/)\nformat.\n\n## JSON API Conventions\n\nThe JSONAPIAdapter uses JSON API conventions for building the url\nfor a record and selecting the HTTP verb to use with a request. The\nactions you can take on a record map onto the following URLs in the\nJSON API adapter:\n\n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n\n \n \n \n\n
\n Action\n \n HTTP Verb\n \n URL\n
\n `store.findRecord('post', 123)`\n \n GET\n \n /posts/123\n
\n `store.findAll('post')`\n \n GET\n \n /posts\n
\n Update `postRecord.save()`\n \n PATCH\n \n /posts/123\n
\n Create `store.createRecord('post').save()`\n \n POST\n \n /posts\n
\n Delete `postRecord.destroyRecord()`\n \n DELETE\n \n /posts/123\n
\n\n## Success and failure\n\nThe JSONAPIAdapter will consider a success any response with a\nstatus code of the 2xx family (\"Success\"), as well as 304 (\"Not\nModified\"). Any other status code will be considered a failure.\n\nOn success, the request promise will be resolved with the full\nresponse payload.\n\nFailed responses with status code 422 (\"Unprocessable Entity\") will\nbe considered \"invalid\". The response will be discarded, except for\nthe `errors` key. The request promise will be rejected with a\n`DS.InvalidError`. This error object will encapsulate the saved\n`errors` value.\n\nAny other status codes will be treated as an adapter error. The\nrequest promise will be rejected, similarly to the invalid case,\nbut with an instance of `DS.AdapterError` instead.\n\n### Endpoint path customization\n\nEndpoint paths can be prefixed with a `namespace` by setting the\nnamespace property on the adapter:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n namespace: 'api/1'\n});\n```\nRequests for the `person` model would now target `/api/1/people/1`.\n\n### Host customization\n\nAn adapter can target other hosts by setting the `host` property.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n host: 'https://api.example.com'\n});\n```\n\nRequests for the `person` model would now target\n`https://api.example.com/people/1`.", + "since": "1.13.0", + "is_constructor": 1, + "extends": "DS.RESTAdapter" + }, + "DS.RESTAdapter": { + "name": "DS.RESTAdapter", + "shortname": "DS.RESTAdapter", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/adapters/rest.js", + "line": 33, + "description": "The REST adapter allows your store to communicate with an HTTP server by\ntransmitting JSON via XHR. Most Ember.js apps that consume a JSON API\nshould use the REST adapter.\n\nThis adapter is designed around the idea that the JSON exchanged with\nthe server should be conventional.\n\n## Success and failure\n\nThe REST adapter will consider a success any response with a status code\nof the 2xx family (\"Success\"), as well as 304 (\"Not Modified\"). Any other\nstatus code will be considered a failure.\n\nOn success, the request promise will be resolved with the full response\npayload.\n\nFailed responses with status code 422 (\"Unprocessable Entity\") will be\nconsidered \"invalid\". The response will be discarded, except for the\n`errors` key. The request promise will be rejected with a `DS.InvalidError`.\nThis error object will encapsulate the saved `errors` value.\n\nAny other status codes will be treated as an \"adapter error\". The request\npromise will be rejected, similarly to the \"invalid\" case, but with\nan instance of `DS.AdapterError` instead.\n\n## JSON Structure\n\nThe REST adapter expects the JSON returned from your server to follow\nthese conventions.\n\n### Object Root\n\nThe JSON payload should be an object that contains the record inside a\nroot property. For example, in response to a `GET` request for\n`/posts/1`, the JSON should look like this:\n\n```js\n{\n \"posts\": {\n \"id\": 1,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\"\n }\n}\n```\n\nSimilarly, in response to a `GET` request for `/posts`, the JSON should\nlook like this:\n\n```js\n{\n \"posts\": [\n {\n \"id\": 1,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\"\n },\n {\n \"id\": 2,\n \"title\": \"Rails is omakase\",\n \"author\": \"D2H\"\n }\n ]\n}\n```\n\nNote that the object root can be pluralized for both a single-object response\nand an array response: the REST adapter is not strict on this. Further, if the\nHTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a\n`findRecord` query) with more than one object in the array, Ember Data will\nonly display the object with the matching ID.\n\n### Conventional Names\n\nAttribute names in your JSON payload should be the camelCased versions of\nthe attributes in your Ember.js models.\n\nFor example, if you have a `Person` model:\n\n```app/models/person.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n firstName: DS.attr('string'),\n lastName: DS.attr('string'),\n occupation: DS.attr('string')\n});\n```\n\nThe JSON returned should look like this:\n\n```js\n{\n \"people\": {\n \"id\": 5,\n \"firstName\": \"Zaphod\",\n \"lastName\": \"Beeblebrox\",\n \"occupation\": \"President\"\n }\n}\n```\n\n#### Relationships\n\nRelationships are usually represented by ids to the record in the\nrelationship. The related records can then be sideloaded in the\nresponse under a key for the type.\n\n```js\n{\n \"posts\": {\n \"id\": 5,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\",\n \"comments\": [1, 2]\n },\n \"comments\": [{\n \"id\": 1,\n \"author\": \"User 1\",\n \"message\": \"First!\",\n }, {\n \"id\": 2,\n \"author\": \"User 2\",\n \"message\": \"Good Luck!\",\n }]\n}\n```\n\nIf the records in the relationship are not known when the response\nis serialized its also possible to represent the relationship as a\nurl using the `links` key in the response. Ember Data will fetch\nthis url to resolve the relationship when it is accessed for the\nfirst time.\n\n```js\n{\n \"posts\": {\n \"id\": 5,\n \"title\": \"I'm Running to Reform the W3C's Tag\",\n \"author\": \"Yehuda Katz\",\n \"links\": {\n \"comments\": \"/posts/5/comments\"\n }\n }\n}\n```\n\n### Errors\n\nIf a response is considered a failure, the JSON payload is expected to include\na top-level key `errors`, detailing any specific issues. For example:\n\n```js\n{\n \"errors\": {\n \"msg\": \"Something went wrong\"\n }\n}\n```\n\nThis adapter does not make any assumptions as to the format of the `errors`\nobject. It will simply be passed along as is, wrapped in an instance\nof `DS.InvalidError` or `DS.AdapterError`. The serializer can interpret it\nafterwards.\n\n## Customization\n\n### Endpoint path customization\n\nEndpoint paths can be prefixed with a `namespace` by setting the namespace\nproperty on the adapter:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n namespace: 'api/1'\n});\n```\nRequests for the `Person` model would now target `/api/1/people/1`.\n\n### Host customization\n\nAn adapter can target other hosts by setting the `host` property.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n host: 'https://api.example.com'\n});\n```\n\n### Headers customization\n\nSome APIs require HTTP headers, e.g. to provide an API key. Arbitrary\nheaders can be set as key/value pairs on the `RESTAdapter`'s `headers`\nobject and Ember Data will send them along with each ajax request.\n\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n headers: {\n 'API_KEY': 'secret key',\n 'ANOTHER_HEADER': 'Some header value'\n }\n});\n```\n\n`headers` can also be used as a computed property to support dynamic\nheaders. In the example below, the `session` object has been\ninjected into an adapter by Ember's container.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { computed } from '@ember/object';\n\nexport default DS.RESTAdapter.extend({\n headers: computed('session.authToken', function() {\n return {\n 'API_KEY': this.get('session.authToken'),\n 'ANOTHER_HEADER': 'Some header value'\n };\n })\n});\n```\n\nIn some cases, your dynamic headers may require data from some\nobject outside of Ember's observer system (for example\n`document.cookie`). You can use the\n[volatile](/api/classes/Ember.ComputedProperty.html#method_volatile)\nfunction to set the property into a non-cached mode causing the headers to\nbe recomputed with every request.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { get } from '@ember/object';\nimport { computed } from '@ember/object';\n\nexport default DS.RESTAdapter.extend({\n headers: computed(function() {\n return {\n 'API_KEY': get(document.cookie.match(/apiKey\\=([^;]*)/), '1'),\n 'ANOTHER_HEADER': 'Some header value'\n };\n }).volatile()\n});\n```", + "is_constructor": 1, + "extends": "DS.Adapter", + "uses": [ + "DS.BuildURLMixin" + ] + }, + "DS.EmbeddedRecordsMixin": { + "name": "DS.EmbeddedRecordsMixin", + "shortname": "DS.EmbeddedRecordsMixin", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/embedded-records-mixin.js", + "line": 8, + "description": "## Using Embedded Records\n\n`DS.EmbeddedRecordsMixin` supports serializing embedded records.\n\nTo set up embedded records, include the mixin when extending a serializer,\nthen define and configure embedded (model) relationships.\n\nNote that embedded records will serialize with the serializer for their model instead of the serializer in which they are defined.\n\nBelow is an example of a per-type serializer (`post` type).\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n attrs: {\n author: { embedded: 'always' },\n comments: { serialize: 'ids' }\n }\n});\n```\nNote that this use of `{ embedded: 'always' }` is unrelated to\nthe `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of\ndefining a model while working with the `ActiveModelSerializer`. Nevertheless,\nusing `{ embedded: 'always' }` as an option to `DS.attr` is not a valid way to setup\nembedded records.\n\nThe `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:\n\n```js\n{\n serialize: 'records',\n deserialize: 'records'\n}\n```\n\n### Configuring Attrs\n\nA resource's `attrs` option may be set to use `ids`, `records` or false for the\n`serialize` and `deserialize` settings.\n\nThe `attrs` property can be set on the `ApplicationSerializer` or a per-type\nserializer.\n\nIn the case where embedded JSON is expected while extracting a payload (reading)\nthe setting is `deserialize: 'records'`, there is no need to use `ids` when\nextracting as that is the default behavior without this mixin if you are using\nthe vanilla `EmbeddedRecordsMixin`. Likewise, to embed JSON in the payload while\nserializing `serialize: 'records'` is the setting to use. There is an option of\nnot embedding JSON in the serialized payload by using `serialize: 'ids'`. If you\ndo not want the relationship sent at all, you can use `serialize: false`.\n\n\n### EmbeddedRecordsMixin defaults\nIf you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`\nwill behave in the following way:\n\nBelongsTo: `{ serialize: 'id', deserialize: 'id' }`\nHasMany: `{ serialize: false, deserialize: 'ids' }`\n\n### Model Relationships\n\nEmbedded records must have a model defined to be extracted and serialized. Note that\nwhen defining any relationships on your model such as `belongsTo` and `hasMany`, you\nshould not both specify `async: true` and also indicate through the serializer's\n`attrs` attribute that the related model should be embedded for deserialization.\nIf a model is declared embedded for deserialization (`embedded: 'always'` or `deserialize: 'records'`),\nthen do not use `async: true`.\n\nTo successfully extract and serialize embedded records the model relationships\nmust be setup correcty. See the\n[defining relationships](/guides/models/defining-models/#toc_defining-relationships)\nsection of the **Defining Models** guide page.\n\nRecords without an `id` property are not considered embedded records, model\ninstances must have an `id` property to be used with Ember Data.\n\n### Example JSON payloads, Models and Serializers\n\n**When customizing a serializer it is important to grok what the customizations\nare. Please read the docs for the methods this mixin provides, in case you need\nto modify it to fit your specific needs.**\n\nFor example review the docs for each method of this mixin:\n* [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)\n* [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)\n* [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)" + }, + "DS.JSONAPISerializer": { + "name": "DS.JSONAPISerializer", + "shortname": "DS.JSONAPISerializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/json-api.js", + "line": 15, + "description": "Ember Data 2.0 Serializer:\n\nIn Ember Data a Serializer is used to serialize and deserialize\nrecords when they are transferred in and out of an external source.\nThis process involves normalizing property names, transforming\nattribute values and serializing relationships.\n\n`JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\nserializer recommended by Ember Data.\n\nThis serializer normalizes a JSON API payload that looks like:\n\n```app/models/player.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n name: DS.attr('string'),\n skill: DS.attr('string'),\n gamesPlayed: DS.attr('number'),\n club: DS.belongsTo('club')\n});\n```\n\n```app/models/club.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n name: DS.attr('string'),\n location: DS.attr('string'),\n players: DS.hasMany('player')\n});\n```\n\n```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n```\n\nto the format that the Ember Data store expects.\n\n### Customizing meta\n\nSince a JSON API Document can have meta defined in multiple locations you can\nuse the specific serializer hooks if you need to customize the meta.\n\nOne scenario would be to camelCase the meta keys of your payload. The example\nbelow shows how this could be done using `normalizeArrayResponse` and\n`extractRelationship`.\n\n```app/serializers/application.js\nexport default JSONAPISerializer.extend({\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = this._super(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n },\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = this._super(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n});\n```", + "since": "1.13.0", + "extends": "DS.JSONSerializer" + }, + "DS.JSONSerializer": { + "name": "DS.JSONSerializer", + "shortname": "DS.JSONSerializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/json.js", + "line": 17, + "description": "Ember Data 2.0 Serializer:\n\nIn Ember Data a Serializer is used to serialize and deserialize\nrecords when they are transferred in and out of an external source.\nThis process involves normalizing property names, transforming\nattribute values and serializing relationships.\n\nBy default, Ember Data uses and recommends the `JSONAPISerializer`.\n\n`JSONSerializer` is useful for simpler or legacy backends that may\nnot support the http://jsonapi.org/ spec.\n\nFor example, given the following `User` model and JSON payload:\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n friends: DS.hasMany('user'),\n house: DS.belongsTo('location'),\n\n name: DS.attr('string')\n});\n```\n\n```js\n{\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n}\n```\n\n`JSONSerializer` will normalize the JSON payload to the JSON API format that the\nEmber Data store expects.\n\nYou can customize how JSONSerializer processes its payload by passing options in\nthe `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\nThe `JSONSerializer` normalization process follows these steps:\n\n - `normalizeResponse` - entry method to the serializer.\n - `normalizeCreateRecordResponse` - a `normalizeResponse` for a specific operation is called.\n - `normalizeSingleResponse`|`normalizeArrayResponse` - for methods like `createRecord` we expect\n a single record back, while for methods like `findAll` we expect multiple records back.\n - `normalize` - `normalizeArray` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n - `extractId` | `extractAttributes` | `extractRelationships` - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.", + "extends": "DS.Serializer" + }, + "DS.RESTSerializer": { + "name": "DS.RESTSerializer", + "shortname": "DS.RESTSerializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializers/rest.js", + "line": 21, + "description": "Normally, applications will use the `RESTSerializer` by implementing\nthe `normalize` method.\n\nThis allows you to do whatever kind of munging you need, and is\nespecially useful if your server is inconsistent and you need to\ndo munging differently for many different kinds of responses.\n\nSee the `normalize` documentation for more information.\n\n## Across the Board Normalization\n\nThere are also a number of hooks that you might find useful to define\nacross-the-board rules for your payload. These rules will be useful\nif your server is consistent, or if you're building an adapter for\nan infrastructure service, like Firebase, and want to encode service\nconventions.\n\nFor example, if all of your keys are underscored and all-caps, but\notherwise consistent with the names you use in your models, you\ncan implement across-the-board rules for how to convert an attribute\nname in your model to a key in your JSON.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { underscore } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n keyForAttribute(attr, method) {\n return underscore(attr).toUpperCase();\n }\n});\n```\n\nYou can also implement `keyForRelationship`, which takes the name\nof the relationship as the first parameter, the kind of\nrelationship (`hasMany` or `belongsTo`) as the second parameter, and\nthe method (`serialize` or `deserialize`) as the third parameter.", + "extends": "DS.JSONSerializer" + }, + "DS.BooleanTransform": { + "name": "DS.BooleanTransform", + "shortname": "DS.BooleanTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/boolean.js", + "line": 4, + "description": "The `DS.BooleanTransform` class is used to serialize and deserialize\nboolean attributes on Ember Data record objects. This transform is\nused when `boolean` is passed as the type parameter to the\n[DS.attr](../../data#method_attr) function.\n\nUsage\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n isAdmin: DS.attr('boolean'),\n name: DS.attr('string'),\n email: DS.attr('string')\n});\n```\n\nBy default the boolean transform only allows for values of `true` or\n`false`. You can opt into allowing `null` values for\nboolean attributes via `DS.attr('boolean', { allowNull: true })`\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n email: DS.attr('string'),\n username: DS.attr('string'),\n wantsWeeklyEmail: DS.attr('boolean', { allowNull: true })\n});\n```", + "extends": "DS.Transform" + }, + "Ember.Date": { + "name": "Ember.Date", + "shortname": "Ember.Date", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "Ember", + "file": "addon/transforms/date.js", + "line": 7, + "description": "Date.parse with progressive enhancement for ISO 8601 \n\n© 2011 Colin Snover \n\nReleased under MIT license.", + "static": 1, + "deprecated": true + }, + "DS.DateTransform": { + "name": "DS.DateTransform", + "shortname": "DS.DateTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/date.js", + "line": 35, + "description": "The `DS.DateTransform` class is used to serialize and deserialize\ndate attributes on Ember Data record objects. This transform is used\nwhen `date` is passed as the type parameter to the\n[DS.attr](../../data#method_attr) function. It uses the [`ISO 8601`](https://en.wikipedia.org/wiki/ISO_8601)\nstandard.\n\n```app/models/score.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n value: DS.attr('number'),\n player: DS.belongsTo('player'),\n date: DS.attr('date')\n });\n```", + "extends": "DS.Transform" + }, + "DS.NumberTransform": { + "name": "DS.NumberTransform", + "shortname": "DS.NumberTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/number.js", + "line": 8, + "description": "The `DS.NumberTransform` class is used to serialize and deserialize\nnumeric attributes on Ember Data record objects. This transform is\nused when `number` is passed as the type parameter to the\n[DS.attr](../../data#method_attr) function.\n\nUsage\n\n```app/models/score.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n value: DS.attr('number'),\n player: DS.belongsTo('player'),\n date: DS.attr('date')\n});\n```", + "extends": "DS.Transform" + }, + "DS.StringTransform": { + "name": "DS.StringTransform", + "shortname": "DS.StringTransform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/string.js", + "line": 4, + "description": "The `DS.StringTransform` class is used to serialize and deserialize\nstring attributes on Ember Data record objects. This transform is\nused when `string` is passed as the type parameter to the\n[DS.attr](../../data#method_attr) function.\n\nUsage\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n isAdmin: DS.attr('boolean'),\n name: DS.attr('string'),\n email: DS.attr('string')\n});\n```", + "extends": "DS.Transform" + }, + "DS.Transform": { + "name": "DS.Transform", + "shortname": "DS.Transform", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/transforms/transform.js", + "line": 3, + "description": "The `DS.Transform` class is used to serialize and deserialize model\nattributes when they are saved or loaded from an\nadapter. Subclassing `DS.Transform` is useful for creating custom\nattributes. All subclasses of `DS.Transform` must implement a\n`serialize` and a `deserialize` method.\n\nExample\n\n```app/transforms/temperature.js\nimport DS from 'ember-data';\n\n// Converts centigrade in the JSON to fahrenheit in the app\nexport default DS.Transform.extend({\n deserialize(serialized, options) {\n return (serialized * 1.8) + 32;\n },\n\n serialize(deserialized, options) {\n return (deserialized - 32) / 1.8;\n }\n});\n```\n\nThe options passed into the `DS.attr` function when the attribute is\ndeclared on the model is also available in the transform.\n\n```app/models/post.js\nexport default DS.Model.extend({\n title: DS.attr('string'),\n markdown: DS.attr('markdown', {\n markdown: {\n gfm: false,\n sanitize: true\n }\n })\n});\n```\n\n```app/transforms/markdown.js\nexport default DS.Transform.extend({\n serialize(deserialized, options) {\n return deserialized.raw;\n },\n\n deserialize(serialized, options) {\n var markdownOptions = options.markdown || {};\n\n return marked(serialized, markdownOptions);\n }\n});\n```\n\nUsage\n\n```app/models/requirement.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n name: DS.attr('string'),\n temperature: DS.attr('temperature')\n});\n```" + }, + "DS.Adapter": { + "name": "DS.Adapter", + "shortname": "DS.Adapter", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/adapter.js", + "line": 7, + "description": "An adapter is an object that receives requests from a store and\ntranslates them into the appropriate action to take against your\npersistence layer. The persistence layer is usually an HTTP API, but\nmay be anything, such as the browser's local storage. Typically the\nadapter is not invoked directly instead its functionality is accessed\nthrough the `store`.\n\n### Creating an Adapter\n\nCreate a new subclass of `DS.Adapter` in the `app/adapters` folder:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n // ...your code here\n});\n```\n\nModel-specific adapters can be created by putting your adapter\nclass in an `app/adapters/` + `model-name` + `.js` file of the application.\n\n```app/adapters/post.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n // ...Post-specific adapter code goes here\n});\n```\n\n`DS.Adapter` is an abstract base class that you should override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:\n\n * `findRecord()`\n * `createRecord()`\n * `updateRecord()`\n * `deleteRecord()`\n * `findAll()`\n * `query()`\n\nTo improve the network performance of your application, you can optimize\nyour adapter by overriding these lower-level methods:\n\n * `findMany()`\n\n\nFor an example implementation, see `DS.RESTAdapter`, the\nincluded REST adapter.", + "extends": "Ember.Object" + }, + "DS.Serializer": { + "name": "DS.Serializer", + "shortname": "DS.Serializer", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS", + "file": "addon/serializer.js", + "line": 7, + "description": "`DS.Serializer` is an abstract base class that you should override in your\napplication to customize it for your backend. The minimum set of methods\nthat you should implement is:\n\n * `normalizeResponse()`\n * `serialize()`\n\nAnd you can optionally override the following methods:\n\n * `normalize()`\n\nFor an example implementation, see\n[DS.JSONSerializer](DS.JSONSerializer), the included JSON serializer.", + "extends": "Ember.Object" + }, + "DS.String": { + "name": "DS.String", + "shortname": "String", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS" + }, + "DS.Ember.HTMLBars.helpers": { + "name": "DS.Ember.HTMLBars.helpers", + "shortname": "Ember.HTMLBars.helpers", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "DS" + }, + "Ember.HTMLBars.helpers": { + "name": "Ember.HTMLBars.helpers", + "shortname": "Ember.HTMLBars.helpers", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "" + }, + "Ember.Inflector": { + "name": "Ember.Inflector", + "shortname": "Ember.Inflector", + "classitems": [], + "plugins": [], + "extensions": [], + "plugin_for": [], + "extension_for": [], + "module": "ember-data", + "namespace": "Ember", + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 32, + "description": "Inflector.Ember provides a mechanism for supplying inflection rules for your\napplication. Ember includes a default set of inflection rules, and provides an\nAPI for providing additional rules.\n\nExamples:\n\nCreating an inflector with no rules.\n\n```js\nvar inflector = new Ember.Inflector();\n```\n\nCreating an inflector with the default ember ruleset.\n\n```js\nvar inflector = new Ember.Inflector(Ember.Inflector.defaultRules);\n\ninflector.pluralize('cow'); //=> 'kine'\ninflector.singularize('kine'); //=> 'cow'\n```\n\nCreating an inflector and adding rules later.\n\n```javascript\nvar inflector = Ember.Inflector.inflector;\n\ninflector.pluralize('advice'); // => 'advices'\ninflector.uncountable('advice');\ninflector.pluralize('advice'); // => 'advice'\n\ninflector.pluralize('formula'); // => 'formulas'\ninflector.irregular('formula', 'formulae');\ninflector.pluralize('formula'); // => 'formulae'\n\n// you would not need to add these as they are the default rules\ninflector.plural(/$/, 's');\ninflector.singular(/s$/i, '');\n```\n\nCreating an inflector with a nondefault ruleset.\n\n```javascript\nvar rules = {\n plurals: [\n [ /$/, 's' ]\n ],\n singular: [\n [ /\\s$/, '' ]\n ],\n irregularPairs: [\n [ 'cow', 'kine' ]\n ],\n uncountable: [ 'fish' ]\n};\n\nvar inflector = new Ember.Inflector(rules);\n```" + } + }, + "elements": {}, + "classitems": [ + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 34, + "description": "Builds a URL for a given type and optional ID.\n\nBy default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see [pathForType](#method_pathForType).\n\nIf an ID is specified, it adds the ID to the path generated\nfor the type, separated by a `/`.\n\nWhen called by RESTAdapter.findMany() the `id` and `snapshot` parameters\nwill be arrays of ids and snapshots.", + "itemtype": "method", + "name": "buildURL", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "single id or array of ids or query", + "type": "(String|Array|Object)" + }, + { + "name": "snapshot", + "description": "single snapshot or array of snapshots", + "type": "(DS.Snapshot|Array)" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "object of query parameters to send for query requests.", + "type": "Object" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 82, + "itemtype": "method", + "name": "_buildURL", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 111, + "description": "Builds a URL for a `store.findRecord(type, id)` call.\n\nExample:\n\n```app/adapters/user.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n urlForFindRecord(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id, snapshot);\n return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n }\n});\n```", + "itemtype": "method", + "name": "urlForFindRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 138, + "description": "Builds a URL for a `store.findAll(type)` call.\n\nExample:\n\n```app/adapters/comment.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n urlForFindAll(modelName, snapshot) {\n return 'data/comments.json';\n }\n});\n```", + "itemtype": "method", + "name": "urlForFindAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 162, + "description": "Builds a URL for a `store.query(type, query)` call.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n host: 'https://api.github.com',\n urlForQuery (query, modelName) {\n switch(modelName) {\n case 'repo':\n return `https://api.github.com/orgs/${query.orgId}/repos`;\n default:\n return this._super(...arguments);\n }\n }\n});\n```", + "itemtype": "method", + "name": "urlForQuery", + "params": [ + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 192, + "description": "Builds a URL for a `store.queryRecord(type, query)` call.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n urlForQueryRecord({ slug }, modelName) {\n let baseUrl = this.buildURL();\n return `${baseUrl}/${encodeURIComponent(slug)}`;\n }\n});\n```", + "itemtype": "method", + "name": "urlForQueryRecord", + "params": [ + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 217, + "description": "Builds a URL for coalesceing multiple `store.findRecord(type, id)`\nrecords into 1 request when the adapter's `coalesceFindRequests`\nproperty is true.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n urlForFindMany(ids, modelName) {\n let baseUrl = this.buildURL();\n return `${baseUrl}/coalesce`;\n }\n});\n```", + "itemtype": "method", + "name": "urlForFindMany", + "params": [ + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 245, + "description": "Builds a URL for fetching a async hasMany relationship when a url\nis not provided by the server.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n urlForFindHasMany(id, modelName, snapshot) {\n let baseUrl = this.buildURL(id, modelName);\n return `${baseUrl}/relationships`;\n }\n});\n```", + "itemtype": "method", + "name": "urlForFindHasMany", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 272, + "description": "Builds a URL for fetching a async belongsTo relationship when a url\nis not provided by the server.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPIAdapter.extend({\n urlForFindBelongsTo(id, modelName, snapshot) {\n let baseUrl = this.buildURL(id, modelName);\n return `${baseUrl}/relationships`;\n }\n});\n```", + "itemtype": "method", + "name": "urlForFindBelongsTo", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 299, + "description": "Builds a URL for a `record.save()` call when the record was created\nlocally using `store.createRecord()`.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n urlForCreateRecord(modelName, snapshot) {\n return this._super(...arguments) + '/new';\n }\n});\n```", + "itemtype": "method", + "name": "urlForCreateRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 324, + "description": "Builds a URL for a `record.save()` call when the record has been update locally.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n urlForUpdateRecord(id, modelName, snapshot) {\n return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n }\n});\n```", + "itemtype": "method", + "name": "urlForUpdateRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 349, + "description": "Builds a URL for a `record.save()` call when the record has been deleted locally.\n\nExample:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n urlForDeleteRecord(id, modelName, snapshot) {\n return this._super(...arguments) + '/destroy';\n }\n});\n```", + "itemtype": "method", + "name": "urlForDeleteRecord", + "params": [ + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "url", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 374, + "itemtype": "method", + "name": "urlPrefix", + "access": "private", + "tagname": "", + "params": [ + { + "name": "path", + "description": "", + "type": "String" + }, + { + "name": "parentURL", + "description": "", + "type": "String" + } + ], + "return": { + "description": "urlPrefix", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/build-url-mixin.js", + "line": 411, + "description": "Determines the pathname for a given type.\n\nBy default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').\n\n### Pathname customization\n\nFor example if you have an object LineItem with an\nendpoint of \"/line_items/\".\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { decamelize } from '@ember/string';\nimport { pluralize } from 'ember-inflector';\n\nexport default DS.RESTAdapter.extend({\n pathForType: function(modelName) {\n var decamelized = decamelize(modelName);\n return pluralize(decamelized);\n }\n});\n```", + "itemtype": "method", + "name": "pathForType", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "path", + "type": "String" + }, + "class": "DS.BuildURLMixin", + "namespace": "DS" + }, + { + "file": "addon/-private/adapters/errors.js", + "line": 325, + "description": "Convert an hash of errors into an array with errors in JSON-API format.\n\n```javascript\nimport DS from 'ember-data';\n\nconst { errorsHashToArray } = DS;\n\nlet errors = {\n base: 'Invalid attributes on saving this record',\n name: 'Must be present',\n age: ['Must be present', 'Must be a number']\n};\n\nlet errorsArray = errorsHashToArray(errors);\n// [\n// {\n// title: \"Invalid Document\",\n// detail: \"Invalid attributes on saving this record\",\n// source: { pointer: \"/data\" }\n// },\n// {\n// title: \"Invalid Attribute\",\n// detail: \"Must be present\",\n// source: { pointer: \"/data/attributes/name\" }\n// },\n// {\n// title: \"Invalid Attribute\",\n// detail: \"Must be present\",\n// source: { pointer: \"/data/attributes/age\" }\n// },\n// {\n// title: \"Invalid Attribute\",\n// detail: \"Must be a number\",\n// source: { pointer: \"/data/attributes/age\" }\n// }\n// ]\n```", + "itemtype": "method", + "name": "errorsHashToArray", + "access": "public", + "tagname": "", + "params": [ + { + "name": "errors", + "description": "hash with errors as properties", + "type": "Object" + } + ], + "return": { + "description": "array of errors in JSON-API format", + "type": "Array" + }, + "class": "DS" + }, + { + "file": "addon/-private/adapters/errors.js", + "line": 398, + "description": "Convert an array of errors in JSON-API format into an object.\n\n```javascript\nimport DS from 'ember-data';\n\nconst { errorsArrayToHash } = DS;\n\nlet errorsArray = [\n {\n title: 'Invalid Attribute',\n detail: 'Must be present',\n source: { pointer: '/data/attributes/name' }\n },\n {\n title: 'Invalid Attribute',\n detail: 'Must be present',\n source: { pointer: '/data/attributes/age' }\n },\n {\n title: 'Invalid Attribute',\n detail: 'Must be a number',\n source: { pointer: '/data/attributes/age' }\n }\n];\n\nlet errors = errorsArrayToHash(errorsArray);\n// {\n// \"name\": [\"Must be present\"],\n// \"age\": [\"Must be present\", \"must be a number\"]\n// }\n```", + "itemtype": "method", + "name": "errorsArrayToHash", + "access": "public", + "tagname": "", + "params": [ + { + "name": "errors", + "description": "array of errors in JSON-API format", + "type": "Array" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 90, + "description": "Register with target handler", + "itemtype": "method", + "name": "registerHandlers", + "params": [ + { + "name": "target", + "description": "", + "type": "Object" + }, + { + "name": "becameInvalid", + "description": "", + "type": "Function" + }, + { + "name": "becameValid", + "description": "", + "type": "Function" + } + ], + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 110, + "description": "Register with target handler", + "itemtype": "method", + "name": "_registerHandlers", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 122, + "itemtype": "property", + "name": "errorsByAttributeName", + "type": "{Ember.MapWithDefault}", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 135, + "description": "Returns errors for a given attribute\n\n```javascript\nlet user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n});\nuser.save().catch(function(){\n user.get('errors').errorsFor('email'); // returns:\n // [{attribute: \"email\", message: \"Doesn't look like a valid email.\"}]\n});\n```", + "itemtype": "method", + "name": "errorsFor", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Array" + }, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 157, + "description": "An array containing all of the error messages for this\nrecord. This is useful for displaying all errors to the user.\n\n```handlebars\n{{#each model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", + "itemtype": "property", + "name": "messages", + "type": "{Array}", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 174, + "itemtype": "property", + "name": "content", + "type": "{Array}", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 183, + "itemtype": "method", + "name": "unknownProperty", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 193, + "description": "Total number of errors.", + "itemtype": "property", + "name": "length", + "type": "{Number}", + "readonly": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 201, + "itemtype": "property", + "name": "isEmpty", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 208, + "description": "Adds error messages to a given attribute and sends\n`becameInvalid` event to the record.\n\nExample:\n\n```javascript\nif (!user.get('username') {\n user.get('errors').add('username', 'This field is required');\n}\n```", + "itemtype": "method", + "name": "add", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + }, + { + "name": "messages", + "description": "", + "type": "(Array|String)" + } + ], + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 240, + "description": "Adds error messages to a given attribute without sending event.", + "itemtype": "method", + "name": "_add", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 254, + "itemtype": "method", + "name": "_findOrCreateMessages", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 279, + "description": "Removes all error messages from the given attribute and sends\n`becameValid` event to the record if there no more errors left.\n\nExample:\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n email: DS.attr('string'),\n twoFactorAuth: DS.attr('boolean'),\n phone: DS.attr('string')\n});\n```\n\n```app/routes/user/edit.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n actions: {\n save: function(user) {\n if (!user.get('twoFactorAuth')) {\n user.get('errors').remove('phone');\n }\n user.save();\n }\n }\n});\n```", + "itemtype": "method", + "name": "remove", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + } + ], + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 328, + "description": "Removes all error messages from the given attribute without sending event.", + "itemtype": "method", + "name": "_remove", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 345, + "description": "Removes all error messages and sends `becameValid` event\nto the record.\n\nExample:\n\n```app/routes/user/edit.js\n import Route from '@ember/routing/route';\n\nexport default Route.extend({\n actions: {\n retrySave: function(user) {\n user.get('errors').clear();\n user.save();\n }\n }\n});\n```", + "itemtype": "method", + "name": "clear", + "deprecated": true, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 379, + "description": "Removes all error messages.\nto the record.", + "itemtype": "method", + "name": "_clear", + "access": "private", + "tagname": "", + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/errors.js", + "line": 405, + "description": "Checks if there is error messages for the given attribute.\n\n```app/routes/user/edit.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n actions: {\n save: function(user) {\n if (user.get('errors').has('email')) {\n return alert('Please update your email before attempting to save.');\n }\n user.save();\n }\n }\n});\n```", + "itemtype": "method", + "name": "has", + "params": [ + { + "name": "attribute", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if there some errors on given attribute", + "type": "Boolean" + }, + "class": "DS.Errors", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/internal-model.js", + "line": 435, + "description": "Computes the set of internal models reachable from `this` across exactly one\nrelationship.", + "return": { + "description": "An array containing the internal models that `this` belongs\nto or has many.", + "type": "Array" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/internal-model.js", + "line": 452, + "description": "Computes the set of internal models reachable from this internal model.\n\nReachability is determined over the relationship graph (ie a graph where\nnodes are internal models and edges are belongs to or has many\nrelationships).", + "return": { + "description": "An array including `this` and all internal models reachable\nfrom `this`.", + "type": "Array" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/internal-model.js", + "line": 485, + "description": "Unload the record for this internal model. This will cause the record to be\ndestroyed and freed up for garbage collection. It will also do a check\nfor cleaning up internal models.\n\nThis check is performed by first computing the set of related internal\nmodels. If all records in this set are unloaded, then the entire set is\ndestroyed. Otherwise, nothing in the set is destroyed.\n\nThis means that this internal model will be freed up for garbage collection\nonce all models that refer to it via some relationship are also unloaded.", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 96, + "description": "If this property is `true` the record is in the `empty`\nstate. Empty is the first state all records enter after they have\nbeen created. Most records created by the store will quickly\ntransition to the `loading` state if data needs to be fetched from\nthe server or the `created` state if the record is created on the\nclient. A record can also enter the empty state if the adapter is\nunable to locate the record.", + "itemtype": "property", + "name": "isEmpty", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 110, + "description": "If this property is `true` the record is in the `loading` state. A\nrecord enters this state when the store asks the adapter for its\ndata. It remains in this state until the adapter provides the\nrequested data.", + "itemtype": "property", + "name": "isLoading", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 121, + "description": "If this property is `true` the record is in the `loaded` state. A\nrecord enters this state when its data is populated. Most of a\nrecord's lifecycle is spent inside substates of the `loaded`\nstate.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('isLoaded'); // true\n\nstore.findRecord('model', 1).then(function(model) {\n model.get('isLoaded'); // true\n});\n```", + "itemtype": "property", + "name": "isLoaded", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 143, + "description": "If this property is `true` the record is in the `dirty` state. The\nrecord has local changes that have not yet been saved by the\nadapter. This includes records that have been created (but not yet\nsaved) or deleted.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('hasDirtyAttributes'); // true\n\nstore.findRecord('model', 1).then(function(model) {\n model.get('hasDirtyAttributes'); // false\n model.set('foo', 'some value');\n model.get('hasDirtyAttributes'); // true\n});\n```", + "since": "1.13.0", + "itemtype": "property", + "name": "hasDirtyAttributes", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 170, + "description": "If this property is `true` the record is in the `saving` state. A\nrecord enters the saving state when `save` is called, but the\nadapter has not yet acknowledged that the changes have been\npersisted to the backend.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('isSaving'); // false\nlet promise = record.save();\nrecord.get('isSaving'); // true\npromise.then(function() {\n record.get('isSaving'); // false\n});\n```", + "itemtype": "property", + "name": "isSaving", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 193, + "description": "If this property is `true` the record is in the `deleted` state\nand has been marked for deletion. When `isDeleted` is true and\n`hasDirtyAttributes` is true, the record is deleted locally but the deletion\nwas not yet persisted. When `isSaving` is true, the change is\nin-flight. When both `hasDirtyAttributes` and `isSaving` are false, the\nchange has persisted.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('isDeleted'); // false\nrecord.deleteRecord();\n\n// Locally deleted\nrecord.get('isDeleted'); // true\nrecord.get('hasDirtyAttributes'); // true\nrecord.get('isSaving'); // false\n\n// Persisting the deletion\nlet promise = record.save();\nrecord.get('isDeleted'); // true\nrecord.get('isSaving'); // true\n\n// Deletion Persisted\npromise.then(function() {\n record.get('isDeleted'); // true\n record.get('isSaving'); // false\n record.get('hasDirtyAttributes'); // false\n});\n```", + "itemtype": "property", + "name": "isDeleted", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 231, + "description": "If this property is `true` the record is in the `new` state. A\nrecord will be in the `new` state when it has been created on the\nclient and the adapter has not yet report that it was successfully\nsaved.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('isNew'); // true\n\nrecord.save().then(function(model) {\n model.get('isNew'); // false\n});\n```", + "itemtype": "property", + "name": "isNew", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 253, + "description": "If this property is `true` the record is in the `valid` state.\n\nA record will be in the `valid` state when the adapter did not report any\nserver-side validation failures.", + "itemtype": "property", + "name": "isValid", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 264, + "description": "If the record is in the dirty state this property will report what\nkind of change has caused it to move into the dirty\nstate. Possible values are:\n\n- `created` The record has been created by the client and not yet saved to the adapter.\n- `updated` The record has been updated by the client and not yet saved to the adapter.\n- `deleted` The record has been deleted by the client and not yet saved to the adapter.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('dirtyType'); // 'created'\n```", + "itemtype": "property", + "name": "dirtyType", + "type": "{String}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 286, + "description": "If `true` the adapter reported that it was unable to save local\nchanges to the backend for any reason other than a server-side\nvalidation error.\n\nExample\n\n```javascript\nrecord.get('isError'); // false\nrecord.set('foo', 'valid value');\nrecord.save().then(null, function() {\n record.get('isError'); // true\n});\n```", + "itemtype": "property", + "name": "isError", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 307, + "description": "If `true` the store is attempting to reload the record from the adapter.\n\nExample\n\n```javascript\nrecord.get('isReloading'); // false\nrecord.reload();\nrecord.get('isReloading'); // true\n```", + "itemtype": "property", + "name": "isReloading", + "type": "{Boolean}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 324, + "description": "All ember models have an id property. This is an identifier\nmanaged by an external source. These are always coerced to be\nstrings before being used internally. Note when declaring the\nattributes for a model it is an error to declare an id\nattribute.\n\n```javascript\nlet record = store.createRecord('model');\nrecord.get('id'); // null\n\nstore.findRecord('model', 1).then(function(model) {\n model.get('id'); // '1'\n});\n```", + "itemtype": "property", + "name": "id", + "type": "{String}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 345, + "itemtype": "property", + "name": "currentState", + "access": "private", + "tagname": "", + "type": "{Object}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 352, + "description": "When the record is in the `invalid` state this object will contain\nany errors returned by the adapter. When present the errors hash\ncontains keys corresponding to the invalid property names\nand values which are arrays of Javascript objects with two keys:\n\n- `message` A string containing the error message from the backend\n- `attribute` The name of the property associated with this error message\n\n```javascript\nrecord.get('errors.length'); // 0\nrecord.set('foo', 'invalid value');\nrecord.save().catch(function() {\n record.get('errors').get('foo');\n // [{message: 'foo should be a number.', attribute: 'foo'}]\n});\n```\n\nThe `errors` property us useful for displaying error messages to\nthe user.\n\n```handlebars\n\n{{#each model.errors.username as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n\n{{#each model.errors.email as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\n\nYou can also access the special `messages` property on the error\nobject to get an array of all the error strings.\n\n```handlebars\n{{#each model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", + "itemtype": "property", + "name": "errors", + "type": "{DS.Errors}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 416, + "description": "This property holds the `DS.AdapterError` object with which\nlast adapter operation was rejected.", + "itemtype": "property", + "name": "adapterError", + "type": "{DS.AdapterError}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 425, + "description": "Create a JSON representation of the record, using the serialization\nstrategy of the store's adapter.\n\n `serialize` takes an optional hash as a parameter, currently\nsupported options are:\n\n - `includeId`: `true` if the record's ID should be included in the\n JSON representation.", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "an object whose values are primitive JSON values only", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 443, + "description": "Use [DS.JSONSerializer](DS.JSONSerializer.html) to\nget the JSON representation of a record.\n\n`toJSON` takes an optional hash as a parameter, currently\nsupported options are:\n\n- `includeId`: `true` if the record's ID should be included in the\n JSON representation.", + "itemtype": "method", + "name": "toJSON", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "A JSON representation of the object.", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 465, + "description": "Fired when the record is ready to be interacted with,\nthat is either loaded from the server or created locally.", + "itemtype": "event", + "name": "ready", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 473, + "description": "Fired when the record is loaded from the server.", + "itemtype": "event", + "name": "didLoad", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 480, + "description": "Fired when the record is updated.", + "itemtype": "event", + "name": "didUpdate", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 487, + "description": "Fired when a new record is commited to the server.", + "itemtype": "event", + "name": "didCreate", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 494, + "description": "Fired when the record is deleted.", + "itemtype": "event", + "name": "didDelete", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 501, + "description": "Fired when the record becomes invalid.", + "itemtype": "event", + "name": "becameInvalid", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 508, + "description": "Fired when the record enters the error state.", + "itemtype": "event", + "name": "becameError", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 515, + "description": "Fired when the record is rolled back.", + "itemtype": "event", + "name": "rolledBack", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 523, + "itemtype": "method", + "name": "send", + "access": "private", + "tagname": "", + "params": [ + { + "name": "name", + "description": "", + "type": "String" + }, + { + "name": "context", + "description": "", + "type": "Object" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 533, + "itemtype": "method", + "name": "transitionTo", + "access": "private", + "tagname": "", + "params": [ + { + "name": "name", + "description": "", + "type": "String" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 543, + "description": "Marks the record as deleted but does not save it. You must call\n`save` afterwards if you want to persist it. You might use this\nmethod if you want to allow the user to still `rollbackAttributes()`\nafter a delete was made.\n\nExample\n\n```app/routes/model/delete.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n actions: {\n softDelete() {\n this.get('controller.model').deleteRecord();\n },\n confirm() {\n this.get('controller.model').save();\n },\n undo() {\n this.get('controller.model').rollbackAttributes();\n }\n }\n});\n```", + "itemtype": "method", + "name": "deleteRecord", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 575, + "description": "Same as `deleteRecord`, but saves the record immediately.\n\nExample\n\n```app/routes/model/delete.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n actions: {\n delete() {\n this.get('controller.model').destroyRecord().then(function() {\n controller.transitionToRoute('model.index');\n });\n }\n }\n});\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to your adapter via the snapshot\n\n```js\nrecord.destroyRecord({ adapterOptions: { subscribe: false } });\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n deleteRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n});\n```", + "itemtype": "method", + "name": "destroyRecord", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", + "type": "Promise" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 624, + "description": "Unloads the record from the store. This will cause the record to be destroyed and freed up for garbage collection.", + "itemtype": "method", + "name": "unloadRecord", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 634, + "itemtype": "method", + "name": "_notifyProperties", + "access": "private", + "tagname": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 648, + "description": "Returns an object, whose keys are changed properties, and value is\nan [oldProp, newProp] array.\n\nThe array represents the diff of the canonical state with the local state\nof the model. Note: if the model is created locally, the canonical state is\nempty since the adapter hasn't acknowledged the attributes yet:\n\nExample\n\n```app/models/mascot.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n name: DS.attr('string'),\n isAdmin: DS.attr('boolean', {\n defaultValue: false\n })\n});\n```\n\n```javascript\nlet mascot = store.createRecord('mascot');\n\nmascot.changedAttributes(); // {}\n\nmascot.set('name', 'Tomster');\nmascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\nmascot.set('isAdmin', true);\nmascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\nmascot.save().then(function() {\n mascot.changedAttributes(); // {}\n\n mascot.set('isAdmin', false);\n mascot.changedAttributes(); // { isAdmin: [true, false] }\n});\n```", + "itemtype": "method", + "name": "changedAttributes", + "return": { + "description": "an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 698, + "itemtype": "method", + "name": "adapterDidDirty", + "access": "private", + "tagname": "adapterDidDirty: function() {\nthis.send('becomeDirty');\nthis.updateRecordArraysLater();\n },", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 714, + "description": "If the model `hasDirtyAttributes` this function will discard any unsaved\nchanges. If the model `isNew` it will be removed from the store.\n\nExample\n\n```javascript\nrecord.get('name'); // 'Untitled Document'\nrecord.set('name', 'Doc 1');\nrecord.get('name'); // 'Doc 1'\nrecord.rollbackAttributes();\nrecord.get('name'); // 'Untitled Document'\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "rollbackAttributes", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 747, + "description": "Save the record and persist any changes to the record to an\nexternal source via the adapter.\n\nExample\n\n```javascript\nrecord.set('name', 'Tomster');\nrecord.save().then(function() {\n // Success callback\n}, function() {\n // Error callback\n});\n```\n\n If you pass an object using the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot.\n\n```js\nrecord.save({ adapterOptions: { subscribe: false } });\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n updateRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n});\n```", + "itemtype": "method", + "name": "save", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", + "type": "Promise" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 793, + "description": "Reload the record from the adapter.\n\nThis will only work if the record has already finished loading.\n\nExample\n\n```app/routes/model/view.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n actions: {\n reload() {\n this.controller.get('model').reload().then(function(model) {\n // do something with the reloaded model\n });\n }\n }\n});\n```", + "itemtype": "method", + "name": "reload", + "return": { + "description": "a promise that will be resolved with the record when the\nadapter returns successfully or rejected if the adapter returns\nwith an error.", + "type": "Promise" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 826, + "description": "Override the default event firing from Ember.Evented to\nalso call methods with the given name.", + "itemtype": "method", + "name": "trigger", + "access": "private", + "tagname": "", + "params": [ + { + "name": "name", + "description": "", + "type": "String" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 854, + "description": "Get the reference for the specified belongsTo relationship.\n\nExample\n\n```app/models/blog.js\nexport default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n});\n```\n\n```javascript\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n});\nlet userRef = blog.belongsTo('user');\n\n// check if the user relationship is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n} else if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n}\n\n// load user (via store.findRecord or store.findBelongsTo)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n}).then(function(user) {\n userRef.value() === user;\n});\n```", + "itemtype": "method", + "name": "belongsTo", + "params": [ + { + "name": "name", + "description": "of the relationship", + "type": "String" + } + ], + "since": "2.5.0", + "return": { + "description": "reference for this relationship", + "type": "BelongsToReference" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 919, + "description": "Get the reference for the specified hasMany relationship.\n\nExample\n\n```javascript\n// models/blog.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n comments: {\n data: [\n { type: 'comment', id: 1 },\n { type: 'comment', id: 2 }\n ]\n }\n }\n }\n});\nlet commentsRef = blog.hasMany('comments');\n\n// check if the comments are loaded already\nlet isLoaded = commentsRef.value() !== null;\n\n// get the records of the reference (null if not yet available)\nlet comments = commentsRef.value();\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n\n// load comments (via store.findMany or store.findHasMany)\ncommentsRef.load().then(...)\n\n// or trigger a reload\ncommentsRef.reload().then(...)\n\n// provide data for reference\ncommentsRef.push([{ type: 'comment', id: 1 }, { type: 'comment', id: 2 }]).then(function(comments) {\n commentsRef.value() === comments;\n});\n```", + "itemtype": "method", + "name": "hasMany", + "params": [ + { + "name": "name", + "description": "of the relationship", + "type": "String" + } + ], + "since": "2.5.0", + "return": { + "description": "reference for this relationship", + "type": "HasManyReference" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 984, + "description": "Provides info about the model for debugging purposes\nby grouping the properties into more semantic groups.\n\nMeant to be used by debugging tools such as the Chrome Ember Extension.\n\n- Groups all attributes in \"Attributes\" group.\n- Groups all belongsTo relationships in \"Belongs To\" group.\n- Groups all hasMany relationships in \"Has Many\" group.\n- Groups all flags in \"Flags\" group.\n- Flags relationship CPs as expensive properties.", + "itemtype": "method", + "name": "_debugInfo", + "access": "private", + "tagname": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1049, + "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.\n\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, descriptor);\n```\n\n- `name` the name of the current property in the iteration\n- `descriptor` the meta object that describes this relationship\n\nThe relationship descriptor argument is an object with the following properties.\n\n- **key** String the name of this relationship on the Model\n- **kind** String \"hasMany\" or \"belongsTo\"\n- **options** Object the original options hash passed when the relationship was declared\n- **parentType** DS.Model the type of the Model that owns this relationship\n- **type** String the type name of the related Model\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n serialize: function(record, options) {\n let json = {};\n\n record.eachRelationship(function(name, descriptor) {\n if (descriptor.kind === 'hasMany') {\n let serializedHasManyName = name.toUpperCase() + '_IDS';\n json[serializedHasManyName] = record.get(name).mapBy('id');\n }\n });\n\n return json;\n }\n });\n```", + "itemtype": "method", + "name": "eachRelationship", + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1127, + "itemtype": "property", + "name": "data", + "access": "private", + "tagname": "", + "type": "{Object}", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1153, + "description": "Override the class' `create()` method to raise an error. This\nprevents end users from inadvertently calling `create()` instead\nof `createRecord()`. The store is still able to create instances\nby calling the `_create()` method. To create an instance of a\n`DS.Model` use [store.createRecord](DS.Store.html#method_createRecord).", + "itemtype": "method", + "name": "create", + "access": "private", + "tagname": "", + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1164, + "description": "Represents the model's class name as a string. This can be used to look up the model's class name through\n`DS.Store`'s modelFor method.\n\n`modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.\nFor example:\n\n```javascript\nstore.modelFor('post').modelName; // 'post'\nstore.modelFor('blog-post').modelName; // 'blog-post'\n```\n\nThe most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload\nkeys to underscore (instead of dasherized), you might use the following code:\n\n```javascript\nimport { underscore } from '@ember/string';\n\nexport default const PostSerializer = DS.RESTSerializer.extend({\n payloadKeyFromModelName(modelName) {\n return underscore(modelName);\n }\n});\n```", + "itemtype": "property", + "name": "modelName", + "type": "String", + "readonly": "", + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1212, + "description": "For a given relationship name, returns the model type of the relationship.\n\nFor example, if you define a model like this:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('comment')\n });\n```\n\nCalling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.", + "itemtype": "method", + "name": "typeForRelationship", + "static": 1, + "params": [ + { + "name": "name", + "description": "the name of the relationship", + "type": "String" + }, + { + "name": "store", + "description": "an instance of DS.Store", + "type": "Store" + } + ], + "return": { + "description": "the type of the relationship, or undefined", + "type": "DS.Model" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1242, + "description": "Find the relationship which is the inverse of the one asked for.\n\nFor example, if you define models like this:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('message')\n });\n```\n\n```app/models/message.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n owner: DS.belongsTo('post')\n });\n```\n\n``` js\nstore.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }\n```", + "itemtype": "method", + "name": "inverseFor", + "static": 1, + "params": [ + { + "name": "name", + "description": "the name of the relationship", + "type": "String" + }, + { + "name": "store", + "description": "", + "type": "DS.Store" + } + ], + "return": { + "description": "the inverse relationship, or null", + "type": "Object" + }, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1361, + "description": "The model's relationships as a map, keyed on the type of the\nrelationship. The value of each entry is an array containing a descriptor\nfor each relationship with that type, describing the name of the relationship\nas well as the type.\n\nFor example, given the following model definition:\n\n```app/models/blog.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n users: DS.hasMany('user'),\n owner: DS.belongsTo('user'),\n posts: DS.hasMany('post')\n });\n```\n\nThis computed property would return a map describing these\nrelationships, like this:\n\n```javascript\nimport Ember from 'ember';\nimport Blog from 'app/models/blog';\nimport User from 'app/models/user';\nimport Post from 'app/models/post';\n\nlet relationships = Ember.get(Blog, 'relationships');\nrelationships.get(User);\n//=> [ { name: 'users', kind: 'hasMany' },\n// { name: 'owner', kind: 'belongsTo' } ]\nrelationships.get(Post);\n//=> [ { name: 'posts', kind: 'hasMany' } ]\n```", + "itemtype": "property", + "name": "relationships", + "static": 1, + "type": "Ember.Map", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1404, + "description": "A hash containing lists of the model's relationships, grouped\nby the relationship kind. For example, given a model with this\ndefinition:\n\n```app/models/blog.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n users: DS.hasMany('user'),\n owner: DS.belongsTo('user'),\n\n posts: DS.hasMany('post')\n });\n```\n\nThis property would contain the following:\n\n```javascript\nimport Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet relationshipNames = Ember.get(Blog, 'relationshipNames');\nrelationshipNames.hasMany;\n//=> ['users', 'posts']\nrelationshipNames.belongsTo;\n//=> ['owner']\n```", + "itemtype": "property", + "name": "relationshipNames", + "static": 1, + "type": "Object", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1453, + "description": "An array of types directly related to a model. Each type will be\nincluded once, regardless of the number of relationships it has with\nthe model.\n\nFor example, given a model with this definition:\n\n```app/models/blog.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n users: DS.hasMany('user'),\n owner: DS.belongsTo('user'),\n\n posts: DS.hasMany('post')\n });\n```\n\nThis property would contain the following:\n\n```javascript\nimport Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet relatedTypes = Ember.get(Blog, 'relatedTypes');\n//=> [ User, Post ]\n```", + "itemtype": "property", + "name": "relatedTypes", + "static": 1, + "type": "Ember.Array", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1488, + "description": "A map whose keys are the relationships of a model and whose values are\nrelationship descriptors.\n\nFor example, given a model with this\ndefinition:\n\n```app/models/blog.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n users: DS.hasMany('user'),\n owner: DS.belongsTo('user'),\n\n posts: DS.hasMany('post')\n });\n```\n\nThis property would contain the following:\n\n```javascript\nimport Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet relationshipsByName = Ember.get(Blog, 'relationshipsByName');\nrelationshipsByName.get('users');\n//=> { key: 'users', kind: 'hasMany', type: 'user', options: Object, isRelationship: true }\nrelationshipsByName.get('owner');\n//=> { key: 'owner', kind: 'belongsTo', type: 'user', options: Object, isRelationship: true }\n```", + "itemtype": "property", + "name": "relationshipsByName", + "static": 1, + "type": "Ember.Map", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1526, + "description": "A map whose keys are the fields of the model and whose values are strings\ndescribing the kind of the field. A model's fields are the union of all of its\nattributes and relationships.\n\nFor example:\n\n```app/models/blog.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n users: DS.hasMany('user'),\n owner: DS.belongsTo('user'),\n\n posts: DS.hasMany('post'),\n\n title: DS.attr('string')\n });\n```\n\n```js\nimport Ember from 'ember';\nimport Blog from 'app/models/blog';\n\nlet fields = Ember.get(Blog, 'fields');\nfields.forEach(function(kind, field) {\n console.log(field, kind);\n });\n\n// prints:\n// users, hasMany\n// owner, belongsTo\n// posts, hasMany\n// title, attribute\n```", + "itemtype": "property", + "name": "fields", + "static": 1, + "type": "Ember.Map", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1581, + "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.", + "itemtype": "method", + "name": "eachRelationship", + "static": 1, + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1597, + "description": "Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.", + "itemtype": "method", + "name": "eachRelatedType", + "static": 1, + "params": [ + { + "name": "callback", + "description": "the callback to invoke", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Any" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1638, + "description": "A map whose keys are the attributes of the model (properties\ndescribed by DS.attr) and whose values are the meta object for the\nproperty.\n\nExample\n\n```app/models/person.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n firstName: DS.attr('string'),\n lastName: DS.attr('string'),\n birthday: DS.attr('date')\n });\n```\n\n```javascript\nimport Ember from 'ember';\nimport Person from 'app/models/person';\n\nlet attributes = Ember.get(Person, 'attributes')\n\nattributes.forEach(function(meta, name) {\n console.log(name, meta);\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", + "itemtype": "property", + "name": "attributes", + "static": 1, + "type": "{Ember.Map}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1691, + "description": "A map whose keys are the attributes of the model (properties\ndescribed by DS.attr) and whose values are type of transformation\napplied to each attribute. This map does not include any\nattributes that do not have an transformation type.\n\nExample\n\n```app/models/person.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n firstName: DS.attr(),\n lastName: DS.attr('string'),\n birthday: DS.attr('date')\n });\n```\n\n```javascript\nimport Ember from 'ember';\nimport Person from 'app/models/person';\n\nlet transformedAttributes = Ember.get(Person, 'transformedAttributes')\n\ntransformedAttributes.forEach(function(field, type) {\n console.log(field, type);\n });\n\n// prints:\n// lastName string\n// birthday date\n```", + "itemtype": "property", + "name": "transformedAttributes", + "static": 1, + "type": "{Ember.Map}", + "readonly": "", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1741, + "description": "Iterates through the attributes of the model, calling the passed function on each\nattribute.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, meta);\n```\n\n- `name` the name of the current property in the iteration\n- `meta` the meta object for the attribute property in the iteration\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport DS from 'ember-data';\n\nlet Person = DS.Model.extend({\n firstName: DS.attr('string'),\n lastName: DS.attr('string'),\n birthday: DS.attr('date')\n });\n\nPerson.eachAttribute(function(name, meta) {\n console.log(name, meta);\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", + "itemtype": "method", + "name": "eachAttribute", + "params": [ + { + "name": "callback", + "description": "The callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1790, + "description": "Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, type);\n```\n\n- `name` the name of the current property in the iteration\n- `type` a string containing the name of the type of transformed\napplied to the attribute\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport DS from 'ember-data';\n\nlet Person = DS.Model.extend({\n firstName: DS.attr(),\n lastName: DS.attr('string'),\n birthday: DS.attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n console.log(name, type);\n });\n\n// prints:\n// lastName string\n// birthday date\n```", + "itemtype": "method", + "name": "eachTransformedAttribute", + "params": [ + { + "name": "callback", + "description": "The callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "static": 1, + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1862, + "description": "Discards any unsaved changes to the given attribute. This feature is not enabled by default. You must enable `ds-rollback-attribute` and be running a canary build.\n\nExample\n\n```javascript\nrecord.get('name'); // 'Untitled Document'\nrecord.set('name', 'Doc 1');\nrecord.get('name'); // 'Doc 1'\nrecord.rollbackAttribute('name');\nrecord.get('name'); // 'Untitled Document'\n```", + "itemtype": "method", + "name": "rollbackAttribute", + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/model/model.js", + "line": 1895, + "description": "This Ember.js hook allows an object to be notified when a property\nis defined.\n\nIn this case, we use it to be notified when an Ember Data user defines a\nbelongs-to relationship. In that case, we need to set up observers for\neach one, allowing us to track relationship changes and automatically\nreflect changes in the inverse has-many array.\n\nThis hook passes the class being set up, as well as the key and value\nbeing defined. So, for example, when the user does this:\n\n```javascript\nDS.Model.extend({\n parent: DS.belongsTo('user')\n });\n```\n\nThis hook would be called with \"parent\" as the key and the computed\nproperty returned by `DS.belongsTo` as the value.", + "itemtype": "method", + "name": "didDefineProperty", + "params": [ + { + "name": "proto", + "description": "", + "type": "Object" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "value", + "description": "", + "type": "Ember.ComputedProperty" + } + ], + "class": "DS.Model", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/adapter-populated-record-array.js", + "line": 66, + "itemtype": "method", + "name": "_setInternalModels", + "params": [ + { + "name": "internalModels", + "description": "", + "type": "Array" + }, + { + "name": "payload", + "description": "normalized payload", + "type": "Object" + } + ], + "access": "private", + "tagname": "", + "class": "DS.AdapterPopulatedRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/filtered-record-array.js", + "line": 22, + "description": "The filterFunction is a function used to test records from the store to\ndetermine if they should be part of the record array.\n\nExample\n\n```javascript\nvar allPeople = store.peekAll('person');\nallPeople.mapBy('name'); // [\"Tom Dale\", \"Yehuda Katz\", \"Trek Glowacki\"]\n\nvar people = store.filter('person', function(person) {\n if (person.get('name').match(/Katz$/)) { return true; }\n});\npeople.mapBy('name'); // [\"Yehuda Katz\"]\n\nvar notKatzFilter = function(person) {\n return !person.get('name').match(/Katz$/);\n};\npeople.set('filterFunction', notKatzFilter);\npeople.mapBy('name'); // [\"Tom Dale\", \"Trek Glowacki\"]\n```", + "itemtype": "method", + "name": "filterFunction", + "params": [ + { + "name": "record", + "description": "", + "type": "DS.Model" + } + ], + "return": { + "description": "`true` if the record should be in the array", + "type": "Boolean" + }, + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/filtered-record-array.js", + "line": 53, + "itemtype": "method", + "name": "updateFilter", + "access": "private", + "tagname": "", + "class": "DS.FilteredRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 30, + "description": "The array of client ids backing the record array. When a\nrecord is requested from the record array, the record\nfor the client id at the same index is materialized, if\nnecessary, by the store.", + "itemtype": "property", + "name": "content", + "access": "private", + "tagname": "", + "type": "Ember.Array", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 42, + "description": "The flag to signal a `RecordArray` is finished loading data.\n\nExample\n\n```javascript\nvar people = store.peekAll('person');\npeople.get('isLoaded'); // true\n```", + "itemtype": "property", + "name": "isLoaded", + "type": "Boolean", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 56, + "description": "The flag to signal a `RecordArray` is currently loading data.\n\nExample\n\n```javascript\nvar people = store.peekAll('person');\npeople.get('isUpdating'); // false\npeople.update();\npeople.get('isUpdating'); // true\n```", + "itemtype": "property", + "name": "isUpdating", + "type": "Boolean", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 73, + "description": "The store that created this record array.", + "itemtype": "property", + "name": "store", + "access": "private", + "tagname": "", + "type": "DS.Store", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 88, + "description": "The modelClass represented by this record array.", + "itemtype": "property", + "name": "type", + "type": "DS.Model", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 101, + "description": "Retrieves an object from the content by index.", + "itemtype": "method", + "name": "objectAtContent", + "access": "private", + "tagname": "", + "params": [ + { + "name": "index", + "description": "", + "type": "Number" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 114, + "description": "Used to get the latest version of all of the records in this array\nfrom the adapter.\n\nExample\n\n```javascript\nvar people = store.peekAll('person');\npeople.get('isUpdating'); // false\n\npeople.update().then(function() {\n people.get('isUpdating'); // false\n});\n\npeople.get('isUpdating'); // true\n```", + "itemtype": "method", + "name": "update", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 157, + "description": "Adds an internal model to the `RecordArray` without duplicates", + "itemtype": "method", + "name": "_pushInternalModels", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 171, + "description": "Removes an internalModel to the `RecordArray`.", + "itemtype": "method", + "name": "removeInternalModel", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 182, + "description": "Saves all of the records in the `RecordArray`.\n\nExample\n\n```javascript\nvar messages = store.peekAll('message');\nmessages.forEach(function(message) {\n message.set('hasBeenSeen', true);\n});\nmessages.save();\n```", + "itemtype": "method", + "name": "save", + "return": { + "description": "promise", + "type": "DS.PromiseArray" + }, + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-arrays/record-array.js", + "line": 216, + "itemtype": "method", + "name": "_unregisterFromManager", + "access": "private", + "tagname": "", + "class": "DS.RecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 31, + "description": "This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the \"link\" otherwise it defaults to \"id\".\n\nExample\n\n```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n } else if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n }\n ```", + "itemtype": "method", + "name": "remoteType", + "return": { + "description": "The name of the remote type. This should either be \"link\" or \"id\"", + "type": "String" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 74, + "description": "The `id` of the record that this reference refers to. Together, the\n`type()` and `id()` methods form a composite key for the identity\nmap. This can be used to access the id of an async relationship\nwithout triggering a fetch that would normally happen if you\nattempted to use `record.get('relationship.id')`.\n\nExample\n\n```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n }\n ```", + "itemtype": "method", + "name": "id", + "return": { + "description": "The id of the record in this belongsTo relationship.", + "type": "String" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 116, + "description": "The link Ember Data will use to fetch or reload this belongs-to\nrelationship.\n\nExample\n\n```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: '/articles/1/author'\n }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // get the identifier of the reference\n if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n }\n ```", + "itemtype": "method", + "name": "link", + "return": { + "description": "The link Ember Data will use to fetch or reload this belongs-to relationship.", + "type": "String" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 156, + "description": "The meta data for the belongs-to relationship.\n\nExample\n\n```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: {\n href: '/articles/1/author',\n meta: {\n lastUpdated: 1458014400000\n }\n }\n }\n }\n }\n }\n });\n\n let userRef = blog.belongsTo('user');\n\n userRef.meta() // { lastUpdated: 1458014400000 }\n ```", + "itemtype": "method", + "name": "meta", + "return": { + "description": "The meta information for the belongs-to relationship.", + "type": "Object" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 198, + "description": "`push` can be used to update the data in the relationship and Ember\nData will treat the new data as the conanical value of this\nrelationship on the backend.\n\nExample\n\n ```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n // provide data for reference\n userRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "objectOrPromise", + "description": "a promise that resolves to a JSONAPI document object describing the new value of this relationship.", + "type": "Object|Promise" + } + ], + "return": { + "description": "A promise that resolves with the new value in this belongs-to relationship.", + "type": "Promise" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 266, + "description": "`value()` synchronously returns the current value of the belongs-to\nrelationship. Unlike `record.get('relationshipName')`, calling\n`value()` on a reference does not trigger a fetch if the async\nrelationship is not yet loaded. If the relationship is not loaded\nit will always return `null`.\n\nExample\n\n ```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.value(); // null\n\n // provide data for reference\n userRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value(); // user\n });\n ```", + "itemtype": "method", + "name": "value", + "return": { + "description": "the record in this relationship", + "type": "DS.Model" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 323, + "description": "Loads a record in a belongs to relationship if it is not already\nloaded. If the relationship is already loaded this method does not\ntrigger a new load.\n\nExample\n\n ```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.value(); // null\n\n userRef.load().then(function(user) {\n userRef.value() === user\n });\n ```", + "itemtype": "method", + "name": "load", + "return": { + "description": "a promise that resolves with the record in this belongs-to relationship.", + "type": "Promise" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/belongs-to.js", + "line": 371, + "description": "Triggers a reload of the value in this relationship. If the\nremoteType is `\"link\"` Ember Data will use the relationship link to\nreload the relationship. Otherwise it will reload the record by its\nid.\n\nExample\n\n ```javascript\n // models/blog.js\n export default DS.Model.extend({\n user: DS.belongsTo({ async: true })\n });\n\n let blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\n let userRef = blog.belongsTo('user');\n\n userRef.reload().then(function(user) {\n userRef.value() === user\n });\n ```", + "itemtype": "method", + "name": "reload", + "return": { + "description": "a promise that resolves with the record in this belongs-to relationship after the reload has completed.", + "type": "Promise" + }, + "class": "DS.BelongsToReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 31, + "description": "This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the \"link\" otherwise it defaults to \"id\".\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n```", + "itemtype": "method", + "name": "remoteType", + "return": { + "description": "The name of the remote type. This should either be \"link\" or \"ids\"", + "type": "String" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 78, + "description": "The link Ember Data will use to fetch or reload this has-many\nrelationship.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n links: {\n related: '/posts/1/comments'\n }\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.link(); // '/posts/1/comments'\n```", + "itemtype": "method", + "name": "link", + "return": { + "description": "The link Ember Data will use to fetch or reload this has-many relationship.", + "type": "String" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 117, + "description": "`ids()` returns an array of the record ids in this relationship.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n```", + "itemtype": "method", + "name": "ids", + "return": { + "description": "The ids in this has-many relationship", + "type": "Array" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 157, + "description": "The meta data for the has-many relationship.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n links: {\n related: {\n href: '/posts/1/comments',\n meta: {\n count: 10\n }\n }\n }\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.meta(); // { count: 10 }\n```", + "itemtype": "method", + "name": "meta", + "return": { + "description": "The meta information for the has-many relationship.", + "type": "Object" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 200, + "description": "`push` can be used to update the data in the relationship and Ember\nData will treat the new data as the canonical value of this\nrelationship on the backend.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n\ncommentsRef.push([\n [{ type: 'comment', id: 2 }],\n [{ type: 'comment', id: 3 }],\n])\n\ncommentsRef.ids(); // ['2', '3']\n```", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "objectOrPromise", + "description": "a promise that resolves to a JSONAPI document object describing the new value of this relationship.", + "type": "Array|Promise" + } + ], + "return": { + "description": "", + "type": "DS.ManyArray" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 313, + "description": "`value()` synchronously returns the current value of the has-many\n relationship. Unlike `record.get('relationshipName')`, calling\n `value()` on a reference does not trigger a fetch if the async\n relationship is not yet loaded. If the relationship is not loaded\n it will always return `null`.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\npost.get('comments').then(function(comments) {\n commentsRef.value() === comments\n})\n```", + "itemtype": "method", + "name": "value", + "return": { + "description": "", + "type": "DS.ManyArray" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 359, + "description": "Loads the relationship if it is not already loaded. If the\nrelationship is already loaded this method does not trigger a new\nload.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.load().then(function(comments) {\n //...\n});\n```", + "itemtype": "method", + "name": "load", + "return": { + "description": "a promise that resolves with the ManyArray in\nthis has-many relationship.", + "type": "Promise" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/has-many.js", + "line": 404, + "description": "Reloads this has-many relationship.\n\nExample\n\n```app/models/post.js\nexport default DS.Model.extend({\n comments: DS.hasMany({ async: true })\n});\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.reload().then(function(comments) {\n //...\n});\n```", + "itemtype": "method", + "name": "reload", + "return": { + "description": "a promise that resolves with the ManyArray in this has-many relationship.", + "type": "Promise" + }, + "class": "DS.HasManyReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/record.js", + "line": 21, + "description": "The `id` of the record that this reference refers to.\n\nTogether, the `type` and `id` properties form a composite key for\nthe identity map.\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\nuserRef.id(); // '1'\n```", + "itemtype": "method", + "name": "id", + "return": { + "description": "The id of the record.", + "type": "String" + }, + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/record.js", + "line": 42, + "description": "How the reference will be looked up when it is loaded: Currently\nthis always return `identity` to signifying that a record will be\nloaded by the `type` and `id`.\n\nExample\n\n```javascript\nconst userRef = store.getReference('user', 1);\n\nuserRef.remoteType(); // 'identity'\n```", + "itemtype": "method", + "name": "remoteType", + "return": { + "description": "'identity'", + "type": "String" + }, + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/record.js", + "line": 62, + "description": "This API allows you to provide a reference with new data. The\nsimplest usage of this API is similar to `store.push`: you provide a\nnormalized hash of data and the object represented by the reference\nwill update.\n\nIf you pass a promise to `push`, Ember Data will not ask the adapter\nfor the data if another attempt to fetch it is made in the\ninterim. When the promise resolves, the underlying object is updated\nwith the new data, and the promise returned by *this function* is resolved\nwith that object.\n\nFor example, `recordReference.push(promise)` will be resolved with a\nrecord.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({ data: { id: 1, username: \"@user\" }}).then(function(user) {\n userRef.value() === user;\n });\n ```", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "UNKNOWN", + "description": "", + "type": "Promise|Object" + } + ], + "return": { + "description": "Promise a promise for the value (record or relationship)" + }, + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/record.js", + "line": 98, + "description": "If the entity referred to by the reference is already loaded, it is\npresent as `reference.value`. Otherwise the value returned by this function\nis `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```", + "itemtype": "method", + "name": "value", + "return": { + "description": "the record for this RecordReference", + "type": "DS.Model" + }, + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/record.js", + "line": 121, + "description": "Triggers a fetch for the backing entity based on its `remoteType`\n(see `remoteType` definitions per reference type).\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\n// load user (via store.find)\nuserRef.load().then(...)\n```", + "itemtype": "method", + "name": "load", + "return": { + "description": "the record for this RecordReference", + "type": "Promise" + }, + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/references/record.js", + "line": 141, + "description": "Reloads the record if it is already loaded. If the record is not\nloaded it will load the record via `store.findRecord`\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\n// or trigger a reload\nuserRef.reload().then(...)\n```", + "itemtype": "method", + "name": "reload", + "return": { + "description": "the record for this RecordReference", + "type": "Promise" + }, + "class": "DS.RecordReference", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/relationships/belongs-to.js", + "line": 5, + "description": "`DS.belongsTo` is used to define One-To-One and One-To-Many\nrelationships on a [DS.Model](/api/data/classes/DS.Model.html).\n\n\n`DS.belongsTo` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship.\n- `inverse`: A string used to identify the inverse property on a\n related model in a One-To-Many relationship. See [Explicit Inverses](#toc_explicit-inverses)\n\n#### One-To-One\nTo declare a one-to-one relationship between two models, use\n`DS.belongsTo`:\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n profile: DS.belongsTo('profile')\n});\n```\n\n```app/models/profile.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n user: DS.belongsTo('user')\n});\n```\n\n#### One-To-Many\nTo declare a one-to-many relationship between two models, use\n`DS.belongsTo` in combination with `DS.hasMany`, like this:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('comment')\n});\n```\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n post: DS.belongsTo('post')\n});\n```\n\nYou can avoid passing a string as the first parameter. In that case Ember Data\nwill infer the type from the key name.\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n post: DS.belongsTo()\n});\n```\n\nwill lookup for a Post type.", + "itemtype": "method", + "name": "belongsTo", + "params": [ + { + "name": "modelName", + "description": "(optional) type of the relationship", + "type": "String" + }, + { + "name": "options", + "description": "(optional) a hash of options", + "type": "Object" + } + ], + "return": { + "description": "relationship", + "type": "Ember.computed" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/has-many.js", + "line": 12, + "description": "`DS.hasMany` is used to define One-To-Many and Many-To-Many\nrelationships on a [DS.Model](/api/data/classes/DS.Model.html).\n\n`DS.hasMany` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship.\n- `inverse`: A string used to identify the inverse property on a related model.\n\n#### One-To-Many\nTo declare a one-to-many relationship between two models, use\n`DS.belongsTo` in combination with `DS.hasMany`, like this:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('comment')\n});\n```\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n post: DS.belongsTo('post')\n});\n```\n\n#### Many-To-Many\nTo declare a many-to-many relationship between two models, use\n`DS.hasMany`:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n tags: DS.hasMany('tag')\n});\n```\n\n```app/models/tag.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n posts: DS.hasMany('post')\n});\n```\n\nYou can avoid passing a string as the first parameter. In that case Ember Data\nwill infer the type from the singularized key name.\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n tags: DS.hasMany()\n});\n```\n\nwill lookup for a Tag type.\n\n#### Explicit Inverses\n\nEmber Data will do its best to discover which relationships map to\none another. In the one-to-many code above, for example, Ember Data\ncan figure out that changing the `comments` relationship should update\nthe `post` relationship on the inverse because post is the only\nrelationship to that model.\n\nHowever, sometimes you may have multiple `belongsTo`/`hasMany` for the\nsame type. You can specify which property on the related model is\nthe inverse using `DS.hasMany`'s `inverse` option:\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n onePost: DS.belongsTo('post'),\n twoPost: DS.belongsTo('post'),\n redPost: DS.belongsTo('post'),\n bluePost: DS.belongsTo('post')\n});\n```\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n comments: DS.hasMany('comment', {\n inverse: 'redPost'\n })\n});\n```\n\nYou can also specify an inverse on a `belongsTo`, which works how\nyou'd expect.", + "itemtype": "method", + "name": "hasMany", + "params": [ + { + "name": "type", + "description": "(optional) type of the relationship", + "type": "String" + }, + { + "name": "options", + "description": "(optional) a hash of options", + "type": "Object" + } + ], + "return": { + "description": "relationship", + "type": "Ember.computed" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 67, + "description": "Find the payload for the given relationship of the given model.\n\nReturns the payload for the given relationship, whether raw or computed from\nthe payload of the inverse relationship.", + "example": [ + "\n\n relationshipPayloadsManager.get('hobby', 2, 'user') === {\n {\n data: {\n id: 1,\n type: 'user'\n }\n }\n }" + ], + "itemtype": "method", + "name": "", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 91, + "description": "Push a model's relationships payload into this cache.", + "example": [ + "\n\n let userPayload = {\n data: {\n id: 1,\n type: 'user',\n relationships: {\n hobbies: {\n data: [{\n id: 2,\n type: 'hobby'\n }]\n }\n }\n },\n };\n relationshipPayloadsManager.push('user', 1, userPayload.data.relationships);" + ], + "itemtype": "method", + "name": "", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 125, + "description": "Unload a model's relationships payload.", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 141, + "description": "Find the RelationshipPayloads object for the given relationship. The same\nRelationshipPayloads object is returned for either side of a relationship.", + "example": [ + "\n\n const User = DS.Model.extend({\n hobbies: DS.hasMany('hobby')\n });\n\n const Hobby = DS.Model.extend({\n user: DS.belongsTo('user')\n });\n\n relationshipPayloads.get('user', 'hobbies') === relationshipPayloads.get('hobby', 'user');\n\nThe signature has a somewhat large arity to avoid extra work, such as\n a) string manipulation & allocation with `modelName` and\n `relationshipName`\n b) repeatedly getting `relationshipsByName` via `Ember.get`" + ], + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads-manager.js", + "line": 293, + "description": "Create the `RelationshipsPayload` for the relationship `modelName`, `relationshipName`, and its inverse.", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloadsManager", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 93, + "description": "Get the payload for the relationship of an individual record.\n\nThis might return the raw payload as pushed into the store, or one computed\nfrom the payload of the inverse relationship.", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 112, + "description": "Push a relationship payload for an individual record.\n\nThis will make the payload available later for both this relationship and its inverse.", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 123, + "description": "Unload the relationship payload for an individual record.\n\nThis does not unload the inverse relationship payload.", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 141, + "return": { + "description": "true iff `modelName` and `relationshipName` refer to the\nleft hand side of this relationship, as opposed to the right hand side.", + "type": "Boolean" + }, + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 161, + "return": { + "description": "true iff `modelName` and `relationshipName` refer to the\nright hand side of this relationship, as opposed to the left hand side.", + "type": "Boolean" + }, + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 268, + "description": "Populate the inverse relationship for `relationshipData`.\n\nIf `relationshipData` is an array (eg because the relationship is hasMany)\nthis means populate each inverse, otherwise populate only the single\ninverse.", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 296, + "description": "Actually add `inversePayload` to `inverseIdToPayloads`. This is part of\n`_populateInverse` after we've normalized the case of `relationshipData`\nbeing either an array or a pojo.\n\nWe still have to handle the case that the *inverse* relationship payload may\nbe an array or pojo.", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 350, + "description": "Remove the relationship in `previousPayload` from its inverse(s), because\nthis relationship payload has just been updated (eg because the same\nrelationship had multiple payloads pushed before the relationship was\ninitialized).", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/relationships/relationship-payloads.js", + "line": 381, + "description": "Remove `id` from its inverse record with id `inverseId`. If the inverse\nrelationship is a belongsTo, this means just setting it to null, if the\ninverse relationship is a hasMany, then remove that id from its array of ids.", + "itemtype": "method", + "name": "", + "class": "RelationshipPayloads", + "module": "ember-data" + }, + { + "file": "addon/-private/system/diff-array.js", + "line": 1, + "itemtype": "method", + "name": "diffArray", + "access": "private", + "tagname": "", + "params": [ + { + "name": "oldArray", + "description": "the old array", + "type": "Array" + }, + { + "name": "newArray", + "description": "the new array", + "type": "Array" + } + ], + "return": { + "description": "{\n firstChangeIndex: , // null if no change\n addedCount: , // 0 if no change\n removedCount: // 0 if no change\n }", + "type": "Hash" + }, + "class": "IdentityMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/identity-map.js", + "line": 16, + "description": "Retrieves the `InternalModelMap` for a given modelName,\ncreating one if one did not already exist. This is\nsimilar to `getWithDefault` or `get` on a `MapWithDefault`", + "itemtype": "method", + "name": "retrieve", + "params": [ + { + "name": "modelName", + "description": "a previously normalized modelName" + } + ], + "return": { + "description": "the InternalModelMap for the given modelName", + "type": "InternalModelMap" + }, + "class": "IdentityMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/identity-map.js", + "line": 35, + "description": "Clears the contents of all known `RecordMaps`, but does\nnot remove the InternalModelMap instances.", + "itemtype": "method", + "name": "clear", + "class": "IdentityMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/internal-model-map.js", + "line": 22, + "params": [ + { + "name": "id", + "description": "" + } + ], + "return": { + "description": "", + "type": "InternalModel" + }, + "class": "InternalModelMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/internal-model-map.js", + "line": 72, + "description": "An array of all models of this modelName", + "class": "InternalModelMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/internal-model-map.js", + "line": 79, + "description": "meta information about internalModels", + "class": "InternalModelMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/internal-model-map.js", + "line": 86, + "description": "deprecated (and unsupported) way of accessing modelClass", + "deprecated": true, + "class": "InternalModelMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/internal-model-map.js", + "line": 95, + "description": "Destroy all models in the internalModelTest and wipe metadata.", + "itemtype": "method", + "name": "clear", + "class": "InternalModelMap", + "module": "ember-data" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 61, + "description": "The loading state of this array", + "itemtype": "property", + "name": "isLoaded", + "type": "Boolean", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 69, + "description": "Used for async `hasMany` arrays\nto keep track of when they will resolve.", + "itemtype": "property", + "name": "promise", + "type": "Ember.RSVP.Promise", + "access": "private", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 78, + "description": "Metadata associated with the request for async hasMany relationships.\n\nExample\n\nGiven that the server returns the following JSON payload when fetching a\nhasMany relationship:\n\n```js\n{\n \"comments\": [{\n \"id\": 1,\n \"comment\": \"This is the first comment\",\n }, {\n// ...\n }],\n\n \"meta\": {\n \"page\": 1,\n \"total\": 5\n }\n}\n```\n\nYou can then access the metadata via the `meta` property:\n\n```js\npost.get('comments').then(function(comments) {\n var meta = comments.get('meta');\n\n// meta.page => 1\n// meta.total => 5\n});\n```", + "itemtype": "property", + "name": "meta", + "type": "Object", + "access": "public", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 118, + "description": "`true` if the relationship is polymorphic, `false` otherwise.", + "itemtype": "property", + "name": "isPolymorphic", + "type": "Boolean", + "access": "private", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 126, + "description": "The relationship which manages this array.", + "itemtype": "property", + "name": "relationship", + "type": "ManyRelationship", + "access": "private", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 216, + "description": "Reloads all of the records in the manyArray. If the manyArray\nholds a relationship that was originally fetched using a links url\nEmber Data will revisit the original links url to repopulate the\nrelationship.\n\nIf the manyArray holds the result of a `store.query()` reload will\nre-run the original query.\n\nExample\n\n```javascript\nvar user = store.peekRecord('user', 1)\nuser.login().then(function() {\n user.get('permissions').then(function(permissions) {\n return permissions.reload();\n });\n});\n```", + "itemtype": "method", + "name": "reload", + "access": "public", + "tagname": "", + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 243, + "description": "Saves all of the records in the `ManyArray`.\n\nExample\n\n```javascript\nstore.findRecord('inbox', 1).then(function(inbox) {\n inbox.get('messages').then(function(messages) {\n messages.forEach(function(message) {\n message.set('isRead', true);\n });\n messages.save()\n });\n});\n```", + "itemtype": "method", + "name": "save", + "return": { + "description": "promise", + "type": "DS.PromiseArray" + }, + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/many-array.js", + "line": 271, + "description": "Create a child record within the owner", + "itemtype": "method", + "name": "createRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.ManyArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/normalize-model-name.js", + "line": 6, + "description": "This method normalizes a modelName into the format Ember Data uses\ninternally.", + "itemtype": "method", + "name": "normalizeModelName", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalizedModelName", + "type": "String" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 145, + "description": "Update an individual filter.", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "updateFilterRecordArray", + "params": [ + { + "name": "array", + "description": "", + "type": "DS.FilteredRecordArray" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "internalModels", + "description": "", + "type": "Array" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 211, + "description": "This method is invoked if the `filterFunction` property is\nchanged on a `DS.FilteredRecordArray`.\n\nIt essentially re-runs the filter from scratch. This same\nmethod is invoked when the filter is created in th first place.", + "itemtype": "method", + "name": "updateFilter", + "params": [ + { + "name": "array", + "description": "", + "type": "Array" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "filter", + "description": "", + "type": "Function" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 239, + "description": "Get the `DS.RecordArray` for a modelName, which contains all loaded records of\ngiven modelName.", + "itemtype": "method", + "name": "liveRecordArrayFor", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 279, + "description": "Get the `DS.RecordArray` for a modelName, which contains all loaded records of\ngiven modelName.", + "itemtype": "method", + "name": "filteredRecordArraysFor", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 294, + "description": "Create a `DS.RecordArray` for a modelName.", + "itemtype": "method", + "name": "createRecordArray", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "_content", + "description": "(optional|private)", + "type": "Array" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 321, + "description": "Create a `DS.FilteredRecordArray` for a modelName and register it for updates.", + "itemtype": "method", + "name": "createFilteredRecordArray", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "filter", + "description": "", + "type": "Function" + }, + { + "name": "query", + "description": "(optional", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "DS.FilteredRecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 348, + "description": "Create a `DS.AdapterPopulatedRecordArray` for a modelName with given query.", + "itemtype": "method", + "name": "createAdapterPopulatedRecordArray", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "DS.AdapterPopulatedRecordArray" + }, + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 390, + "description": "Register a RecordArray for a given modelName to be backed by\na filter function. This will cause the array to update\nautomatically when records of that modelName change attribute\nvalues or states.", + "itemtype": "method", + "name": "registerFilteredRecordArray", + "params": [ + { + "name": "array", + "description": "", + "type": "DS.RecordArray" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "filter", + "description": "", + "type": "Function" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/record-array-manager.js", + "line": 409, + "description": "Unregister a RecordArray.\nSo manager will not update this array.", + "itemtype": "method", + "name": "unregisterRecordArray", + "params": [ + { + "name": "array", + "description": "", + "type": "DS.RecordArray" + } + ], + "class": "DS.RecordArrayManager", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 15, + "description": "An array of snapshots", + "access": "private", + "tagname": "", + "itemtype": "property", + "name": "_snapshots", + "type": "{Array}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 23, + "description": "An array of records", + "access": "private", + "tagname": "", + "itemtype": "property", + "name": "_recordArray", + "type": "{Array}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 31, + "description": "Number of records in the array\n\nExample\n\n```app/adapters/post.js\nimport DS from 'ember-data'\n\nexport default DS.JSONAPIAdapter.extend({\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n },\n});\n```", + "itemtype": "property", + "name": "length", + "type": "{Number}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 53, + "description": "Meta objects for the record array.\n\nExample\n\n```app/adapters/post.js\nimport DS from 'ember-data'\n\nexport default DS.JSONAPIAdapter.extend({\n shouldReloadAll(store, snapshotRecordArray) {\n var lastRequestTime = snapshotRecordArray.meta.lastRequestTime;\n var twentyMinutes = 20 * 60 * 1000;\n return Date.now() > lastRequestTime + twentyMinutes;\n },\n});\n```", + "itemtype": "property", + "name": "meta", + "type": "{Object}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 75, + "description": "A hash of adapter options passed into the store method for this request.\n\nExample\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n});\n```", + "itemtype": "property", + "name": "adapterOptions", + "type": "{Object}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 98, + "description": "The relationships to include for this request.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n findAll(store, type, snapshotRecordArray) {\n var url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n});", + "itemtype": "property", + "name": "include", + "type": "{String|Array}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 120, + "description": "The type of the underlying records for the snapshots in the array, as a DS.Model", + "itemtype": "property", + "name": "type", + "type": "{DS.Model}", + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot-record-array.js", + "line": 129, + "description": "Get snapshots of the underlying record array\n\nExample\n\n```app/adapters/post.js\nimport DS from 'ember-data'\n\nexport default DS.JSONAPIAdapter.extend({\n shouldReloadAll(store, snapshotArray) {\n var snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n var timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n});\n```", + "itemtype": "method", + "name": "snapshots", + "return": { + "description": "Array of snapshots", + "type": "Array" + }, + "class": "DS.SnapshotRecordArray", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 27, + "description": "The underlying record for this snapshot. Can be used to access methods and\nproperties defined on the record.\n\nExample\n\n```javascript\nlet json = snapshot.record.toJSON();\n```", + "itemtype": "property", + "name": "record", + "type": "{DS.Model}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 43, + "description": "The id of the snapshot's underlying record\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.id; // => '1'\n```", + "itemtype": "property", + "name": "id", + "type": "{String}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 58, + "description": "A hash of adapter options", + "itemtype": "property", + "name": "adapterOptions", + "type": "{Object}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 66, + "description": "The name of the type of the underlying record for this snapshot, as a string.", + "itemtype": "property", + "name": "modelName", + "type": "{String}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 77, + "description": "The type of the underlying record for this snapshot, as a DS.Model.", + "itemtype": "property", + "name": "type", + "type": "{DS.Model}", + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 90, + "description": "Returns the value of an attribute.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.attr('author'); // => 'Tomster'\npostSnapshot.attr('title'); // => 'Ember.js rocks'\n```\n\nNote: Values are loaded eagerly and cached when the snapshot is created.", + "itemtype": "method", + "name": "attr", + "params": [ + { + "name": "keyName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "The attribute value or undefined", + "type": "Object" + }, + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 114, + "description": "Returns all attributes and their corresponding values.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n```", + "itemtype": "method", + "name": "attributes", + "return": { + "description": "All attributes of the current snapshot", + "type": "Object" + }, + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 131, + "description": "Returns all changed attributes and their old and new values.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostModel.set('title', 'Ember.js rocks!');\npostSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n```", + "itemtype": "method", + "name": "changedAttributes", + "return": { + "description": "All changed attributes of the current snapshot", + "type": "Object" + }, + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 157, + "description": "Returns the current value of a belongsTo relationship.\n\n`belongsTo` takes an optional hash of options as a second parameter,\ncurrently supported options are:\n\n- `id`: set to `true` if you only want the ID of the related record to be\nreturned.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, title: 'Hello World' });\n// store.createRecord('comment', { body: 'Lorem ipsum', post: post });\ncommentSnapshot.belongsTo('post'); // => DS.Snapshot\ncommentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n// store.push('comment', { id: 1, body: 'Lorem ipsum' });\ncommentSnapshot.belongsTo('post'); // => undefined\n```\n\nCalling `belongsTo` will return a new Snapshot as long as there's any known\ndata for the relationship available, such as an ID. If the relationship is\nknown but unset, `belongsTo` will return `null`. If the contents of the\nrelationship is unknown `belongsTo` will return `undefined`.\n\nNote: Relationships are loaded lazily and cached upon first access.", + "itemtype": "method", + "name": "belongsTo", + "params": [ + { + "name": "keyName", + "description": "", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true + } + ], + "return": { + "description": "A snapshot or ID of a known\nrelationship or null if the relationship is known but unset. undefined\nwill be returned if the contents of the relationship is unknown.", + "type": "(DS.Snapshot|String|null|undefined)" + }, + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 234, + "description": "Returns the current value of a hasMany relationship.\n\n`hasMany` takes an optional hash of options as a second parameter,\ncurrently supported options are:\n\n- `ids`: set to `true` if you only want the IDs of the related records to be\nreturned.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\npostSnapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]\npostSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n// store.push('post', { id: 1, title: 'Hello World' });\npostSnapshot.hasMany('comments'); // => undefined\n```\n\nNote: Relationships are loaded lazily and cached upon first access.", + "itemtype": "method", + "name": "hasMany", + "params": [ + { + "name": "keyName", + "description": "", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true + } + ], + "return": { + "description": "An array of snapshots or IDs of a known\nrelationship or an empty array if the relationship is known but unset.\nundefined will be returned if the contents of the relationship is unknown.", + "type": "(Array|undefined)" + }, + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 306, + "description": "Iterates through all the attributes of the model, calling the passed\nfunction on each attribute.\n\nExample\n\n```javascript\nsnapshot.eachAttribute(function(name, meta) {\n // ...\n});\n```", + "itemtype": "method", + "name": "eachAttribute", + "params": [ + { + "name": "callback", + "description": "the callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 326, + "description": "Iterates through all the relationships of the model, calling the passed\nfunction on each relationship.\n\nExample\n\n```javascript\nsnapshot.eachRelationship(function(name, relationship) {\n // ...\n});\n```", + "itemtype": "method", + "name": "eachRelationship", + "params": [ + { + "name": "callback", + "description": "the callback to execute", + "type": "Function" + }, + { + "name": "binding", + "description": "the value to which the callback's `this` should be bound", + "type": "Object", + "optional": true + } + ], + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/snapshot.js", + "line": 346, + "description": "Serializes the snapshot using the serializer for the model.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n createRecord(store, type, snapshot) {\n var data = snapshot.serialize({ includeId: true });\n var url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n});\n```", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "an object whose values are primitive JSON values only", + "type": "Object" + }, + "class": "DS.Snapshot", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 200, + "itemtype": "method", + "name": "init", + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 237, + "description": "The default adapter to use to communicate to a backend server or\nother persistence layer. This will be overridden by an application\nadapter if present.\n\nIf you want to specify `app/adapters/custom.js` as a string, do:\n\n```js\nimport DS from 'ember-data';\n\nexport default DS.Store.extend({\n adapter: 'custom',\n});\n```", + "itemtype": "property", + "name": "adapter", + "default": "'-json-api'", + "type": "{String}", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 258, + "description": "Returns a JSON representation of the record using a custom\ntype-specific serializer, if one exists.\n\nThe available options are:\n\n* `includeId`: `true` if the record's ID should be included in\n the JSON representation", + "itemtype": "method", + "name": "serialize", + "access": "private", + "tagname": "", + "deprecated": true, + "params": [ + { + "name": "record", + "description": "the record to serialize", + "type": "DS.Model" + }, + { + "name": "options", + "description": "an options hash", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 284, + "description": "This property returns the adapter, after resolving a possible\nstring key.\n\nIf the supplied `adapter` was a class, or a String property\npath resolved to a class, this property will instantiate the\nclass.\n\nThis property is cacheable, so the same instance of a specified\nadapter class should be used for the lifetime of the store.", + "itemtype": "property", + "name": "defaultAdapter", + "access": "private", + "tagname": "", + "return": { + "description": "DS.Adapter" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 311, + "description": "Create a new record in the current store. The properties passed\nto this method are set on the newly created record.\n\nTo create a new instance of a `Post`:\n\n```js\nstore.createRecord('post', {\n title: 'Rails is omakase'\n});\n```\n\nTo create a new instance of a `Post` that has a relationship with a `User` record:\n\n```js\nlet user = this.store.peekRecord('user', 1);\nstore.createRecord('post', {\n title: 'Rails is omakase',\n user: user\n});\n```", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "inputProperties", + "description": "a hash of properties to set on the\n newly created record.", + "type": "Object" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 371, + "description": "If possible, this method asks the adapter to generate an ID for\na newly created record.", + "itemtype": "method", + "name": "_generateId", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "properties", + "description": "from the new record", + "type": "Object" + } + ], + "return": { + "description": "if the adapter can generate one, an ID", + "type": "String" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 396, + "description": "For symmetry, a record can be deleted via the store.\n\nExample\n\n```javascript\nlet post = store.createRecord('post', {\n title: 'Rails is omakase'\n});\n\nstore.deleteRecord(post);\n```", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "record", + "description": "", + "type": "DS.Model" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 416, + "description": "For symmetry, a record can be unloaded via the store.\nThis will cause the record to be destroyed and freed up for garbage collection.\n\nExample\n\n```javascript\nstore.findRecord('post', 1).then(function(post) {\n store.unloadRecord(post);\n});\n```", + "itemtype": "method", + "name": "unloadRecord", + "params": [ + { + "name": "record", + "description": "", + "type": "DS.Model" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 439, + "itemtype": "method", + "name": "find", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String|Integer" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 463, + "description": "This method returns a record for a given type and id combination.\n\nThe `findRecord` method will always resolve its promise with the same\nobject for a given type and `id`.\n\nThe `findRecord` method will always return a **promise** that will be\nresolved with the record.\n\nExample\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id);\n }\n});\n```\n\nIf the record is not yet available, the store will ask the adapter's `find`\nmethod to find the necessary data. If the record is already present in the\nstore, it depends on the reload behavior _when_ the returned promise\nresolves.\n\n### Preloading\n\nYou can optionally `preload` specific attributes and relationships that you know of\nby passing them via the passed `options`.\n\nFor example, if your Ember route looks like `/posts/1/comments/2` and your API route\nfor the comment also looks like `/posts/1/comments/2` if you want to fetch the comment\nwithout fetching the post you can pass in the post to the `findRecord` call:\n\n```javascript\nstore.findRecord('comment', 2, { preload: { post: 1 } });\n```\n\nIf you have access to the post model you can also pass the model itself:\n\n```javascript\nstore.findRecord('post', 1).then(function (myPostModel) {\n store.findRecord('comment', 2, { post: myPostModel });\n});\n```\n\n### Reloading\n\nThe reload behavior is configured either via the passed `options` hash or\nthe result of the adapter's `shouldReloadRecord`.\n\nIf `{ reload: true }` is passed or `adapter.shouldReloadRecord` evaluates\nto `true`, then the returned promise resolves once the adapter returns\ndata, regardless if the requested record is already in the store:\n\n```js\nstore.push({\n data: {\n id: 1,\n type: 'post',\n revision: 1\n }\n});\n\n// adapter#findRecord resolves with\n// [\n// {\n// id: 1,\n// type: 'post',\n// revision: 2\n// }\n// ]\nstore.findRecord('post', 1, { reload: true }).then(function(post) {\n post.get('revision'); // 2\n});\n```\n\nIf no reload is indicated via the abovementioned ways, then the promise\nimmediately resolves with the cached version in the store.\n\n### Background Reloading\n\nOptionally, if `adapter.shouldBackgroundReloadRecord` evaluates to `true`,\nthen a background reload is started, which updates the records' data, once\nit is available:\n\n```js\n// app/adapters/post.js\nimport ApplicationAdapter from \"./application\";\n\nexport default ApplicationAdapter.extend({\n shouldReloadRecord(store, snapshot) {\n return false;\n },\n\n shouldBackgroundReloadRecord(store, snapshot) {\n return true;\n }\n});\n\n// ...\n\nstore.push({\n data: {\n id: 1,\n type: 'post',\n revision: 1\n }\n});\n\nlet blogPost = store.findRecord('post', 1).then(function(post) {\n post.get('revision'); // 1\n});\n\n// later, once adapter#findRecord resolved with\n// [\n// {\n// id: 1,\n// type: 'post',\n// revision: 2\n// }\n// ]\n\nblogPost.get('revision'); // 2\n```\n\nIf you would like to force or prevent background reloading, you can set a\nboolean value for `backgroundReload` in the options object for\n`findRecord`.\n\n```app/routes/post/edit.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id, { backgroundReload: false });\n }\n});\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to you adapter via the snapshot\n\n```app/routes/post/edit.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id, {\n adapterOptions: { subscribe: false }\n });\n }\n});\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n findRecord(store, type, id, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n});\n```\n\nSee [peekRecord](#method_peekRecord) to get the cached version of a record.\n\n### Retrieving Related Model Records\n\nIf you use an adapter such as Ember's default\n[`JSONAPIAdapter`](https://emberjs.com/api/data/classes/DS.JSONAPIAdapter.html)\nthat supports the [JSON API specification](http://jsonapi.org/) and if your server\nendpoint supports the use of an\n['include' query parameter](http://jsonapi.org/format/#fetching-includes),\nyou can use `findRecord()` to automatically retrieve additional records related to\nthe one you request by supplying an `include` parameter in the `options` object.\n\nFor example, given a `post` model that has a `hasMany` relationship with a `comment`\nmodel, when we retrieve a specific post we can have the server also return that post's\ncomments in the same request:\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id, { include: 'comments' });\n }\n});\n\n```\nIn this case, the post's comments would then be available in your template as\n`model.comments`.\n\nMultiple relationships can be requested using an `include` parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the post's\ncomments and the authors of those comments the request would look like this:\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });\n }\n});\n\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "(String|Integer)" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 753, + "description": "This method makes a series of requests to the adapter's `find` method\nand returns a promise that resolves once they are all loaded.", + "access": "private", + "tagname": "", + "itemtype": "method", + "name": "findByIds", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "ids", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 778, + "description": "This method is called by `findRecord` if it discovers that a particular\ntype/id pair hasn't been loaded yet to kick off a request to the\nadapter.", + "itemtype": "method", + "name": "_fetchRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "model", + "type": "InternalModel" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 977, + "description": "Get the reference for the specified record.\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\n// check if the user is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === 'id') {\nlet id = userRef.id();\n}\n\n// load user (via store.find)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({ id: 1, username: '@user' }).then(function(user) {\n userRef.value() === user;\n});\n```", + "itemtype": "method", + "name": "getReference", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String|Integer" + } + ], + "since": "2.5.0", + "return": { + "description": "", + "type": "RecordReference" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1020, + "description": "Get a record by a given type and ID without triggering a fetch.\n\nThis method will synchronously return the record if it is available in the store,\notherwise it will return `null`. A record is available if it has been fetched earlier, or\npushed manually into the store.\n\nSee [findRecord](#method_findRecord) if you would like to request this record from the backend.\n\n_Note: This is a synchronous method and does not return a promise._\n\n```js\nlet post = store.peekRecord('post', 1);\n\npost.get('id'); // 1\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "peekRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String|Integer" + } + ], + "return": { + "description": "record", + "type": "DS.Model|null" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1057, + "description": "This method is called by the record's `reload` method.\n\nThis method calls the adapter's `find` method, which returns a promise. When\n**that** promise resolves, `reloadRecord` will resolve the promise returned\nby the record's `reload`.", + "itemtype": "method", + "name": "reloadRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "DS.Model" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1080, + "description": "This method returns true if a record for a given modelName and id is already\nloaded in the store. Use this function to know beforehand if a findRecord()\nwill result in a request or that it will be a cache hit.\n\nExample\n\n```javascript\nstore.hasRecordForId('post', 1); // false\nstore.findRecord('post', 1).then(function() {\n store.hasRecordForId('post', 1); // true\n});\n```", + "itemtype": "method", + "name": "hasRecordForId", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "(String|Integer)" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1111, + "description": "Returns id record for a given type and ID. If one isn't already loaded,\nit builds a new record and leaves it in the `empty` state.", + "itemtype": "method", + "name": "recordForId", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "(String|Integer)" + } + ], + "return": { + "description": "record", + "type": "DS.Model" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1157, + "itemtype": "method", + "name": "findMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModels", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1174, + "description": "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\nrelationship is fetched.\n\nThe link (which is usually a URL) is passed through unchanged, so the\nadapter can make whatever request it wants.\n\nThe usual use-case is for the server to register a URL as a link, and\nthen use that URL in the future to make a request for the relationship.", + "itemtype": "method", + "name": "findHasMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "link", + "description": "", + "type": "Any" + }, + { + "name": "relationship", + "description": "", + "type": "(Relationship)" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1201, + "itemtype": "method", + "name": "findBelongsTo", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "link", + "description": "", + "type": "Any" + }, + { + "name": "relationship", + "description": "", + "type": "Relationship" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1218, + "description": "This method delegates a query to the adapter. This is the one place where\nadapter-level semantics are exposed to the application.\n\nEach time this method is called a new request is made through the adapter.\n\nExposing queries this way seems preferable to creating an abstract query\nlanguage for all server-side queries, and then require all adapters to\nimplement them.\n\n---\n\nIf you do something like this:\n\n```javascript\nstore.query('person', { page: 1 });\n```\n\nThe call made to the server, using a Rails backend, will look something like this:\n\n```\nStarted GET \"/api/v1/person?page=1\"\nProcessing by Api::V1::PersonsController#index as HTML\nParameters: { \"page\"=>\"1\" }\n```\n\n---\n\nIf you do something like this:\n\n```javascript\nstore.query('person', { ids: [1, 2, 3] });\n```\n\nThe call to the server, using a Rails backend, will look something like this:\n\n```\nStarted GET \"/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3\"\nProcessing by Api::V1::PersonsController#index as HTML\nParameters: { \"ids\" => [\"1\", \"2\", \"3\"] }\n```\n\nThis method returns a promise, which is resolved with an\n[`AdapterPopulatedRecordArray`](https://emberjs.com/api/data/classes/DS.AdapterPopulatedRecordArray.html)\nonce the server returns.", + "since": "1.13.0", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "an opaque query to be used by the adapter", + "type": "Any" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1302, + "description": "This method makes a request for one record, where the `id` is not known\nbeforehand (if the `id` is known, use [`findRecord`](#method_findRecord)\ninstead).\n\nThis method can be used when it is certain that the server will return a\nsingle object for the primary data.\n\nEach time this method is called a new request is made through the adapter.\n\nLet's assume our API provides an endpoint for the currently logged in user\nvia:\n\n```\n// GET /api/current_user\n{\n user: {\n id: 1234,\n username: 'admin'\n }\n}\n```\n\nSince the specific `id` of the `user` is not known beforehand, we can use\n`queryRecord` to get the user:\n\n```javascript\nstore.queryRecord('user', {}).then(function(user) {\n let username = user.get('username');\n console.log(`Currently logged in as ${username}`);\n});\n```\n\nThe request is made through the adapters' `queryRecord`:\n\n```app/adapters/user.js\nimport $ from 'jquery';\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n queryRecord(modelName, query) {\n return $.getJSON('/api/current_user');\n }\n});\n```\n\nNote: the primary use case for `store.queryRecord` is when a single record\nis queried and the `id` is not known beforehand. In all other cases\n`store.query` and using the first item of the array is likely the preferred\nway:\n\n```\n// GET /users?username=unique\n{\n data: [{\n id: 1234,\n type: 'user',\n attributes: {\n username: \"unique\"\n }\n }]\n}\n```\n\n```javascript\nstore.query('user', { username: 'unique' }).then(function(users) {\n return users.get('firstObject');\n}).then(function(user) {\n let id = user.get('id');\n});\n```\n\nThis method returns a promise, which resolves with the found record.\n\nIf the adapter returns no data for the primary data of the payload, then\n`queryRecord` resolves with `null`:\n\n```\n// GET /users?username=unique\n{\n data: null\n}\n```\n\n```javascript\nstore.queryRecord('user', { username: 'unique' }).then(function(user) {\n console.log(user); // null\n});\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "an opaque query to be used by the adapter", + "type": "Any" + } + ], + "return": { + "description": "promise which resolves with the found record or `null`", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1421, + "description": "`findAll` asks the adapter's `findAll` method to find the records for the\ngiven type, and returns a promise which will resolve with all records of\nthis type present in the store, even if the adapter only returns a subset\nof them.\n\n```app/routes/authors.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findAll('author');\n }\n});\n```\n\n_When_ the returned promise resolves depends on the reload behavior,\nconfigured via the passed `options` hash and the result of the adapter's\n`shouldReloadAll` method.\n\n### Reloading\n\nIf `{ reload: true }` is passed or `adapter.shouldReloadAll` evaluates to\n`true`, then the returned promise resolves once the adapter returns data,\nregardless if there are already records in the store:\n\n```js\nstore.push({\n data: {\n id: 'first',\n type: 'author'\n }\n});\n\n// adapter#findAll resolves with\n// [\n// {\n// id: 'second',\n// type: 'author'\n// }\n// ]\nstore.findAll('author', { reload: true }).then(function(authors) {\n authors.getEach('id'); // ['first', 'second']\n});\n```\n\nIf no reload is indicated via the abovementioned ways, then the promise\nimmediately resolves with all the records currently loaded in the store.\n\n### Background Reloading\n\nOptionally, if `adapter.shouldBackgroundReloadAll` evaluates to `true`,\nthen a background reload is started. Once this resolves, the array with\nwhich the promise resolves, is updated automatically so it contains all the\nrecords in the store:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nexport default DS.Adapter.extend({\n shouldReloadAll(store, snapshotsArray) {\n return false;\n },\n\n shouldBackgroundReloadAll(store, snapshotsArray) {\n return true;\n }\n});\n\n// ...\n\nstore.push({\n data: {\n id: 'first',\n type: 'author'\n }\n});\n\nlet allAuthors;\nstore.findAll('author').then(function(authors) {\n authors.getEach('id'); // ['first']\n\n allAuthors = authors;\n});\n\n// later, once adapter#findAll resolved with\n// [\n// {\n// id: 'second',\n// type: 'author'\n// }\n// ]\n\nallAuthors.getEach('id'); // ['first', 'second']\n```\n\nIf you would like to force or prevent background reloading, you can set a\nboolean value for `backgroundReload` in the options object for\n`findAll`.\n\n```app/routes/post/edit.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model() {\n return this.store.findAll('post', { backgroundReload: false });\n }\n});\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to you adapter via the `snapshotRecordArray`\n\n```app/routes/posts.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model(params) {\n return this.store.findAll('post', {\n adapterOptions: { subscribe: false }\n });\n }\n});\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default MyCustomAdapter.extend({\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n});\n```\n\nSee [peekAll](#method_peekAll) to get an array of current records in the\nstore, without waiting until a reload is finished.\n\n### Retrieving Related Model Records\n\nIf you use an adapter such as Ember's default\n[`JSONAPIAdapter`](https://emberjs.com/api/data/classes/DS.JSONAPIAdapter.html)\nthat supports the [JSON API specification](http://jsonapi.org/) and if your server\nendpoint supports the use of an\n['include' query parameter](http://jsonapi.org/format/#fetching-includes),\nyou can use `findAll()` to automatically retrieve additional records related to\nthose requested by supplying an `include` parameter in the `options` object.\n\nFor example, given a `post` model that has a `hasMany` relationship with a `comment`\nmodel, when we retrieve all of the post records we can have the server also return\nall of the posts' comments in the same request:\n\n```app/routes/posts.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model() {\n return this.store.findAll('post', { include: 'comments' });\n }\n});\n\n```\nMultiple relationships can be requested using an `include` parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the posts'\ncomments and the authors of those comments the request would look like this:\n\n```app/routes/posts.js\nimport Route from '@ember/routing/route';\n\nexport default Route.extend({\n model() {\n return this.store.findAll('post', { include: 'comments,comments.author' });\n }\n});\n\n```\n\nSee [query](#method_query) to only get a subset of records from the server.", + "since": "1.13.0", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1624, + "itemtype": "method", + "name": "_fetchAll", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "DS.Model" + }, + { + "name": "array", + "description": "", + "type": "DS.RecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1662, + "itemtype": "method", + "name": "_didUpdateAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1677, + "description": "This method returns a filtered array that contains all of the\nknown records for a given type in the store.\n\nNote that because it's just a filter, the result will contain any\nlocally created records of the type, however, it will not make a\nrequest to the backend to retrieve additional records. If you\nwould like to request all the records from the backend please use\n[store.findAll](#method_findAll).\n\nAlso note that multiple calls to `peekAll` for a given type will always\nreturn the same `RecordArray`.\n\nExample\n\n```javascript\nlet localPosts = store.peekAll('post');\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "peekAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.RecordArray" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1709, + "description": "This method unloads all records in the store.\nIt schedules unloading to happen during the next run loop.\n\nOptionally you can pass a type which unload all records for a given type.\n\n```javascript\nstore.unloadAll();\nstore.unloadAll('post');\n```", + "itemtype": "method", + "name": "unloadAll", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1734, + "description": "Takes a type and filter function, and returns a live RecordArray that\nremains up to date as new records are loaded into the store or created\nlocally.\n\nThe filter function takes a materialized record, and returns true\nif the record should be included in the filter and false if it should\nnot.\n\nExample\n\n```javascript\nstore.filter('post', function(post) {\n return post.get('unread');\n});\n```\n\nThe filter function is called once on all records for the type when\nit is created, and then once on each newly loaded or created record.\n\nIf any of a record's properties change, or if it changes state, the\nfilter function will be invoked again to determine whether it should\nstill be in the array.\n\nOptionally you can pass a query, which is the equivalent of calling\n[query](#method_query) with that same query, to fetch additional records\nfrom the server. The results returned by the server could then appear\nin the filter if they match the filter function.\n\nThe query itself is not used to filter records, it's only sent to your\nserver for you to be able to do server-side filtering. The filter\nfunction will be applied on the returned results regardless.\n\nExample\n\n```javascript\nstore.filter('post', { unread: true }, function(post) {\n return post.get('unread');\n}).then(function(unreadPosts) {\n unreadPosts.get('length'); // 5\n let unreadPost = unreadPosts.objectAt(0);\n unreadPost.set('unread', false);\n unreadPosts.get('length'); // 4\n});\n```", + "itemtype": "method", + "name": "filter", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "query", + "description": "optional query", + "type": "Object" + }, + { + "name": "filter", + "description": "", + "type": "Function" + } + ], + "return": { + "description": "", + "type": "DS.PromiseArray" + }, + "deprecated": true, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1821, + "description": "This method has been deprecated and is an alias for store.hasRecordForId, which should\nbe used instead.", + "deprecated": true, + "itemtype": "method", + "name": "recordIsLoaded", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1844, + "description": "This method is called by `record.save`, and gets passed a\nresolver for the promise that `record.save` returns.\n\nIt schedules saving to happen at the end of the run loop.", + "itemtype": "method", + "name": "scheduleSave", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "resolver", + "description": "", + "type": "Resolver" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1867, + "description": "This method is called at the end of the run loop, and\nflushes any records passed into `scheduleSave`", + "itemtype": "method", + "name": "flushPendingSave", + "access": "private", + "tagname": "", + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1902, + "description": "This method is called once the promise returned by an\nadapter's `createRecord`, `updateRecord` or `deleteRecord`\nis resolved.\n\nIf the data provides a server-generated ID, it will\nupdate the record and the store's indexes.", + "itemtype": "method", + "name": "didSaveRecord", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "the in-flight internal model", + "type": "InternalModel" + }, + { + "name": "data", + "description": "optional data (see above)", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1933, + "description": "This method is called once the promise returned by an\nadapter's `createRecord`, `updateRecord` or `deleteRecord`\nis rejected with a `DS.InvalidError`.", + "itemtype": "method", + "name": "recordWasInvalid", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "errors", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1947, + "description": "This method is called once the promise returned by an\nadapter's `createRecord`, `updateRecord` or `deleteRecord`\nis rejected (with anything other than a `DS.InvalidError`).", + "itemtype": "method", + "name": "recordWasError", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "error", + "description": "", + "type": "Error" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1961, + "description": "When an adapter's `createRecord`, `updateRecord` or `deleteRecord`\nresolves with data, this method extracts the ID from the supplied\ndata.", + "itemtype": "method", + "name": "updateId", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + }, + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 1999, + "description": "Returns a map of IDs to client IDs for a given modelName.", + "itemtype": "method", + "name": "_internalModelsFor", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "recordMap", + "type": "Object" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2016, + "description": "This internal method is used by `push`.", + "itemtype": "method", + "name": "_load", + "access": "private", + "tagname": "", + "params": [ + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2087, + "description": "Returns the model class for the particular `modelName`.\n\nThe class of a model might be useful if you want to get a list of all the\nrelationship names of the model, see\n[`relationshipNames`](https://emberjs.com/api/data/classes/DS.Model.html#property_relationshipNames)\nfor example.", + "itemtype": "method", + "name": "modelFor", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.Model" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2167, + "description": "Push some data for a given type into the store.\n\nThis method expects normalized [JSON API](http://jsonapi.org/) document. This means you have to follow [JSON API specification](http://jsonapi.org/format/) with few minor adjustments:\n- record's `type` should always be in singular, dasherized form\n- members (properties) should be camelCased\n\n[Your primary data should be wrapped inside `data` property](http://jsonapi.org/format/#document-top-level):\n\n```js\nstore.push({\n data: {\n // primary data for single record of type `Person`\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Daniel',\n lastName: 'Kmak'\n }\n }\n});\n```\n\n[Demo.](http://ember-twiddle.com/fb99f18cd3b4d3e2a4c7)\n\n`data` property can also hold an array (of records):\n\n```js\nstore.push({\n data: [\n // an array of records\n {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Daniel',\n lastName: 'Kmak'\n }\n },\n {\n id: '2',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n }\n }\n ]\n});\n```\n\n[Demo.](http://ember-twiddle.com/69cdbeaa3702159dc355)\n\nThere are some typical properties for `JSONAPI` payload:\n* `id` - mandatory, unique record's key\n* `type` - mandatory string which matches `model`'s dasherized name in singular form\n* `attributes` - object which holds data for record attributes - `DS.attr`'s declared in model\n* `relationships` - object which must contain any of the following properties under each relationships' respective key (example path is `relationships.achievements.data`):\n - [`links`](http://jsonapi.org/format/#document-links)\n - [`data`](http://jsonapi.org/format/#document-resource-object-linkage) - place for primary data\n - [`meta`](http://jsonapi.org/format/#document-meta) - object which contains meta-information about relationship\n\nFor this model:\n\n```app/models/person.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n firstName: DS.attr('string'),\n lastName: DS.attr('string'),\n\n children: DS.hasMany('person')\n});\n```\n\nTo represent the children as IDs:\n\n```js\n{\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n data: [\n {\n id: '2',\n type: 'person'\n },\n {\n id: '3',\n type: 'person'\n },\n {\n id: '4',\n type: 'person'\n }\n ]\n }\n }\n }\n}\n```\n\n[Demo.](http://ember-twiddle.com/343e1735e034091f5bde)\n\nTo represent the children relationship as a URL:\n\n```js\n{\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n links: {\n related: '/people/1/children'\n }\n }\n }\n }\n}\n```\n\nIf you're streaming data or implementing an adapter, make sure\nthat you have converted the incoming data into this form. The\nstore's [normalize](#method_normalize) method is a convenience\nhelper for converting a json payload into the form Ember Data\nexpects.\n\n```js\nstore.push(store.normalize('person', data));\n```\n\nThis method can be used both to push in brand new\nrecords, as well as to update existing records.", + "itemtype": "method", + "name": "push", + "params": [ + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "the record(s) that was created or\n updated.", + "type": "DS.Model|Array" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2465, + "description": "Push some raw data into the store.\n\nThis method can be used both to push in brand new\nrecords, as well as to update existing records. You\ncan push in more than one type of object at once.\nAll objects should be in the format expected by the\nserializer.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.ActiveModelSerializer;\n```\n\n```js\nlet pushData = {\n posts: [\n { id: 1, post_title: \"Great post\", comment_ids: [2] }\n ],\n comments: [\n { id: 2, comment_body: \"Insightful comment\" }\n ]\n}\n\nstore.pushPayload(pushData);\n```\n\nBy default, the data will be deserialized using a default\nserializer (the application serializer if it exists).\n\nAlternatively, `pushPayload` will accept a model type which\nwill determine which serializer will process the payload.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.ActiveModelSerializer;\n```\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer;\n```\n\n```js\nstore.pushPayload(pushData); // Will use the application serializer\nstore.pushPayload('post', pushData); // Will use the post serializer\n```", + "itemtype": "method", + "name": "pushPayload", + "params": [ + { + "name": "modelName", + "description": "Optionally, a model type used to determine which serializer will be used", + "type": "String" + }, + { + "name": "inputPayload", + "description": "", + "type": "Object" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2540, + "description": "`normalize` converts a json payload into the normalized form that\n[push](#method_push) expects.\n\nExample\n\n```js\nsocket.on('message', function(message) {\n let modelName = message.model;\n let data = message.data;\n store.push(store.normalize(modelName, data));\n});\n```", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "modelName", + "description": "The name of the model type for this payload", + "type": "String" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "The normalized payload", + "type": "Object" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2569, + "description": "Build a brand new record for a given type, ID, and\ninitial data.", + "itemtype": "method", + "name": "_buildInternalModel", + "access": "private", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "data", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "internal model", + "type": "InternalModel" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2624, + "description": "When a record is destroyed, this un-indexes it and\nremoves it from any record arrays so it can be GCed.", + "itemtype": "method", + "name": "_removeFromIdMap", + "access": "private", + "tagname": "", + "params": [ + { + "name": "internalModel", + "description": "", + "type": "InternalModel" + } + ], + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2643, + "description": "Returns an instance of the adapter for a given type. For\nexample, `adapterFor('person')` will return an instance of\n`App.PersonAdapter`.\n\nIf no `App.PersonAdapter` is found, this method will look\nfor an `App.ApplicationAdapter` (the default adapter for\nyour entire application).\n\nIf no `App.ApplicationAdapter` is found, it will return\nthe value of the `defaultAdapter`.", + "itemtype": "method", + "name": "adapterFor", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "DS.Adapter" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/system/store.js", + "line": 2673, + "description": "Returns an instance of the serializer for a given type. For\nexample, `serializerFor('person')` will return an instance of\n`App.PersonSerializer`.\n\nIf no `App.PersonSerializer` is found, this method will look\nfor an `App.ApplicationSerializer` (the default serializer for\nyour entire application).\n\nif no `App.ApplicationSerializer` is found, it will attempt\nto get the `defaultSerializer` from the `PersonAdapter`\n(`adapterFor('person')`).\n\nIf a serializer cannot be found on the adapter, it will fall back\nto an instance of `DS.JSONSerializer`.", + "itemtype": "method", + "name": "serializerFor", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "the record to serialize", + "type": "String" + } + ], + "return": { + "description": "", + "type": "DS.Serializer" + }, + "class": "DS.Store", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/-private/core.js", + "line": 15, + "itemtype": "property", + "name": "VERSION", + "type": "String", + "static": 1, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/adapters/json-api.js", + "line": 152, + "itemtype": "method", + "name": "ajaxOptions", + "access": "private", + "tagname": "", + "params": [ + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "type", + "description": "The request type GET, POST, PUT, DELETE etc.", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/json-api.js", + "line": 194, + "description": "By default the JSONAPIAdapter will send each find request coming from a `store.find`\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.\n\nFor example, if you have an initial payload of:\n\n```javascript\n{\n data: {\n id: 1,\n type: 'post',\n relationship: {\n comments: {\n data: [\n { id: 1, type: 'comment' },\n { id: 2, type: 'comment' }\n ]\n }\n }\n }\n}\n```\n\nBy default calling `post.get('comments')` will trigger the following requests(assuming the\ncomments haven't been loaded before):\n\n```\nGET /comments/1\nGET /comments/2\n```\n\nIf you set coalesceFindRequests to `true` it will instead trigger the following request:\n\n```\nGET /comments?filter[id]=1,2\n```\n\nSetting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`\nrelationships accessed within the same runloop. If you set `coalesceFindRequests: true`\n\n```javascript\nstore.findRecord('comment', 1);\nstore.findRecord('comment', 2);\n```\n\nwill also send a request to: `GET /comments?filter[id]=1,2`\n\nNote: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app\n`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.", + "itemtype": "property", + "name": "coalesceFindRequests", + "type": "{boolean}", + "class": "DS.JSONAPIAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 294, + "description": "By default, the RESTAdapter will send the query params sorted alphabetically to the\nserver.\n\nFor example:\n\n```js\nstore.query('posts', { sort: 'price', category: 'pets' });\n```\n\nwill generate a requests like this `/posts?category=pets&sort=price`, even if the\nparameters were specified in a different order.\n\nThat way the generated URL will be deterministic and that simplifies caching mechanisms\nin the backend.\n\nSetting `sortQueryParams` to a falsey value will respect the original order.\n\nIn case you want to sort the query parameters with a different criteria, set\n`sortQueryParams` to your custom sort function.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n sortQueryParams(params) {\n let sortedKeys = Object.keys(params).sort().reverse();\n let len = sortedKeys.length, newParams = {};\n\n for (let i = 0; i < len; i++) {\n newParams[sortedKeys[i]] = params[sortedKeys[i]];\n }\n\n return newParams;\n }\n});\n```", + "itemtype": "method", + "name": "sortQueryParams", + "params": [ + { + "name": "obj", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 351, + "description": "By default the RESTAdapter will send each find request coming from a `store.find`\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.\n\nFor example, if you have an initial payload of:\n\n```javascript\n{\n post: {\n id: 1,\n comments: [1, 2]\n }\n}\n```\n\nBy default calling `post.get('comments')` will trigger the following requests(assuming the\ncomments haven't been loaded before):\n\n```\nGET /comments/1\nGET /comments/2\n```\n\nIf you set coalesceFindRequests to `true` it will instead trigger the following request:\n\n```\nGET /comments?ids[]=1&ids[]=2\n```\n\nSetting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`\nrelationships accessed within the same runloop. If you set `coalesceFindRequests: true`\n\n```javascript\nstore.findRecord('comment', 1);\nstore.findRecord('comment', 2);\n```\n\nwill also send a request to: `GET /comments?ids[]=1&ids[]=2`\n\nNote: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app\n`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.", + "itemtype": "property", + "name": "coalesceFindRequests", + "type": "{boolean}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 400, + "description": "Endpoint paths can be prefixed with a `namespace` by setting the namespace\nproperty on the adapter:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n namespace: 'api/1'\n});\n```\n\nRequests for the `Post` model would now target `/api/1/post/`.", + "itemtype": "property", + "name": "namespace", + "type": "{String}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 418, + "description": "An adapter can target other hosts by setting the `host` property.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n host: 'https://api.example.com'\n});\n```\n\nRequests for the `Post` model would now target `https://api.example.com/post/`.", + "itemtype": "property", + "name": "host", + "type": "{String}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 435, + "description": "Some APIs require HTTP headers, e.g. to provide an API\nkey. Arbitrary headers can be set as key/value pairs on the\n`RESTAdapter`'s `headers` object and Ember Data will send them\nalong with each ajax request. For dynamic headers see [headers\ncustomization](/api/data/classes/DS.RESTAdapter.html#toc_headers-customization).\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTAdapter.extend({\n headers: {\n 'API_KEY': 'secret key',\n 'ANOTHER_HEADER': 'Some header value'\n }\n});\n```", + "itemtype": "property", + "name": "headers", + "type": "{Object}", + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 457, + "description": "Called by the store in order to fetch the JSON for a given\ntype and ID.\n\nThe `findRecord` method makes an Ajax request to a URL computed by\n`buildURL`, and returns a promise for the resulting payload.\n\nThis method performs an HTTP `GET` request with the id provided as part of the query string.", + "since": "1.13.0", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 490, + "description": "Called by the store in order to fetch a JSON array for all\nof the records for a given type.\n\nThe `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a\npromise for the resulting payload.", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "sinceToken", + "description": "", + "type": "String" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 526, + "description": "Called by the store in order to fetch a JSON array for\nthe records that match a particular query.\n\nThe `query` method makes an Ajax (HTTP GET) request to a URL\ncomputed by `buildURL`, and returns a promise for the resulting\npayload.\n\nThe `query` argument is a simple JavaScript object that will be passed directly\nto the server as parameters.", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 562, + "description": "Called by the store in order to fetch a JSON object for\nthe record that matches a particular query.\n\nThe `queryRecord` method makes an Ajax (HTTP GET) request to a URL\ncomputed by `buildURL`, and returns a promise for the resulting\npayload.\n\nThe `query` argument is a simple JavaScript object that will be passed directly\nto the server as parameters.", + "since": "1.13.0", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 599, + "description": "Called by the store in order to fetch several records together if `coalesceFindRequests` is true\n\nFor example, if the original payload looks like:\n\n```js\n{\n \"id\": 1,\n \"title\": \"Rails is omakase\",\n \"comments\": [ 1, 2, 3 ]\n}\n```\n\nThe IDs will be passed as a URL-encoded Array of IDs, in this form:\n\n```\nids[]=1&ids[]=2&ids[]=3\n```\n\nMany servers, such as Rails and PHP, will automatically convert this URL-encoded array\ninto an Array for you on the server-side. If you want to encode the\nIDs, differently, just override this (one-line) method.\n\nThe `findMany` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a\npromise for the resulting payload.", + "itemtype": "method", + "name": "findMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 646, + "description": "Called by the store in order to fetch a JSON array for\nthe unloaded records in a has-many relationship that were originally\nspecified as a URL (inside of `links`).\n\nFor example, if your original payload looks like this:\n\n```js\n{\n \"post\": {\n \"id\": 1,\n \"title\": \"Rails is omakase\",\n \"links\": { \"comments\": \"/posts/1/comments\" }\n }\n}\n```\n\nThis method will be called with the parent record and `/posts/1/comments`.\n\nThe `findHasMany` method will make an Ajax (HTTP GET) request to the originally specified URL.\n\nThe format of your `links` value will influence the final request URL via the `urlPrefix` method:\n\n* Links beginning with `//`, `http://`, `https://`, will be used as is, with no further manipulation.\n\n* Links beginning with a single `/` will have the current adapter's `host` value prepended to it.\n\n* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.", + "itemtype": "method", + "name": "findHasMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "relationship", + "description": "meta object describing the relationship", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 700, + "description": "Called by the store in order to fetch the JSON for the unloaded record in a\nbelongs-to relationship that was originally specified as a URL (inside of\n`links`).\n\nFor example, if your original payload looks like this:\n\n```js\n{\n \"person\": {\n \"id\": 1,\n \"name\": \"Tom Dale\",\n \"links\": { \"group\": \"/people/1/group\" }\n }\n}\n```\n\nThis method will be called with the parent record and `/people/1/group`.\n\nThe `findBelongsTo` method will make an Ajax (HTTP GET) request to the originally specified URL.\n\nThe format of your `links` value will influence the final request URL via the `urlPrefix` method:\n\n* Links beginning with `//`, `http://`, `https://`, will be used as is, with no further manipulation.\n\n* Links beginning with a single `/` will have the current adapter's `host` value prepended to it.\n\n* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.", + "itemtype": "method", + "name": "findBelongsTo", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "relationship", + "description": "meta object describing the relationship", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 753, + "description": "Called by the store when a newly created record is\nsaved via the `save` method on a model record instance.\n\nThe `createRecord` method serializes the record and makes an Ajax (HTTP POST) request\nto a URL computed by `buildURL`.\n\nSee `serialize` for information on how to customize the serialized form\nof a record.", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 788, + "description": "Called by the store when an existing record is saved\nvia the `save` method on a model record instance.\n\nThe `updateRecord` method serializes the record and makes an Ajax (HTTP PUT) request\nto a URL computed by `buildURL`.\n\nSee `serialize` for information on how to customize the serialized form\nof a record.", + "itemtype": "method", + "name": "updateRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 825, + "description": "Called by the store when a record is deleted.\n\nThe `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 875, + "description": "Organize records into groups, each of which is to be passed to separate\ncalls to `findMany`.\n\nThis implementation groups together records that have the same base URL but\ndiffering ids. For example `/comments/1` and `/comments/2` will be grouped together\nbecause we know findMany can coalesce them together as `/comments?ids[]=1&ids[]=2`\n\nIt also supports urls where ids are passed as a query param, such as `/comments?id=1`\nbut not those where there is more than 1 query param such as `/comments?id=2&name=David`\nCurrently only the query param of `id` is supported. If you need to support others, please\noverride this or the `_stripIDFromURL` method.\n\nIt does not group records that have differing base urls, such as for example: `/posts/1/comments/2`\nand `/posts/2/comments/3`", + "itemtype": "method", + "name": "groupRecordsForFindMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", + "type": "Array" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 939, + "description": "Takes an ajax response, and returns the json payload or an error.\n\nBy default this hook just returns the json payload passed to it.\nYou might want to override it in two cases:\n\n1. Your API might return useful results in the response headers.\nResponse headers are passed in as the second argument.\n\n2. Your API might return errors as successful responses with status code\n200 and an Errors text or object. You can return a `DS.InvalidError` or a\n`DS.AdapterError` (or a sub class) from this hook and it will automatically\nreject the promise and put your record into the invalid or error state.\n\nReturning a `DS.InvalidError` from this method will cause the\nrecord to transition into the `invalid` state and make the\n`errors` object available on the record. When returning an\n`DS.InvalidError` the store will attempt to normalize the error data\nreturned from the server using the serializer's `extractErrors`\nmethod.", + "since": "1.13.0", + "itemtype": "method", + "name": "handleResponse", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "requestData", + "description": "- the original request information", + "type": "Object" + } + ], + "return": { + "description": "response", + "type": "Object | DS.AdapterError" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 996, + "description": "Default `handleResponse` implementation uses this hook to decide if the\nresponse is a success.", + "since": "1.13.0", + "itemtype": "method", + "name": "isSuccess", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1011, + "description": "Default `handleResponse` implementation uses this hook to decide if the\nresponse is an invalid error.", + "since": "1.13.0", + "itemtype": "method", + "name": "isInvalid", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1026, + "description": "Takes a URL, an HTTP method and a hash of data, and makes an\nHTTP request.\n\nWhen the server responds with a payload, Ember Data will call into `extractSingle`\nor `extractArray` (depending on whether the original query was for one record or\nmany records).\n\nBy default, `ajax` method has the following behavior:\n\n* It sets the response `dataType` to `\"json\"`\n* If the HTTP method is not `\"GET\"`, it sets the `Content-Type` to be\n `application/json; charset=utf-8`\n* If the HTTP method is not `\"GET\"`, it stringifies the data passed in. The\n data is the serialized record in the case of a save.\n* Registers success and failure handlers.", + "itemtype": "method", + "name": "ajax", + "access": "private", + "tagname": "", + "params": [ + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "type", + "description": "The request type GET, POST, PUT, DELETE etc.", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1082, + "itemtype": "method", + "name": "_ajaxRequest", + "access": "private", + "tagname": "", + "params": [ + { + "name": "options", + "description": "jQuery ajax options to be used for the ajax request", + "type": "Object" + } + ], + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1091, + "itemtype": "method", + "name": "ajaxOptions", + "access": "private", + "tagname": "", + "params": [ + { + "name": "url", + "description": "", + "type": "String" + }, + { + "name": "type", + "description": "The request type GET, POST, PUT, DELETE etc.", + "type": "String" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1137, + "itemtype": "method", + "name": "parseErrorResponse", + "access": "private", + "tagname": "", + "params": [ + { + "name": "responseText", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1155, + "itemtype": "method", + "name": "normalizeErrorResponse", + "access": "private", + "tagname": "", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "errors payload", + "type": "Array" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapters/rest.js", + "line": 1177, + "description": "Generates a detailed (\"friendly\") error message, with plenty\nof information for debugging (good luck!)", + "itemtype": "method", + "name": "generatedDetailedMessage", + "access": "private", + "tagname": "", + "params": [ + { + "name": "status", + "description": "", + "type": "Number" + }, + { + "name": "headers", + "description": "", + "type": "Object" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "requestData", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "detailed error message", + "type": "String" + }, + "class": "DS.RESTAdapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 102, + "description": "Normalize the record and recursively normalize/extract all the embedded records\nwhile pushing them into the store as they are encountered\n\nA payload with an attr configured for embedded records needs to be extracted:\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"Rails is unagi\"\n }, {\n \"id\": \"2\",\n \"body\": \"Omakase O_o\"\n }]\n }\n}\n```", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "to be normalized", + "type": "Object" + }, + { + "name": "prop", + "description": "the hash has been referenced by", + "type": "String" + } + ], + "return": { + "description": "the normalized hash", + "type": "Object" + }, + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 143, + "description": "Serialize `belongsTo` relationship when it is configured as an embedded object.\n\nThis example of an author model belongs to a post model:\n\n```js\nPost = DS.Model.extend({\n title: DS.attr('string'),\n body: DS.attr('string'),\n author: DS.belongsTo('author')\n});\n\nAuthor = DS.Model.extend({\n name: DS.attr('string'),\n post: DS.belongsTo('post')\n});\n```\n\nUse a custom (type) serializer for the post model to configure embedded author\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n attrs: {\n author: { embedded: 'always' }\n }\n})\n```\n\nA payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"author\": {\n \"id\": \"2\"\n \"name\": \"dhh\"\n }\n }\n}\n```", + "itemtype": "method", + "name": "serializeBelongsTo", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 242, + "description": "Serializes `hasMany` relationships when it is configured as embedded objects.\n\nThis example of a post model has many comments:\n\n```js\nPost = DS.Model.extend({\n title: DS.attr('string'),\n body: DS.attr('string'),\n comments: DS.hasMany('comment')\n});\n\nComment = DS.Model.extend({\n body: DS.attr('string'),\n post: DS.belongsTo('post')\n});\n```\n\nUse a custom (type) serializer for the post model to configure embedded comments\n\n```app/serializers/post.js\nimport DS from 'ember-data;\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n attrs: {\n comments: { embedded: 'always' }\n }\n})\n```\n\nA payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"body\": \"I want this for my ORM, I want that for my template language...\"\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"Rails is unagi\"\n }, {\n \"id\": \"2\",\n \"body\": \"Omakase O_o\"\n }]\n }\n}\n```\n\nThe attrs options object can use more specific instruction for extracting and\nserializing. When serializing, an option to embed `ids`, `ids-and-types` or `records` can be set.\nWhen extracting the only option is `records`.\n\nSo `{ embedded: 'always' }` is shorthand for:\n`{ serialize: 'records', deserialize: 'records' }`\n\nTo embed the `ids` for a related object (using a hasMany relationship):\n\n```app/serializers/post.js\nimport DS from 'ember-data;\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n attrs: {\n comments: { serialize: 'ids', deserialize: 'records' }\n }\n})\n```\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"body\": \"I want this for my ORM, I want that for my template language...\"\n \"comments\": [\"1\", \"2\"]\n }\n}\n```\n\nTo embed the relationship as a collection of objects with `id` and `type` keys, set\n`ids-and-types` for the related object.\n\nThis is particularly useful for polymorphic relationships where records don't share\nthe same table and the `id` is not enough information.\n\nBy example having a user that has many pets:\n\n```js\nUser = DS.Model.extend({\n name: DS.attr('string'),\n pets: DS.hasMany('pet', { polymorphic: true })\n});\n\nPet = DS.Model.extend({\n name: DS.attr('string'),\n});\n\nCat = Pet.extend({\n // ...\n});\n\nParrot = Pet.extend({\n // ...\n});\n```\n\n```app/serializers/user.js\nimport DS from 'ember-data;\n\nexport default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {\n attrs: {\n pets: { serialize: 'ids-and-types', deserialize: 'records' }\n }\n});\n```\n\n```js\n{\n \"user\": {\n \"id\": \"1\"\n \"name\": \"Bertin Osborne\",\n \"pets\": [\n { \"id\": \"1\", \"type\": \"Cat\" },\n { \"id\": \"1\", \"type\": \"Parrot\"}\n ]\n }\n}\n```", + "itemtype": "method", + "name": "serializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 455, + "description": "When serializing an embedded record, modify the property (in the json payload)\nthat refers to the parent record (foreign key for relationship).\n\nSerializing a `belongsTo` relationship removes the property that refers to the\nparent record\n\nSerializing a `hasMany` relationship does not remove the property that refers to\nthe parent record.", + "itemtype": "method", + "name": "removeEmbeddedForeignKey", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "embeddedSnapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + }, + { + "name": "json", + "description": "", + "type": "Object" + } + ], + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 532, + "itemtype": "method", + "name": "_extractEmbeddedRecords", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 550, + "itemtype": "method", + "name": "_extractEmbeddedHasMany", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 579, + "itemtype": "method", + "name": "_extractEmbeddedBelongsTo", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/embedded-records-mixin.js", + "line": 602, + "itemtype": "method", + "name": "_normalizeEmbeddedRelationship", + "access": "private", + "tagname": "", + "class": "DS.EmbeddedRecordsMixin", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 133, + "itemtype": "method", + "name": "_normalizeDocumentHelper", + "params": [ + { + "name": "documentHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 170, + "itemtype": "method", + "name": "_normalizeRelationshipDataHelper", + "params": [ + { + "name": "relationshipDataHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 198, + "itemtype": "method", + "name": "_normalizeResourceHelper", + "params": [ + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 244, + "itemtype": "method", + "name": "pushPayload", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 258, + "itemtype": "method", + "name": "_normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "isSingle", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 347, + "itemtype": "method", + "name": "_extractType", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "String" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 374, + "description": "Dasherizes and singularizes the model name in the payload to match\nthe format Ember Data uses internally for the model name.\n\nFor example the key `posts` would be converted to `post` and the\nkey `studentAssesments` would be converted to `student-assesment`.", + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 390, + "description": "Converts the model name to a pluralized version of the model name.\n\nFor example `post` would be converted to `posts` and\n`student-assesment` would be converted to `student-assesments`.", + "itemtype": "method", + "name": "payloadKeyFromModelName", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 426, + "description": "`keyForAttribute` can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.\nBy default `JSONAPISerializer` follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as the word separator in the JSON\nattribute keys.\n\nThis behaviour can be easily customized by extending this method.\n\nExample\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { dasherize } from '@ember/string';\n\nexport default DS.JSONAPISerializer.extend({\n keyForAttribute(attr, method) {\n return dasherize(attr).toUpperCase();\n }\n});\n```", + "itemtype": "method", + "name": "keyForAttribute", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 457, + "description": "`keyForRelationship` can be used to define a custom key when\nserializing and deserializing relationship properties.\nBy default `JSONAPISerializer` follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as word separators in\nrelationship properties.\n\nThis behaviour can be easily customized by extending this method.\n\nExample\n\n ```app/serializers/post.js\n import DS from 'ember-data';\n import { underscore } from '@ember/string';\n\n export default DS.JSONAPISerializer.extend({\n keyForRelationship(key, relationship, method) {\n return underscore(key);\n }\n });\n ```", + "itemtype": "method", + "name": "keyForRelationship", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 636, + "description": "`modelNameFromPayloadType` can be used to change the mapping for a DS model\nname, taken from the value in the payload.\n\nSay your API namespaces the type of a model and returns the following\npayload for the `post` model:\n\n```javascript\n// GET /api/posts/1\n{\n \"data\": {\n \"id\": 1,\n \"type: \"api::v1::post\"\n }\n}\n```\n\nBy overwriting `modelNameFromPayloadType` you can specify that the\n`post` model should be used:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONAPISerializer.extend({\n modelNameFromPayloadType(payloadType) {\n return payloadType.replace('api::v1::', '');\n }\n});\n```\n\nBy default the modelName for a model is its singularized name in dasherized\nform. Usually, Ember Data can use the correct inflection to do this for\nyou. Most of the time, you won't need to override\n`modelNameFromPayloadType` for this purpose.\n\nAlso take a look at\n[payloadTypeFromModelName](#method_payloadTypeFromModelName) to customize\nhow the type of a record should be serialized.", + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "payloadType", + "description": "type from payload", + "type": "String" + } + ], + "return": { + "description": "modelName", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json-api.js", + "line": 684, + "description": "`payloadTypeFromModelName` can be used to change the mapping for the type in\nthe payload, taken from the model name.\n\nSay your API namespaces the type of a model and expects the following\npayload when you update the `post` model:\n\n```javascript\n// POST /api/posts/1\n{\n \"data\": {\n \"id\": 1,\n \"type\": \"api::v1::post\"\n }\n}\n```\n\nBy overwriting `payloadTypeFromModelName` you can specify that the\nnamespaces model name for the `post` should be used:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default JSONAPISerializer.extend({\n payloadTypeFromModelName(modelName) {\n return 'api::v1::' + modelName;\n }\n});\n```\n\nBy default the payload type is the pluralized model name. Usually, Ember\nData can use the correct inflection to do this for you. Most of the time,\nyou won't need to override `payloadTypeFromModelName` for this purpose.\n\nAlso take a look at\n[modelNameFromPayloadType](#method_modelNameFromPayloadType) to customize\nhow the model name from should be mapped from the payload.", + "itemtype": "method", + "name": "payloadTypeFromModelName", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelname", + "description": "modelName from the record", + "type": "String" + } + ], + "return": { + "description": "payloadType", + "type": "String" + }, + "class": "DS.JSONAPISerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 85, + "description": "The `primaryKey` is used when serializing and deserializing\ndata. Ember Data always uses the `id` property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\n`primaryKey` property to match the `primaryKey` of your external\nstore.\n\nExample\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n primaryKey: '_id'\n});\n```", + "itemtype": "property", + "name": "primaryKey", + "type": "{String}", + "default": "'id'", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 109, + "description": "The `attrs` object can be used to declare a simple mapping between\nproperty names on `DS.Model` records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty `key` can also be used to designate the attribute's key on\nthe response payload.\n\nExample\n\n```app/models/person.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n firstName: DS.attr('string'),\n lastName: DS.attr('string'),\n occupation: DS.attr('string'),\n admin: DS.attr('boolean')\n});\n```\n\n```app/serializers/person.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n attrs: {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n});\n```\n\nYou can also remove attributes by setting the `serialize` key to\n`false` in your mapping object.\n\nExample\n\n```app/serializers/person.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n attrs: {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n});\n```\n\nWhen serialized:\n\n```javascript\n{\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n}\n```\n\nNote that the `admin` is now not included in the payload.", + "itemtype": "property", + "name": "attrs", + "type": "{Object}", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 173, + "description": "Given a subclass of `DS.Model` and a JSON object this method will\niterate through each attribute of the `DS.Model` and invoke the\n`DS.Transform#deserialize` method on the matching property of the\nJSON object. This method is typically called after the\nserializer's `normalize` method.", + "itemtype": "method", + "name": "applyTransforms", + "access": "private", + "tagname": "", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "data", + "description": "The data to transform", + "type": "Object" + } + ], + "return": { + "description": "data The transformed data object", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 200, + "description": "The `normalizeResponse` method is used to normalize a payload from the\nserver to a JSON-API Document.\n\nhttp://jsonapi.org/format/#document-structure\n\nThis method delegates to a more specific normalize method based on\nthe `requestType`.\n\nTo override this method with a custom one, make sure to call\n`return this._super(store, primaryModelClass, payload, id, requestType)` with your\npre-processed data.\n\nHere's an example of using `normalizeResponse` manually:\n\n```javascript\nsocket.on('message', function(message) {\n var data = message.data;\n var modelClass = store.modelFor(data.modelName);\n var serializer = store.serializerFor(data.modelName);\n var normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n store.push(normalized);\n});\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 260, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 274, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 288, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindAllResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 302, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindBelongsToResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 316, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindHasManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 330, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeFindManyResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 344, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeQueryResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 358, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeCreateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 372, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeDeleteRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 386, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeUpdateRecordResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 400, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSaveResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 414, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeSingleResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 428, + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeArrayResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 442, + "itemtype": "method", + "name": "_normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + }, + { + "name": "isSingle", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 489, + "description": "Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.\n\nIt takes the type of the record that is being normalized\n(as a DS.Model class), the property where the hash was\noriginally found, and the hash to normalize.\n\nYou can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.\n\nExample\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { underscore } from '@ember/string';\nimport { get } from '@ember/object';\n\nexport default DS.JSONSerializer.extend({\n normalize(typeClass, hash) {\n var fields = get(typeClass, 'fields');\n\n fields.forEach(function(field) {\n var payloadField = underscore(field);\n if (field === payloadField) { return; }\n\n hash[field] = hash[payloadField];\n delete hash[payloadField];\n });\n\n return this._super.apply(this, arguments);\n }\n});\n```", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 552, + "description": "Returns the resource's ID.", + "itemtype": "method", + "name": "extractId", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 566, + "description": "Returns the resource's attributes formatted as a JSON-API \"attributes object\".\n\nhttp://jsonapi.org/format/#document-resource-object-attributes", + "itemtype": "method", + "name": "extractAttributes", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 590, + "description": "Returns a relationship formatted as a JSON-API \"relationship object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships", + "itemtype": "method", + "name": "extractRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 639, + "description": "Returns a polymorphic relationship formatted as a JSON-API \"relationship object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships\n\n`relationshipOptions` is a hash which contains more information about the\npolymorphic relationship which should be extracted:\n - `resourceHash` complete hash of the resource the relationship should be\n extracted from\n - `relationshipKey` key under which the value for the relationship is\n extracted from the resourceHash\n - `relationshipMeta` meta information about the relationship", + "itemtype": "method", + "name": "extractPolymorphicRelationship", + "params": [ + { + "name": "relationshipModelName", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + }, + { + "name": "relationshipOptions", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 662, + "description": "Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships", + "itemtype": "method", + "name": "extractRelationships", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "Object" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 718, + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 728, + "itemtype": "method", + "name": "normalizeRelationships", + "access": "private", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 747, + "itemtype": "method", + "name": "normalizeUsingDeclaredMapping", + "access": "private", + "tagname": "", + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 778, + "description": "Looks up the property key that was set by the custom `attr` mapping\npassed to the serializer.", + "itemtype": "method", + "name": "_getMappedKey", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 809, + "description": "Check attrs.key.serialize property to inform if the `key`\ncan be serialized", + "itemtype": "method", + "name": "_canSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key can be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 824, + "description": "When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized", + "itemtype": "method", + "name": "_mustSerialize", + "access": "private", + "tagname": "", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the key must be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 840, + "description": "Check if the given hasMany relationship should be serialized", + "itemtype": "method", + "name": "shouldSerializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 861, + "description": "Check if the given hasMany relationship should be serialized", + "itemtype": "method", + "name": "_shouldSerializeHasMany", + "access": "private", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "relationshipType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "true if the hasMany relationship should be serialized", + "type": "Boolean" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 881, + "description": "Called when a record is saved in order to convert the\nrecord into JSON.\n\nBy default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.\n\nFor example, consider this model:\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n title: DS.attr(),\n body: DS.attr(),\n\n author: DS.belongsTo('user')\n});\n```\n\nThe default serialization would create a JSON object like:\n\n```javascript\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`DS.attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n serialize(snapshot, options) {\n var json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n});\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { singularize } from 'ember-inflector';\n\nexport default DS.JSONSerializer.extend({\n serialize(snapshot, options) {\n var json = {};\n\n snapshot.eachAttribute(function(name) {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship(function(name, relationship) {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n});\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ 1, 2, 3 ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n serialize(snapshot, options) {\n var json = this._super(...arguments);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n});\n```", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "json", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1062, + "description": "You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.\n\nFor example, your server may expect underscored root objects.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { decamelize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n serializeIntoHash(data, type, snapshot, options) {\n var root = decamelize(type.modelName);\n data[root] = this.serialize(snapshot, options);\n }\n});\n```", + "itemtype": "method", + "name": "serializeIntoHash", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1094, + "description": "`serializeAttribute` can be used to customize how `DS.attr`\nproperties are serialized\n\nFor example if you wanted to ensure all your attributes were always\nserialized as properties on an `attributes` object you could\nwrite:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n serializeAttribute(snapshot, json, key, attributes) {\n json.attributes = json.attributes || {};\n this._super(snapshot, json.attributes, key, attributes);\n }\n});\n```", + "itemtype": "method", + "name": "serializeAttribute", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "attribute", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1141, + "description": "`serializeBelongsTo` can be used to customize how `DS.belongsTo`\nproperties are serialized.\n\nExample\n\n```app/serializers/post.js\nimport DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n serializeBelongsTo(snapshot, json, relationship) {\n var key = relationship.key;\n var belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForRelationship ? this.keyForRelationship(key, \"belongsTo\", \"serialize\") : key;\n\n json[key] = isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();\n }\n});\n```", + "itemtype": "method", + "name": "serializeBelongsTo", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1194, + "description": "`serializeHasMany` can be used to customize how `DS.hasMany`\nproperties are serialized.\n\nExample\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n serializeHasMany(snapshot, json, relationship) {\n var key = relationship.key;\n if (key === 'comments') {\n return;\n } else {\n this._super(...arguments);\n }\n }\n});\n```", + "itemtype": "method", + "name": "serializeHasMany", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1243, + "description": "You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n`{ polymorphic: true }` is pass as the second argument to the\n`DS.belongsTo` function.\n\nExample\n\n```app/serializers/comment.js\nimport DS from 'ember-data';\nimport { isNone } from '@ember/utils';\n\nexport default DS.JSONSerializer.extend({\n serializePolymorphicType(snapshot, json, relationship) {\n var key = relationship.key;\n var belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n if (isNone(belongsTo)) {\n json[key + '_type'] = null;\n } else {\n json[key + '_type'] = belongsTo.modelName;\n }\n }\n});\n```", + "itemtype": "method", + "name": "serializePolymorphicType", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1278, + "description": "`extractMeta` is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the `meta` property of the payload object.\n\nExample\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n extractMeta(store, typeClass, payload) {\n if (payload && payload.hasOwnProperty('_pagination')) {\n let meta = payload._pagination;\n delete payload._pagination;\n return meta;\n }\n }\n});\n```", + "itemtype": "method", + "name": "extractMeta", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1312, + "description": "`extractErrors` is used to extract model errors when a call\nto `DS.Model#save` fails with an `InvalidError`. By default\nEmber Data expects error information to be located on the `errors`\nproperty of the payload object.\n\nThis serializer expects this `errors` object to be an Array similar\nto the following, compliant with the JSON-API specification:\n\n```js\n{\n \"errors\": [\n {\n \"detail\": \"This username is already taken!\",\n \"source\": {\n \"pointer\": \"data/attributes/username\"\n }\n }, {\n \"detail\": \"Doesn't look like a valid email.\",\n \"source\": {\n \"pointer\": \"data/attributes/email\"\n }\n }\n ]\n}\n```\n\nThe key `detail` provides a textual description of the problem.\nAlternatively, the key `title` can be used for the same purpose.\n\nThe nested keys `source.pointer` detail which specific element\nof the request data was invalid.\n\nNote that JSON-API also allows for object-level errors to be placed\nin an object with pointer `data`, signifying that the problem\ncannot be traced to a specific attribute:\n\n```javascript\n{\n \"errors\": [\n {\n \"detail\": \"Some generic non property error message\",\n \"source\": {\n \"pointer\": \"data\"\n }\n }\n ]\n}\n```\n\nWhen turn into a `DS.Errors` object, you can read these errors\nthrough the property `base`:\n\n```handlebars\n{{#each model.errors.base as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\nExample of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\n extractErrors(store, typeClass, payload, id) {\n if (payload && typeof payload === 'object' && payload._problems) {\n payload = payload._problems;\n this.normalizeErrors(typeClass, payload);\n }\n return payload;\n }\n});\n```", + "itemtype": "method", + "name": "extractErrors", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "(String|Number)" + } + ], + "return": { + "description": "json The deserialized errors", + "type": "Object" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1423, + "description": "`keyForAttribute` can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.\n\nExample\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { underscore } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n keyForAttribute(attr, method) {\n return underscore(attr).toUpperCase();\n }\n});\n```", + "itemtype": "method", + "name": "keyForAttribute", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1449, + "description": "`keyForRelationship` can be used to define a custom key when\nserializing and deserializing relationship properties. By default\n`JSONSerializer` does not provide an implementation of this method.\n\nExample\n\n ```app/serializers/post.js\n import DS from 'ember-data';\n import { underscore } from '@ember/string';\n\n export default DS.JSONSerializer.extend({\n keyForRelationship(key, relationship, method) {\n return `rel_${underscore(key)}`;\n }\n });\n ```", + "itemtype": "method", + "name": "keyForRelationship", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1477, + "description": "`keyForLink` can be used to define a custom key when deserializing link\nproperties.", + "itemtype": "method", + "name": "keyForLink", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "kind", + "description": "`belongsTo` or `hasMany`", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1492, + "itemtype": "method", + "name": "transformFor", + "access": "private", + "tagname": "", + "params": [ + { + "name": "attributeType", + "description": "", + "type": "String" + }, + { + "name": "skipAssertion", + "description": "", + "type": "Boolean" + } + ], + "return": { + "description": "transform", + "type": "DS.Transform" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1512, + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "type", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/json.js", + "line": 1534, + "description": "serializeId can be used to customize how id is serialized\nFor example, your server may expect integer datatype of id\n\nBy default the snapshot's id (String) is set on the json hash via json[primaryKey] = snapshot.id.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.JSONSerializer.extend({\nserializeId(snapshot, json, primaryKey) {\n var id = snapshot.id;\n json[primaryKey] = parseInt(id, 10);\n }\n});\n```", + "itemtype": "method", + "name": "serializeId", + "access": "public", + "tagname": "", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "primaryKey", + "description": "", + "type": "String" + } + ], + "class": "DS.JSONSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 66, + "description": "`keyForPolymorphicType` can be used to define a custom key when\nserializing and deserializing a polymorphic type. By default, the\nreturned key is `${key}Type`.\n\nExample\n\n ```app/serializers/post.js\n import DS from 'ember-data';\n\n export default DS.RESTSerializer.extend({\n keyForPolymorphicType(key, relationship) {\n var relationshipKey = this.keyForRelationship(key);\n\n return 'type-' + relationshipKey;\n }\n });\n ```", + "itemtype": "method", + "name": "keyForPolymorphicType", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + }, + { + "name": "typeClass", + "description": "", + "type": "String" + }, + { + "name": "method", + "description": "", + "type": "String" + } + ], + "return": { + "description": "normalized key", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 97, + "description": "Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.\n\nIt takes the type of the record that is being normalized\n(as a DS.Model class), the property where the hash was\noriginally found, and the hash to normalize.\n\nFor example, if you have a payload that looks like this:\n\n```js\n{\n \"post\": {\n \"id\": 1,\n \"title\": \"Rails is omakase\",\n \"comments\": [ 1, 2 ]\n },\n \"comments\": [{\n \"id\": 1,\n \"body\": \"FIRST\"\n }, {\n \"id\": 2,\n \"body\": \"Rails is unagi\"\n }]\n}\n```\n\nThe `normalize` method will be called three times:\n\n* With `App.Post`, `\"posts\"` and `{ id: 1, title: \"Rails is omakase\", ... }`\n* With `App.Comment`, `\"comments\"` and `{ id: 1, body: \"FIRST\" }`\n* With `App.Comment`, `\"comments\"` and `{ id: 2, body: \"Rails is unagi\" }`\n\nYou can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations. You will only need to implement\n`normalize` and manipulate the payload as desired.\n\nFor example, if the `IDs` under `\"comments\"` are provided as `_id` instead of\n`id`, you can specify how to normalize just the comments:\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n normalize(model, hash, prop) {\n if (prop === 'comments') {\n hash.id = hash._id;\n delete hash._id;\n }\n\n return this._super(...arguments);\n }\n});\n```\n\nOn each call to the `normalize` method, the third parameter (`prop`) is always\none of the keys that were in the original payload or in the result of another\nnormalization as `normalizeResponse`.", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "modelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "resourceHash", + "description": "", + "type": "Object" + }, + { + "name": "prop", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 174, + "description": "Normalizes an array of resource payloads and returns a JSON-API Document\nwith primary data and, if any, included data as `{ data, included }`.", + "itemtype": "method", + "name": "_normalizeArray", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "modelName", + "description": "", + "type": "String" + }, + { + "name": "arrayHash", + "description": "", + "type": "Object" + }, + { + "name": "prop", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "access": "private", + "tagname": "", + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 385, + "description": "This method allows you to push a payload containing top-level\ncollections of records organized per type.\n\n```js\n{\n \"posts\": [{\n \"id\": \"1\",\n \"title\": \"Rails is omakase\",\n \"author\", \"1\",\n \"comments\": [ \"1\" ]\n }],\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"FIRST\"\n }],\n \"users\": [{\n \"id\": \"1\",\n \"name\": \"@d2h\"\n }]\n}\n```\n\nIt will first normalize the payload, so you can use this to push\nin data streaming in from your server structured the same way\nthat fetches and saves are structured.", + "itemtype": "method", + "name": "pushPayload", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "payload", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 449, + "description": "This method is used to convert each JSON root key in the payload\ninto a modelName that it can use to look up the appropriate model for\nthat part of the payload.\n\nFor example, your server may send a model name that does not correspond with\nthe name of the model in your app. Let's take a look at an example model,\nand an example payload:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n});\n```\n\n```javascript\n {\n \"blog/post\": {\n \"id\": \"1\n }\n }\n```\n\nEmber Data is going to normalize the payload's root key for the modelName. As a result,\nit will try to look up the \"blog/post\" model. Since we don't have a model called \"blog/post\"\n(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error\nbecause it cannot find the \"blog/post\" model.\n\nSince we want to remove this namespace, we can define a serializer for the application that will\nremove \"blog/\" from the payload key whenver it's encountered by Ember Data:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n modelNameFromPayloadKey(payloadKey) {\n if (payloadKey === 'blog/post') {\n return this._super(payloadKey.replace('blog/', ''));\n } else {\n return this._super(payloadKey);\n }\n }\n});\n```\n\nAfter refreshing, Ember Data will appropriately look up the \"post\" model.\n\nBy default the modelName for a model is its\nname in dasherized form. This means that a payload key like \"blogPost\" would be\nnormalized to \"blog-post\" when Ember Data looks up the model. Usually, Ember Data\ncan use the correct inflection to do this for you. Most of the time, you won't\nneed to override `modelNameFromPayloadKey` for this purpose.", + "itemtype": "method", + "name": "modelNameFromPayloadKey", + "params": [ + { + "name": "key", + "description": "", + "type": "String" + } + ], + "return": { + "description": "the model's modelName", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 513, + "description": "Called when a record is saved in order to convert the\nrecord into JSON.\n\nBy default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.\n\nFor example, consider this model:\n\n```app/models/comment.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n title: DS.attr(),\n body: DS.attr(),\n\n author: DS.belongsTo('user')\n});\n```\n\nThe default serialization would create a JSON object like:\n\n```js\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`DS.attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n serialize(snapshot, options) {\n var json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n});\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { pluralize } from 'ember-inflector';\n\nexport default DS.RESTSerializer.extend({\n serialize(snapshot, options) {\n var json = {};\n\n snapshot.eachAttribute(function(name) {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship(function(name, relationship) {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n});\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```js\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ 1, 2, 3 ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.\n\n```app/serializers/post.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n serialize(snapshot, options) {\n var json = this._super(snapshot, options);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n});\n```", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "json", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 669, + "description": "You can use this method to customize the root keys serialized into the JSON.\nThe hash property should be modified by reference (possibly using something like _.extend)\nBy default the REST Serializer sends the modelName of a model, which is a camelized\nversion of the name.\n\nFor example, your server may expect underscored root objects.\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { decamelize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n serializeIntoHash(data, type, record, options) {\n var root = decamelize(type.modelName);\n data[root] = this.serialize(record, options);\n }\n});\n```", + "itemtype": "method", + "name": "serializeIntoHash", + "params": [ + { + "name": "hash", + "description": "", + "type": "Object" + }, + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 700, + "description": "You can use `payloadKeyFromModelName` to override the root key for an outgoing\nrequest. By default, the RESTSerializer returns a camelized version of the\nmodel's name.\n\nFor a model called TacoParty, its `modelName` would be the string `taco-party`. The RESTSerializer\nwill send it to the server with `tacoParty` as the root key in the JSON payload:\n\n```js\n{\n \"tacoParty\": {\n \"id\": \"1\",\n \"location\": \"Matthew Beale's House\"\n }\n}\n```\n\nFor example, your server may expect dasherized root objects:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\nimport { dasherize } from '@ember/string';\n\nexport default DS.RESTSerializer.extend({\n payloadKeyFromModelName(modelName) {\n return dasherize(modelName);\n }\n});\n```\n\nGiven a `TacoParty` model, calling `save` on it would produce an outgoing\nrequest like:\n\n```js\n{\n \"taco-party\": {\n \"id\": \"1\",\n \"location\": \"Matthew Beale's House\"\n }\n}\n```", + "itemtype": "method", + "name": "payloadKeyFromModelName", + "params": [ + { + "name": "modelName", + "description": "", + "type": "String" + } + ], + "return": { + "description": "", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 750, + "description": "You can use this method to customize how polymorphic objects are serialized.\nBy default the REST Serializer creates the key by appending `Type` to\nthe attribute and value from the model's camelcased model name.", + "itemtype": "method", + "name": "serializePolymorphicType", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "json", + "description": "", + "type": "Object" + }, + { + "name": "relationship", + "description": "", + "type": "Object" + } + ], + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 794, + "description": "You can use this method to customize how a polymorphic relationship should\nbe extracted.", + "itemtype": "method", + "name": "extractPolymorphicRelationship", + "params": [ + { + "name": "relationshipType", + "description": "", + "type": "Object" + }, + { + "name": "relationshipHash", + "description": "", + "type": "Object" + }, + { + "name": "relationshipOptions", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 869, + "description": "`modelNameFromPayloadType` can be used to change the mapping for a DS model\nname, taken from the value in the payload.\n\nSay your API namespaces the type of a model and returns the following\npayload for the `post` model, which has a polymorphic `user` relationship:\n\n```javascript\n// GET /api/posts/1\n{\n \"post\": {\n \"id\": 1,\n \"user\": 1,\n \"userType: \"api::v1::administrator\"\n }\n}\n```\n\nBy overwriting `modelNameFromPayloadType` you can specify that the\n`administrator` model should be used:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n modelNameFromPayloadType(payloadType) {\n return payloadType.replace('api::v1::', '');\n }\n});\n```\n\nBy default the modelName for a model is its name in dasherized form.\nUsually, Ember Data can use the correct inflection to do this for you. Most\nof the time, you won't need to override `modelNameFromPayloadType` for this\npurpose.\n\nAlso take a look at\n[payloadTypeFromModelName](#method_payloadTypeFromModelName) to customize\nhow the type of a record should be serialized.", + "itemtype": "method", + "name": "modelNameFromPayloadType", + "access": "public", + "tagname": "", + "params": [ + { + "name": "payloadType", + "description": "type from payload", + "type": "String" + } + ], + "return": { + "description": "modelName", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializers/rest.js", + "line": 918, + "description": "`payloadTypeFromModelName` can be used to change the mapping for the type in\nthe payload, taken from the model name.\n\nSay your API namespaces the type of a model and expects the following\npayload when you update the `post` model, which has a polymorphic `user`\nrelationship:\n\n```javascript\n// POST /api/posts/1\n{\n \"post\": {\n \"id\": 1,\n \"user\": 1,\n \"userType\": \"api::v1::administrator\"\n }\n}\n```\n\nBy overwriting `payloadTypeFromModelName` you can specify that the\nnamespaces model name for the `administrator` should be used:\n\n```app/serializers/application.js\nimport DS from 'ember-data';\n\nexport default DS.RESTSerializer.extend({\n payloadTypeFromModelName(modelName) {\n return 'api::v1::' + modelName;\n }\n});\n```\n\nBy default the payload type is the camelized model name. Usually, Ember\nData can use the correct inflection to do this for you. Most of the time,\nyou won't need to override `payloadTypeFromModelName` for this purpose.\n\nAlso take a look at\n[modelNameFromPayloadType](#method_modelNameFromPayloadType) to customize\nhow the model name from should be mapped from the payload.", + "itemtype": "method", + "name": "payloadTypeFromModelName", + "access": "public", + "tagname": "", + "params": [ + { + "name": "modelName", + "description": "modelName from the record", + "type": "String" + } + ], + "return": { + "description": "payloadType", + "type": "String" + }, + "class": "DS.RESTSerializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/transforms/transform.js", + "line": 71, + "description": "When given a deserialized value from a record attribute this\nmethod must return the serialized value.\n\nExample\n\n```javascript\nimport { isEmpty } from '@ember/utils';\n\nserialize(deserialized, options) {\n return isEmpty(deserialized) ? null : Number(deserialized);\n}\n```", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "deserialized", + "description": "The deserialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The serialized value" + }, + "class": "DS.Transform", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/transforms/transform.js", + "line": 92, + "description": "When given a serialize value from a JSON object this method must\nreturn the deserialized value for the record attribute.\n\nExample\n\n```javascript\ndeserialize(serialized, options) {\n return empty(serialized) ? null : Number(serialized);\n}\n```", + "itemtype": "method", + "name": "deserialize", + "params": [ + { + "name": "serialized", + "description": "The serialized value" + }, + { + "name": "options", + "description": "hash of options passed to `DS.attr`" + } + ], + "return": { + "description": "The deserialized value" + }, + "class": "DS.Transform", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 65, + "description": "If you would like your adapter to use a custom serializer you can\nset the `defaultSerializer` property to be the name of the custom\nserializer.\n\nNote the `defaultSerializer` serializer has a lower priority than\na model specific serializer (i.e. `PostSerializer`) or the\n`application` serializer.\n\n```app/adapters/django.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n defaultSerializer: 'django'\n});\n```", + "itemtype": "property", + "name": "defaultSerializer", + "type": "{String}", + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 87, + "description": "The `findRecord()` method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to `findRecord()` being called, you\nshould query your persistence layer for a record with the given ID. The `findRecord`\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.\n\nHere is an example `findRecord` implementation:\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n findRecord(store, type, id, snapshot) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "findRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "id", + "description": "", + "type": "String" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 123, + "description": "The `findAll()` method is used to retrieve all records for a given type.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n findAll(store, type, sinceToken) {\n let query = { since: sinceToken };\n\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`, query).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "findAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "sinceToken", + "description": "", + "type": "String" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 157, + "description": "This method is called when you call `query` on the store.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n query(store, type, query) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`, query).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "query", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + }, + { + "name": "recordArray", + "description": "", + "type": "DS.AdapterPopulatedRecordArray" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 189, + "description": "The `queryRecord()` method is invoked when the store is asked for a single\nrecord through a query object.\n\nIn response to `queryRecord()` being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's `push()` method\nto push the record into the store.\n\nHere is an example `queryRecord` implementation:\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend(DS.BuildURLMixin, {\n queryRecord(store, type, query) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`, query).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "queryRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "", + "type": "subclass of DS.Model" + }, + { + "name": "query", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 227, + "description": "If the globally unique IDs for your records should be generated on the client,\nimplement the `generateIdForRecord()` method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's `primaryKey`.\n\nMost traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls `didCreateRecord()`. Only implement this method if\nyou intend to generate record IDs on the client-side.\n\nThe `generateIdForRecord()` method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:\n\n```javascript\nimport DS from 'ember-data';\nimport { v4 } from 'uuid';\n\nexport default DS.Adapter.extend({\n generateIdForRecord(store, inputProperties) {\n return v4();\n }\n});\n```", + "itemtype": "method", + "name": "generateIdForRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "inputProperties", + "description": "a hash of properties to set on the\n newly created record.", + "type": "Object" + } + ], + "return": { + "description": "id", + "type": "(String|Number)" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 261, + "description": "Proxies to the serializer's `serialize` method.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\n\nexport default DS.Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let url = `/${type.modelName}`;\n\n // ...\n }\n});\n```", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "serialized snapshot", + "type": "Object" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 288, + "description": "Implement this method in a subclass to handle the creation of\nnew records.\n\nSerializes the record and sends it to the server.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'POST',\n url: `/${type.modelName}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n run(null, resolve, data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n run(null, reject, jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "createRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 331, + "description": "Implement this method in a subclass to handle the updating of\na record.\n\nSerializes the record update and sends it to the server.\n\nThe updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with `undefined` and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n updateRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let id = snapshot.id;\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'PUT',\n url: `/${type.modelName}/${id}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n run(null, resolve, data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n run(null, reject, jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "updateRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 383, + "description": "Implement this method in a subclass to handle the deletion of\na record.\n\nSends a delete request for the record to the server.\n\nExample\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n deleteRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let id = snapshot.id;\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'DELETE',\n url: `/${type.modelName}/${id}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n run(null, resolve, data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n run(null, reject, jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "deleteRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the record", + "type": "DS.Model" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 427, + "description": "By default the store will try to coalesce all `fetchRecord` calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.", + "itemtype": "property", + "name": "coalesceFindRequests", + "type": "{boolean}", + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 438, + "description": "The store will call `findMany` instead of multiple `findRecord`\nrequests to find multiple records at once if coalesceFindRequests\nis true.\n\n```app/adapters/application.js\nimport DS from 'ember-data';\nimport { run } from '@ember/runloop';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default DS.Adapter.extend({\n findMany(store, type, ids, snapshots) {\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'GET',\n url: `/${type.modelName}/`,\n dataType: 'json',\n data: { filter: { id: ids.join(',') } }\n }).then(function(data) {\n run(null, resolve, data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n run(null, reject, jqXHR);\n });\n });\n }\n});\n```", + "itemtype": "method", + "name": "findMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "type", + "description": "the DS.Model class of the records", + "type": "DS.Model" + }, + { + "name": "ids", + "description": "", + "type": "Array" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "promise", + "type": "Promise" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 477, + "description": "Organize records into groups, each of which is to be passed to separate\ncalls to `findMany`.\n\nFor example, if your api has nested URLs that depend on the parent, you will\nwant to group records by their parent.\n\nThe default implementation returns the records as a single group.", + "itemtype": "method", + "name": "groupRecordsForFindMany", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshots", + "description": "", + "type": "Array" + } + ], + "return": { + "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", + "type": "Array" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 497, + "description": "This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\n`store.findRecord`.\n\nIf this method returns `true`, the store will re-fetch a record from\nthe adapter. If this method returns `false`, the store will resolve\nimmediately using the cached record.\n\nFor example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:\n\n```javascript\nshouldReloadRecord(store, ticketSnapshot) {\n let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n}\n```\n\nThis method would ensure that whenever you do `store.findRecord('ticket',\nid)` you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, `findRecord` will not\nresolve until you fetched the latest version.\n\nBy default this hook returns `false`, as most UIs should not block user\ninteractions while waiting on data update.\n\nNote that, with default settings, `shouldBackgroundReloadRecord` will always\nre-fetch the records in the background even if `shouldReloadRecord` returns\n`false`. You can override `shouldBackgroundReloadRecord` if this does not\nsuit your use case.", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldReloadRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 547, + "description": "This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\n`store.findAll`.\n\nIf this method returns `true`, the store will re-fetch all records from\nthe adapter. If this method returns `false`, the store will resolve\nimmediately using the cached records.\n\nFor example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:\n\n```javascript\nshouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any((ticketSnapshot) => {\n let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n}\n```\n\nThis method would ensure that whenever you do `store.findAll('ticket')` you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, `findAll` will not\nresolve until you fetched the latest versions.\n\nBy default this methods returns `true` if the passed `snapshotRecordArray`\nis empty (meaning that there are no records locally available yet),\notherwise it returns `false`.\n\nNote that, with default settings, `shouldBackgroundReloadAll` will always\nre-fetch all the records in the background even if `shouldReloadAll` returns\n`false`. You can override `shouldBackgroundReloadAll` if this does not suit\nyour use case.", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldReloadAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 602, + "description": "This method is used by the store to determine if the store should\nreload a record after the `store.findRecord` method resolves a\ncached record.\n\nThis method is *only* checked by the store when the store is\nreturning a cached record.\n\nIf this method returns `true` the store will re-fetch a record from\nthe adapter.\n\nFor example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\n`shouldBackgroundReloadRecord` as follows:\n\n```javascript\nshouldBackgroundReloadRecord(store, snapshot) {\n let connection = window.navigator.connection;\n\n if (connection === 'cellular' || connection === 'none') {\n return false;\n } else {\n return true;\n }\n}\n```\n\nBy default this hook returns `true` so the data for the record is updated\nin the background.", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldBackgroundReloadRecord", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/adapter.js", + "line": 642, + "description": "This method is used by the store to determine if the store should\nreload a record array after the `store.findAll` method resolves\nwith a cached record array.\n\nThis method is *only* checked by the store when the store is\nreturning a cached record array.\n\nIf this method returns `true` the store will re-fetch all records\nfrom the adapter.\n\nFor example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\n`shouldBackgroundReloadAll` as follows:\n\n```javascript\nshouldBackgroundReloadAll(store, snapshotArray) {\n let connection = window.navigator.connection;\n\n if (connection === 'cellular' || connection === 'none') {\n return false;\n } else {\n return true;\n }\n}\n```\n\nBy default this method returns `true`, indicating that a background reload\nshould always be triggered.", + "since": "1.13.0", + "itemtype": "method", + "name": "shouldBackgroundReloadAll", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "snapshotRecordArray", + "description": "", + "type": "DS.SnapshotRecordArray" + } + ], + "return": { + "description": "", + "type": "Boolean" + }, + "class": "DS.Adapter", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/attr.js", + "line": 38, + "description": "`DS.attr` defines an attribute on a [DS.Model](/api/data/classes/DS.Model.html).\nBy default, attributes are passed through as-is, however you can specify an\noptional type to have the value automatically transformed.\nEmber Data ships with four basic transform types: `string`, `number`,\n`boolean` and `date`. You can define your own transforms by subclassing\n[DS.Transform](/api/data/classes/DS.Transform.html).\n\nNote that you cannot use `attr` to define an attribute of `id`.\n\n`DS.attr` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `defaultValue`: Pass a string or a function to be called to set the attribute\n to a default value if none is supplied.\n\nExample\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n username: DS.attr('string'),\n email: DS.attr('string'),\n verified: DS.attr('boolean', { defaultValue: false })\n});\n```\n\nDefault value can also be a function. This is useful it you want to return\na new object for each attribute.\n\n```app/models/user.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n username: DS.attr('string'),\n email: DS.attr('string'),\n settings: DS.attr({\n defaultValue() {\n return {};\n }\n })\n});\n```\n\nThe `options` hash is passed as second argument to a transforms'\n`serialize` and `deserialize` method. This allows to configure a\ntransformation and adapt the corresponding value, based on the config:\n\n```app/models/post.js\nimport DS from 'ember-data';\n\nexport default DS.Model.extend({\n text: DS.attr('text', {\n uppercase: true\n })\n});\n```\n\n```app/transforms/text.js\nimport DS from 'ember-data';\n\nexport default DS.Transform.extend({\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n },\n\n deserialize(value) {\n return value;\n }\n})\n```", + "itemtype": "method", + "name": "attr", + "params": [ + { + "name": "type", + "description": "the attribute type", + "type": "String|Object" + }, + { + "name": "options", + "description": "a hash of options", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Attribute" + }, + "class": "DS", + "module": "ember-data" + }, + { + "file": "addon/serializer.js", + "line": 29, + "description": "The `store` property is the application's `store` that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.\n\nExample:\n\n```js\nSerializer.extend({\n extractRelationship(relationshipModelName, relationshipHash) {\n var modelClass = this.store.modelFor(relationshipModelName);\n var relationshipSerializer = this.store.serializerFor(relationshipModelName);\n return relationshipSerializer.normalize(modelClass, relationshipHash);\n }\n});\n```", + "itemtype": "property", + "name": "store", + "type": "{DS.Store}", + "access": "public", + "tagname": "", + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializer.js", + "line": 51, + "description": "The `normalizeResponse` method is used to normalize a payload from the\nserver to a JSON-API Document.\n\nhttp://jsonapi.org/format/#document-structure\n\nExample:\n\n```js\nSerializer.extend({\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n if (requestType === 'findRecord') {\n return this.normalize(primaryModelClass, payload);\n } else {\n return payload.reduce(function(documentHash, item) {\n let { data, included } = this.normalize(primaryModelClass, item);\n documentHash.included.push(...included);\n documentHash.data.push(data);\n return documentHash;\n }, { data: [], included: [] })\n }\n }\n});\n```", + "since": "1.13.0", + "itemtype": "method", + "name": "normalizeResponse", + "params": [ + { + "name": "store", + "description": "", + "type": "DS.Store" + }, + { + "name": "primaryModelClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "payload", + "description": "", + "type": "Object" + }, + { + "name": "id", + "description": "", + "type": "String|Number" + }, + { + "name": "requestType", + "description": "", + "type": "String" + } + ], + "return": { + "description": "JSON-API Document", + "type": "Object" + }, + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializer.js", + "line": 87, + "description": "The `serialize` method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.\n\n`serialize` takes an optional `options` hash with a single option:\n\n- `includeId`: If this is `true`, `serialize` should include the ID\n in the serialized object it builds.\n\nExample:\n\n```js\nSerializer.extend({\n serialize(snapshot, options) {\n var json = {\n id: snapshot.id\n };\n\n snapshot.eachAttribute((key, attribute) => {\n json[key] = snapshot.attr(key);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n json[key] = snapshot.belongsTo(key, { id: true });\n } else if (relationship.kind === 'hasMany') {\n json[key] = snapshot.hasMany(key, { ids: true });\n }\n });\n\n return json;\n },\n});\n```", + "itemtype": "method", + "name": "serialize", + "params": [ + { + "name": "snapshot", + "description": "", + "type": "DS.Snapshot" + }, + { + "name": "options", + "description": "", + "type": "Object", + "optional": true + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "addon/serializer.js", + "line": 129, + "description": "The `normalize` method is used to convert a payload received from your\nexternal data source into the normalized form `store.push()` expects. You\nshould override this method, munge the hash and return the normalized\npayload.\n\nExample:\n\n```js\nSerializer.extend({\n normalize(modelClass, resourceHash) {\n var data = {\n id: resourceHash.id,\n type: modelClass.modelName,\n attributes: resourceHash\n };\n return { data: data };\n }\n})\n```", + "itemtype": "method", + "name": "normalize", + "params": [ + { + "name": "typeClass", + "description": "", + "type": "DS.Model" + }, + { + "name": "hash", + "description": "", + "type": "Object" + } + ], + "return": { + "description": "", + "type": "Object" + }, + "class": "DS.Serializer", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "node_modules/ember-inflector/addon/lib/ext/string.js", + "line": 8, + "description": "See {{#crossLink \"Ember.String/pluralize\"}}{{/crossLink}}", + "itemtype": "method", + "name": "pluralize", + "class": "DS.String", + "module": "ember-data" + }, + { + "file": "node_modules/ember-inflector/addon/lib/ext/string.js", + "line": 27, + "description": "See {{#crossLink \"Ember.String/singularize\"}}{{/crossLink}}", + "itemtype": "method", + "name": "singularize", + "class": "DS.String", + "module": "ember-data", + "namespace": "DS" + }, + { + "file": "node_modules/ember-inflector/addon/lib/helpers/pluralize.js", + "line": 4, + "description": "If you have Ember Inflector (such as if Ember Data is present),\n pluralize a word. For example, turn \"ox\" into \"oxen\".\nExample:\n{{pluralize count myProperty}}\n {{pluralize 1 \"oxen\"}}\n {{pluralize myProperty}}\n {{pluralize \"ox\"}}", + "itemtype": "method", + "name": "pluralize", + "params": [ + { + "name": "count", + "description": "count of objects", + "type": "Number|Property", + "optional": true + }, + { + "name": "word", + "description": "word to pluralize", + "type": "String|Property" + } + ], + "class": "DS.Ember.HTMLBars.helpers", + "module": "ember-data" + }, + { + "file": "node_modules/ember-inflector/addon/lib/helpers/singularize.js", + "line": 4, + "description": "If you have Ember Inflector (such as if Ember Data is present),\n singularize a word. For example, turn \"oxen\" into \"ox\".\nExample:\n{{singularize myProperty}}\n {{singularize \"oxen\"}}", + "itemtype": "method", + "name": "singularize", + "params": [ + { + "name": "word", + "description": "word to singularize", + "type": "String|Property" + } + ], + "class": "Ember.HTMLBars.helpers", + "module": "ember-data" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 125, + "access": "public", + "tagname": "As inflections can be costly, and commonly the same subset of words are repeatedly\ninflected an optional cache is provided.", + "itemtype": "method", + "name": "enableCache", + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 148, + "access": "public", + "tagname": "", + "itemtype": "method", + "name": "purgedCache", + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 159, + "access": "public", + "tagname": "disable caching", + "itemtype": "method", + "name": "disableCache;", + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 177, + "itemtype": "method", + "name": "plural", + "params": [ + { + "name": "regex", + "description": "", + "type": "RegExp" + }, + { + "name": "string", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 187, + "itemtype": "method", + "name": "singular", + "params": [ + { + "name": "regex", + "description": "", + "type": "RegExp" + }, + { + "name": "string", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 197, + "itemtype": "method", + "name": "uncountable", + "params": [ + { + "name": "regex", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 206, + "itemtype": "method", + "name": "irregular", + "params": [ + { + "name": "singular", + "description": "", + "type": "String" + }, + { + "name": "plural", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 216, + "itemtype": "method", + "name": "pluralize", + "params": [ + { + "name": "word", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 235, + "itemtype": "method", + "name": "singularize", + "params": [ + { + "name": "word", + "description": "", + "type": "String" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + }, + { + "file": "node_modules/ember-inflector/addon/lib/system/inflector.js", + "line": 247, + "access": "protected", + "tagname": "", + "itemtype": "method", + "name": "inflect", + "params": [ + { + "name": "word", + "description": "", + "type": "String" + }, + { + "name": "typeRules", + "description": "", + "type": "Object" + }, + { + "name": "irregular", + "description": "", + "type": "Object" + } + ], + "class": "Ember.Inflector", + "module": "ember-data", + "namespace": "Ember" + } + ], + "warnings": [ + { + "message": "param name missing: {Promise|Object}", + "line": " addon/-private/system/references/record.js:62" + }, + { + "message": "replacing incorrect tag: returns with return", + "line": " addon/-private/system/identity-map.js:16" + }, + { + "message": "replacing incorrect tag: returns with return", + "line": " addon/-private/system/internal-model-map.js:22" + }, + { + "message": "Missing item type\nComputes the set of internal models reachable from `this` across exactly one\nrelationship.", + "line": " addon/-private/system/model/internal-model.js:435" + }, + { + "message": "Missing item type\nComputes the set of internal models reachable from this internal model.\n\nReachability is determined over the relationship graph (ie a graph where\nnodes are internal models and edges are belongs to or has many\nrelationships).", + "line": " addon/-private/system/model/internal-model.js:452" + }, + { + "message": "Missing item type\nUnload the record for this internal model. This will cause the record to be\ndestroyed and freed up for garbage collection. It will also do a check\nfor cleaning up internal models.\n\nThis check is performed by first computing the set of related internal\nmodels. If all records in this set are unloaded, then the entire set is\ndestroyed. Otherwise, nothing in the set is destroyed.\n\nThis means that this internal model will be freed up for garbage collection\nonce all models that refer to it via some relationship are also unloaded.", + "line": " addon/-private/system/model/internal-model.js:485" + }, + { + "message": "Missing item type", + "line": " addon/-private/system/internal-model-map.js:22" + }, + { + "message": "Missing item type\nAn array of all models of this modelName", + "line": " addon/-private/system/internal-model-map.js:72" }, { - "name": "sinceToken", - "description": "This parameter is no longer used and will always be null.", - "type": "Null" + "message": "Missing item type\nmeta information about internalModels", + "line": " addon/-private/system/internal-model-map.js:79" }, { - "name": "snapshotRecordArray", - "description": "an object containing any passed in options,\n adapterOptions, and the ability to access a snapshot for each existing record of the type.", - "type": "SnapshotRecordArray" + "message": "Missing item type\ndeprecated (and unsupported) way of accessing modelClass", + "line": " addon/-private/system/internal-model-map.js:86" } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 104, - "description": "`adapter.query` takes a request for resources of a given `type` and should return\n a `Promise` which fulfills with a collection of resource data matching that `type`.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `query`, which should return a `JSON:API` document.\n\nAs with `findAll`, the final result after normalization to `JSON:API` will be added to\nstore via `store.push` where it will merge with any existing records for `type`.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\n`adapter.query` is called whenever `store.query` is called or a previous query result is\nasked to reload.\n\nExisting records for the `type` will not be removed. The key difference is in the result\nreturned by the `store`. For `findAll` the result is all known records of the `type`,\nwhile for `query` it will only be the records returned from `adapter.query`.", - "itemtype": "method", - "name": "query", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 143, - "description": "`adapter.queryRecord` takes a request for resource of a given `type` and should return\n a `Promise` which fulfills with data for a single resource matching that `type`.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `queryRecord`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data for the returned record.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.", - "itemtype": "method", - "name": "queryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "query", - "description": "" - }, - { - "name": "options", - "description": "" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 173, - "description": "`adapter.createRecord` takes a request to create a resource of a given `type` and should\nreturn a `Promise` which fulfills with data for the newly created resource.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `createRecord`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data for the record.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\nIf the adapter rejects or throws an error the record will enter an error state and the attributes\nthat had attempted to be saved will still be considered dirty.\n\n### InvalidErrors\n\nWhen rejecting a `createRecord` request due to validation issues during save (typically a 422 status code),\nyou may throw an `InvalidError`.\n\nThrowing an `InvalidError` makes per-attribute errors available for records to use in the UI as needed.\nRecords can also use this information to mark themselves as being in an `invalid` state.\nFor more reading [see the RecordData Errors RFC](https://emberjs.github.io/rfcs/0465-record-data-errors.html)\n\n```js\nlet error = new Error(errorMessage);\n\n// these two properties combined\n// alert EmberData to this error being for\n// invalid properties on the record during\n// the request\nerror.isAdapterError = true;\nerror.code = 'InvalidError';\n\n// A JSON:API formatted array of errors\n// See https://jsonapi.org/format/#errors\nerror.errors = [];\n\nthrow error;\n```", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 226, - "description": "`adapter.updateRecord` takes a request to update a resource of a given `type` and should\nreturn a `Promise` which fulfills with the updated data for the resource.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `updateRecord`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data for the record.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\nIf the adapter rejects or throws an error the record will enter an error state and the attributes\nthat had attempted to be saved will still be considered dirty.\n\n### InvalidErrors\n\nWhen rejecting a `createRecord` request due to validation issues during save (typically a 422 status code),\nyou may throw an `InvalidError`.\n\nThrowing an `InvalidError` makes per-attribute errors available for records to use in the UI as needed.\nRecords can also use this information to mark themselves as being in an `invalid` state.\nFor more reading [see the RecordData Errors RFC](https://emberjs.github.io/rfcs/0465-record-data-errors.html)\n\n```js\nlet error = new Error(errorMessage);\n\n// these two properties combined\n// alert EmberData to this error being for\n// invalid properties on the record during\n// the request\nerror.isAdapterError = true;\nerror.code = 'InvalidError';\n\n// A JSON:API formatted array of errors\n// See https://jsonapi.org/format/#errors\nerror.errors = [];\n\nthrow error;\n```", - "itemtype": "method", - "name": "updateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 278, - "description": "`adapter.deleteRecord` takes a request to delete a resource of a given `type` and\nshould return a `Promise` which resolves when that deletion is complete.\n\nUsually the response will be empty, but you may include additional updates in the\nresponse. The response will be fed to the associated serializer's `normalizeResponse` method\nwith the `requestType` set to `deleteRecord`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\nIf the adapter rejects or errors the record will need to be saved again once the reason\nfor the error is addressed in order to persist the deleted state.", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the record's current data", - "type": "Snapshot" - } - ], - "return": { - "description": "" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 306, - "description": "`adapter.findBelongsTo` takes a request to fetch a related resource located at a\n`relatedLink` and should return a `Promise` which fulfills with data for a single\n resource.\n\n⚠️ This method is only called if the store previously received relationship information for a resource\ncontaining a [related link](https://jsonapi.org/format/#document-resource-object-related-resource-links).\n\nIf the cache does not have a `link` for the relationship then `findRecord` will be used if a `type` and `id`\nfor the related resource is known.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `findBelongsTo`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.", - "itemtype": "method", - "name": "findBelongsTo [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the parent record's current data", - "type": "Snapshot" - }, - { - "name": "relatedLink", - "description": "The link at which the associated resource might be found", - "type": "String" - }, - { - "name": "relationship", - "description": "", - "type": "RelationshipSchema" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 343, - "description": "`adapter.findHasMany` takes a request to fetch a related resource collection located\n at a `relatedLink` and should return a `Promise` which fulfills with data for that\n collection.\n\n⚠️ This method is only called if the store previously received relationship information for a resource\ncontaining a [related link](https://jsonapi.org/format/#document-resource-object-related-resource-links).\n\nIf the cache does not have a `link` for the relationship but the `type` and `id` of\nrelated resources are known then `findRecord` will be used for each individual related\nresource.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `findHasMany`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.", - "itemtype": "method", - "name": "findhasMany [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the parent record's current data", - "type": "Snapshot" - }, - { - "name": "relatedLink", - "description": "The link at which the associated resource collection might be found", - "type": "String" - }, - { - "name": "relationship", - "description": "", - "type": "RelationshipSchema" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 381, - "description": "⚠️ This Method is only called if `coalesceFindRequests` is `true`. The array passed to it is determined\nby the adapter's `groupRecordsForFindMany` method, and will be called once per group returned.\n\n`adapter.findMany` takes a request to fetch a collection of resources and should return a\n`Promise` which fulfills with data for that collection.\n\nThe response will be fed to the associated serializer's `normalizeResponse` method\n with the `requestType` set to `findMany`, which should return a `JSON:API` document.\n\nThe final result after normalization to `JSON:API` will be added to store via `store.push` where\nit will merge with any existing data.\n\n⚠️ If the adapter's response resolves to a false-y value, the associated `serializer.normalizeResponse`\ncall will NOT be made. In this scenario you may need to do at least a minimum amount of response\nprocessing within the adapter.\n\nSee also `groupRecordsForFindMany` and `coalesceFindRequests`", - "itemtype": "method", - "name": "findMany [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "ids", - "description": "An array of the ids of the resources to fetch", - "type": "Array" - }, - { - "name": "snapshots", - "description": "An array of snapshots of the available data for the resources to fetch", - "type": "Array" - } - ], - "return": { - "description": "a promise resolving with resource data to feed to the associated serializer", - "type": "Promise" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 412, - "description": "This method provides the ability to generate an ID to assign to a new record whenever `store.createRecord`\nis called if no `id` was provided.\n\nAlternatively you can pass an id into the call to `store.createRecord` directly.\n\n```js\nlet id = generateNewId(type);\nlet newRecord = store.createRecord(type, { id });\n```", - "itemtype": "method", - "name": "generateIdForRecord [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "type", - "description": "The type (or modelName) of record being created", - "type": "String" - }, - { - "name": "properties", - "description": "the properties passed as the second arg to `store.createRecord`" - } - ], - "return": { - "description": "a string ID that should be unique (no other models of `type` in the cache should have this `id`)", - "type": "String" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 433, - "description": "If your adapter implements `findMany`, setting this to `true` will cause `findRecord`\nrequests triggered within the same `runloop` to be coalesced into one or more calls\nto `adapter.findMany`. The number of calls made and the records contained in each call\ncan be tuned by your adapter's `groupRecordsForHasMany` method.\n\nImplementing coalescing using this flag and the associated methods does not always offer\nthe right level of correctness, timing control or granularity. If your application would\nbe better suited coalescing across multiple types, coalescing for longer than a single runloop,\nor with a more custom request structure, coalescing within your application adapter may prove\nmore effective.", - "itemtype": "property", - "name": "coalesceFindRequests [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "type": "{boolean} true if the requests to find individual records should be coalesced, false otherwise", - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 452, - "description": "⚠️ This Method is only called if `coalesceFindRequests` is `true`.\n\nThis method allows for you to split pending requests for records into multiple `findMany`\nrequests. It receives an array of snapshots where each snapshot represents a unique record\nrequested via `store.findRecord` during the most recent `runloop` that was not found in the\ncache or needs to be reloaded. It should return an array of groups.\n\nA group is an array of snapshots meant to be fetched together by a single `findMany` request.\n\nBy default if this method is not implemented EmberData will call `findMany` once with all\nrequested records as a single group when `coalesceFindRequests` is `true`.\n\nSee also `findMany` and `coalesceFindRequests`", - "itemtype": "method", - "name": "groupRecordsForFindMany [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshots", - "description": "An array of snapshots", - "type": "Array" - } - ], - "return": { - "description": "An array of Snapshot arrays", - "type": "Array>" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 476, - "description": "When a record is already available in the store and is requested again via `store.findRecord`,\nand `reload` is not specified as an option in the request, this method is called to determine\nwhether the record should be reloaded prior to returning the result.\n\nIf `reload` is specified as an option in the request (`true` or `false`) this method will not\nbe called.\n\n```js\nstore.findRecord('user', '1', { reload: false })\n```\n\nThe default behavior if this method is not implemented and the option is not specified is to\nnot reload, the same as a return of `false`.\n\nSee also the documentation for `shouldBackgroundReloadRecord` which defaults to `true`.", - "itemtype": "method", - "name": "shouldReloadRecord [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the record's current data", - "type": "Snapshot" - } - ], - "return": { - "description": "true if the record should be reloaded immediately, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 502, - "description": "When `store.findAll()` is called without a `reload` option, the adapter\nis presented the opportunity to trigger a new request for records of that type.\n\nIf `reload` is specified as an option in the request (`true` or `false`) this method will not\nbe called.\n\n```js\nstore.findAll('user', { reload: false })\n```\n\nThe default behavior if this method is not implemented and the option is not specified is to\nnot reload, the same as a return of `false`.\n\nNote: the Promise returned by `store.findAll` resolves to the same RecordArray instance\nreturned by `store.peekAll` for that type, and will include all records in the store for\nthe given type, including any previously existing records not returned by the reload request.", - "itemtype": "method", - "name": "shouldReloadAll [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshotArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "true if the a new request for all records of the type in SnapshotRecordArray should be made immediately, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 529, - "description": "When a record is already available in the store and is requested again via `store.findRecord`,\nand the record does not need to be reloaded prior to return, this method provides the ability\nto specify whether a refresh of the data for the reload should be scheduled to occur in the background.\n\nUsers may explicitly declare a record should/should not be background reloaded by passing\n`backgroundReload: true` or `backgroundReload: false` as an option to the request respectively.\n\n```js\nstore.findRecord('user', '1', { backgroundReload: false })\n```\n\nIf the `backgroundReload` option is not present, this method will be called to determine whether\na backgroundReload should be performed.\n\nThe default behavior if this method is not implemented and the option was not specified is to\nbackground reload, the same as a return of `true`.", - "itemtype": "method", - "name": "shouldBackgroundReloadRecord [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshot", - "description": "A Snapshot containing the record's current data", - "type": "Snapshot" - } - ], - "return": { - "description": "true if the record should be reloaded in the background, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 556, - "description": "When `store.findAll()` is called and a `reload` is not initiated, the adapter\nis presented the opportunity to trigger a new non-blocking (background) request for\nrecords of that type\n\nUsers may explicitly declare that this background request should/should not occur by passing\n`backgroundReload: true` or `backgroundReload: false` as an option to the request respectively.\n\n```js\nstore.findAll('user', { backgroundReload: false })\n```\n\nThe default behavior if this method is not implemented and the option is not specified is to\nperform a reload, the same as a return of `true`.", - "itemtype": "method", - "name": "shouldBackgroundReloadAll [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "snapshotArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "true if the a new request for all records of the type in SnapshotRecordArray should be made in the background, false otherwise", - "type": "Boolean" - }, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-adapter-interface.ts", - "line": 580, - "description": "In some situations the adapter may need to perform cleanup when destroyed,\nthat cleanup can be done in `destroy`.\n\nIf not implemented, the store does not inform the adapter of destruction.", - "itemtype": "method", - "name": "destroy [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "class": " Adapter", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 45, - "description": "This method is responsible for normalizing the value resolved from the promise returned\nby an Adapter request into the format expected by the `Store`.\n\nThe output should be a [JSON:API Document](https://jsonapi.org/format/#document-structure)\nwith the following additional restrictions:\n\n- `type` should be formatted in the `singular` `dasherized` `lowercase` form\n- `members` (the property names of attributes and relationships) should be formatted\n to match their definition in the corresponding `Model` definition. Typically this\n will be `camelCase`.\n- [`lid`](https://github.com/emberjs/rfcs/blob/main/text/0403-ember-data-identifiers.md) is\n a valid optional sibling to `id` and `type` in both [Resources](https://jsonapi.org/format/#document-resource-objects)\n and [Resource Identifier Objects](https://jsonapi.org/format/#document-resource-identifier-objects)", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "rawPayload", - "description": "The raw JSON response data returned from an API request.\n This correlates to the value the promise returned by the adapter method that performed\n the request resolved to.", - "type": "JSONObject" - }, - { - "name": "id", - "description": "For a findRecord request, this is the id initially provided\n in the call to store.findRecord. Else this value is null.", - "type": "String|null" - }, - { - "name": "requestType", - "description": "The\n type of request the Adapter had been asked to perform.", - "type": "'findRecord' | 'queryRecord' | 'findAll' | 'findBelongsTo' | 'findHasMany' | 'findMany' | 'query' | 'createRecord' | 'deleteRecord' | 'updateRecord'" - } - ], - "return": { - "description": "a document following the structure of a JSON:API Document.", - "type": "JsonApiDocument" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 93, - "description": "This method is responsible for serializing an individual record\nvia a [Snapshot](Snapshot) into the format expected by the API.\n\nThis method is called by `snapshot.serialize()`.\n\nWhen using `Model`, this method is called by `record.serialize()`.\n\nWhen using `JSONAPIAdapter` or `RESTAdapter` this method is called\nby `updateRecord` and `createRecord` if `Serializer.serializeIntoHash`\nis not implemented.", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "A Snapshot for the record to serialize", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 112, - "description": "This method is intended to normalize data into a [JSON:API Document](https://jsonapi.org/format/#document-structure)\nwith a data member containing a single [Resource](https://jsonapi.org/format/#document-resource-objects).\n\n- `type` should be formatted in the singular, dasherized and lowercase form\n- `members` (the property names of attributes and relationships) should be formatted\n to match their definition in the corresponding `Model` definition. Typically this\n will be `camelCase`.\n- [`lid`](https://github.com/emberjs/rfcs/blob/main/text/0403-ember-data-identifiers.md) is\n a valid optional sibling to `id` and `type` in both [Resources](https://jsonapi.org/format/#document-resource-objects)\n and [Resource Identifier Objects](https://jsonapi.org/format/#document-resource-identifier-objects)\n\nThis method is called by the `Store` when `store.normalize(modelName, payload)` is\ncalled. It is recommended to use `store.serializerFor(modelName).normalizeResponse`\nover `store.normalize`.\n\nThis method may be called when also using the `RESTSerializer`\nwhen `serializer.pushPayload` is called by `store.pushPayload`.\nHowever, it is recommended to use `store.push` over `store.pushPayload` after normalizing\nthe payload directly.\n\nExample:\n```js\nfunction pushPayload(store, modelName, rawPayload) {\n const ModelClass = store.modelFor(modelName);\n const serializer = store.serializerFor(modelName);\n const jsonApiPayload = serializer.normalizeResponse(store, ModelClass, rawPayload, null, 'query');\n\n return store.push(jsonApiPayload);\n}\n```\n\nThis method may be called when also using the `JSONAPISerializer`\nwhen normalizing included records. If mixing serializer usage in this way\nwe recommend implementing this method, but caution that it may lead\nto unexpected mixing of formats.\n\nThis method may also be called when normalizing embedded relationships when\nusing the `EmbeddedRecordsMixin`. If using this mixin in a serializer in\nyour application we recommend implementing this method, but caution that\nit may lead to unexpected mixing of formats.", - "itemtype": "method", - "name": "normalize [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "rawPayload", - "description": "Some raw JSON data to be normalized into a JSON:API Resource.", - "type": "JSONObject" - }, - { - "name": "prop", - "description": "When called by the EmbeddedRecordsMixin this param will be the\n property at which the object provided as rawPayload was found.", - "type": "String", - "optional": true - } - ], - "return": { - "description": "A JSON:API Document\n containing a single JSON:API Resource\n as its primary data.", - "type": "SingleResourceDocument" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 168, - "description": "When using `JSONAPIAdapter` or `RESTAdapter` this method is called\nby `adapter.updateRecord` and `adapter.createRecord` if `serializer.serializeIntoHash`\nis implemented. If this method is not implemented, `serializer.serialize`\nwill be called in this case.\n\nYou can use this method to customize the root keys serialized into the payload.\nThe hash property should be modified by reference.\n\nFor instance, your API may expect resources to be keyed by underscored type in the payload:\n\n```js\n{\n _user: {\n type: 'user',\n id: '1'\n }\n}\n```\n\nWhich when using these adapters can be achieved by implementing this method similar\nto the following:\n\n```js\nserializeIntoHash(hash, ModelClass, snapshot, options) {\n hash[`_${snapshot.modelName}`] = this.serialize(snapshot, options).data;\n}\n```", - "itemtype": "method", - "name": "serializeIntoHash [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "hash", - "description": "A top most object of the request payload onto\n which to append the serialized record" - }, - { - "name": "schema", - "description": "An object with methods for accessing information about\n the type, attributes and relationships of the primary type associated with the request.", - "type": "ModelSchema" - }, - { - "name": "snapshot", - "description": "A Snapshot for the record to serialize", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "optional": true - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 210, - "description": "This method allows for normalization of data when `store.pushPayload` is called\nand should be implemented if you want to use that method.\n\nThe method is responsible for pushing new data to the store using `store.push`\nonce any necessary normalization has occurred, and no data in the store will be\nupdated unless it does so.\n\nThe normalized form pushed to the store should be a [JSON:API Document](https://jsonapi.org/format/#document-structure)\nwith the following additional restrictions:\n\n- `type` should be formatted in the singular, dasherized and lowercase form\n- `members` (the property names of attributes and relationships) should be formatted\n to match their definition in the corresponding `Model` definition. Typically this\n will be `camelCase`.\n- [`lid`](https://github.com/emberjs/rfcs/blob/main/text/0403-ember-data-identifiers.md) is\n a valid optional sibling to `id` and `type` in both [Resources](https://jsonapi.org/format/#document-resource-objects)\n and [Resource Identifier Objects](https://jsonapi.org/format/#document-resource-identifier-objects)\n\nIf you need better control over normalization or want access to the records being added or updated\nin the store, we recommended using `store.push` over `store.pushPayload` after normalizing\nthe payload directly. This can even take advantage of an existing serializer for the format\nthe data is in, for example:\n\n```js\nfunction pushPayload(store, modelName, rawPayload) {\n const ModelClass = store.modelFor(modelName);\n const serializer = store.serializerFor(modelName);\n const jsonApiPayload = serializer.normalizeResponse(store, ModelClass, rawPayload, null, 'query');\n\n return store.push(jsonApiPayload);\n}\n```", - "itemtype": "method", - "name": "pushPayload [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "params": [ - { - "name": "store", - "description": "The store service that initiated the request being normalized", - "type": "Store" - }, - { - "name": "rawPayload", - "description": "The raw JSON response data returned from an API request.\n This JSON should be in the API format expected by the serializer.", - "type": "JSONObject" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/minimum-serializer-interface.ts", - "line": 254, - "description": "In some situations the serializer may need to perform cleanup when destroyed,\nthat cleanup can be done in `destroy`.\n\nIf not implemented, the store does not inform the serializer of destruction.", - "itemtype": "method", - "name": "destroy [OPTIONAL]", - "access": "public", - "tagname": "", - "optional": 1, - "class": " Serializer", - "module": "@ember-data/experimental-preview-types" - }, - { - "file": "../ember-data-types/q/schema-service.ts", - "line": 59, - "description": "Queries whether the schema-definition-service recognizes `type` as a resource type", - "itemtype": "method", - "name": "doesTypeExist", - "access": "public", - "tagname": "", - "params": [ - { - "name": "type", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "SchemaService", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/schema-service.ts", - "line": 69, - "description": "Returns definitions for all properties of the specified resource\nthat are considered \"attributes\". Generally these are properties\nthat are not related to book-keeping state on the client and do\nnot represent a linkage to another resource.\n\nThe return value should be a dictionary of key:value pairs\nwhere the `key` is the attribute or property's name and `value`\nis an object with at least the property `name` which should also\nmatch `key`.\n\nOptionally, this object may also specify `type`, which should\nbe a string reference to a `transform`, and `options` which\nshould be dictionary in which any key:value pairs are permissable.\n\nFor instance, when using `@ember-data/model`, the following attribute\ndefinition:\n\n```ts\nclass extends Model {", - "attr": "firstName;\n}\n```\n\nWould be returned as:\n\n```js\n{\n greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },\n birthday: { name: 'birthday', type: 'date' },\n firstName: { name: 'firstName' }\n}\n```", - "itemtype": "method", - "name": "attributesDefinitionFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "}", - "description": "identifier", - "type": "RecordIdentifier| type: string" - } - ], - "return": { - "description": "", - "type": "AttributesSchema" - }, - "class": "SchemaService", - "module": "@ember-data/store" - }, - { - "file": "../ember-data-types/q/schema-service.ts", - "line": 112, - "description": "Returns definitions for all properties of the specified resource\nthat are considered \"relationships\". Generally these are properties\nthat represent a linkage to another resource.\n\nThe return value should be a dictionary of key:value pairs\nwhere the `key` is the relationship or property's name and `value`\nis an object with at least the following properties:\n\n- `name` which should also match the `key` used in the dictionary.\n- `kind` which should be either `belongsTo` or `hasMany`\n- `type` which should be the related resource's string \"type\"\n- `options` which should be a dictionary allowing any key but with\n at least the below keys present.\n\n- `options.async` a boolean representing whether data for this relationship is\n typically loaded on-demand.\n- `options.inverse` a string or null representing the field name / key of the\n corresponding relationship on the inverse resource.\n\nAdditionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)\n\n- `options.polymorphic` a boolean representing whether multiple resource types\n can be used to satisfy this relationship.\n- `options.as` a string representing the abstract type that the concrete side of\n a relationship must specify when fulfilling a polymorphic inverse.\n\nFor example, the following Model using @ember-data/model would generate this relationships\ndefinition by default:\n\n```js\nclass User extends Model {", - "belongsto": "('user', { async: false, inverse: null }) bestFriend;", - "hasmany": "('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;\n}\n```\n\nWhich would be returned as\n\n```js\n{\n bestFriend: {\n name: 'bestFriend',\n kind: 'belongsTo',\n type: 'user',\n options: {\n async: false,\n inverse: null\n }\n },\n friends: {\n name: 'friends',\n kind: 'hasMany',\n type: 'user',\n options: {\n async: true,\n inverse: 'friends'\n }\n },\n pets: {\n name: 'pets',\n kind: 'hasMany',\n type: 'pet',\n options: {\n async: false,\n polymorphic: true,\n inverse: 'owner'\n }\n },\n}\n```", - "itemtype": "method", - "name": "relationshipsDefinitionFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "}", - "description": "identifier", - "type": "RecordIdentifier| type: string" - } - ], - "return": { - "description": "", - "type": "RelationshipsSchema" - }, - "class": "SchemaService", - "module": "@ember-data/store" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 145, - "description": "Builds a URL for a given type and optional ID.\n\nBy default, it pluralizes the type's name (for example, 'post'\nbecomes 'posts' and 'person' becomes 'people'). To override the\npluralization see [pathForType](./pathForType?anchor=pathForType).\n\nIf an ID is specified, it adds the ID to the path generated\nfor the type, separated by a `/`.\n\nWhen called by `RESTAdapter.findMany()` the `id` and `snapshot` parameters\nwill be arrays of ids and snapshots.", - "itemtype": "method", - "name": "buildURL", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "id", - "description": "single id or array of ids or query", - "type": "(String|Array|Object)" - }, - { - "name": "snapshot", - "description": "single snapshot or array of snapshots", - "type": "(Snapshot|SnapshotRecordArray)" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "object of query parameters to send for query requests.", - "type": "Object" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 294, - "itemtype": "method", - "name": "_buildURL", - "access": "private", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "id", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 329, - "description": "Builds a URL for a `store.findRecord(type, id)` call.\n\nExample:\n\n```app/adapters/user.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindRecord(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id, snapshot);\n return `${baseUrl}/users/${snapshot.adapterOptions.user_id}/playlists/${id}`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForFindRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 357, - "description": "Builds a URL for a `store.findAll(type)` call.\n\nExample:\n\n```app/adapters/comment.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindAll(modelName, snapshot) {\n let baseUrl = this.buildURL(modelName);\n return `${baseUrl}/data/comments.json`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForFindAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 383, - "description": "Builds a URL for a `store.query(type, query)` call.\n\nExample:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n host = 'https://api.github.com';\n urlForQuery (query, modelName) {\n switch(modelName) {\n case 'repo':\n return `https://api.github.com/orgs/${query.orgId}/repos`;\n default:\n return super.urlForQuery(...arguments);\n }\n }\n}\n```", - "itemtype": "method", - "name": "urlForQuery", - "access": "public", - "tagname": "", - "params": [ - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 414, - "description": "Builds a URL for a `store.queryRecord(type, query)` call.\n\nExample:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n urlForQueryRecord({ slug }, modelName) {\n let baseUrl = this.buildURL();\n return `${baseUrl}/${encodeURIComponent(slug)}`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForQueryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 440, - "description": "Builds a URL for coalescing multiple `store.findRecord(type, id)`\nrecords into 1 request when the adapter's `coalesceFindRequests`\nproperty is `true`.\n\nExample:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n urlForFindMany(ids, modelName) {\n let baseUrl = this.buildURL();\n return `${baseUrl}/coalesce`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 469, - "description": "Builds a URL for fetching an async `hasMany` relationship when a URL\nis not provided by the server.\n\nExample:\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindHasMany(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id);\n return `${baseUrl}/relationships`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForFindHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 497, - "description": "Builds a URL for fetching an async `belongsTo` relationship when a url\nis not provided by the server.\n\nExample:\n\n```app/adapters/application.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class ApplicationAdapter extends JSONAPIAdapter {\n urlForFindBelongsTo(id, modelName, snapshot) {\n let baseUrl = this.buildURL(modelName, id);\n return `${baseUrl}/relationships`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForFindBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 525, - "description": "Builds a URL for a `record.save()` call when the record was created\nlocally using `store.createRecord()`.\n\nExample:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n urlForCreateRecord(modelName, snapshot) {\n return super.urlForCreateRecord(...arguments) + '/new';\n }\n}\n```", - "itemtype": "method", - "name": "urlForCreateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 551, - "description": "Builds a URL for a `record.save()` call when the record has been updated locally.\n\nExample:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n urlForUpdateRecord(id, modelName, snapshot) {\n return `/${id}/feed?access_token=${snapshot.adapterOptions.token}`;\n }\n}\n```", - "itemtype": "method", - "name": "urlForUpdateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 577, - "description": "Builds a URL for a `record.save()` call when the record has been deleted locally.\n\nExample:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n urlForDeleteRecord(id, modelName, snapshot) {\n return super.urlForDeleteRecord(...arguments) + '/destroy';\n }\n}\n```", - "itemtype": "method", - "name": "urlForDeleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "url", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 603, - "itemtype": "method", - "name": "urlPrefix", - "access": "private", - "tagname": "", - "params": [ - { - "name": "path", - "description": "", - "type": "String" - }, - { - "name": "parentURL", - "description": "", - "type": "String" - } - ], - "return": { - "description": "urlPrefix", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/-private/build-url-mixin.ts", - "line": 643, - "description": "Determines the pathname for a given type.\n\nBy default, it pluralizes the type's name (for example,\n'post' becomes 'posts' and 'person' becomes 'people').\n\n### Pathname customization\n\nFor example, if you have an object `LineItem` with an\nendpoint of `/line_items/`.\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\nimport { decamelize, pluralize } from '/utils/string-utils';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n pathForType(modelName) {\n var decamelized = decamelize(modelName);\n return pluralize(decamelized);\n }\n}\n```", - "itemtype": "method", - "name": "pathForType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "path", - "type": "String" - }, - "class": "BuildURLMixin", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 260, - "description": "The `findRecord()` method is invoked when the store is asked for a record that\nhas not previously been loaded. In response to `findRecord()` being called, you\nshould query your persistence layer for a record with the given ID. The `findRecord`\nmethod should return a promise that will resolve to a JavaScript object that will be\nnormalized by the serializer.\n\nHere is an example of the `findRecord` implementation:\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n findRecord(store, type, id, snapshot) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}/${id}`).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "findRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 302, - "description": "The `findAll()` method is used to retrieve all records for a given type.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n findAll(store, type) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "findAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 345, - "description": "This method is called when you call `query` on the store.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n query(store, type, query) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`, query).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "query", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 384, - "description": "The `queryRecord()` method is invoked when the store is asked for a single\nrecord through a query object.\n\nIn response to `queryRecord()` being called, you should always fetch fresh\ndata. Once found, you can asynchronously call the store's `push()` method\nto push the record into the store.\n\nHere is an example `queryRecord` implementation:\n\nExample\n\n```app/adapters/application.js\nimport Adapter, { BuildURLMixin } from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {\n queryRecord(store, type, query) {\n return new RSVP.Promise(function(resolve, reject) {\n $.getJSON(`/${type.modelName}`, query).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "queryRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Subclass of Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 429, - "description": "If the globally unique IDs for your records should be generated on the client,\nimplement the `generateIdForRecord()` method. This method will be invoked\neach time you create a new record, and the value returned from it will be\nassigned to the record's `primaryKey`.\n\nMost traditional REST-like HTTP APIs will not use this method. Instead, the ID\nof the record will be set by the server, and your adapter will update the store\nwith the new ID when it calls `didCreateRecord()`. Only implement this method if\nyou intend to generate record IDs on the client-side.\n\nThe `generateIdForRecord()` method will be invoked with the requesting store as\nthe first parameter and the newly created record as the second parameter:\n\n```javascript\nimport Adapter from '@ember-data/adapter';\nimport { v4 } from 'uuid';\n\nexport default class ApplicationAdapter extends Adapter {\n generateIdForRecord(store, type, inputProperties) {\n return v4();\n }\n}\n```", - "itemtype": "method", - "name": "generateIdForRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "inputProperties", - "description": "a hash of properties to set on the\n newly created record.", - "type": "Object" - } - ], - "return": { - "description": "id", - "type": "(String|Number)" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 463, - "description": "Proxies to the serializer's `serialize` method.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter {\n createRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let url = `/${type.modelName}`;\n\n // ...\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "serialized snapshot", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 491, - "description": "Implement this method in a subclass to handle the creation of\nnew records.\n\nSerializes the record and sends it to the server.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n createRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n\n return new RSVP.Promise(function (resolve, reject) {\n $.ajax({\n type: 'POST',\n url: `/${type.modelName}`,\n dataType: 'json',\n data: data\n }).then(function (data) {\n resolve(data);\n }, function (jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "createRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 539, - "description": "Implement this method in a subclass to handle the updating of\na record.\n\nSerializes the record update and sends it to the server.\n\nThe updateRecord method is expected to return a promise that will\nresolve with the serialized record. This allows the backend to\ninform the Ember Data store the current state of this record after\nthe update. If it is not possible to return a serialized record\nthe updateRecord promise can also resolve with `undefined` and the\nEmber Data store will assume all of the updates were successfully\napplied on the backend.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n updateRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let id = snapshot.id;\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'PUT',\n url: `/${type.modelName}/${id}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "updateRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 596, - "description": "Implement this method in a subclass to handle the deletion of\na record.\n\nSends a delete request for the record to the server.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n deleteRecord(store, type, snapshot) {\n let data = this.serialize(snapshot, { includeId: true });\n let id = snapshot.id;\n\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'DELETE',\n url: `/${type.modelName}/${id}`,\n dataType: 'json',\n data: data\n }).then(function(data) {\n resolve(data)\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "deleteRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the record", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 645, - "description": "By default the store will try to coalesce all `findRecord` calls within the same runloop\ninto as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.\nYou can opt out of this behaviour by either not implementing the findMany hook or by setting\ncoalesceFindRequests to false.", - "itemtype": "property", - "name": "coalesceFindRequests", - "access": "public", - "tagname": "", - "type": "{boolean}", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 667, - "description": "The store will call `findMany` instead of multiple `findRecord`\nrequests to find multiple records at once if coalesceFindRequests\nis true.\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\nimport RSVP from 'RSVP';\nimport $ from 'jquery';\n\nexport default class ApplicationAdapter extends Adapter {\n findMany(store, type, ids, snapshots) {\n return new RSVP.Promise(function(resolve, reject) {\n $.ajax({\n type: 'GET',\n url: `/${type.modelName}/`,\n dataType: 'json',\n data: { filter: { id: ids.join(',') } }\n }).then(function(data) {\n resolve(data);\n }, function(jqXHR) {\n jqXHR.then = null; // tame jQuery's ill mannered promises\n reject(jqXHR);\n });\n });\n }\n}\n```", - "itemtype": "method", - "name": "findMany", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "the Model class of the records", - "type": "Model" - }, - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 705, - "description": "Organize records into groups, each of which is to be passed to separate\ncalls to `findMany`.\n\nFor example, if your API has nested URLs that depend on the parent, you will\nwant to group records by their parent.\n\nThe default implementation returns the records as a single group.", - "itemtype": "method", - "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", - "type": "Array" - }, - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 725, - "description": "This method is used by the store to determine if the store should\nreload a record from the adapter when a record is requested by\n`store.findRecord`.\n\nIf this method returns `true`, the store will re-fetch a record from\nthe adapter. If this method returns `false`, the store will resolve\nimmediately using the cached record.\n\nFor example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:\n\n```javascript\nshouldReloadRecord(store, ticketSnapshot) {\n let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n}\n```\n\nThis method would ensure that whenever you do `store.findRecord('ticket',\nid)` you will always get a ticket that is no more than 20 minutes old. In\ncase the cached version is more than 20 minutes old, `findRecord` will not\nresolve until you fetched the latest version.\n\nBy default this hook returns `false`, as most UIs should not block user\ninteractions while waiting on data update.\n\nNote that, with default settings, `shouldBackgroundReloadRecord` will always\nre-fetch the records in the background even if `shouldReloadRecord` returns\n`false`. You can override `shouldBackgroundReloadRecord` if this does not\nsuit your use case.", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldReloadRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 776, - "description": "This method is used by the store to determine if the store should\nreload all records from the adapter when records are requested by\n`store.findAll`.\n\nIf this method returns `true`, the store will re-fetch all records from\nthe adapter. If this method returns `false`, the store will resolve\nimmediately using the cached records.\n\nFor example, if you are building an events ticketing system, in which users\ncan only reserve tickets for 20 minutes at a time, and want to ensure that\nin each route you have data that is no more than 20 minutes old you could\nwrite:\n\n```javascript\nshouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any((ticketSnapshot) => {\n let lastAccessedAt = ticketSnapshot.attr('lastAccessedAt');\n let timeDiff = moment().diff(lastAccessedAt, 'minutes');\n\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n}\n```\n\nThis method would ensure that whenever you do `store.findAll('ticket')` you\nwill always get a list of tickets that are no more than 20 minutes old. In\ncase a cached version is more than 20 minutes old, `findAll` will not\nresolve until you fetched the latest versions.\n\nBy default, this method returns `true` if the passed `snapshotRecordArray`\nis empty (meaning that there are no records locally available yet),\notherwise, it returns `false`.\n\nNote that, with default settings, `shouldBackgroundReloadAll` will always\nre-fetch all the records in the background even if `shouldReloadAll` returns\n`false`. You can override `shouldBackgroundReloadAll` if this does not suit\nyour use case.", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldReloadAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 832, - "description": "This method is used by the store to determine if the store should\nreload a record after the `store.findRecord` method resolves a\ncached record.\n\nThis method is *only* checked by the store when the store is\nreturning a cached record.\n\nIf this method returns `true` the store will re-fetch a record from\nthe adapter.\n\nFor example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\n`shouldBackgroundReloadRecord` as follows:\n\n```javascript\nshouldBackgroundReloadRecord(store, snapshot) {\n let { downlink, effectiveType } = navigator.connection;\n\n return downlink > 0 && effectiveType === '4g';\n}\n```\n\nBy default, this hook returns `true` so the data for the record is updated\nin the background.", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldBackgroundReloadRecord", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/index.ts", - "line": 869, - "description": "This method is used by the store to determine if the store should\nreload a record array after the `store.findAll` method resolves\nwith a cached record array.\n\nThis method is *only* checked by the store when the store is\nreturning a cached record array.\n\nIf this method returns `true` the store will re-fetch all records\nfrom the adapter.\n\nFor example, if you do not want to fetch complex data over a mobile\nconnection, or if the network is down, you can implement\n`shouldBackgroundReloadAll` as follows:\n\n```javascript\nshouldBackgroundReloadAll(store, snapshotArray) {\n let { downlink, effectiveType } = navigator.connection;\n\n return downlink > 0 && effectiveType === '4g';\n}\n```\n\nBy default this method returns `true`, indicating that a background reload\nshould always be triggered.", - "since": "1.13.0", - "itemtype": "method", - "name": "shouldBackgroundReloadAll", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "access": "public", - "tagname": "", - "class": "Adapter", - "module": "@ember-data/adapter" - }, - { - "file": "../packages/adapter/src/json-api.ts", - "line": 166, - "itemtype": "method", - "name": "ajaxOptions", - "access": "private", - "tagname": "", - "params": [ - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "type", - "description": "The request type GET, POST, PUT, DELETE etc.", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/json-api" - }, - { - "file": "../packages/adapter/src/json-api.ts", - "line": 186, - "description": "By default the JSONAPIAdapter will send each find request coming from a `store.find`\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.\n\nFor example, if you have an initial payload of:\n\n```javascript\n{\n data: {\n id: 1,\n type: 'post',\n relationship: {\n comments: {\n data: [\n { id: 1, type: 'comment' },\n { id: 2, type: 'comment' }\n ]\n }\n }\n }\n}\n```\n\nBy default calling `post.comments` will trigger the following requests(assuming the\ncomments haven't been loaded before):\n\n```\nGET /comments/1\nGET /comments/2\n```\n\nIf you set coalesceFindRequests to `true` it will instead trigger the following request:\n\n```\nGET /comments?filter[id]=1,2\n```\n\nSetting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`\nrelationships accessed within the same runloop. If you set `coalesceFindRequests: true`\n\n```javascript\nstore.findRecord('comment', 1);\nstore.findRecord('comment', 2);\n```\n\nwill also send a request to: `GET /comments?filter[id]=1,2`\n\nNote: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app\n`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.", - "itemtype": "property", - "name": "coalesceFindRequests", - "access": "public", - "tagname": "", - "type": "{boolean}", - "class": "JSONAPIAdapter", - "module": "@ember-data/adapter/json-api" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 342, - "description": "This property allows ajax to still be used instead when `false`.", - "itemtype": "property", - "name": "useFetch", - "type": "{Boolean}", - "default": "true", - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 369, - "description": "By default, the RESTAdapter will send the query params sorted alphabetically to the\nserver.\n\nFor example:\n\n```js\nstore.query('posts', { sort: 'price', category: 'pets' });\n```\n\nwill generate a requests like this `/posts?category=pets&sort=price`, even if the\nparameters were specified in a different order.\n\nThat way the generated URL will be deterministic and that simplifies caching mechanisms\nin the backend.\n\nSetting `sortQueryParams` to a falsey value will respect the original order.\n\nIn case you want to sort the query parameters with a different criteria, set\n`sortQueryParams` to your custom sort function.\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n sortQueryParams(params) {\n let sortedKeys = Object.keys(params).sort().reverse();\n let len = sortedKeys.length, newParams = {};\n\n for (let i = 0; i < len; i++) {\n newParams[sortedKeys[i]] = params[sortedKeys[i]];\n }\n\n return newParams;\n }\n}\n```", - "itemtype": "method", - "name": "sortQueryParams", - "params": [ - { - "name": "obj", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 427, - "description": "By default the RESTAdapter will send each find request coming from a `store.find`\nor from accessing a relationship separately to the server. If your server supports passing\nids as a query string, you can set coalesceFindRequests to true to coalesce all find requests\nwithin a single runloop.\n\nFor example, if you have an initial payload of:\n\n```javascript\n{\n post: {\n id: 1,\n comments: [1, 2]\n }\n}\n```\n\nBy default calling `post.comments` will trigger the following requests(assuming the\ncomments haven't been loaded before):\n\n```\nGET /comments/1\nGET /comments/2\n```\n\nIf you set coalesceFindRequests to `true` it will instead trigger the following request:\n\n```\nGET /comments?ids[]=1&ids[]=2\n```\n\nSetting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`\nrelationships accessed within the same runloop. If you set `coalesceFindRequests: true`\n\n```javascript\nstore.findRecord('comment', 1);\nstore.findRecord('comment', 2);\n```\n\nwill also send a request to: `GET /comments?ids[]=1&ids[]=2`\n\nNote: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app\n`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.", - "itemtype": "property", - "name": "coalesceFindRequests", - "access": "public", - "tagname": "", - "type": "{boolean}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 487, - "description": "Endpoint paths can be prefixed with a `namespace` by setting the namespace\nproperty on the adapter:\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n namespace = 'api/1';\n}\n```\n\nRequests for the `Post` model would now target `/api/1/post/`.", - "itemtype": "property", - "name": "namespace", - "access": "public", - "tagname": "", - "type": "{String}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 506, - "description": "An adapter can target other hosts by setting the `host` property.\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n host = 'https://api.example.com';\n}\n```\n\nRequests for the `Post` model would now target `https://api.example.com/post/`.", - "itemtype": "property", - "name": "host", - "access": "public", - "tagname": "", - "type": "{String}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 524, - "description": "Some APIs require HTTP headers, e.g. to provide an API\nkey. Arbitrary headers can be set as key/value pairs on the\n`RESTAdapter`'s `headers` object and Ember Data will send them\nalong with each ajax request. For dynamic headers see [headers\ncustomization](/ember-data/release/classes/RESTAdapter).\n\n```app/adapters/application.js\nimport RESTAdapter from '@ember-data/adapter/rest';\nimport { computed } from '@ember/object';\n\nexport default class ApplicationAdapter extends RESTAdapter {\n headers: computed(function() {\n return {\n 'API_KEY': 'secret key',\n 'ANOTHER_HEADER': 'Some header value'\n };\n })\n}\n```", - "itemtype": "property", - "name": "headers", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 551, - "description": "Called by the store in order to fetch the JSON for a given\ntype and ID.\n\nThe `findRecord` method makes an Ajax request to a URL computed by\n`buildURL`, and returns a promise for the resulting payload.\n\nThis method performs an HTTP `GET` request with the id provided as part of the query string.", - "since": "1.13.0", - "itemtype": "method", - "name": "findRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "id", - "description": "", - "type": "String" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 576, - "description": "Called by the store in order to fetch a JSON array for all\nof the records for a given type.\n\nThe `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a\npromise for the resulting payload.", - "itemtype": "method", - "name": "findAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "neverSet", - "description": "a value is never provided to this argument", - "type": "Undefined" - }, - { - "name": "snapshotRecordArray", - "description": "", - "type": "SnapshotRecordArray" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 607, - "description": "Called by the store in order to fetch a JSON array for\nthe records that match a particular query.\n\nThe `query` method makes an Ajax (HTTP GET) request to a URL\ncomputed by `buildURL`, and returns a promise for the resulting\npayload.\n\nThe `query` argument is a simple JavaScript object that will be passed directly\nto the server as parameters.", - "itemtype": "method", - "name": "query", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "recordArray", - "description": "", - "type": "Collection" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 637, - "description": "Called by the store in order to fetch a JSON object for\nthe record that matches a particular query.\n\nThe `queryRecord` method makes an Ajax (HTTP GET) request to a URL\ncomputed by `buildURL`, and returns a promise for the resulting\npayload.\n\nThe `query` argument is a simple JavaScript object that will be passed directly\nto the server as parameters.", - "since": "1.13.0", - "itemtype": "method", - "name": "queryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "query", - "description": "", - "type": "Object" - }, - { - "name": "adapterOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 672, - "description": "Called by the store in order to fetch several records together if `coalesceFindRequests` is true\n\nFor example, if the original payload looks like:\n\n```js\n{\n \"id\": 1,\n \"title\": \"Rails is omakase\",\n \"comments\": [ 1, 2, 3 ]\n}\n```\n\nThe IDs will be passed as a URL-encoded Array of IDs, in this form:\n\n```\nids[]=1&ids[]=2&ids[]=3\n```\n\nMany servers, such as Rails and PHP, will automatically convert this URL-encoded array\ninto an Array for you on the server-side. If you want to encode the\nIDs, differently, just override this (one-line) method.\n\nThe `findMany` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a\npromise for the resulting payload.", - "itemtype": "method", - "name": "findMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "ids", - "description": "", - "type": "Array" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 711, - "description": "Called by the store in order to fetch a JSON array for\nthe unloaded records in a has-many relationship that were originally\nspecified as a URL (inside of `links`).\n\nFor example, if your original payload looks like this:\n\n```js\n{\n \"post\": {\n \"id\": 1,\n \"title\": \"Rails is omakase\",\n \"links\": { \"comments\": \"/posts/1/comments\" }\n }\n}\n```\n\nThis method will be called with the parent record and `/posts/1/comments`.\n\nThe `findHasMany` method will make an Ajax (HTTP GET) request to the originally specified URL.\n\nThe format of your `links` value will influence the final request URL via the `urlPrefix` method:\n\n* Links beginning with `//`, `http://`, `https://`, will be used as is, with no further manipulation.\n\n* Links beginning with a single `/` will have the current adapter's `host` value prepended to it.\n\n* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.", - "itemtype": "method", - "name": "findHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "relationship", - "description": "meta object describing the relationship", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 766, - "description": "Called by the store in order to fetch the JSON for the unloaded record in a\nbelongs-to relationship that was originally specified as a URL (inside of\n`links`).\n\nFor example, if your original payload looks like this:\n\n```js\n{\n \"person\": {\n \"id\": 1,\n \"name\": \"Tom Dale\",\n \"links\": { \"group\": \"/people/1/group\" }\n }\n}\n```\n\nThis method will be called with the parent record and `/people/1/group`.\n\nThe `findBelongsTo` method will make an Ajax (HTTP GET) request to the originally specified URL.\n\nThe format of your `links` value will influence the final request URL via the `urlPrefix` method:\n\n* Links beginning with `//`, `http://`, `https://`, will be used as is, with no further manipulation.\n\n* Links beginning with a single `/` will have the current adapter's `host` value prepended to it.\n\n* Links with no beginning `/` will have a parentURL prepended to it, via the current adapter's `buildURL`.", - "itemtype": "method", - "name": "findBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "relationship", - "description": "meta object describing the relationship", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 815, - "description": "Called by the store when a newly created record is\nsaved via the `save` method on a model record instance.\n\nThe `createRecord` method serializes the record and makes an Ajax (HTTP POST) request\nto a URL computed by `buildURL`.\n\nSee `serialize` for information on how to customize the serialized form\nof a record.", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 840, - "description": "Called by the store when an existing record is saved\nvia the `save` method on a model record instance.\n\nThe `updateRecord` method serializes the record and makes an Ajax (HTTP PUT) request\nto a URL computed by `buildURL`.\n\nSee `serialize` for information on how to customize the serialized form\nof a record.", - "itemtype": "method", - "name": "updateRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "schema", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 867, - "description": "Called by the store when a record is deleted.\n\nThe `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 917, - "description": "Organize records into groups, each of which is to be passed to separate\ncalls to `findMany`.\n\nThis implementation groups together records that have the same base URL but\ndiffering ids. For example `/comments/1` and `/comments/2` will be grouped together\nbecause we know findMany can coalesce them together as `/comments?ids[]=1&ids[]=2`\n\nIt also supports urls where ids are passed as a query param, such as `/comments?id=1`\nbut not those where there is more than 1 query param such as `/comments?id=2&name=David`\nCurrently only the query param of `id` is supported. If you need to support others, please\noverride this or the `_stripIDFromURL` method.\n\nIt does not group records that have differing base urls, such as for example: `/posts/1/comments/2`\nand `/posts/2/comments/3`", - "itemtype": "method", - "name": "groupRecordsForFindMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "snapshots", - "description": "", - "type": "Array" - } - ], - "return": { - "description": "an array of arrays of records, each of which is to be\n loaded separately by `findMany`.", - "type": "Array" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 986, - "description": "Takes an ajax response, and returns the json payload or an error.\n\nBy default this hook just returns the json payload passed to it.\nYou might want to override it in two cases:\n\n1. Your API might return useful results in the response headers.\nResponse headers are passed in as the second argument.\n\n2. Your API might return errors as successful responses with status code\n200 and an Errors text or object. You can return a `InvalidError` or a\n`AdapterError` (or a sub class) from this hook and it will automatically\nreject the promise and put your record into the invalid or error state.\n\nReturning a `InvalidError` from this method will cause the\nrecord to transition into the `invalid` state and make the\n`errors` object available on the record. When returning an\n`InvalidError` the store will attempt to normalize the error data\nreturned from the server using the serializer's `extractErrors`\nmethod.", - "since": "1.13.0", - "itemtype": "method", - "name": "handleResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "requestData", - "description": "- the original request information", - "type": "Object" - } - ], - "return": { - "description": "response", - "type": "Object | AdapterError" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1049, - "description": "Default `handleResponse` implementation uses this hook to decide if the\nresponse is a success.", - "since": "1.13.0", - "itemtype": "method", - "name": "isSuccess", - "access": "public", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1065, - "description": "Default `handleResponse` implementation uses this hook to decide if the\nresponse is an invalid error.", - "since": "1.13.0", - "itemtype": "method", - "name": "isInvalid", - "access": "public", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1081, - "description": "Takes a URL, an HTTP method and a hash of data, and makes an\nHTTP request.\n\nWhen the server responds with a payload, Ember Data will call into `extractSingle`\nor `extractArray` (depending on whether the original query was for one record or\nmany records).\n\nBy default, `ajax` method has the following behavior:\n\n* It sets the response `dataType` to `\"json\"`\n* If the HTTP method is not `\"GET\"`, it sets the `Content-Type` to be\n `application/json; charset=utf-8`\n* If the HTTP method is not `\"GET\"`, it stringifies the data passed in. The\n data is the serialized record in the case of a save.\n* Registers success and failure handlers.", - "itemtype": "method", - "name": "ajax", - "access": "private", - "tagname": "", - "params": [ - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "type", - "description": "The request type GET, POST, PUT, DELETE etc.", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1142, - "itemtype": "method", - "name": "_ajaxRequest", - "access": "private", - "tagname": "", - "params": [ - { - "name": "options", - "description": "jQuery ajax options to be used for the ajax request", - "type": "Object" - } - ], - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1166, - "itemtype": "method", - "name": "ajaxOptions", - "access": "private", - "tagname": "", - "params": [ - { - "name": "url", - "description": "", - "type": "String" - }, - { - "name": "type", - "description": "The request type GET, POST, PUT, DELETE etc.", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1241, - "itemtype": "method", - "name": "parseErrorResponse", - "access": "private", - "tagname": "", - "params": [ - { - "name": "responseText", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1259, - "itemtype": "method", - "name": "normalizeErrorResponse", - "access": "private", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "errors payload", - "type": "Array" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1289, - "description": "Generates a detailed (\"friendly\") error message, with plenty\nof information for debugging (good luck!)", - "itemtype": "method", - "name": "generatedDetailedMessage", - "access": "private", - "tagname": "", - "params": [ - { - "name": "status", - "description": "", - "type": "Number" - }, - { - "name": "headers", - "description": "", - "type": "Object" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "requestData", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "detailed error message", - "type": "String" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1321, - "description": "Used by `findAll` and `findRecord` to build the query's `data` hash\nsupplied to the ajax method.", - "itemtype": "method", - "name": "buildQuery", - "since": "2.5.0", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTAdapter", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/adapter/src/rest.ts", - "line": 1497, - "description": "Helper function that translates the options passed to `jQuery.ajax` into a format that `fetch` expects.", - "itemtype": "method", - "name": "fetchOptions", - "params": [ - { - "name": "_options", - "description": "", - "type": "Object" - }, - { - "name": "adapter", - "description": "", - "type": "Adapter" - } - ], - "access": "private", - "tagname": "", - "return": { - "description": "", - "type": "Object" - }, - "class": "@ember-data/adapter/rest", - "module": "@ember-data/adapter/rest" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 57, - "description": "Specifies how records can be filtered based on the state of the record\nRecords returned will need to have a `filterValues`\nproperty with a key for every name in the returned array", - "itemtype": "method", - "name": "getFilters", - "access": "private", - "tagname": "", - "return": { - "description": "List of objects defining filters\n The object should have a `name` and `desc` property", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 79, - "description": "Fetch the model types and observe them for changes.\nMaintains the list of model types without needing the Model package for detection.", - "itemtype": "method", - "name": "watchModelTypes", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typesAdded", - "description": "Callback to call to add types.\nTakes an array of objects containing wrapped types (returned from `wrapModelType`).", - "type": "Function" - }, - { - "name": "typesUpdated", - "description": "Callback to call when a type has changed.\nTakes an array of objects containing wrapped types.", - "type": "Function" - } - ], - "return": { - "description": "Method to call to remove all observers", - "type": "Function" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 130, - "description": "Loop over the discovered types and use the callbacks from watchModelTypes to notify\nthe consumer of this adapter about the mdoels.", - "itemtype": "method", - "name": "watchTypeIfUnseen", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "discoveredTypes", - "description": "", - "type": "Map" - }, - { - "name": "type", - "description": "", - "type": "String" - }, - { - "name": "typesAdded", - "description": "", - "type": "Function" - }, - { - "name": "typesUpdated", - "description": "", - "type": "Function" - }, - { - "name": "releaseMethods", - "description": "", - "type": "Array" - } - ], - "access": "private", - "tagname": "", - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 153, - "description": "Creates a human readable string used for column headers", - "itemtype": "method", - "name": "columnNameToDesc", - "access": "private", - "tagname": "", - "params": [ - { - "name": "name", - "description": "The attribute name", - "type": "String" - } - ], - "return": { - "description": "Human readable string based on the attribute name", - "type": "String" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 165, - "description": "Get the columns for a given model type", - "itemtype": "method", - "name": "columnsForType", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "An array of columns of the following format:\n name: {String} The name of the column\n desc: {String} Humanized description (what would show in a table column name)", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 194, - "description": "Fetches all loaded records for a given type", - "itemtype": "method", - "name": "getRecords", - "access": "private", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "of the record", - "type": "Model" - }, - { - "name": "modelName", - "description": "of the record", - "type": "String" - } - ], - "return": { - "description": "An array of Model records\n This array will be observed for changes,\n so it should update when new records are added/removed", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 220, - "description": "Gets the values for each column\nThis is the attribute values for a given record", - "itemtype": "method", - "name": "getRecordColumnValues", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "to get values from", - "type": "Model" - } - ], - "return": { - "description": "Keys should match column names defined by the model type", - "type": "Object" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 242, - "description": "Returns keywords to match when searching records", - "itemtype": "method", - "name": "getRecordKeywords", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "Relevant keywords for search based on the record's attribute values", - "type": "Array" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 258, - "description": "Returns the values of filters defined by `getFilters`\nThese reflect the state of the record", - "itemtype": "method", - "name": "getRecordFilterValues", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "The record state filter values", - "type": "Object" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 275, - "description": "Returns a color that represents the record's state\nPossible colors: black, blue, green", - "itemtype": "method", - "name": "getRecordColor", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "return": { - "description": "The record color", - "type": "String" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/debug/addon/index.js", - "line": 294, - "description": "Observes all relevant properties and re-sends the wrapped record\nwhen a change occurs", - "itemtype": "method", - "name": "observeRecord", - "access": "private", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - }, - { - "name": "recordUpdated", - "description": "Callback used to notify changes", - "type": "Function" - } - ], - "return": { - "description": "The function to call to remove all observers", - "type": "Function" - }, - "class": "InspectorDataAdapter", - "module": "@ember-data/debug" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 109, - "description": "The Cache Version that this implementation implements.", - "type": "{'2'}", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "version", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 133, - "description": "Cache the response to a request\n\nImplements `Cache.put`.\n\nExpects a StructuredDocument whose `content` member is a JsonApiDocument.\n\n```js\ncache.put({\n request: { url: 'https://api.example.com/v1/user/1' },\n content: {\n data: {\n type: 'user',\n id: '1',\n attributes: {\n name: 'Chris'\n }\n }\n }\n})\n```\n\n> **Note:** The nested `content` and `data` members are not a mistake. This is because\n> there are two separate concepts involved here, the `StructuredDocument` which contains\n> the context of a given Request that has been issued with the returned contents as its\n> `content` property, and a `JSON:API Document` which is the json contents returned by\n> this endpoint and which uses its `data` property to signify which resources are the\n> primary resources associated with the request.\n\nStructuredDocument's with urls will be cached as full documents with\nassociated resource membership order and contents preserved but linked\ninto the cache.", - "itemtype": "method", - "name": "put", - "params": [ - { - "name": "doc", - "description": "", - "type": "StructuredDocument" - } - ], - "return": { - "description": "", - "type": "ResourceDocument" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 259, - "description": "Update the \"remote\" or \"canonical\" (persisted) state of the Cache\nby merging new information into the existing state.\n\nNote: currently the only valid resource operation is a MergeOperation\nwhich occurs when a collision of identifiers is detected.", - "itemtype": "method", - "name": "patch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "op", - "description": "the operation to perform", - "type": "Operation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 292, - "description": "Update the \"local\" or \"current\" (unpersisted) state of the Cache", - "itemtype": "method", - "name": "mutate", - "params": [ - { - "name": "mutation", - "description": "", - "type": "Mutation" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 314, - "description": "Peek resource data from the Cache.\n\nIn development, if the return value\nis JSON the return value\nwill be deep-cloned and deep-frozen\nto prevent mutation thereby enforcing cache\nImmutability.\n\nThis form of peek is useful for implementations\nthat want to feed raw-data from cache to the UI\nor which want to interact with a blob of data\ndirectly from the presentation cache.\n\nAn implementation might want to do this because\nde-referencing records which read from their own\nblob is generally safer because the record does\nnot require retainining connections to the Store\nand Cache to present data on a per-field basis.\n\nThis generally takes the place of `getAttr` as\nan API and may even take the place of `getRelationship`\ndepending on implementation specifics, though this\nlatter usage is less recommended due to the advantages\nof the Graph handling necessary entanglements and\nnotifications for relational data.", - "itemtype": "method", - "name": "peek", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier | StableDocumentIdentifier" - } - ], - "return": { - "description": "the known resource data", - "type": "ResourceDocument | ResourceBlob | null" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 388, - "description": "Peek the Cache for the existing request data associated with\na cacheable request", - "itemtype": "method", - "name": "peekRequest", - "params": [ - { - "name": "UNKNOWN", - "description": "", - "type": "StableDocumentIdentifier" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 401, - "description": "Push resource data from a remote source into the cache for this identifier", - "itemtype": "method", - "name": "upsert", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - }, - { - "name": "hasRecord", - "description": "" - } - ], - "return": { - "description": "if `hasRecord` is true then calculated key changes should be returned", - "type": "Void | string[]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 489, - "description": "Merge a fork back into a parent Cache.\n\nApplications should typically not call this method themselves,\npreferring instead to merge at the Store level, which will\nutilize this method to merge the caches.", - "itemtype": "method", - "name": "merge", - "params": [ - { - "name": "cache", - "description": "", - "type": "Cache" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 505, - "description": "Generate the list of changes applied to all\nrecord in the store.\n\nEach individual resource or document that has\nbeen mutated should be described as an individual\n`Change` entry in the returned array.\n\nA `Change` is described by an object containing up to\nthree properties: (1) the `identifier` of the entity that\nchanged; (2) the `op` code of that change being one of\n`upsert` or `remove`, and if the op is `upsert` a `patch`\ncontaining the data to merge into the cache for the given\nentity.\n\nThis `patch` is opaque to the Store but should be understood\nby the Cache and may expect to be utilized by an Adapter\nwhen generating data during a `save` operation.\n\nIt is generally recommended that the `patch` contain only\nthe updated state, ignoring fields that are unchanged\n\n```ts\ninterface Change {\n identifier: StableRecordIdentifier | StableDocumentIdentifier;\n op: 'upsert' | 'remove';\n patch?: unknown;\n}\n```", - "itemtype": "method", - "name": "diff", - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 545, - "description": "Serialize the entire contents of the Cache into a Stream\nwhich may be fed back into a new instance of the same Cache\nvia `cache.hydrate`.", - "itemtype": "method", - "name": "dump", - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 558, - "description": "hydrate a Cache from a Stream with content previously serialized\nfrom another instance of the same Cache, resolving when hydration\nis complete.\n\nThis method should expect to be called both in the context of restoring\nthe Cache during application rehydration after SSR **AND** at unknown\ntimes during the lifetime of an already booted application when it is\ndesired to bulk-load additional information into the cache. This latter\nbehavior supports optimizing pre/fetching of data for route transitions\nvia data-only SSR modes.", - "itemtype": "method", - "name": "hydrate", - "params": [ - { - "name": "stream", - "description": "", - "type": "ReadableStream" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 582, - "description": "[LIFECYCLE] Signal to the cache that a new record has been instantiated on the client\n\nIt returns properties from options that should be set on the record during the create\nprocess. This return value behavior is deprecated.", - "itemtype": "method", - "name": "clientDidCreate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "createArgs", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 669, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwill be part of a save transaction.", - "itemtype": "method", - "name": "willCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 683, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwas successfully updated as part of a save transaction.", - "itemtype": "method", - "name": "didCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 787, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwas update via a save transaction failed.", - "itemtype": "method", - "name": "commitWasRejected", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "errors", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 816, - "description": "[LIFECYCLE] Signals to the cache that all data for a resource\nshould be cleared.\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 891, - "description": "Retrieve the data for an attribute from the cache", - "itemtype": "method", - "name": "getAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "", - "type": "Unknown" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 914, - "description": "Mutate the data for an attribute in the cache\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "setAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - }, - { - "name": "value", - "description": "" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 946, - "description": "Query the cache for the changed attributes of a resource.", - "itemtype": "method", - "name": "changedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": ": [, ]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 959, - "description": "Query the cache for whether any mutated attributes exist", - "itemtype": "method", - "name": "hasChangedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 976, - "description": "Tell the cache to discard any uncommitted mutations to attributes\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "rollbackAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "the names of fields that were restored", - "type": "String[]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1023, - "description": "Query the cache for the current state of a relationship property", - "itemtype": "method", - "name": "getRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "field", - "description": "" - } - ], - "return": { - "description": "resource relationship object" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1042, - "description": "Update the cache state for the given resource to be marked\nas locally deleted, or remove such a mark.\n\nThis method is a candidate to become a mutation", - "itemtype": "method", - "name": "setIsDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "isDeleted", - "description": "", - "type": "Boolean" - } - ], - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1067, - "description": "Query the cache for any validation errors applicable to the given resource.", - "itemtype": "method", - "name": "getErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "JsonApiError[]" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1079, - "description": "Query the cache for whether a given resource has any available data", - "itemtype": "method", - "name": "isEmpty", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1092, - "description": "Query the cache for whether a given resource was created locally and not\nyet persisted.", - "itemtype": "method", - "name": "isNew", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1106, - "description": "Query the cache for whether a given resource is marked as deleted (but not\nnecessarily persisted yet).", - "itemtype": "method", - "name": "isDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/json-api/src/-private/cache.ts", - "line": 1120, - "description": "Query the cache for whether a given resource has been deleted and that deletion\nhas also been persisted.", - "itemtype": "method", - "name": "isDeletionCommitted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "Cache", - "module": "@ember-data/json-api" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 29, - "description": "SnapshotRecordArray is not directly instantiable.\nInstances are provided to consuming application's\nadapters and serializers for certain requests.", - "itemtype": "method", - "name": "constructor", - "access": "private", - "tagname": "", - "is_constructor": 1, - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "type", - "description": "", - "type": "String" - }, - { - "name": "options", - "description": "" - } - ], - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 43, - "description": "An array of snapshots", - "access": "private", - "tagname": "", - "itemtype": "property", - "name": "_snapshots", - "type": "{Array}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 51, - "description": "The modelName of the underlying records for the snapshots in the array, as a Model", - "itemtype": "property", - "name": "modelName", - "access": "public", - "tagname": "", - "type": "{Model}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 59, - "description": "A hash of adapter options passed into the store method for this request.\n\nExample\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n}\n```", - "itemtype": "property", - "name": "adapterOptions", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 83, - "description": "The relationships to include for this request.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\n\nexport 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```", - "itemtype": "property", - "name": "include", - "access": "public", - "tagname": "", - "type": "{String|Array}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 107, - "description": "An array of records", - "itemtype": "property", - "name": "_recordArray", - "access": "private", - "tagname": "", - "type": "{Array}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 118, - "description": "Number of records in the array\n\nExample\n\n```app/adapters/post.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n});\n```", - "itemtype": "property", - "name": "length", - "access": "public", - "tagname": "", - "type": "{Number}", - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot-record-array.ts", - "line": 141, - "description": "Get snapshots of the underlying record array\n\nExample\n\n```app/adapters/post.js\nimport JSONAPIAdapter from '@ember-data/adapter/json-api';\n\nexport 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```", - "itemtype": "method", - "name": "snapshots", - "access": "public", - "tagname": "", - "return": { - "description": "Array of snapshots", - "type": "Array" - }, - "class": "SnapshotRecordArray", - "module": "@ember-data/legacy-compat" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 47, - "itemtype": "method", - "name": "constructor", - "is_constructor": 1, - "access": "private", - "tagname": "", - "params": [ - { - "name": "options", - "description": "" - }, - { - "name": "identifier", - "description": "" - }, - { - "name": "_store", - "description": "" - } - ], - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 67, - "description": "The unique RecordIdentifier associated with this Snapshot.", - "itemtype": "property", - "name": "identifier", - "access": "public", - "tagname": "", - "type": "{StableRecordIdentifier}", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 87, - "description": "The id of the snapshot's underlying record\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.id; // => '1'\n```", - "itemtype": "property", - "name": "id", - "type": "{String}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 103, - "description": "A hash of adapter options", - "itemtype": "property", - "name": "adapterOptions", - "type": "{Object}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 111, - "description": "If `include` was passed to the options hash for the request, the value\nwould be available here.", - "itemtype": "property", - "name": "include", - "type": "{String|Array}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 121, - "description": "The name of the type of the underlying record for this snapshot, as a string.", - "itemtype": "property", - "name": "modelName", - "type": "{String}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 135, - "description": "The underlying record for this snapshot. Can be used to access methods and\nproperties defined on the record.\n\nExample\n\n```javascript\nlet json = snapshot.record.toJSON();\n```", - "itemtype": "property", - "name": "record", - "type": "{Model}", - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 174, - "description": "Returns the value of an attribute.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.attr('author'); // => 'Tomster'\npostSnapshot.attr('title'); // => 'Ember.js rocks'\n```\n\nNote: Values are loaded eagerly and cached when the snapshot is created.", - "itemtype": "method", - "name": "attr", - "params": [ - { - "name": "keyName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "The attribute value or undefined", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 199, - "description": "Returns all attributes and their corresponding values.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n```", - "itemtype": "method", - "name": "attributes", - "return": { - "description": "All attributes of the current snapshot", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 217, - "description": "Returns all changed attributes and their old and new values.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\npostModel.set('title', 'Ember.js rocks!');\npostSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n```", - "itemtype": "method", - "name": "changedAttributes", - "return": { - "description": "All changed attributes of the current snapshot", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 248, - "description": "Returns the current value of a belongsTo relationship.\n\n`belongsTo` takes an optional hash of options as a second parameter,\ncurrently supported options are:\n\n- `id`: set to `true` if you only want the ID of the related record to be\nreturned.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, title: 'Hello World' });\n// store.createRecord('comment', { body: 'Lorem ipsum', post: post });\ncommentSnapshot.belongsTo('post'); // => Snapshot\ncommentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n// store.push('comment', { id: 1, body: 'Lorem ipsum' });\ncommentSnapshot.belongsTo('post'); // => undefined\n```\n\nCalling `belongsTo` will return a new Snapshot as long as there's any known\ndata for the relationship available, such as an ID. If the relationship is\nknown but unset, `belongsTo` will return `null`. If the contents of the\nrelationship is unknown `belongsTo` will return `undefined`.\n\nNote: Relationships are loaded lazily and cached upon first access.", - "itemtype": "method", - "name": "belongsTo", - "params": [ - { - "name": "keyName", - "description": "", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "A snapshot or ID of a known\nrelationship or null if the relationship is known but unset. undefined\nwill be returned if the contents of the relationship is unknown.", - "type": "(Snapshot|String|null|undefined)" - }, - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 359, - "description": "Returns the current value of a hasMany relationship.\n\n`hasMany` takes an optional hash of options as a second parameter,\ncurrently supported options are:\n\n- `ids`: set to `true` if you only want the IDs of the related records to be\nreturned.\n\nExample\n\n```javascript\n// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\npostSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\npostSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n// store.push('post', { id: 1, title: 'Hello World' });\npostSnapshot.hasMany('comments'); // => undefined\n```\n\nNote: Relationships are loaded lazily and cached upon first access.", - "itemtype": "method", - "name": "hasMany", - "params": [ - { - "name": "keyName", - "description": "", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "An array of snapshots or IDs of a known\nrelationship or an empty array if the relationship is known but unset.\nundefined will be returned if the contents of the relationship is unknown.", - "type": "(Array|undefined)" - }, - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 466, - "description": "Iterates through all the attributes of the model, calling the passed\nfunction on each attribute.\n\nExample\n\n```javascript\nsnapshot.eachAttribute(function(name, meta) {\n // ...\n});\n```", - "itemtype": "method", - "name": "eachAttribute", - "params": [ - { - "name": "callback", - "description": "the callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 490, - "description": "Iterates through all the relationships of the model, calling the passed\nfunction on each relationship.\n\nExample\n\n```javascript\nsnapshot.eachRelationship(function(name, relationship) {\n // ...\n});\n```", - "itemtype": "method", - "name": "eachRelationship", - "params": [ - { - "name": "callback", - "description": "the callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/legacy-compat/src/legacy-network-handler/snapshot.ts", - "line": 514, - "description": "Serializes the snapshot using the serializer for the model.\n\nExample\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\n\nexport 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```", - "itemtype": "method", - "name": "serialize", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "an object whose values are primitive JSON values only", - "type": "Object" - }, - "access": "public", - "tagname": "", - "class": "Snapshot", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 101, - "description": "The identifier of the record that this reference refers to.\n`null` if no related record is known.", - "itemtype": "property", - "name": "identifier", - "type": "StableRecordIdentifier | null", - "access": "public", - "tagname": "", - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 134, - "description": "The `id` of the record that this reference refers to. Together, the\n`type()` and `id()` methods form a composite key for the identity\nmap. This can be used to access the id of an async relationship\nwithout triggering a fetch that would normally happen if you\nattempted to use `record.relationship.id`.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n }\n```", - "itemtype": "method", - "name": "id", - "access": "public", - "tagname": "", - "return": { - "description": "The id of the record in this belongsTo relationship.", - "type": "String" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 178, - "description": "The link Ember Data will use to fetch or reload this belongs-to\nrelationship. By default it uses only the \"related\" resource linkage.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\nexport default Model.extend({\n user: belongsTo('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: '/articles/1/author'\n }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n }\n```", - "itemtype": "method", - "name": "link", - "access": "public", - "tagname": "", - "return": { - "description": "The link Ember Data will use to fetch or reload this belongs-to relationship.", - "type": "String" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 228, - "description": "any links that have been received for this relationship", - "itemtype": "method", - "name": "links", - "access": "public", - "tagname": "", - "return": { - "description": "" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 241, - "description": "The meta data for the belongs-to relationship.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\nexport default Model.extend({\n user: belongsTo('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: {\n href: '/articles/1/author'\n },\n },\n meta: {\n lastUpdated: 1458014400000\n }\n }\n }\n }\n });\n\nlet userRef = blog.belongsTo('user');\n\nuserRef.meta() // { lastUpdated: 1458014400000 }\n```", - "itemtype": "method", - "name": "meta", - "access": "public", - "tagname": "", - "return": { - "description": "The meta information for the belongs-to relationship.", - "type": "Object" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 296, - "description": "This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the \"link\" otherwise it defaults to \"id\".\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n```", - "itemtype": "method", - "name": "remoteType", - "access": "public", - "tagname": "", - "return": { - "description": "The name of the remote type. This should either be `link` or `id`", - "type": "String" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 346, - "description": "`push` can be used to update the data in the relationship and Ember\nData will treat the new data as the canonical value of this\nrelationship on the backend.\n\nExample\n\n```app/models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "belongsto": "('user', { async: true, inverse: null }) user;\n }\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\n// provide data for reference\nuserRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n```", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "object", - "description": "a JSONAPI document object describing the new value of this relationship.", - "type": "Object" - } - ], - "return": { - "description": "A promise that resolves with the new value in this belongs-to relationship.", - "type": "Promise" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 419, - "description": "`value()` synchronously returns the current value of the belongs-to\nrelationship. Unlike `record.relationshipName`, calling\n`value()` on a reference does not trigger a fetch if the async\nrelationship is not yet loaded. If the relationship is not loaded\nit will always return `null`.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\nuserRef.value(); // null\n\n// provide data for reference\nuserRef.push({\n data: {\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value(); // user\n });\n```", - "itemtype": "method", - "name": "value", - "access": "public", - "tagname": "", - "return": { - "description": "the record in this relationship", - "type": "Model" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 474, - "description": "Loads a record in a belongs-to relationship if it is not already\nloaded. If the relationship is already loaded this method does not\ntrigger a new load.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\nuserRef.value(); // null\n\nuserRef.load().then(function(user) {\n userRef.value() === user\n });\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference.\n\nExample\n\n```javascript\nuserRef.load({ adapterOptions: { isPrivate: true } }).then(function(user) {\n userRef.value() === user;\n});\n```\n```app/adapters/user.js\nimport Adapter from '@ember-data/adapter';\n\nexport default class UserAdapter extends Adapter {\n findRecord(store, type, id, snapshot) {\n // In the adapter you will have access to adapterOptions.\n let adapterOptions = snapshot.adapterOptions;\n }\n});\n```", - "itemtype": "method", - "name": "load", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the record in this belongs-to relationship.", - "type": "Promise" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/belongs-to.ts", - "line": 547, - "description": "Triggers a reload of the value in this relationship. If the\nremoteType is `\"link\"` Ember Data will use the relationship link to\nreload the relationship. Otherwise it will reload the record by its\nid.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\nuserRef.reload().then(function(user) {\n userRef.value() === user\n });\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference. A full example\ncan be found in the `load` method.\n\nExample\n\n```javascript\nuserRef.reload({ adapterOptions: { isPrivate: true } })\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the record in this belongs-to relationship after the reload has completed.", - "type": "Promise" - }, - "class": "BelongsToReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 101, - "description": "An array of identifiers for the records that this reference refers to.", - "itemtype": "property", - "name": "identifiers", - "type": "StableRecordIdentifier[]", - "access": "public", - "tagname": "", - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 153, - "description": "This returns a string that represents how the reference will be\nlooked up when it is loaded. If the relationship has a link it will\nuse the \"link\" otherwise it defaults to \"id\".\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n```", - "itemtype": "method", - "name": "remoteType", - "access": "public", - "tagname": "", - "return": { - "description": "The name of the remote type. This should either be `link` or `ids`", - "type": "String" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 204, - "description": "`ids()` returns an array of the record IDs in this relationship.\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n```", - "itemtype": "method", - "name": "ids", - "access": "public", - "tagname": "", - "return": { - "description": "The ids in this has-many relationship", - "type": "Array" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 243, - "description": "The link Ember Data will use to fetch or reload this belongs-to\nrelationship. By default it uses only the \"related\" resource linkage.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\nexport default Model.extend({\n user: belongsTo('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n links: {\n related: '/articles/1/author'\n }\n }\n }\n }\n });\nlet userRef = blog.belongsTo('user');\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n }\n```", - "itemtype": "method", - "name": "link", - "access": "public", - "tagname": "", - "return": { - "description": "The link Ember Data will use to fetch or reload this belongs-to relationship.", - "type": "String" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 293, - "description": "any links that have been received for this relationship", - "itemtype": "method", - "name": "links", - "access": "public", - "tagname": "", - "return": { - "description": "" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 306, - "description": "The meta data for the has-many relationship.\n\nExample\n\n```javascript\n// models/blog.js\nimport Model, { hasMany } from '@ember-data/model';\nexport default Model.extend({\n users: hasMany('user', { async: true, inverse: null })\n });\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n users: {\n links: {\n related: {\n href: '/articles/1/authors'\n },\n },\n meta: {\n lastUpdated: 1458014400000\n }\n }\n }\n }\n });\n\nlet usersRef = blog.hasMany('user');\n\nusersRef.meta() // { lastUpdated: 1458014400000 }\n```", - "itemtype": "method", - "name": "meta", - "access": "public", - "tagname": "", - "return": { - "description": "The meta information for the belongs-to relationship.", - "type": "Object" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 355, - "description": "`push` can be used to update the data in the relationship and Ember\nData will treat the new data as the canonical value of this\nrelationship on the backend.\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.ids(); // ['1']\n\ncommentsRef.push([\n[{ type: 'comment', id: 2 }],\n[{ type: 'comment', id: 3 }],\n])\n\ncommentsRef.ids(); // ['2', '3']\n```", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "objectOrPromise", - "description": "a promise that resolves to a JSONAPI document object describing the new value of this relationship.", - "type": "Array|Promise" - } - ], - "return": { - "description": "", - "type": "ManyArray" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 459, - "description": "`value()` synchronously returns the current value of the has-many\nrelationship. Unlike `record.relationshipName`, calling\n`value()` on a reference does not trigger a fetch if the async\nrelationship is not yet loaded. If the relationship is not loaded\nit will always return `null`.\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\npost.comments.then(function(comments) {\n commentsRef.value() === comments\n})\n```", - "itemtype": "method", - "name": "value", - "access": "public", - "tagname": "", - "return": { - "description": "", - "type": "ManyArray" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 517, - "description": "Loads the relationship if it is not already loaded. If the\nrelationship is already loaded this method does not trigger a new\nload. This causes a request to the specified\nrelationship link or reloads all items currently in the relationship.\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.load().then(function(comments) {\n //...\n});\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference.\n\nExample\n\n```javascript\ncommentsRef.load({ adapterOptions: { isPrivate: true } })\n .then(function(comments) {\n //...\n });\n```\n\n```app/adapters/comment.js\nexport default ApplicationAdapter.extend({\n findMany(store, type, id, snapshots) {\n // In the adapter you will have access to adapterOptions.\n let adapterOptions = snapshots[0].adapterOptions;\n }\n});\n```", - "itemtype": "method", - "name": "load", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the ManyArray in\nthis has-many relationship.", - "type": "Promise" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/references/has-many.ts", - "line": 592, - "description": "Reloads this has-many relationship. This causes a request to the specified\nrelationship link or reloads all items currently in the relationship.\n\nExample\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n```\n\n```javascript\nlet post = store.push({\n data: {\n type: 'post',\n id: 1,\n relationships: {\n comments: {\n data: [{ type: 'comment', id: 1 }]\n }\n }\n }\n});\n\nlet commentsRef = post.hasMany('comments');\n\ncommentsRef.reload().then(function(comments) {\n //...\n});\n```\n\nYou may also pass in an options object whose properties will be\nfed forward. This enables you to pass `adapterOptions` into the\nrequest given to the adapter via the reference. A full example\ncan be found in the `load` method.\n\nExample\n\n```javascript\ncommentsRef.reload({ adapterOptions: { isPrivate: true } })\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "the options to pass in.", - "type": "Object" - } - ], - "return": { - "description": "a promise that resolves with the ManyArray in this has-many relationship.", - "type": "Promise" - }, - "class": "HasManyReference", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/attr.js", - "line": 14, - "description": "`attr` defines an attribute on a [Model](/ember-data/release/classes/Model).\nBy default, attributes are passed through as-is, however you can specify an\noptional type to have the value automatically transformed.\nEmber Data ships with four basic transform types: `string`, `number`,\n`boolean` and `date`. You can define your own transforms by subclassing\n[Transform](/ember-data/release/classes/Transform).\n\nNote that you cannot use `attr` to define an attribute of `id`.\n\n`attr` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `defaultValue`: Pass a string or a function to be called to set the attribute\nto a default value if and only if the key is absent from the payload response.\n\nExample\n\n```app/models/user.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "attr": "('text', {\n uppercase: true\n })\n text;\n}\n```\n\n```app/transforms/text.js\nexport default class TextTransform {\n serialize(value, options) {\n if (options.uppercase) {\n return value.toUpperCase();\n }\n\n return value;\n }\n\n deserialize(value) {\n return value;\n }\n\n static create() {\n return new this();\n }\n}\n```", - "itemtype": "method", - "name": "attr", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "the attribute type", - "type": "String|Object" - }, - { - "name": "options", - "description": "a hash of options", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Attribute" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/belongs-to.js", - "line": 17, - "description": "`belongsTo` is used to define One-To-One and One-To-Many\nrelationships on a [Model](/ember-data/release/classes/Model).\n\n\n`belongsTo` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n- `inverse`: A string used to identify the inverse property on a\n related model in a One-To-Many relationship. See [Explicit Inverses](#explicit-inverses)\n- `polymorphic` A boolean value to mark the relationship as polymorphic\n\n#### One-To-One\nTo declare a one-to-one relationship between two models, use\n`belongsTo`:\n\n```app/models/user.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class UserModel extends Model {", - "belongsto": "('post', {\n async: false,\n inverse: null\n })\n post;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return the record (Model instance) for the existing\nlocal resource, or null. But it will error on access when\na related resource is known to exist and it has not been loaded.\n\n```\nlet post = comment.post;\n\n```", - "hasmany": "('comment', { async: false, inverse: 'post' }) comments;\n}\n```\n\n```app/models/comment.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "itemtype": "method", - "name": "belongsTo", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "modelName", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 107, - "itemtype": "property", - "name": "errorsByAttributeName", - "type": "{MapWithDefault}", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 117, - "description": "Returns errors for a given attribute\n\n```javascript\nlet user = store.createRecord('user', {\n username: 'tomster',\n email: 'invalidEmail'\n});\nuser.save().catch(function(){\n user.errors.errorsFor('email'); // returns:\n // [{attribute: \"email\", message: \"Doesn't look like a valid email.\"}]\n});\n```", - "itemtype": "method", - "name": "errorsFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "attribute", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Array" - }, - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 155, - "description": "An array containing all of the error messages for this\nrecord. This is useful for displaying all errors to the user.\n\n```handlebars\n{{#each @model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", - "itemtype": "property", - "name": "messages", - "access": "public", - "tagname": "", - "type": "{Array}", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 174, - "itemtype": "property", - "name": "content", - "type": "{Array}", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 184, - "itemtype": "method", - "name": "unknownProperty", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 196, - "description": "Total number of errors.", - "itemtype": "property", - "name": "length", - "type": "{Number}", - "access": "public", - "tagname": "", - "readonly": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 205, - "description": "`true` if we have no errors.", - "itemtype": "property", - "name": "isEmpty", - "type": "{Boolean}", - "access": "public", - "tagname": "", - "readonly": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 216, - "description": "Manually adds errors to the record. This will trigger the `becameInvalid` event/ lifecycle method on\n the record and transition the record into an `invalid` state.\n\nExample\n```javascript\n let errors = user.errors;\n\n // add multiple errors\n errors.add('password', [\n 'Must be at least 12 characters',\n 'Must contain at least one symbol',\n 'Cannot contain your name'\n ]);\n\n errors.errorsFor('password');\n // =>\n // [\n // { attribute: 'password', message: 'Must be at least 12 characters' },\n // { attribute: 'password', message: 'Must contain at least one symbol' },\n // { attribute: 'password', message: 'Cannot contain your name' },\n // ]\n\n // add a single error\n errors.add('username', 'This field is required');\n\n errors.errorsFor('username');\n // =>\n // [\n // { attribute: 'username', message: 'This field is required' },\n // ]\n```", - "itemtype": "method", - "name": "add", - "access": "public", - "tagname": "", - "params": [ - { - "name": "attribute", - "description": "- the property name of an attribute or relationship", - "type": "String" - }, - { - "name": "messages", - "description": "- an error message or array of error messages for the attribute", - "type": "String[]|string" - } - ], - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 263, - "itemtype": "method", - "name": "_findOrCreateMessages", - "access": "private", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 288, - "description": "Manually removes all errors for a given member from the record.\n This will transition the record into a `valid` state, and\n triggers the `becameValid` event and lifecycle method.\n\nExample:\n\n```javascript\n let errors = user.errors;\n errors.add('phone', ['error-1', 'error-2']);\n\n errors.errorsFor('phone');\n // =>\n // [\n // { attribute: 'phone', message: 'error-1' },\n // { attribute: 'phone', message: 'error-2' },\n // ]\n\n errors.remove('phone');\n\n errors.errorsFor('phone');\n // => undefined\n```", - "itemtype": "method", - "name": "remove", - "access": "public", - "tagname": "", - "params": [ - { - "name": "member", - "description": "- the property name of an attribute or relationship", - "type": "String" - } - ], - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 339, - "description": "Manually clears all errors for the record.\n This will transition the record into a `valid` state, and\n will trigger the `becameValid` event and lifecycle method.\n\n Example:\n\n```javascript\nlet errors = user.errors;\nerrors.add('username', ['error-a']);\nerrors.add('phone', ['error-1', 'error-2']);\n\nerrors.errorsFor('username');\n// =>\n// [\n// { attribute: 'username', message: 'error-a' },\n// ]\n\nerrors.errorsFor('phone');\n// =>\n// [\n// { attribute: 'phone', message: 'error-1' },\n// { attribute: 'phone', message: 'error-2' },\n// ]\n\nerrors.clear();\n\nerrors.errorsFor('username');\n// => undefined\n\nerrors.errorsFor('phone');\n// => undefined\n\nerrors.messages\n// => []\n```", - "itemtype": "method", - "name": "clear", - "access": "public", - "tagname": "", - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/errors.ts", - "line": 399, - "description": "Checks if there are error messages for the given attribute.\n\n```app/controllers/user/edit.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';\n\nexport default class UserEditController extends Controller {", - "action": "save(user) {\n if (user.errors.has('email')) {\n return alert('Please update your email before attempting to save.');\n }\n user.save();\n }\n}\n```", - "itemtype": "method", - "name": "has", - "access": "public", - "tagname": "", - "params": [ - { - "name": "attribute", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if there some errors on given attribute", - "type": "Boolean" - }, - "class": "Errors", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/has-many.js", - "line": 20, - "description": "`hasMany` is used to define One-To-Many and Many-To-Many\nrelationships on a [Model](/ember-data/release/classes/Model).\n\n`hasMany` takes an optional hash as a second parameter, currently\nsupported options are:\n\n- `async`: A boolean value used to explicitly declare this to be an async relationship. The default is true.\n- `inverse`: A string used to identify the inverse property on a related model.\n- `polymorphic` A boolean value to mark the relationship as polymorphic\n\n#### One-To-Many\nTo declare a one-to-many relationship between two models, use\n`belongsTo` in combination with `hasMany`, like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment', {\n async: false\n })\n comments;\n}\n```\n\nIn contrast to async relationship, accessing a sync relationship\nwill always return a [ManyArray](/ember-data/release/classes/ManyArray) instance\ncontaining the existing local resources. But it will error on access\nwhen any of the known related resources have not been loaded.\n\n```\npost.comments.forEach((comment) => {\n\n});\n\n```\n\nIf you are using `links` with sync relationships, you have to use\n`ref.reload` to fetch the resources.", - "belongsto": "('post') bluePost;\n}\n```\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "itemtype": "method", - "name": "hasMany", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "type", - "description": "(optional) type of the relationship", - "type": "String" - }, - { - "name": "options", - "description": "(optional) a hash of options", - "type": "Object" - } - ], - "return": { - "description": "relationship", - "type": "Ember.computed" - }, - "class": "@ember-data/model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 88, - "description": "The loading state of this array", - "itemtype": "property", - "name": "isLoaded", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 96, - "description": "`true` if the relationship is polymorphic, `false` otherwise.", - "itemtype": "property", - "name": "isPolymorphic", - "type": "Boolean", - "access": "private", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 104, - "description": "Metadata associated with the request for async hasMany relationships.\n\nExample\n\nGiven that the server returns the following JSON payload when fetching a\nhasMany relationship:\n\n```js\n{\n \"comments\": [{\n \"id\": 1,\n \"comment\": \"This is the first comment\",\n }, {\n// ...\n }],\n\n \"meta\": {\n \"page\": 1,\n \"total\": 5\n }\n}\n```\n\nYou can then access the meta data via the `meta` property:\n\n```js\nlet comments = await post.comments;\nlet meta = comments.meta;\n\n// meta.page => 1\n// meta.total => 5\n```", - "itemtype": "property", - "name": "meta", - "type": "Object | null", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 142, - "description": "Retrieve the links for this relationship", - "itemtype": "property", - "name": "links", - "type": "Object | null", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 284, - "description": "Reloads all of the records in the manyArray. If the manyArray\nholds a relationship that was originally fetched using a links url\nEmber Data will revisit the original links url to repopulate the\nrelationship.\n\nIf the manyArray holds the result of a `store.query()` reload will\nre-run the original query.\n\nExample\n\n```javascript\nlet user = store.peekRecord('user', '1')\nawait login(user);\n\nlet permissions = await user.permissions;\nawait permissions.reload();\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 311, - "description": "Saves all of the records in the `ManyArray`.\n\nExample\n\n```javascript\nlet inbox = await store.findRecord('inbox', '1');\nlet messages = await inbox.messages;\nmessages.forEach((message) => {\n message.isRead = true;\n});\nmessages.save();\n```", - "itemtype": "method", - "name": "save", - "access": "public", - "tagname": "", - "return": { - "description": "promise", - "type": "PromiseArray" - }, - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/many-array.ts", - "line": 330, - "description": "Create a child record within the owner", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "record", - "type": "Model" - }, - "class": "ManyArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 171, - "description": "If this property is `true` the record is in the `empty`\nstate. Empty is the first state all records enter after they have\nbeen created. Most records created by the store will quickly\ntransition to the `loading` state if data needs to be fetched from\nthe server or the `created` state if the record is created on the\nclient. A record can also enter the empty state if the adapter is\nunable to locate the record.", - "itemtype": "property", - "name": "isEmpty", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 190, - "description": "If this property is `true` the record is in the `loading` state. A\nrecord enters this state when the store asks the adapter for its\ndata. It remains in this state until the adapter provides the\nrequested data.", - "itemtype": "property", - "name": "isLoading", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 206, - "description": "If this property is `true` the record is in the `loaded` state. A\nrecord enters this state when its data is populated. Most of a\nrecord's lifecycle is spent inside substates of the `loaded`\nstate.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.isLoaded; // true\n\nstore.findRecord('model', 1).then(function(model) {\n model.isLoaded; // true\n});\n```", - "itemtype": "property", - "name": "isLoaded", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 233, - "description": "If this property is `true` the record is in the `dirty` state. The\nrecord has local changes that have not yet been saved by the\nadapter. This includes records that have been created (but not yet\nsaved) or deleted.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.hasDirtyAttributes; // true\n\nstore.findRecord('model', 1).then(function(model) {\n model.hasDirtyAttributes; // false\n model.set('foo', 'some value');\n model.hasDirtyAttributes; // true\n});\n```", - "since": "1.13.0", - "itemtype": "property", - "name": "hasDirtyAttributes", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 263, - "description": "If this property is `true` the record is in the `saving` state. A\nrecord enters the saving state when `save` is called, but the\nadapter has not yet acknowledged that the changes have been\npersisted to the backend.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.isSaving; // false\nlet promise = record.save();\nrecord.isSaving; // true\npromise.then(function() {\n record.isSaving; // false\n});\n```", - "itemtype": "property", - "name": "isSaving", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 291, - "description": "If this property is `true` the record is in the `deleted` state\nand has been marked for deletion. When `isDeleted` is true and\n`hasDirtyAttributes` is true, the record is deleted locally but the deletion\nwas not yet persisted. When `isSaving` is true, the change is\nin-flight. When both `hasDirtyAttributes` and `isSaving` are false, the\nchange has persisted.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.isDeleted; // false\nrecord.deleteRecord();\n\n// Locally deleted\nrecord.isDeleted; // true\nrecord.hasDirtyAttributes; // true\nrecord.isSaving; // false\n\n// Persisting the deletion\nlet promise = record.save();\nrecord.isDeleted; // true\nrecord.isSaving; // true\n\n// Deletion Persisted\npromise.then(function() {\n record.isDeleted; // true\n record.isSaving; // false\n record.hasDirtyAttributes; // false\n});\n```", - "itemtype": "property", - "name": "isDeleted", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 334, - "description": "If this property is `true` the record is in the `new` state. A\nrecord will be in the `new` state when it has been created on the\nclient and the adapter has not yet report that it was successfully\nsaved.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.isNew; // true\n\nrecord.save().then(function(model) {\n model.isNew; // false\n});\n```", - "itemtype": "property", - "name": "isNew", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 361, - "description": "If this property is `true` the record is in the `valid` state.\n\nA record will be in the `valid` state when the adapter did not report any\nserver-side validation failures.", - "itemtype": "property", - "name": "isValid", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 377, - "description": "If the record is in the dirty state this property will report what\nkind of change has caused it to move into the dirty\nstate. Possible values are:\n\n- `created` The record has been created by the client and not yet saved to the adapter.\n- `updated` The record has been updated by the client and not yet saved to the adapter.\n- `deleted` The record has been deleted by the client and not yet saved to the adapter.\n\nExample\n\n```javascript\nlet record = store.createRecord('model');\nrecord.dirtyType; // 'created'\n```", - "itemtype": "property", - "name": "dirtyType", - "access": "public", - "tagname": "", - "type": "{String}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 403, - "description": "If `true` the adapter reported that it was unable to save local\nchanges to the backend for any reason other than a server-side\nvalidation error.\n\nExample\n\n```javascript\nrecord.isError; // false\nrecord.set('foo', 'valid value');\nrecord.save().then(null, function() {\n record.isError; // true\n});\n```", - "itemtype": "property", - "name": "isError", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 433, - "description": "If `true` the store is attempting to reload the record from the adapter.\n\nExample\n\n```javascript\nrecord.isReloading; // false\nrecord.reload();\nrecord.isReloading; // true\n```", - "itemtype": "property", - "name": "isReloading", - "access": "public", - "tagname": "", - "type": "{Boolean}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 451, - "description": "All ember models have an id property. This is an identifier\nmanaged by an external source. These are always coerced to be\nstrings before being used internally. Note when declaring the\nattributes for a model it is an error to declare an id\nattribute.\n\n```javascript\nlet record = store.createRecord('model');\nrecord.id; // null\n\nstore.findRecord('model', 1).then(function(model) {\n model.id; // '1'\n});\n```", - "itemtype": "property", - "name": "id", - "access": "public", - "tagname": "", - "type": "{String}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 504, - "itemtype": "property", - "name": "currentState", - "access": "private", - "tagname": "", - "type": "{Object}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 528, - "description": "The store service instance which created this record instance", - "itemtype": "property", - "name": "store", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 535, - "description": "When the record is in the `invalid` state this object will contain\nany errors returned by the adapter. When present the errors hash\ncontains keys corresponding to the invalid property names\nand values which are arrays of Javascript objects with two keys:\n\n- `message` A string containing the error message from the backend\n- `attribute` The name of the property associated with this error message\n\n```javascript\nrecord.errors.length; // 0\nrecord.set('foo', 'invalid value');\nrecord.save().catch(function() {\n record.errors.foo;\n // [{message: 'foo should be a number.', attribute: 'foo'}]\n});\n```\n\nThe `errors` property is useful for displaying error messages to\nthe user.\n\n```handlebars\n\n{{#each @model.errors.username as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n\n{{#each @model.errors.email as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\n\nYou can also access the special `messages` property on the error\nobject to get an array of all the error strings.\n\n```handlebars\n{{#each @model.errors.messages as |message|}}\n
\n {{message}}\n
\n{{/each}}\n```", - "itemtype": "property", - "name": "errors", - "access": "public", - "tagname": "", - "type": "{Errors}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 594, - "description": "This property holds the `AdapterError` object with which\nlast adapter operation was rejected.", - "itemtype": "property", - "name": "adapterError", - "access": "public", - "tagname": "", - "type": "{AdapterError}", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 610, - "description": "Create a JSON representation of the record, using the serialization\nstrategy of the store's adapter.\n\n `serialize` takes an optional hash as a parameter, currently\nsupported options are:\n\n - `includeId`: `true` if the record's ID should be included in the\n JSON representation.", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "an object whose values are primitive JSON values only", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 645, - "description": "Marks the record as deleted but does not save it. You must call\n`save` afterwards if you want to persist it. You might use this\nmethod if you want to allow the user to still `rollbackAttributes()`\nafter a delete was made.\n\nExample\n\n```app/controllers/model/delete.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';\n\nexport default class ModelDeleteController extends Controller {", - "action": "undo() {\n this.model.rollbackAttributes();\n }\n}\n```", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 685, - "description": "Same as `deleteRecord`, but saves the record immediately.\n\nExample\n\n```app/controllers/model/delete.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';\n\nexport default class ModelDeleteController extends Controller {", - "action": "delete() {\n this.model.destroyRecord().then(function() {\n this.transitionToRoute('model.index');\n });\n }\n}\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to your adapter via the snapshot\n\n```js\nrecord.destroyRecord({ adapterOptions: { subscribe: false } });\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n deleteRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n}\n```", - "itemtype": "method", - "name": "destroyRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", - "type": "Promise" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 744, - "description": "Unloads the record from the store. This will not send a delete request\nto your server, it just unloads the record from memory.", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 758, - "itemtype": "method", - "name": "_notifyProperties", - "access": "private", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 775, - "description": "Returns an object, whose keys are changed properties, and value is\nan [oldProp, newProp] array.\n\nThe array represents the diff of the canonical state with the local state\nof the model. Note: if the model is created locally, the canonical state is\nempty since the adapter hasn't acknowledged the attributes yet:\n\nExample\n\n```app/models/mascot.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class MascotModel extends Model {", - "attr": "('boolean', {\n defaultValue: false\n })\n isAdmin;\n}\n```\n\n```javascript\nlet mascot = store.createRecord('mascot');\n\nmascot.changedAttributes(); // {}\n\nmascot.set('name', 'Tomster');\nmascot.changedAttributes(); // { name: [undefined, 'Tomster'] }\n\nmascot.set('isAdmin', true);\nmascot.changedAttributes(); // { isAdmin: [undefined, true], name: [undefined, 'Tomster'] }\n\nmascot.save().then(function() {\n mascot.changedAttributes(); // {}\n\n mascot.set('isAdmin', false);\n mascot.changedAttributes(); // { isAdmin: [true, false] }\n});\n```", - "itemtype": "method", - "name": "changedAttributes", - "access": "public", - "tagname": "", - "return": { - "description": "an object, whose keys are changed properties,\n and value is an [oldProp, newProp] array.", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 825, - "description": "If the model `hasDirtyAttributes` this function will discard any unsaved\nchanges. If the model `isNew` it will be removed from the store.\n\nExample\n\n```javascript\nrecord.name; // 'Untitled Document'\nrecord.set('name', 'Doc 1');\nrecord.name; // 'Doc 1'\nrecord.rollbackAttributes();\nrecord.name; // 'Untitled Document'\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "rollbackAttributes", - "access": "public", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 857, - "itemtype": "method", - "name": "_createSnapshot", - "access": "private", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 873, - "description": "Save the record and persist any changes to the record to an\nexternal source via the adapter.\n\nExample\n\n```javascript\nrecord.set('name', 'Tomster');\nrecord.save().then(function() {\n // Success callback\n}, function() {\n // Error callback\n});\n```\n\n If you pass an object using the `adapterOptions` property of the options\n argument it will be passed to your adapter via the snapshot.\n\n```js\nrecord.save({ adapterOptions: { subscribe: false } });\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n updateRecord(store, type, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n}\n```", - "itemtype": "method", - "name": "save", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "a promise that will be resolved when the adapter returns\nsuccessfully or rejected if the adapter returns with an error.", - "type": "Promise" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 926, - "description": "Reload the record from the adapter.\n\nThis will only work if the record has already finished loading.\n\nExample\n\n```app/controllers/model/view.js\nimport Controller from '@ember/controller';\nimport { action } from '@ember/object';\n\nexport default class ViewController extends Controller {", - "action": "reload() {\n this.model.reload().then(function(model) {\n // do something with the reloaded model\n });\n }\n}\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "optional, may include `adapterOptions` hash which will be passed to adapter request", - "type": "Object" - } - ], - "return": { - "description": "a promise that will be resolved with the record when the\nadapter returns successfully or rejected if the adapter returns\nwith an error.", - "type": "Promise" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 987, - "description": "Get the reference for the specified belongsTo relationship.\n\nExample\n\n```app/models/blog.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "belongsto": "('user', { async: true, inverse: null }) user;\n}\n```\n\n```javascript\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n user: {\n data: { type: 'user', id: 1 }\n }\n }\n }\n});\nlet userRef = blog.belongsTo('user');\n\n// check if the user relationship is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === \"id\") {\n let id = userRef.id();\n} else if (userRef.remoteType() === \"link\") {\n let link = userRef.link();\n}\n\n// load user (via store.findRecord or store.findBelongsTo)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({\n type: 'user',\n id: 1,\n attributes: {\n username: \"@user\"\n }\n}).then(function(user) {\n userRef.value() === user;\n});\n```", - "itemtype": "method", - "name": "belongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "name", - "description": "of the relationship", - "type": "String" - } - ], - "since": "2.5.0", - "return": { - "description": "reference for this relationship", - "type": "BelongsToReference" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1055, - "description": "Get the reference for the specified hasMany relationship.\n\nExample\n\n```app/models/blog.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "hasmany": "('comment', { async: true, inverse: null }) comments;\n}\n\nlet blog = store.push({\n data: {\n type: 'blog',\n id: 1,\n relationships: {\n comments: {\n data: [\n { type: 'comment', id: 1 },\n { type: 'comment', id: 2 }\n ]\n }\n }\n }\n});\nlet commentsRef = blog.hasMany('comments');\n\n// check if the comments are loaded already\nlet isLoaded = commentsRef.value() !== null;\n\n// get the records of the reference (null if not yet available)\nlet comments = commentsRef.value();\n\n// get the identifier of the reference\nif (commentsRef.remoteType() === \"ids\") {\n let ids = commentsRef.ids();\n} else if (commentsRef.remoteType() === \"link\") {\n let link = commentsRef.link();\n}\n\n// load comments (via store.findMany or store.findHasMany)\ncommentsRef.load().then(...)\n\n// or trigger a reload\ncommentsRef.reload().then(...)\n\n// provide data for reference\ncommentsRef.push([{ type: 'comment', id: 1 }, { type: 'comment', id: 2 }]).then(function(comments) {\n commentsRef.value() === comments;\n});\n```", - "itemtype": "method", - "name": "hasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "name", - "description": "of the relationship", - "type": "String" - } - ], - "since": "2.5.0", - "return": { - "description": "reference for this relationship", - "type": "HasManyReference" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1118, - "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.\n\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, descriptor);\n```\n\n- `name` the name of the current property in the iteration\n- `descriptor` the meta object that describes this relationship\n\nThe relationship descriptor argument is an object with the following properties.\n\n- **key** String the name of this relationship on the Model\n- **kind** String \"hasMany\" or \"belongsTo\"\n- **options** Object the original options hash passed when the relationship was declared\n- **parentType** Model the type of the Model that owns this relationship\n- **type** String the type name of the related Model\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n serialize(record, options) {\n let json = {};\n\n record.eachRelationship(function(name, descriptor) {\n if (descriptor.kind === 'hasMany') {\n let serializedHasManyName = name.toUpperCase() + '_IDS';\n json[serializedHasManyName] = record.get(name).map(r => r.id);\n }\n });\n\n return json;\n }\n }\n```", - "itemtype": "method", - "name": "eachRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1189, - "description": "Create should only ever be called by the store. To create an instance of a\n`Model` in a dirty state use `store.createRecord`.\n\n To create instances of `Model` in a clean state, use `store.push`", - "itemtype": "method", - "name": "create", - "access": "private", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1200, - "description": "Represents the model's class name as a string. This can be used to look up the model's class name through\n`Store`'s modelFor method.\n\n`modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.\nFor example:\n\n```javascript\nstore.modelFor('post').modelName; // 'post'\nstore.modelFor('blog-post').modelName; // 'blog-post'\n```\n\nThe most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload\nkeys to underscore (instead of dasherized), you might use the following code:\n\n```javascript\nimport RESTSerializer from '@ember-data/serializer/rest';\nimport { underscore } from '/utils/string-utils';\n\nexport default const PostSerializer = RESTSerializer.extend({\n payloadKeyFromModelName(modelName) {\n return underscore(modelName);\n }\n});\n```", - "itemtype": "property", - "name": "modelName", - "access": "public", - "tagname": "", - "type": "String", - "readonly": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1250, - "description": "For a given relationship name, returns the model type of the relationship.\n\nFor example, if you define a model like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('comment') comments;\n}\n```\n\nCalling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.", - "itemtype": "method", - "name": "typeForRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "an instance of Store", - "type": "Store" - } - ], - "return": { - "description": "the type of the relationship, or undefined", - "type": "Model" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1291, - "description": "Find the relationship which is the inverse of the one asked for.\n\nFor example, if you define models like this:\n\n```app/models/post.js\nimport Model, { hasMany } from '@ember-data/model';\n\nexport default class PostModel extends Model {", - "hasmany": "('message') comments;\n }\n```\n\n```app/models/message.js\nimport Model, { belongsTo } from '@ember-data/model';\n\nexport default class MessageModel extends Model {", - "belongsto": "('post') owner;\n }\n```\n\n``` js\nstore.modelFor('post').inverseFor('comments', store) // { type: App.Message, name: 'owner', kind: 'belongsTo' }\nstore.modelFor('message').inverseFor('owner', store) // { type: App.Post, name: 'comments', kind: 'hasMany' }\n```", - "itemtype": "method", - "name": "inverseFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "name", - "description": "the name of the relationship", - "type": "String" - }, - { - "name": "store", - "description": "", - "type": "Store" - } - ], - "return": { - "description": "the inverse relationship, or null", - "type": "Object" - }, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1480, - "description": "The model's relationships as a map, keyed on the type of the\nrelationship. The value of each entry is an array containing a descriptor\nfor each relationship with that type, describing the name of the relationship\nas well as the type.\n\nFor example, given the following model definition:\n\n```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "hasmany": "('post') posts;\n }\n```\n\nThis computed property would return a map describing these\nrelationships, like this:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\nimport User from 'app/models/user';\nimport Post from 'app/models/post';\n\nlet relationships = Blog.relationships;\nrelationships.user;\n//=> [ { name: 'users', kind: 'hasMany' },\n// { name: 'owner', kind: 'belongsTo' } ]\nrelationships.post;\n//=> [ { name: 'posts', kind: 'hasMany' } ]\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relationships", - "access": "public", - "tagname": "", - "static": 1, - "type": "Map", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1546, - "description": "A hash containing lists of the model's relationships, grouped\nby the relationship kind. For example, given a model with this\ndefinition:\n\n```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "hasmany": "('post') posts;\n }\n```\n\nThis property would contain the following:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\n\nlet relationshipNames = Blog.relationshipNames;\nrelationshipNames.hasMany;\n//=> ['users', 'posts']\nrelationshipNames.belongsTo;\n//=> ['owner']\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relationshipNames", - "access": "public", - "tagname": "", - "static": 1, - "type": "Object", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1601, - "description": "An array of types directly related to a model. Each type will be\nincluded once, regardless of the number of relationships it has with\nthe model.\n\nFor example, given a model with this definition:\n\n```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "hasmany": "('post') posts;\n }\n```\n\nThis property would contain the following:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\n\nlet relatedTypes = Blog.relatedTypes');\n//=> ['user', 'post']\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relatedTypes", - "access": "public", - "tagname": "", - "static": 1, - "type": "Ember.Array", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1662, - "description": "A map whose keys are the relationships of a model and whose values are\nrelationship descriptors.\n\nFor example, given a model with this\ndefinition:\n\n```app/models/blog.js\nimport Model, { belongsTo, hasMany } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "hasmany": "('post') posts;\n }\n```\n\nThis property would contain the following:\n\n```javascript\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog';\n\nlet relationshipsByName = Blog.relationshipsByName;\nrelationshipsByName.users;\n//=> { key: 'users', kind: 'hasMany', type: 'user', options: Object, isRelationship: true }\nrelationshipsByName.owner;\n//=> { key: 'owner', kind: 'belongsTo', type: 'user', options: Object, isRelationship: true }\n```", - "belongsto": "('user') owner;", - "itemtype": "property", - "name": "relationshipsByName", - "access": "public", - "tagname": "", - "static": 1, - "type": "Map", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1744, - "description": "A map whose keys are the fields of the model and whose values are strings\ndescribing the kind of the field. A model's fields are the union of all of its\nattributes and relationships.\n\nFor example:\n\n```app/models/blog.js\nimport Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\nexport default class BlogModel extends Model {", - "hasmany": "('post') posts;", - "belongsto": "('user') owner;", - "attr": "('string') title;\n }\n```\n\n```js\nimport { get } from '@ember/object';\nimport Blog from 'app/models/blog'\n\nlet fields = Blog.fields;\nfields.forEach(function(kind, field) {\n // do thing\n });\n\n// prints:\n// users, hasMany\n// owner, belongsTo\n// posts, hasMany\n// title, attribute\n```", - "itemtype": "property", - "name": "fields", - "access": "public", - "tagname": "", - "static": 1, - "type": "Map", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1806, - "description": "Given a callback, iterates over each of the relationships in the model,\ninvoking the callback with the name of each relationship and its relationship\ndescriptor.", - "itemtype": "method", - "name": "eachRelationship", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1828, - "description": "Given a callback, iterates over each of the types related to a model,\ninvoking the callback with the related type's class. Each type will be\nreturned just once, regardless of how many different relationships it has\nwith a model.", - "itemtype": "method", - "name": "eachRelatedType", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "callback", - "description": "the callback to invoke", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Any" - } - ], - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1880, - "description": "A map whose keys are the attributes of the model (properties\ndescribed by attr) and whose values are the meta object for the\nproperty.\n\nExample\n\n```app/models/person.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class PersonModel extends Model {", - "attr": "('date') birthday;\n }\n```\n\n```javascript\nimport { get } from '@ember/object';\nimport Person from 'app/models/person'\n\nlet attributes = Person.attributes\n\nattributes.forEach(function(meta, name) {\n // do thing\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", - "itemtype": "property", - "name": "attributes", - "access": "public", - "tagname": "", - "static": 1, - "type": "{Map}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 1944, - "description": "A map whose keys are the attributes of the model (properties\ndescribed by attr) and whose values are type of transformation\napplied to each attribute. This map does not include any\nattributes that do not have an transformation type.\n\nExample\n\n```app/models/person.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class PersonModel extends Model {", - "attr": "('date') birthday;\n }\n```\n\n```javascript\nimport { get } from '@ember/object';\nimport Person from 'app/models/person';\n\nlet transformedAttributes = Person.transformedAttributes\n\ntransformedAttributes.forEach(function(field, type) {\n // do thing\n });\n\n// prints:\n// lastName string\n// birthday date\n```", - "itemtype": "property", - "name": "transformedAttributes", - "access": "public", - "tagname": "", - "static": 1, - "type": "{Map}", - "readonly": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2001, - "description": "Iterates through the attributes of the model, calling the passed function on each\nattribute.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, meta);\n```\n\n- `name` the name of the current property in the iteration\n- `meta` the meta object for the attribute property in the iteration\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport Model, { attr } from '@ember-data/model';\n\nclass PersonModel extends Model {", - "attr": "('date') birthday;\n }\n\nPersonModel.eachAttribute(function(name, meta) {\n // do thing\n });\n\n// prints:\n// firstName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"firstName\"}\n// lastName {type: \"string\", isAttribute: true, options: Object, parentType: function, name: \"lastName\"}\n// birthday {type: \"date\", isAttribute: true, options: Object, parentType: function, name: \"birthday\"}\n```", - "itemtype": "method", - "name": "eachAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2056, - "description": "Iterates through the transformedAttributes of the model, calling\nthe passed function on each attribute. Note the callback will not be\ncalled for any attributes that do not have an transformation type.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(name, type);\n```\n\n- `name` the name of the current property in the iteration\n- `type` a string containing the name of the type of transformed\napplied to the attribute\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context.\n\nExample\n\n```javascript\nimport Model, { attr } from '@ember-data/model';\n\nlet Person = Model.extend({\n firstName: attr(),\n lastName: attr('string'),\n birthday: attr('date')\n });\n\nPerson.eachTransformedAttribute(function(name, type) {\n // do thing\n });\n\n// prints:\n// lastName string\n// birthday date\n```", - "itemtype": "method", - "name": "eachTransformedAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "The callback to execute", - "type": "Function" - }, - { - "name": "binding", - "description": "the value to which the callback's `this` should be bound", - "type": "Object", - "optional": true - } - ], - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2112, - "description": "Returns the name of the model class.", - "itemtype": "method", - "name": "toString", - "access": "public", - "tagname": "", - "static": 1, - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/model.js", - "line": 2135, - "description": "Provides info about the model for debugging purposes\nby grouping the properties into more semantic groups.\n\nMeant to be used by debugging tools such as the Chrome Ember Extension.\n\n- Groups all attributes in \"Attributes\" group.\n- Groups all belongsTo relationships in \"Belongs To\" group.\n- Groups all hasMany relationships in \"Has Many\" group.\n- Groups all flags in \"Flags\" group.\n- Flags relationship CPs as expensive properties.", - "itemtype": "method", - "name": "_debugInfo", - "access": "private", - "tagname": "", - "class": "Model", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 56, - "description": "Retrieve the length of the content", - "itemtype": "property", - "name": "length", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 82, - "description": "Iterate the proxied content. Called by the glimmer iterator in #each\nWe do not guarantee that forEach will always be available. This\nmay eventually be made to use Symbol.Iterator once glimmer supports it.", - "itemtype": "method", - "name": "forEach", - "params": [ - { - "name": "cb", - "description": "" - } - ], - "return": { - "description": "" - }, - "access": "private", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 98, - "description": "Reload the relationship", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "options", - "description": "" - } - ], - "return": { - "description": "" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 113, - "description": "Whether the loading promise is still pending", - "itemtype": "property", - "name": "isPending", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 120, - "description": "Whether the loading promise rejected", - "itemtype": "property", - "name": "isRejected", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 127, - "description": "Whether the loading promise succeeded", - "itemtype": "property", - "name": "isFulfilled", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 134, - "description": "Whether the loading promise completed (resolved or rejected)", - "itemtype": "property", - "name": "isSettled", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 142, - "description": "chain this promise", - "itemtype": "method", - "name": "then", - "access": "public", - "tagname": "", - "params": [ - { - "name": "success", - "description": "" - }, - { - "name": "fail", - "description": "" - } - ], - "return": { - "description": "Promise" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 155, - "description": "catch errors thrown by this promise", - "itemtype": "method", - "name": "catch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "" - } - ], - "return": { - "description": "Promise" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 166, - "description": "run cleanup after this promise completes", - "itemtype": "method", - "name": "finally", - "access": "public", - "tagname": "", - "params": [ - { - "name": "callback", - "description": "" - } - ], - "return": { - "description": "Promise" - }, - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 188, - "description": "Retrieve the links for this relationship", - "itemtype": "property", - "name": "links", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/model/src/-private/promise-many-array.ts", - "line": 198, - "description": "Retrieve the meta for this relationship", - "itemtype": "property", - "name": "meta", - "access": "public", - "tagname": "", - "class": "PromiseManyArray", - "module": "@ember-data/model" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 31, - "description": "log payloads received by the store\nvia `push` or returned from a delete/update/create\noperation.", - "itemtype": "property", - "name": "LOG_PAYLOADS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 40, - "description": "log remote-state updates to the cache", - "itemtype": "property", - "name": "LOG_OPERATIONS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 47, - "description": "log local-state updates to the cache", - "itemtype": "property", - "name": "LOG_MUTATIONS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 54, - "description": "log notifications received by the NotificationManager", - "itemtype": "property", - "name": "LOG_NOTIFICATIONS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 61, - "description": "log requests issued by the RequestManager", - "itemtype": "property", - "name": "LOG_REQUESTS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 68, - "description": "log updates to requests the store has issued to\nthe network (adapter) to fulfill.", - "itemtype": "property", - "name": "LOG_REQUEST_STATUS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 76, - "description": "log peek, generation and updates to\nRecord Identifiers.", - "itemtype": "property", - "name": "LOG_IDENTIFIERS", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 84, - "description": "log updates received by the graph (relationship pointer storage)", - "itemtype": "property", - "name": "LOG_GRAPH", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/debugging.js", - "line": 91, - "description": "log creation/removal of RecordData and Record\ninstances.", - "itemtype": "property", - "name": "LOG_INSTANCE_CACHE", - "type": "Boolean", - "access": "public", - "tagname": "", - "class": "DebugLogging", - "module": "@ember-data/debug" - }, - { - "file": "../packages/private-build-infra/virtual-packages/deprecations.js", - "line": 73, - "description": "**id: **\n\nThis is a planned deprecation which will trigger when observer or computed\nchains are used to watch for changes on any EmberData RecordArray, ManyArray\nor PromiseManyArray.\n\nSupport for these chains is currently guarded by the inactive deprecation flag\nlisted here.", - "itemtype": "property", - "name": "DEPRECATE_COMPUTED_CHAINS", - "since": "5.0", - "until": "6.0", - "access": "public", - "tagname": "", - "class": "CurrentDeprecations", - "module": "@ember-data/deprecations" - }, - { - "file": "../packages/request/src/-private/manager.ts", - "line": 501, - "description": "Register a handler to use for primary cache intercept.\n\nOnly one such handler may exist. If using the same\nRequestManager as the Store instance the Store\nregisters itself as a Cache handler.", - "itemtype": "method", - "name": "useCache", - "access": "public", - "tagname": "", - "params": [ - { - "name": "cacheHandler", - "description": "", - "type": "Handler[]" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "RequestManager", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/manager.ts", - "line": 528, - "description": "Register handler(s) to use when a request is issued.\n\nHandlers will be invoked in the order they are registered.\nEach Handler is given the opportunity to handle the request,\ncurry the request, or pass along a modified request.", - "itemtype": "method", - "name": "use", - "access": "public", - "tagname": "", - "params": [ - { - "name": "newHandlers", - "description": "", - "type": "Handler[]" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "RequestManager", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/manager.ts", - "line": 562, - "description": "Issue a Request.\n\nReturns a Future that fulfills with a StructuredDocument", - "itemtype": "method", - "name": "request", - "access": "public", - "tagname": "", - "params": [ - { - "name": "request", - "description": "", - "type": "RequestInfo" - } - ], - "return": { - "description": "", - "type": "Future" - }, - "class": "RequestManager", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/types.ts", - "line": 73, - "description": "Cancel this request by firing the AbortController's signal.", - "itemtype": "method", - "name": "abort", - "params": [ - { - "name": "reason", - "description": "optional reason for aborting the request", - "type": "String", - "optional": true - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "", - "type": "Void" - }, - "class": "Future", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/types.ts", - "line": 82, - "description": "Get the response stream, if any, once made available.", - "itemtype": "method", - "name": "getStream", - "access": "public", - "tagname": "", - "return": { - "description": "", - "type": "Promise" - }, - "class": "Future", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/types.ts", - "line": 91, - "description": "Run a callback when this request completes. Use sparingly,\nmostly useful for instrumentation and infrastructure.", - "itemtype": "method", - "name": "onFinalize", - "params": [ - { - "name": "cb", - "description": "the callback to run" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "void" - }, - "class": "Future", - "module": "@ember-data/request" - }, - { - "file": "../packages/request/src/-private/types.ts", - "line": 315, - "description": "Method to implement to handle requests. Receives the request\ncontext and a nextFn to call to pass-along the request to\nother handlers.", - "itemtype": "method", - "name": "request", - "access": "public", - "tagname": "", - "params": [ - { - "name": "context", - "description": "" - }, - { - "name": "next", - "description": "" - } - ], - "class": " Handler", - "module": "@ember-data/request" - }, - { - "file": "../packages/serializer/src/-private/transforms/transform.js", - "line": 82, - "description": "When given a deserialized value from a record attribute this\nmethod must return the serialized value.\n\nExample\n\n```javascript\nserialize(deserialized, options) {\n return deserialized ? null : Number(deserialized);\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "deserialized", - "description": "The deserialized value" - }, - { - "name": "options", - "description": "hash of options passed to `attr`" - } - ], - "return": { - "description": "The serialized value" - }, - "class": "Transform", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/-private/transforms/transform.js", - "line": 100, - "description": "When given a serialized value from a JSON object this method must\nreturn the deserialized value for the record attribute.\n\nExample\n\n```javascript\ndeserialize(serialized, options) {\n return empty(serialized) ? null : Number(serialized);\n}\n```", - "itemtype": "method", - "name": "deserialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "serialized", - "description": "The serialized value" - }, - { - "name": "options", - "description": "hash of options passed to `attr`" - } - ], - "return": { - "description": "The deserialized value" - }, - "class": "Transform", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 105, - "description": "Normalize the record and recursively normalize/extract all the embedded records\nwhile pushing them into the store as they are encountered\n\nA payload with an attr configured for embedded records needs to be extracted:\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"Rails is unagi\"\n }, {\n \"id\": \"2\",\n \"body\": \"Omakase O_o\"\n }]\n }\n}\n```", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "to be normalized", - "type": "Object" - }, - { - "name": "prop", - "description": "the hash has been referenced by", - "type": "String" - } - ], - "return": { - "description": "the normalized hash", - "type": "Object" - }, - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 149, - "description": "Serialize `belongsTo` relationship when it is configured as an embedded object.\n\nThis example of an author model belongs to a post model:\n\n```js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nPost = Model.extend({\n title: attr('string'),\n body: attr('string'),\n author: belongsTo('author')\n});\n\nAuthor = Model.extend({\n name: attr('string'),\n post: belongsTo('post')\n});\n```\n\nUse a custom (type) serializer for the post model to configure embedded author\n\n```app/serializers/post.js\nimport RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n author: { embedded: 'always' }\n }\n}\n```\n\nA payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"author\": {\n \"id\": \"2\"\n \"name\": \"dhh\"\n }\n }\n}\n```", - "itemtype": "method", - "name": "serializeBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 253, - "description": "Serializes `hasMany` relationships when it is configured as embedded objects.\n\nThis example of a post model has many comments:\n\n```js\nimport Model, { attr, belongsTo, hasMany } from '@ember-data/model';\n\nPost = Model.extend({\n title: attr('string'),\n body: attr('string'),\n comments: hasMany('comment')\n});\n\nComment = Model.extend({\n body: attr('string'),\n post: belongsTo('post')\n});\n```\n\nUse a custom (type) serializer for the post model to configure embedded comments\n\n```app/serializers/post.js\nimport RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n comments: { embedded: 'always' }\n }\n}\n```\n\nA payload with an attribute configured for embedded records can serialize\nthe records together under the root attribute's payload:\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"body\": \"I want this for my ORM, I want that for my template language...\"\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"Rails is unagi\"\n }, {\n \"id\": \"2\",\n \"body\": \"Omakase O_o\"\n }]\n }\n}\n```\n\nThe attrs options object can use more specific instruction for extracting and\nserializing. When serializing, an option to embed `ids`, `ids-and-types` or `records` can be set.\nWhen extracting the only option is `records`.\n\nSo `{ embedded: 'always' }` is shorthand for:\n`{ serialize: 'records', deserialize: 'records' }`\n\nTo embed the `ids` for a related object (using a hasMany relationship):\n\n```app/serializers/post.js\nimport RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class PostSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n comments: { serialize: 'ids', deserialize: 'records' }\n }\n}\n```\n\n```js\n{\n \"post\": {\n \"id\": \"1\"\n \"title\": \"Rails is omakase\",\n \"body\": \"I want this for my ORM, I want that for my template language...\"\n \"comments\": [\"1\", \"2\"]\n }\n}\n```\n\nTo embed the relationship as a collection of objects with `id` and `type` keys, set\n`ids-and-types` for the related object.\n\nThis is particularly useful for polymorphic relationships where records don't share\nthe same table and the `id` is not enough information.\n\nFor example having a user that has many pets:\n\n```js\nUser = Model.extend({\n name: attr('string'),\n pets: hasMany('pet', { polymorphic: true })\n});\n\nPet = Model.extend({\n name: attr('string'),\n});\n\nCat = Pet.extend({\n // ...\n});\n\nParrot = Pet.extend({\n // ...\n});\n```\n\n```app/serializers/user.js\nimport RESTSerializer, { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';\n\nexport default class UserSerializer extends RESTSerializer.extend(EmbeddedRecordsMixin) {\n attrs = {\n pets: { serialize: 'ids-and-types', deserialize: 'records' }\n }\n}\n```\n\n```js\n{\n \"user\": {\n \"id\": \"1\"\n \"name\": \"Bertin Osborne\",\n \"pets\": [\n { \"id\": \"1\", \"type\": \"Cat\" },\n { \"id\": \"1\", \"type\": \"Parrot\"}\n ]\n }\n}\n```", - "itemtype": "method", - "name": "serializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 470, - "description": "When serializing an embedded record, modify the property (in the `JSON` payload)\nthat refers to the parent record (foreign key for the relationship).\n\nSerializing a `belongsTo` relationship removes the property that refers to the\nparent record\n\nSerializing a `hasMany` relationship does not remove the property that refers to\nthe parent record.", - "itemtype": "method", - "name": "removeEmbeddedForeignKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "embeddedSnapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - }, - { - "name": "json", - "description": "", - "type": "Object" - } - ], - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 549, - "itemtype": "method", - "name": "_extractEmbeddedRecords", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 567, - "itemtype": "method", - "name": "_extractEmbeddedHasMany", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 596, - "itemtype": "method", - "name": "_extractEmbeddedBelongsTo", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/-private/embedded-records-mixin.js", - "line": 619, - "itemtype": "method", - "name": "_normalizeEmbeddedRelationship", - "access": "private", - "tagname": "", - "class": "EmbeddedRecordsMixin", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 140, - "description": "The `store` property is the application's `store` that contains\nall records. It can be used to look up serializers for other model\ntypes that may be nested inside the payload response.\n\nExample:\n\n```js\nSerializer.extend({\n extractRelationship(relationshipModelName, relationshipHash) {\n let modelClass = this.store.modelFor(relationshipModelName);\n let relationshipSerializer = this.store.serializerFor(relationshipModelName);\n return relationshipSerializer.normalize(modelClass, relationshipHash);\n }\n});\n```", - "itemtype": "property", - "name": "store", - "type": "{Store}", - "access": "public", - "tagname": "", - "class": "Serializer", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 162, - "description": "The `normalizeResponse` method is used to normalize a payload from the\nserver to a JSON-API Document.\n\nhttp://jsonapi.org/format/#document-structure\n\nExample:\n\n```js\nSerializer.extend({\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n if (requestType === 'findRecord') {\n return this.normalize(primaryModelClass, payload);\n } else {\n return payload.reduce(function(documentHash, item) {\n let { data, included } = this.normalize(primaryModelClass, item);\n documentHash.included.push(...included);\n documentHash.data.push(data);\n return documentHash;\n }, { data: [], included: [] })\n }\n }\n});\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "Serializer", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 198, - "description": "The `serialize` method is used when a record is saved in order to convert\nthe record into the form that your external data source expects.\n\n`serialize` takes an optional `options` hash with a single option:\n\n- `includeId`: If this is `true`, `serialize` should include the ID\n in the serialized object it builds.\n\nExample:\n\n```js\nSerializer.extend({\n serialize(snapshot, options) {\n let json = {\n id: snapshot.id\n };\n\n snapshot.eachAttribute((key, attribute) => {\n json[key] = snapshot.attr(key);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n json[key] = snapshot.belongsTo(key, { id: true });\n } else if (relationship.kind === 'hasMany') {\n json[key] = snapshot.hasMany(key, { ids: true });\n }\n });\n\n return json;\n },\n});\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object", - "optional": true - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "Serializer", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/index.ts", - "line": 240, - "description": "The `normalize` method is used to convert a payload received from your\nexternal data source into the normalized form `store.push()` expects. You\nshould override this method, munge the hash and return the normalized\npayload.\n\nExample:\n\n```js\nSerializer.extend({\n normalize(modelClass, resourceHash) {\n let data = {\n id: resourceHash.id,\n type: modelClass.modelName,\n attributes: resourceHash\n };\n return { data: data };\n }\n})\n```", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "Serializer", - "module": "@ember-data/serializer" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 139, - "itemtype": "method", - "name": "_normalizeDocumentHelper", - "params": [ - { - "name": "documentHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 176, - "itemtype": "method", - "name": "_normalizeRelationshipDataHelper", - "params": [ - { - "name": "relationshipDataHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 188, - "itemtype": "method", - "name": "_normalizeResourceHelper", - "params": [ - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 215, - "description": "Normalize some data and push it into the store.", - "itemtype": "method", - "name": "pushPayload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 228, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 278, - "description": "Returns a relationship formatted as a JSON-API \"relationship object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships", - "itemtype": "method", - "name": "extractRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 305, - "description": "Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships", - "itemtype": "method", - "name": "extractRelationships", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 343, - "itemtype": "method", - "name": "_extractType", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "String" - }, - "access": "private", - "tagname": "", - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 354, - "description": "Dasherizes and singularizes the model name in the payload to match\nthe format Ember Data uses internally for the model name.\n\nFor example the key `posts` would be converted to `post` and the\nkey `studentAssesments` would be converted to `student-assesment`.", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 370, - "description": "Converts the model name to a pluralized version of the model name.\n\nFor example `post` would be converted to `posts` and\n`student-assesment` would be converted to `student-assesments`.", - "itemtype": "method", - "name": "payloadKeyFromModelName", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 406, - "description": "`keyForAttribute` can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.\nBy default `JSONAPISerializer` follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as the word separator in the JSON\nattribute keys.\n\nThis behaviour can be easily customized by extending this method.\n\nExample\n\n```app/serializers/application.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\nimport { dasherize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONAPISerializer {\n keyForAttribute(attr, method) {\n return dasherize(attr).toUpperCase();\n }\n}\n```", - "itemtype": "method", - "name": "keyForAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 438, - "description": "`keyForRelationship` can be used to define a custom key when\nserializing and deserializing relationship properties.\nBy default `JSONAPISerializer` follows the format used on the examples of\nhttp://jsonapi.org/format and uses dashes as word separators in\nrelationship properties.\n\nThis behaviour can be easily customized by extending this method.\n\nExample\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data/serializer/json-api';\n import { underscore } from '/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForRelationship(key, relationship, method) {\n return underscore(key);\n }\n }\n ```", - "itemtype": "method", - "name": "keyForRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json-api.js", - "line": 470, - "description": "Called when a record is saved in order to convert the\nrecord into JSON.\n\nFor example, consider this model:\n\n```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "attr": "body;", - "belongsto": "('user', { async: false, inverse: null })\n author;\n}\n```\n\nThe default serialization would create a JSON-API resource object like:\n\n```javascript\n{\n \"data\": {\n \"type\": \"comments\",\n \"attributes\": {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n },\n \"relationships\": {\n \"author\": {\n \"data\": {\n \"id\": \"12\",\n \"type\": \"users\"\n }\n }\n }\n }\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the attributes hash.\n\nBelongs-to relationships are converted into JSON-API\nresource identifier objects.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe JSONAPIAdapter passes in `includeId: true` when serializing a record\nfor `createRecord` or `updateRecord`.\n\n## Customization\n\nYour server may expect data in a different format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn data formatted to match your API's expectations, or override\nthe invoked adapter method and do the serialization in the adapter directly\nby using the provided snapshot.\n\nIf your API's format differs greatly from the JSON:API spec, you should\nconsider authoring your own adapter and serializer instead of extending\nthis class.\n\n```app/serializers/post.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\n\nexport default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\nimport { underscore, singularize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return underscore(attribute).toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + '_IDS';\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n}\n```\n\n## Tweaking the Default Formatting\n\nIf you just want to do some small tweaks on the default JSON:API formatted response,\nyou can call `super.serialize` first and make the tweaks\non the returned object.\n\n```app/serializers/post.js\nimport JSONAPISerializer from '@ember-data/serializer/json-api';\n\nexport default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.data.attributes.subject = json.data.attributes.title;\n delete json.data.attributes.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "JSONAPISerializer", - "module": "@ember-data/serializer/json-api" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 94, - "description": "The `primaryKey` is used when serializing and deserializing\ndata. Ember Data always uses the `id` property to store the id of\nthe record. The external source may not always follow this\nconvention. In these cases it is useful to override the\n`primaryKey` property to match the `primaryKey` of your external\nstore.\n\nExample\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n primaryKey = '_id'\n}\n```", - "itemtype": "property", - "name": "primaryKey", - "type": "{String}", - "access": "public", - "tagname": "", - "default": "'id'", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 119, - "description": "The `attrs` object can be used to declare a simple mapping between\nproperty names on `Model` records and payload keys in the\nserialized JSON object representing the record. An object with the\nproperty `key` can also be used to designate the attribute's key on\nthe response payload.\n\nExample\n\n```app/models/person.js\nimport Model, { attr } from '@ember-data/model';\n\nexport default class PersonModel extends Model {", - "attr": "('boolean') admin;\n}\n```\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PersonSerializer extends JSONSerializer {\n attrs = {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n}\n```\n\nYou can also remove attributes and relationships by setting the `serialize`\nkey to `false` in your mapping object.\n\nExample\n\n```app/serializers/person.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n attrs = {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n}\n```\n\nWhen serialized:\n\n```javascript\n{\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n}\n```\n\nNote that the `admin` is now not included in the payload.\n\nSetting `serialize` to `true` enforces serialization for hasMany\nrelationships even if it's neither a many-to-many nor many-to-none\nrelationship.", - "itemtype": "property", - "name": "attrs", - "access": "public", - "tagname": "", - "type": "{Object}", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 188, - "description": "Given a subclass of `Model` and a JSON object this method will\niterate through each attribute of the `Model` and invoke the\n`Transform#deserialize` method on the matching property of the\nJSON object. This method is typically called after the\nserializer's `normalize` method.", - "itemtype": "method", - "name": "applyTransforms", - "access": "private", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "data", - "description": "The data to transform", - "type": "Object" - } - ], - "return": { - "description": "data The transformed data object", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 217, - "description": "The `normalizeResponse` method is used to normalize a payload from the\nserver to a JSON-API Document.\n\nhttp://jsonapi.org/format/#document-structure\n\nThis method delegates to a more specific normalize method based on\nthe `requestType`.\n\nTo override this method with a custom one, make sure to call\n`return super.normalizeResponse(store, primaryModelClass, payload, id, requestType)` with your\npre-processed data.\n\nHere's an example of using `normalizeResponse` manually:\n\n```javascript\nsocket.on('message', function(message) {\n let data = message.data;\n let modelClass = store.modelFor(data.modelName);\n let serializer = store.serializerFor(data.modelName);\n let normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n store.push(normalized);\n});\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 278, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `findRecord`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 296, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `queryRecord`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 314, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `findAll`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindAllResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 332, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `findBelongsTo`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindBelongsToResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 350, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `findHasMany`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindHasManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 368, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `findMany`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeFindManyResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 386, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `query`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeQueryResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 404, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `createRecord`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeCreateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 422, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `deleteRecord`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeDeleteRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 440, - "description": "Called by the default normalizeResponse implementation when the\ntype of request is `updateRecord`", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeUpdateRecordResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 458, - "description": "normalizeUpdateRecordResponse, normalizeCreateRecordResponse and\nnormalizeDeleteRecordResponse delegate to this method by default.", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSaveResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 476, - "description": "normalizeQueryResponse and normalizeFindRecordResponse delegate to this\nmethod by default.", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeSingleResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 494, - "description": "normalizeQueryResponse, normalizeFindManyResponse, and normalizeFindHasManyResponse delegate\nto this method by default.", - "since": "1.13.0", - "itemtype": "method", - "name": "normalizeArrayResponse", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 512, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 561, - "description": "Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.\n\nIt takes the type of the record that is being normalized\n(as a Model class), the property where the hash was\noriginally found, and the hash to normalize.\n\nYou can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations.\n\nExample\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '/utils/string-utils';\nimport { get } from '@ember/object';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n normalize(typeClass, hash) {\n let fields = typeClass.fields;\n\n fields.forEach(function(type, field) {\n let payloadField = underscore(field);\n if (field === payloadField) { return; }\n\n hash[field] = hash[payloadField];\n delete hash[payloadField];\n });\n\n return super.normalize(...arguments);\n }\n}\n```", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "hash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 625, - "description": "Returns the resource's ID.", - "itemtype": "method", - "name": "extractId", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 640, - "description": "Returns the resource's attributes formatted as a JSON-API \"attributes object\".\n\nhttp://jsonapi.org/format/#document-resource-object-attributes", - "itemtype": "method", - "name": "extractAttributes", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 665, - "description": "Returns a relationship formatted as a JSON-API \"relationship object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships", - "itemtype": "method", - "name": "extractRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 700, - "description": "Returns a polymorphic relationship formatted as a JSON-API \"relationship object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships\n\n`relationshipOptions` is a hash which contains more information about the\npolymorphic relationship which should be extracted:\n - `resourceHash` complete hash of the resource the relationship should be\n extracted from\n - `relationshipKey` key under which the value for the relationship is\n extracted from the resourceHash\n - `relationshipMeta` meta information about the relationship", - "itemtype": "method", - "name": "extractPolymorphicRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipModelName", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - }, - { - "name": "relationshipOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 724, - "description": "Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\nhttp://jsonapi.org/format/#document-resource-object-relationships", - "itemtype": "method", - "name": "extractRelationships", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Object" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 796, - "description": "Dasherizes the model name in the payload", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 808, - "itemtype": "method", - "name": "normalizeRelationships", - "access": "private", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 831, - "itemtype": "method", - "name": "normalizeUsingDeclaredMapping", - "access": "private", - "tagname": "", - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 864, - "description": "Looks up the property key that was set by the custom `attr` mapping\npassed to the serializer.", - "itemtype": "method", - "name": "_getMappedKey", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 903, - "description": "Check attrs.key.serialize property to inform if the `key`\ncan be serialized", - "itemtype": "method", - "name": "_canSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key can be serialized", - "type": "Boolean" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 918, - "description": "When attrs.key.serialize is set to true then\nit takes priority over the other checks and the related\nattribute/relationship will be serialized", - "itemtype": "method", - "name": "_mustSerialize", - "access": "private", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the key must be serialized", - "type": "Boolean" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 934, - "description": "Check if the given hasMany relationship should be serialized\n\nBy default only many-to-many and many-to-none relationships are serialized.\nThis could be configured per relationship by Serializer's `attrs` object.", - "itemtype": "method", - "name": "shouldSerializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "relationshipType", - "description": "", - "type": "String" - } - ], - "return": { - "description": "true if the hasMany relationship should be serialized", - "type": "Boolean" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 957, - "description": "Called when a record is saved in order to convert the\nrecord into JSON.\n\nBy default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.\n\nFor example, consider this model:\n\n```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nexport default class CommentModel extends Model {", - "attr": "body;", - "belongsto": "('user') author;\n}\n```\n\nThe default serialization would create a JSON object like:\n\n```javascript\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\nimport { singularize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```javascript\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call `super.serialize` first and make the tweaks on\nthe returned JSON.\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1135, - "description": "You can use this method to customize how a serialized record is added to the complete\nJSON hash to be sent to the server. By default the JSON Serializer does not namespace\nthe payload and just sends the raw serialized JSON object.\nIf your server expects namespaced keys, you should consider using the RESTSerializer.\nOtherwise you can override this method to customize how the record is added to the hash.\nThe hash property should be modified by reference.\n\nFor example, your server may expect underscored root objects.\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\nimport { decamelize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serializeIntoHash(data, type, snapshot, options) {\n let root = decamelize(type.modelName);\n data[root] = this.serialize(snapshot, options);\n }\n}\n```", - "itemtype": "method", - "name": "serializeIntoHash", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1168, - "description": "`serializeAttribute` can be used to customize how `attr`\nproperties are serialized\n\nFor example if you wanted to ensure all your attributes were always\nserialized as properties on an `attributes` object you could\nwrite:\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n serializeAttribute(snapshot, json, key, attributes) {\n json.attributes = json.attributes || {};\n super.serializeAttribute(snapshot, json.attributes, key, attributes);\n }\n}\n```", - "itemtype": "method", - "name": "serializeAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "attribute", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1216, - "description": "`serializeBelongsTo` can be used to customize how `belongsTo`\nproperties are serialized.\n\nExample\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serializeBelongsTo(snapshot, json, relationship) {\n let key = relationship.key;\n let belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForRelationship ? this.keyForRelationship(key, \"belongsTo\", \"serialize\") : key;\n\n json[key] = !belongsTo ? null : belongsTo.record.toJSON();\n }\n}\n```", - "itemtype": "method", - "name": "serializeBelongsTo", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1270, - "description": "`serializeHasMany` can be used to customize how `hasMany`\nproperties are serialized.\n\nExample\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n serializeHasMany(snapshot, json, relationship) {\n let key = relationship.key;\n if (key === 'comments') {\n return;\n } else {\n super.serializeHasMany(...arguments);\n }\n }\n}\n```", - "itemtype": "method", - "name": "serializeHasMany", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1317, - "description": "You can use this method to customize how polymorphic objects are\nserialized. Objects are considered to be polymorphic if\n`{ polymorphic: true }` is pass as the second argument to the\n`belongsTo` function.\n\nExample\n\n```app/serializers/comment.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class CommentSerializer extends JSONSerializer {\n serializePolymorphicType(snapshot, json, relationship) {\n let key = relationship.key;\n let belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n if (!belongsTo) {\n json[key + '_type'] = null;\n } else {\n json[key + '_type'] = belongsTo.modelName;\n }\n }\n}\n```", - "itemtype": "method", - "name": "serializePolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1352, - "description": "`extractMeta` is used to deserialize any meta information in the\nadapter payload. By default Ember Data expects meta information to\nbe located on the `meta` property of the payload object.\n\nExample\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n extractMeta(store, typeClass, payload) {\n if (payload && payload.hasOwnProperty('_pagination')) {\n let meta = payload._pagination;\n delete payload._pagination;\n return meta;\n }\n }\n}\n```", - "itemtype": "method", - "name": "extractMeta", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1387, - "description": "`extractErrors` is used to extract model errors when a call\nto `Model#save` fails with an `InvalidError`. By default\nEmber Data expects error information to be located on the `errors`\nproperty of the payload object.\n\nThis serializer expects this `errors` object to be an Array similar\nto the following, compliant with the https://jsonapi.org/format/#errors specification:\n\n```js\n{\n \"errors\": [\n {\n \"detail\": \"This username is already taken!\",\n \"source\": {\n \"pointer\": \"data/attributes/username\"\n }\n }, {\n \"detail\": \"Doesn't look like a valid email.\",\n \"source\": {\n \"pointer\": \"data/attributes/email\"\n }\n }\n ]\n}\n```\n\nThe key `detail` provides a textual description of the problem.\nAlternatively, the key `title` can be used for the same purpose.\n\nThe nested keys `source.pointer` detail which specific element\nof the request data was invalid.\n\nNote that JSON-API also allows for object-level errors to be placed\nin an object with pointer `data`, signifying that the problem\ncannot be traced to a specific attribute:\n\n```javascript\n{\n \"errors\": [\n {\n \"detail\": \"Some generic non property error message\",\n \"source\": {\n \"pointer\": \"data\"\n }\n }\n ]\n}\n```\n\nWhen turn into a `Errors` object, you can read these errors\nthrough the property `base`:\n\n```handlebars\n{{#each @model.errors.base as |error|}}\n
\n {{error.message}}\n
\n{{/each}}\n```\n\nExample of alternative implementation, overriding the default\nbehavior to deal with a different format of errors:\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default class PostSerializer extends JSONSerializer {\n extractErrors(store, typeClass, payload, id) {\n if (payload && typeof payload === 'object' && payload._problems) {\n payload = payload._problems;\n this.normalizeErrors(typeClass, payload);\n }\n return payload;\n }\n}\n```", - "itemtype": "method", - "name": "extractErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "(String|Number)" - } - ], - "return": { - "description": "json The deserialized errors", - "type": "Object" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1522, - "description": "`keyForAttribute` can be used to define rules for how to convert an\nattribute name in your model to a key in your JSON.\n\nExample\n\n```app/serializers/application.js\nimport JSONSerializer from '@ember-data/serializer/json';\nimport { underscore } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends JSONSerializer {\n keyForAttribute(attr, method) {\n return underscore(attr).toUpperCase();\n }\n}\n```", - "itemtype": "method", - "name": "keyForAttribute", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1549, - "description": "`keyForRelationship` can be used to define a custom key when\nserializing and deserializing relationship properties. By default\n`JSONSerializer` does not provide an implementation of this method.\n\nExample\n\n ```app/serializers/post.js\n import JSONSerializer from '@ember-data/serializer/json';\n import { underscore } from '/utils/string-utils';\n\n export default class PostSerializer extends JSONSerializer {\n keyForRelationship(key, relationship, method) {\n return `rel_${underscore(key)}`;\n }\n }\n ```", - "itemtype": "method", - "name": "keyForRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1578, - "description": "`keyForLink` can be used to define a custom key when deserializing link\nproperties.", - "itemtype": "method", - "name": "keyForLink", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "kind", - "description": "`belongsTo` or `hasMany`", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/json.js", - "line": 1594, - "itemtype": "method", - "name": "transformFor", - "access": "private", - "tagname": "", - "params": [ - { - "name": "attributeType", - "description": "", - "type": "String" - }, - { - "name": "skipAssertion", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "transform", - "type": "Transform" - }, - "class": "JSONSerializer", - "module": "@ember-data/serializer/json" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 71, - "description": "`keyForPolymorphicType` can be used to define a custom key when\nserializing and deserializing a polymorphic type. By default, the\nreturned key is `${key}Type`.\n\nExample\n\n ```app/serializers/post.js\n import RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer {\n keyForPolymorphicType(key, relationship) {\n let relationshipKey = this.keyForRelationship(key);\n\n return 'type-' + relationshipKey;\n }\n }\n ```", - "itemtype": "method", - "name": "keyForPolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - }, - { - "name": "typeClass", - "description": "", - "type": "String" - }, - { - "name": "method", - "description": "", - "type": "String" - } - ], - "return": { - "description": "normalized key", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 103, - "description": "Normalizes a part of the JSON payload returned by\nthe server. You should override this method, munge the hash\nand call super if you have generic normalization to do.\n\nIt takes the type of the record that is being normalized\n(as a Model class), the property where the hash was\noriginally found, and the hash to normalize.\n\nFor example, if you have a payload that looks like this:\n\n```js\n{\n \"post\": {\n \"id\": 1,\n \"title\": \"Rails is omakase\",\n \"comments\": [ 1, 2 ]\n },\n \"comments\": [{\n \"id\": 1,\n \"body\": \"FIRST\"\n }, {\n \"id\": 2,\n \"body\": \"Rails is unagi\"\n }]\n}\n```\n\nThe `normalize` method will be called three times:\n\n* With `App.Post`, `\"posts\"` and `{ id: 1, title: \"Rails is omakase\", ... }`\n* With `App.Comment`, `\"comments\"` and `{ id: 1, body: \"FIRST\" }`\n* With `App.Comment`, `\"comments\"` and `{ id: 2, body: \"Rails is unagi\" }`\n\nYou can use this method, for example, to normalize underscored keys to camelized\nor other general-purpose normalizations. You will only need to implement\n`normalize` and manipulate the payload as desired.\n\nFor example, if the `IDs` under `\"comments\"` are provided as `_id` instead of\n`id`, you can specify how to normalize just the comments:\n\n```app/serializers/post.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n normalize(model, hash, prop) {\n if (prop === 'comments') {\n hash.id = hash._id;\n delete hash._id;\n }\n\n return super.normalize(...arguments);\n }\n}\n```\n\nOn each call to the `normalize` method, the third parameter (`prop`) is always\none of the keys that were in the original payload or in the result of another\nnormalization as `normalizeResponse`.", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelClass", - "description": "", - "type": "Model" - }, - { - "name": "resourceHash", - "description": "", - "type": "Object" - }, - { - "name": "prop", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 171, - "description": "Normalizes an array of resource payloads and returns a JSON-API Document\nwith primary data and, if any, included data as `{ data, included }`.", - "itemtype": "method", - "name": "_normalizeArray", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "arrayHash", - "description": "", - "type": "Object" - }, - { - "name": "prop", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 222, - "itemtype": "method", - "name": "_normalizeResponse", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "primaryModelClass", - "description": "", - "type": "Model" - }, - { - "name": "payload", - "description": "", - "type": "Object" - }, - { - "name": "id", - "description": "", - "type": "String|Number" - }, - { - "name": "requestType", - "description": "", - "type": "String" - }, - { - "name": "isSingle", - "description": "", - "type": "Boolean" - } - ], - "return": { - "description": "JSON-API Document", - "type": "Object" - }, - "access": "private", - "tagname": "", - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 364, - "description": "This method allows you to push a payload containing top-level\ncollections of records organized per type.\n\n```js\n{\n \"posts\": [{\n \"id\": \"1\",\n \"title\": \"Rails is omakase\",\n \"author\", \"1\",\n \"comments\": [ \"1\" ]\n }],\n \"comments\": [{\n \"id\": \"1\",\n \"body\": \"FIRST\"\n }],\n \"users\": [{\n \"id\": \"1\",\n \"name\": \"@d2h\"\n }]\n}\n```\n\nIt will first normalize the payload, so you can use this to push\nin data streaming in from your server structured the same way\nthat fetches and saves are structured.", - "itemtype": "method", - "name": "pushPayload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "store", - "description": "", - "type": "Store" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 425, - "description": "This method is used to convert each JSON root key in the payload\ninto a modelName that it can use to look up the appropriate model for\nthat part of the payload.\n\nFor example, your server may send a model name that does not correspond with\nthe name of the model in your app. Let's take a look at an example model,\nand an example payload:\n\n```app/models/post.js\nimport Model from '@ember-data/model';\n\nexport default class Post extends Model {}\n```\n\n```javascript\n {\n \"blog/post\": {\n \"id\": \"1\n }\n }\n```\n\nEmber Data is going to normalize the payload's root key for the modelName. As a result,\nit will try to look up the \"blog/post\" model. Since we don't have a model called \"blog/post\"\n(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error\nbecause it cannot find the \"blog/post\" model.\n\nSince we want to remove this namespace, we can define a serializer for the application that will\nremove \"blog/\" from the payload key whenver it's encountered by Ember Data:\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n modelNameFromPayloadKey(payloadKey) {\n if (payloadKey === 'blog/post') {\n return super.modelNameFromPayloadKey(payloadKey.replace('blog/', ''));\n } else {\n return super.modelNameFromPayloadKey(payloadKey);\n }\n }\n}\n```\n\nAfter refreshing, Ember Data will appropriately look up the \"post\" model.\n\nBy default the modelName for a model is its\nname in dasherized form. This means that a payload key like \"blogPost\" would be\nnormalized to \"blog-post\" when Ember Data looks up the model. Usually, Ember Data\ncan use the correct inflection to do this for you. Most of the time, you won't\nneed to override `modelNameFromPayloadKey` for this purpose.", - "itemtype": "method", - "name": "modelNameFromPayloadKey", - "access": "public", - "tagname": "", - "params": [ - { - "name": "key", - "description": "", - "type": "String" - } - ], - "return": { - "description": "the model's modelName", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 489, - "description": "Called when a record is saved in order to convert the\nrecord into JSON.\n\nBy default, it creates a JSON object with a key for\neach attribute and belongsTo relationship.\n\nFor example, consider this model:\n\n```app/models/comment.js\nimport Model, { attr, belongsTo } from '@ember-data/model';\n\nexport default class Comment extends Model {", - "attr": "body", - "belongsto": "('user') author\n}\n```\n\nThe default serialization would create a JSON object like:\n\n```js\n{\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n}\n```\n\nBy default, attributes are passed through as-is, unless\nyou specified an attribute type (`attr('date')`). If\nyou specify a transform, the JavaScript value will be\nserialized when inserted into the JSON hash.\n\nBy default, belongs-to relationships are converted into\nIDs when inserted into the JSON hash.\n\n## IDs\n\n`serialize` takes an options hash with a single option:\n`includeId`. If this option is `true`, `serialize` will,\nby default include the ID in the JSON object it builds.\n\nThe adapter passes in `includeId: true` when serializing\na record for `createRecord`, but not for `updateRecord`.\n\n## Customization\n\nYour server may expect a different JSON format than the\nbuilt-in serialization format.\n\nIn that case, you can implement `serialize` yourself and\nreturn a JSON hash of your choosing.\n\n```app/serializers/post.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n```\n\n## Customizing an App-Wide Serializer\n\nIf you want to define a serializer for your entire\napplication, you'll probably want to use `eachAttribute`\nand `eachRelationship` on the record.\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\nimport { pluralize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute(function(name) {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship(function(name, relationship) {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n}\n\nfunction serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n}\n\nfunction serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n}\n```\n\nThis serializer will generate JSON that looks like this:\n\n```js\n{\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ 1, 2, 3 ]\n}\n```\n\n## Tweaking the Default JSON\n\nIf you just want to do some small tweaks on the default JSON,\nyou can call super first and make the tweaks on the returned\nJSON.\n\n```app/serializers/post.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(snapshot, options);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n}\n```", - "itemtype": "method", - "name": "serialize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "json", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 646, - "description": "You can use this method to customize the root keys serialized into the JSON.\nThe hash property should be modified by reference (possibly using something like _.extend)\nBy default the REST Serializer sends the modelName of a model, which is a camelized\nversion of the name.\n\nFor example, your server may expect underscored root objects.\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\nimport { decamelize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n serializeIntoHash(data, type, record, options) {\n let root = decamelize(type.modelName);\n data[root] = this.serialize(record, options);\n }\n}\n```", - "itemtype": "method", - "name": "serializeIntoHash", - "access": "public", - "tagname": "", - "params": [ - { - "name": "hash", - "description": "", - "type": "Object" - }, - { - "name": "typeClass", - "description": "", - "type": "Model" - }, - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 678, - "description": "You can use `payloadKeyFromModelName` to override the root key for an outgoing\nrequest. By default, the RESTSerializer returns a camelized version of the\nmodel's name.\n\nFor a model called TacoParty, its `modelName` would be the string `taco-party`. The RESTSerializer\nwill send it to the server with `tacoParty` as the root key in the JSON payload:\n\n```js\n{\n \"tacoParty\": {\n \"id\": \"1\",\n \"location\": \"Matthew Beale's House\"\n }\n}\n```\n\nFor example, your server may expect dasherized root objects:\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\nimport { dasherize } from '/utils/string-utils';\n\nexport default class ApplicationSerializer extends RESTSerializer {\n payloadKeyFromModelName(modelName) {\n return dasherize(modelName);\n }\n}\n```\n\nGiven a `TacoParty` model, calling `save` on it would produce an outgoing\nrequest like:\n\n```js\n{\n \"taco-party\": {\n \"id\": \"1\",\n \"location\": \"Matthew Beale's House\"\n }\n}\n```", - "itemtype": "method", - "name": "payloadKeyFromModelName", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "String" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 729, - "description": "You can use this method to customize how polymorphic objects are serialized.\nBy default the REST Serializer creates the key by appending `Type` to\nthe attribute and value from the model's camelcased model name.", - "itemtype": "method", - "name": "serializePolymorphicType", - "access": "public", - "tagname": "", - "params": [ - { - "name": "snapshot", - "description": "", - "type": "Snapshot" - }, - { - "name": "json", - "description": "", - "type": "Object" - }, - { - "name": "relationship", - "description": "", - "type": "Object" - } - ], - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/serializer/src/rest.js", - "line": 752, - "description": "You can use this method to customize how a polymorphic relationship should\nbe extracted.", - "itemtype": "method", - "name": "extractPolymorphicRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "relationshipType", - "description": "", - "type": "Object" - }, - { - "name": "relationshipHash", - "description": "", - "type": "Object" - }, - { - "name": "relationshipOptions", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "Object" - }, - "class": "RESTSerializer", - "module": "@ember-data/serializer/rest" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 180, - "description": "Internal hook to allow management of merge conflicts with identifiers.\n\nwe allow late binding of this private internal merge so that\nthe cache can insert itself here to handle elimination of duplicates", - "itemtype": "method", - "name": "__configureMerge", - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 193, - "itemtype": "method", - "name": "_getRecordIdentifier", - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 344, - "description": "allows us to peek without generating when needed\nuseful for the \"create\" case when we need to see if\nwe are accidentally overwritting something", - "itemtype": "method", - "name": "peekRecordIdentifier", - "params": [ - { - "name": "resource", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier | undefined" - }, - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 358, - "description": "Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.\nReturns `null` if the request does not have a `cacheKey` or `url`.", - "itemtype": "method", - "name": "getOrCreateDocumentIdentifier", - "params": [ - { - "name": "request", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 392, - "description": "Returns the Identifier for the given Resource, creates one if it does not yet exist.\n\nSpecifically this means that we:\n\n- validate the `id` `type` and `lid` combo against known identifiers\n- return an object with an `lid` that is stable (repeated calls with the same\n `id` + `type` or `lid` will return the same `lid` value)\n- this referential stability of the object itself is guaranteed", - "itemtype": "method", - "name": "getOrCreateRecordIdentifier", - "params": [ - { - "name": "resource", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 415, - "description": "Returns a new Identifier for the supplied data. Call this method to generate\nan identifier when a new resource is being created local to the client and\npotentially does not have an `id`.\n\nDelegates generation to the user supplied `GenerateMethod` if one has been provided\nwith the signature `generateMethod({ type }, 'record')`.", - "itemtype": "method", - "name": "createIdentifierForNewRecord", - "params": [ - { - "name": "data", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 455, - "description": "Provides the opportunity to update secondary lookup tables for existing identifiers\nCalled after an identifier created with `createIdentifierForNewRecord` has been\ncommitted.\n\nAssigned `id` to an `Identifier` if `id` has not previously existed; however,\nattempting to change the `id` or calling update without providing an `id` when\none is missing will throw an error.\n\n - sets `id` (if `id` was previously `null`)\n - `lid` and `type` MUST NOT be altered post creation\n\n If a merge occurs, it is possible the returned identifier does not match the originally\n provided identifier. In this case the abandoned identifier will go through the usual\n `forgetRecordIdentifier` codepaths.", - "itemtype": "method", - "name": "updateRecordIdentifier", - "params": [ - { - "name": "identifierObject", - "description": "" - }, - { - "name": "data", - "description": "" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 544, - "itemtype": "method", - "name": "_mergeRecordIdentifiers", - "access": "private", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/identifier-cache.ts", - "line": 574, - "description": "Provides the opportunity to eliminate an identifier from secondary lookup tables\nas well as eliminates it from ember-data's own lookup tables and book keeping.\n\nUseful when a record has been deleted and the deletion has been persisted and\nwe do not care about the record anymore. Especially useful when an `id` of a\ndeleted record might be reused later for a new record.", - "itemtype": "method", - "name": "forgetRecordIdentifier", - "params": [ - { - "name": "identifierObject", - "description": "" - } - ], - "access": "public", - "tagname": "", - "class": "IdentifierCache", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/caches/instance-cache.ts", - "line": 48, - "description": "Retrieves the unique referentially-stable [RecordIdentifier](/ember-data/release/classes/StableRecordIdentifier)\nassigned to the given record instance.\n```js\nimport { recordIdentifierFor } from \"@ember-data/store\";\n// ... gain access to a record, for instance with peekRecord or findRecord\nconst record = store.peekRecord(\"user\", \"1\");\n// get the identifier for the record (see docs for StableRecordIdentifier)\nconst identifier = recordIdentifierFor(record);\n// access the identifier's properties.\nconst { id, type, lid } = identifier;\n```", - "itemtype": "method", - "name": "recordIdentifierFor", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "record", - "description": "a record instance previously obstained from the store.", - "type": "Object" - } - ], - "return": { - "description": "", - "type": "StableRecordIdentifier" - }, - "class": "@ember-data/store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 55, - "description": "The `id` of the record that this reference refers to.\n\nTogether, the `type` and `id` properties form a composite key for\nthe identity map.\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\nuserRef.id(); // '1'\n```", - "itemtype": "method", - "name": "id", - "access": "public", - "tagname": "", - "return": { - "description": "The id of the record.", - "type": "String" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 78, - "description": "The `identifier` of the record that this reference refers to.\n\nTogether, the `type` and `id` properties form a composite key for\nthe identity map.\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\nuserRef.identifier(); // '1'\n```", - "itemtype": "method", - "name": "identifier", - "access": "public", - "tagname": "", - "return": { - "description": "The identifier of the record.", - "type": "String" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 100, - "description": "How the reference will be looked up when it is loaded. Currently\nthis always returns `identity` to signify that a record will be\nloaded by its `type` and `id`.\n\nExample\n\n```javascript\nconst userRef = store.getReference('user', 1);\n\nuserRef.remoteType(); // 'identity'\n```", - "itemtype": "method", - "name": "remoteType", - "access": "public", - "tagname": "", - "return": { - "description": "'identity'", - "type": "String" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 121, - "description": "This API allows you to provide a reference with new data. The\nsimplest usage of this API is similar to `store.push`: you provide a\nnormalized hash of data and the object represented by the reference\nwill update.\n\nIf you pass a promise to `push`, Ember Data will not ask the adapter\nfor the data if another attempt to fetch it is made in the\ninterim. When the promise resolves, the underlying object is updated\nwith the new data, and the promise returned by *this function* is resolved\nwith that object.\n\nFor example, `recordReference.push(promise)` will be resolved with a\nrecord.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n // provide data for reference\n userRef.push({\n data: {\n id: \"1\",\n type: \"user\",\n attributes: {\n username: \"@user\"\n }\n }\n }).then(function(user) {\n userRef.value() === user;\n });\n ```", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "objectOrPromise", - "description": "a JSON:API ResourceDocument or a promise resolving to one" - } - ], - "return": { - "description": "a promise for the value (record or relationship)" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 167, - "description": "If the entity referred to by the reference is already loaded, it is\npresent as `reference.value`. Otherwise the value returned by this function\nis `null`.\n\n Example\n\n ```javascript\n let userRef = store.getReference('user', 1);\n\n userRef.value(); // user\n ```", - "itemtype": "method", - "name": "value", - "access": "public", - "tagname": "", - "return": { - "description": "the record for this RecordReference", - "type": "Model" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 188, - "description": "Triggers a fetch for the backing entity based on its `remoteType`\n(see `remoteType` definitions per reference type).\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\n// load user (via store.find)\nuserRef.load().then(...)\n```", - "itemtype": "method", - "name": "load", - "access": "public", - "tagname": "", - "return": { - "description": "the record for this RecordReference", - "type": "Promise" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/legacy-model-support/record-reference.ts", - "line": 213, - "description": "Reloads the record if it is already loaded. If the record is not\nloaded it will load the record via `store.findRecord`\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\n// or trigger a reload\nuserRef.reload().then(...)\n```", - "itemtype": "method", - "name": "reload", - "access": "public", - "tagname": "", - "return": { - "description": "the record for this RecordReference", - "type": "Promise" - }, - "class": "RecordReference", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 50, - "description": "Cache the response to a request\n\nUnlike `store.push` which has UPSERT\nsemantics, `put` has `replace` semantics similar to\nthe `http` method `PUT`\n\nthe individually cacheabl\ne resource data it may contain\nshould upsert, but the document data surrounding it should\nfully replace any existing information\n\nNote that in order to support inserting arbitrary data\nto the cache that did not originate from a request `put`\nshould expect to sometimes encounter a document with only\na `content` member and therefor must not assume the existence\nof `request` and `response` on the document.", - "itemtype": "method", - "name": "put", - "params": [ - { - "name": "doc", - "description": "", - "type": "StructuredDocument" - } - ], - "return": { - "description": "", - "type": "ResourceDocument" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 77, - "description": "Perform an operation on the cache to update the remote state.\n\nNote: currently the only valid operation is a MergeOperation\nwhich occurs when a collision of identifiers is detected.", - "itemtype": "method", - "name": "patch", - "access": "public", - "tagname": "", - "params": [ - { - "name": "op", - "description": "the operation to perform" - } - ], - "return": { - "description": "", - "type": "Void" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 92, - "description": "Update resource data with a local mutation. Currently supports operations\non relationships only.", - "itemtype": "method", - "name": "mutate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "mutation", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 104, - "description": "Peek resource data from the Cache.\n\nIn development, if the return value\nis JSON the return value\nwill be deep-cloned and deep-frozen\nto prevent mutation thereby enforcing cache\nImmutability.\n\nThis form of peek is useful for implementations\nthat want to feed raw-data from cache to the UI\nor which want to interact with a blob of data\ndirectly from the presentation cache.\n\nAn implementation might want to do this because\nde-referencing records which read from their own\nblob is generally safer because the record does\nnot require retainining connections to the Store\nand Cache to present data on a per-field basis.\n\nThis generally takes the place of `getAttr` as\nan API and may even take the place of `getRelationship`\ndepending on implementation specifics, though this\nlatter usage is less recommended due to the advantages\nof the Graph handling necessary entanglements and\nnotifications for relational data.", - "itemtype": "method", - "name": "peek", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier | StableDocumentIdentifier" - } - ], - "return": { - "description": "the known resource data", - "type": "ResourceDocument | ResourceBlob | null" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 142, - "description": "Peek the Cache for the existing request data associated with\na cacheable request", - "itemtype": "method", - "name": "peekRequest", - "params": [ - { - "name": "UNKNOWN", - "description": "", - "type": "StableDocumentIdentifier" - } - ], - "return": { - "description": "", - "type": "StableDocumentIdentifier | null" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 155, - "description": "Push resource data from a remote source into the cache for this identifier", - "itemtype": "method", - "name": "upsert", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - }, - { - "name": "hasRecord", - "description": "" - } - ], - "return": { - "description": "if `hasRecord` is true then calculated key changes should be returned", - "type": "Void | string[]" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 172, - "description": "Create a fork of the cache from the current state.\n\nApplications should typically not call this method themselves,\npreferring instead to fork at the Store level, which will\nutilize this method to fork the cache.", - "itemtype": "method", - "name": "fork", - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 187, - "description": "Merge a fork back into a parent Cache.\n\nApplications should typically not call this method themselves,\npreferring instead to merge at the Store level, which will\nutilize this method to merge the caches.", - "itemtype": "method", - "name": "merge", - "params": [ - { - "name": "cache", - "description": "", - "type": "Cache" - } - ], - "access": "public", - "tagname": "", - "return": { - "description": "Promise" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 203, - "description": "Generate the list of changes applied to all\nrecord in the store.\n\nEach individual resource or document that has\nbeen mutated should be described as an individual\n`Change` entry in the returned array.\n\nA `Change` is described by an object containing up to\nthree properties: (1) the `identifier` of the entity that\nchanged; (2) the `op` code of that change being one of\n`upsert` or `remove`, and if the op is `upsert` a `patch`\ncontaining the data to merge into the cache for the given\nentity.\n\nThis `patch` is opaque to the Store but should be understood\nby the Cache and may expect to be utilized by an Adapter\nwhen generating data during a `save` operation.\n\nIt is generally recommended that the `patch` contain only\nthe updated state, ignoring fields that are unchanged\n\n```ts\ninterface Change {\n identifier: StableRecordIdentifier | StableDocumentIdentifier;\n op: 'upsert' | 'remove';\n patch?: unknown;\n}\n```", - "itemtype": "method", - "name": "diff", - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 243, - "description": "Serialize the entire contents of the Cache into a Stream\nwhich may be fed back into a new instance of the same Cache\nvia `cache.hydrate`.", - "itemtype": "method", - "name": "dump", - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 256, - "description": "hydrate a Cache from a Stream with content previously serialized\nfrom another instance of the same Cache, resolving when hydration\nis complete.\n\nThis method should expect to be called both in the context of restoring\nthe Cache during application rehydration after SSR **AND** at unknown\ntimes during the lifetime of an already booted application when it is\ndesired to bulk-load additional information into the cache. This latter\nbehavior supports optimizing pre/fetching of data for route transitions\nvia data-only SSR modes.", - "itemtype": "method", - "name": "hydrate", - "params": [ - { - "name": "stream", - "description": "", - "type": "ReadableStream" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "access": "public", - "tagname": "", - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 283, - "description": "[LIFECYLCE] Signal to the cache that a new record has been instantiated on the client\n\nIt returns properties from options that should be set on the record during the create\nprocess. This return value behavior is deprecated.", - "itemtype": "method", - "name": "clientDidCreate", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "options", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 298, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwill be part of a save transaction.", - "itemtype": "method", - "name": "willCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 310, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwas successfully updated as part of a save transaction.", - "itemtype": "method", - "name": "didCommit", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "data", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 323, - "description": "[LIFECYCLE] Signals to the cache that a resource\nwas update via a save transaction failed.", - "itemtype": "method", - "name": "commitWasRejected", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "errors", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 336, - "description": "[LIFECYCLE] Signals to the cache that all data for a resource\nshould be cleared.", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 351, - "description": "Retrieve the data for an attribute from the cache", - "itemtype": "method", - "name": "getAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "propertyName", - "description": "" - } - ], - "return": { - "description": "", - "type": "Unknown" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 364, - "description": "Mutate the data for an attribute in the cache", - "itemtype": "method", - "name": "setAttr", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "propertyName", - "description": "" - }, - { - "name": "value", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 377, - "description": "Query the cache for the changed attributes of a resource.", - "itemtype": "method", - "name": "changedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 389, - "description": "Query the cache for whether any mutated attributes exist", - "itemtype": "method", - "name": "hasChangedAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 401, - "description": "Tell the cache to discard any uncommitted mutations to attributes", - "itemtype": "method", - "name": "rollbackAttrs", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "the names of attributes that were restored" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 416, - "description": "Query the cache for the current state of a relationship property", - "itemtype": "method", - "name": "getRelationship", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "propertyName", - "description": "" - } - ], - "return": { - "description": "resource relationship object" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 435, - "description": "Update the cache state for the given resource to be marked as locally deleted,\nor remove such a mark.", - "itemtype": "method", - "name": "setIsDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "isDeleted", - "description": "" - } - ], - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 448, - "description": "Query the cache for any validation errors applicable to the given resource.", - "itemtype": "method", - "name": "getErrors", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 460, - "description": "Query the cache for whether a given resource has any available data", - "itemtype": "method", - "name": "isEmpty", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 472, - "description": "Query the cache for whether a given resource was created locally and not\nyet persisted.", - "itemtype": "method", - "name": "isNew", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 485, - "description": "Query the cache for whether a given resource is marked as deleted (but not\nnecessarily persisted yet).", - "itemtype": "method", - "name": "isDeleted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/cache-manager.ts", - "line": 498, - "description": "Query the cache for whether a given resource has been deleted and that deletion\nhas also been persisted.", - "itemtype": "method", - "name": "isDeletionCommitted", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "" - } - ], - "return": { - "description": "", - "type": "Boolean" - }, - "class": "CacheManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/notification-manager.ts", - "line": 101, - "description": "Subscribe to changes for a given resource identifier, resource addition/removal, or document addition/removal.\n\n```ts\nexport type CacheOperation = 'added' | 'removed' | 'updated' | 'state';\n\nexport interface NotificationCallback {\n (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;\n (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;\n}\nexport interface ResourceOperationCallback {\n // resource updates\n (identifier: StableRecordIdentifier, notificationType: CacheOperation): void;\n}\nexport interface DocumentOperationCallback {\n // document updates\n (identifier: StableDocumentIdentifier, notificationType: CacheOperation): void;\n}\n```", - "itemtype": "method", - "name": "subscribe", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableDocumentIdentifier | StableRecordIdentifier | 'resource' | 'document'" - }, - { - "name": "callback", - "description": "", - "type": "NotificationCallback | ResourceOperationCallback | DocumentOperationCallback" - } - ], - "return": { - "description": "an opaque token to be used with unsubscribe", - "type": "UnsubscribeToken" - }, - "class": "NotificationManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/notification-manager.ts", - "line": 156, - "description": "remove a previous subscription", - "itemtype": "method", - "name": "unsubscribe", - "access": "public", - "tagname": "", - "params": [ - { - "name": "token", - "description": "", - "type": "UnsubscribeToken" - } - ], - "class": "NotificationManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/managers/notification-manager.ts", - "line": 169, - "description": "Custom Caches and Application Code should not call this method directly.", - "itemtype": "method", - "name": "notify", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "value", - "description": "" - }, - { - "name": "key", - "description": "" - } - ], - "return": { - "description": "whether a notification was delivered to any subscribers", - "type": "Boolean" - }, - "access": "private", - "tagname": "", - "class": "NotificationManager", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/network/request-cache.ts", - "line": 159, - "description": "Subscribe to requests for a given resource identity.\n\nThe callback will receive the current state of the request.\n\n```ts\ninterface RequestState {\n state: 'pending' | 'fulfilled' | 'rejected';\n type: 'query' | 'mutation';\n request: Request;\n response?: { data: unknown };\n}\n```\n\nNote: It should be considered dangerous to use this API for more than simple\nstate derivation or debugging. The `request` and `response` properties are poorly\nspec'd and may change unexpectedly when shifting what Handlers are in use or how\nrequests are issued from the Store.\n\nWe expect to revisit this API in the near future as we continue to refine the\nRequestManager ergonomics, as a simpler but more powerful direct integration\nwith the RequestManager for these purposes is likely to be a better long-term\ndesign.", - "itemtype": "method", - "name": "subscribeForRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - }, - { - "name": "callback", - "description": "", - "type": "(state: RequestState) => void" - } - ], - "class": "RequestStateService", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/network/request-cache.ts", - "line": 195, - "description": "Retrieve all active requests for a given resource identity.", - "itemtype": "method", - "name": "getPendingRequestsForRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - } - ], - "return": { - "description": "an array of request states for any pending requests for the given identifier", - "type": "RequestState[]" - }, - "class": "RequestStateService", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/network/request-cache.ts", - "line": 210, - "description": "Retrieve the last completed request for a given resource identity.", - "itemtype": "method", - "name": "getLastRequestForRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "identifier", - "description": "", - "type": "StableRecordIdentifier" - } - ], - "return": { - "description": "the state of the most recent request for the given identifier", - "type": "RequestState | null" - }, - "class": "RequestStateService", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 166, - "description": "The flag to signal a `RecordArray` is currently loading data.\nExample\n```javascript\nlet people = store.peekAll('person');\npeople.isUpdating; // false\npeople.update();\npeople.isUpdating; // true\n```", - "itemtype": "property", - "name": "isUpdating", - "access": "public", - "tagname": "", - "type": "Boolean", - "class": "RecordArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 195, - "description": "The store that created this record array.", - "itemtype": "property", - "name": "store", - "access": "private", - "tagname": "", - "type": "Store", - "class": "RecordArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 432, - "description": "Used to get the latest version of all of the records in this array\nfrom the adapter.\n\nExample\n\n```javascript\nlet people = store.peekAll('person');\npeople.isUpdating; // false\n\npeople.update().then(function() {\n people.isUpdating; // false\n});\n\npeople.isUpdating; // true\n```", - "itemtype": "method", - "name": "update", - "access": "public", - "tagname": "", - "class": "RecordArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/record-arrays/identifier-array.ts", - "line": 483, - "description": "Saves all of the records in the `RecordArray`.\n\nExample\n\n```javascript\nlet messages = store.peekAll('message');\nmessages.forEach(function(message) {\n message.hasBeenSeen = true;\n});\nmessages.save();\n```", - "itemtype": "method", - "name": "save", - "access": "public", - "tagname": "", - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "RecordArray", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 111, - "description": "Provides access to the NotificationManager associated\nwith this Store instance.\n\nThe NotificationManager can be used to subscribe to\nchanges to the cache.", - "itemtype": "property", - "name": "notifications", - "type": "NotificationManager", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 123, - "description": "Provides access to the SchemaService instance\nfor this Store instance.\n\nThe SchemaService can be used to query for\ninformation about the schema of a resource.", - "itemtype": "property", - "name": "schema", - "type": "SchemaService", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 138, - "description": "Provides access to the IdentifierCache instance\nfor this store.\n\nThe IdentifierCache can be used to generate or\nretrieve a stable unique identifier for any resource.", - "itemtype": "property", - "name": "identifierCache", - "type": "IdentifierCache", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 149, - "description": "Provides access to the requestManager instance associated\nwith this Store instance.\n\nWhen using `ember-data` this property is automatically\nset to an instance of `RequestManager`. When not using `ember-data`\nyou must configure this property yourself, either by declaring\nit as a service or by initializing it.\n\n```ts\nimport Store, { CacheHandler } from '@ember-data/store';\nimport RequestManager from '@ember-data/request';\nimport Fetch from '@ember/data/request/fetch';\n\nclass extends Store {\n constructor() {\n super(...arguments);\n this.requestManager = new RequestManager();\n this.requestManager.use([Fetch]);\n this.requestManager.useCache(CacheHandler);\n }\n}\n```", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "requestManager", - "type": "RequestManager", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 178, - "description": "A Property which an App may set to provide a Lifetimes Service\nto control when a cached request becomes stale.\n\nNote, when defined, these methods will only be invoked if a\ncache key exists for the request, either because the request\ncontains `cacheOptions.key` or because the [IdentifierCache](/ember-data/release/classes/IdentifierCache)\nwas able to generate a key for the request using the configured\n[generation method](/ember-data/release/functions/@ember-data%2Fstore/setIdentifierGenerationMethod).\n\n`isSoftExpired` will only be invoked if `isHardExpired` returns `false`.\n\n```ts\nstore.lifetimes = {\n // make the request and ignore the current cache state\n isHardExpired(identifier: StableDocumentIdentifier): boolean {\n return false;\n }\n\n // make the request in the background if true, return cache state\n isSoftExpired(identifier: StableDocumentIdentifier): boolean {\n return false;\n }\n}\n```", - "access": "public", - "tagname": "", - "itemtype": "property", - "name": "lifetimes", - "type": "LivetimesService|undefined", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 243, - "itemtype": "method", - "name": "init", - "access": "private", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 317, - "description": "Retrieve the RequestStateService instance\nassociated with this Store.\n\nThis can be used to query the status of requests\nthat have been initiated for a given identifier.", - "itemtype": "method", - "name": "getRequestStateService", - "return": { - "description": "", - "type": "RequestStateService" - }, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 349, - "description": "Issue a request via the configured RequestManager,\ninserting the response into the cache and handing\nback a Future which resolves to a ResponseDocument\n\nResource data is always updated in the cache.\n\nOnly GET requests have the request result and document\ncached by default when a cache key is present.\n\nThe cache key used is `requestConfig.cacheOptions.key`\nif present, falling back to `requestconfig.url`.\n\nParams are not serialized as part of the cache-key, so\neither ensure they are already in the url or utilize\n`requestConfig.cacheOptions.key`. For queries issued\nvia the `POST` method `requestConfig.cacheOptions.key`\nMUST be supplied for the document to be cached.", - "itemtype": "method", - "name": "request", - "params": [ - { - "name": "requestConfig", - "description": "", - "type": "StoreRequestInfo" - } - ], - "return": { - "description": "", - "type": "Future" - }, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 426, - "description": "A hook which an app or addon may implement. Called when\nthe Store is attempting to create a Record Instance for\na resource.\n\nThis hook can be used to select or instantiate any desired\nmechanism of presentating cache data to the ui for access\nmutation, and interaction.", - "itemtype": "method", - "name": "instantiateRecord (hook)", - "params": [ - { - "name": "identifier", - "description": "" - }, - { - "name": "createRecordArgs", - "description": "" - }, - { - "name": "recordDataFor", - "description": "deprecated use this.cache" - }, - { - "name": "notificationManager", - "description": "deprecated use this.notifications" - } - ], - "return": { - "description": "A record instance" - }, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 470, - "description": "A hook which an app or addon may implement. Called when\nthe Store is destroying a Record Instance. This hook should\nbe used to teardown any custom record instances instantiated\nwith `instantiateRecord`.", - "itemtype": "method", - "name": "teardownRecord (hook)", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 492, - "description": "Provides access to the SchemaDefinitionService instance\nfor this Store instance.\n\nThe SchemaDefinitionService can be used to query for\ninformation about the schema of a resource.", - "itemtype": "method", - "name": "getSchemaDefinitionService", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 514, - "description": "DEPRECATED - Use `registerSchema` instead.\n\nAllows an app to register a custom SchemaService\nfor use when information about a resource's schema needs\nto be queried.\n\nThis method can only be called more than once, but only one schema\ndefinition service may exist. Therefore if you wish to chain services\nyou must lookup the existing service and close over it with the new\nservice by accessing `store.schema` prior to registration.\n\nFor Example:\n\n```ts\nimport Store from '@ember-data/store';\n\nclass SchemaDelegator {\n constructor(schema) {\n this._schema = schema;\n }\n\n doesTypeExist(type: string): boolean {\n if (AbstractSchemas.has(type)) {\n return true;\n }\n return this._schema.doesTypeExist(type);\n }\n\n attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {\n return this._schema.attributesDefinitionFor(identifier);\n }\n\n relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {\n const schema = AbstractSchemas.get(identifier.type);\n return schema || this._schema.relationshipsDefinitionFor(identifier);\n }\n}\n\nexport default class extends Store {\n constructor(...args) {\n super(...args);\n\n const schema = this.schema;\n this.registerSchemaDefinitionService(new SchemaDelegator(schema));\n }\n}\n```", - "itemtype": "method", - "name": "registerSchemaDefinitionService", - "params": [ - { - "name": "schema", - "description": "", - "type": "SchemaService" - } - ], - "deprecated": true, - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 571, - "description": "Allows an app to register a custom SchemaService\nfor use when information about a resource's schema needs\nto be queried.\n\nThis method can only be called more than once, but only one schema\ndefinition service may exist. Therefore if you wish to chain services\nyou must lookup the existing service and close over it with the new\nservice by accessing `store.schema` prior to registration.\n\nFor Example:\n\n```ts\nimport Store from '@ember-data/store';\n\nclass SchemaDelegator {\n constructor(schema) {\n this._schema = schema;\n }\n\n doesTypeExist(type: string): boolean {\n if (AbstractSchemas.has(type)) {\n return true;\n }\n return this._schema.doesTypeExist(type);\n }\n\n attributesDefinitionFor(identifier: RecordIdentifier | { type: string }): AttributesSchema {\n return this._schema.attributesDefinitionFor(identifier);\n }\n\n relationshipsDefinitionFor(identifier: RecordIdentifier | { type: string }): RelationshipsSchema {\n const schema = AbstractSchemas.get(identifier.type);\n return schema || this._schema.relationshipsDefinitionFor(identifier);\n }\n}\n\nexport default class extends Store {\n constructor(...args) {\n super(...args);\n\n const schema = this.schema;\n this.registerSchema(new SchemaDelegator(schema));\n }\n}\n```", - "itemtype": "method", - "name": "registerSchema", - "params": [ - { - "name": "schema", - "description": "", - "type": "SchemaService" - } - ], - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 626, - "description": "Returns the schema for a particular `modelName`.\n\nWhen used with Model from @ember-data/model the return is the model class,\nbut this is not guaranteed.\n\nIf looking to query attribute or relationship information it is\nrecommended to use `getSchemaDefinitionService` instead. This method\nshould be considered legacy and exists primarily to continue to support\nAdapter/Serializer APIs which expect it's return value in their method\nsignatures.\n\nThe class of a model might be useful if you want to get a list of all the\nrelationship names of the model, see\n[`relationshipNames`](/ember-data/release/classes/Model?anchor=relationshipNames)\nfor example.", - "itemtype": "method", - "name": "modelFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Subclass of Model | ShimModelClass" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 685, - "description": "Create a new record in the current store. The properties passed\nto this method are set on the newly created record.\n\nTo create a new instance of a `Post`:\n\n```js\nstore.createRecord('post', {\n title: 'Ember is awesome!'\n});\n```\n\nTo create a new instance of a `Post` that has a relationship with a `User` record:\n\n```js\nlet user = this.store.peekRecord('user', 1);\nstore.createRecord('post', {\n title: 'Ember is awesome!',\n user: user\n});\n```", - "itemtype": "method", - "name": "createRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "inputProperties", - "description": "a hash of properties to set on the\n newly created record.", - "type": "Object" - } - ], - "return": { - "description": "record", - "type": "Model" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 775, - "description": "For symmetry, a record can be deleted via the store.\n\nExample\n\n```javascript\nlet post = store.createRecord('post', {\n title: 'Ember is awesome!'\n});\n\nstore.deleteRecord(post);\n```", - "itemtype": "method", - "name": "deleteRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 811, - "description": "For symmetry, a record can be unloaded via the store.\nThis will cause the record to be destroyed and freed up for garbage collection.\n\nExample\n\n```javascript\nstore.findRecord('post', 1).then(function(post) {\n store.unloadRecord(post);\n});\n```", - "itemtype": "method", - "name": "unloadRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "Model" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 837, - "description": "This method returns a record for a given identifier or type and id combination.\n\nThe `findRecord` method will always resolve its promise with the same\nobject for a given identifier or type and `id`.\n\nThe `findRecord` method will always return a **promise** that will be\nresolved with the record.\n\n**Example 1**\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n model({ post_id }) {\n return this.store.findRecord('post', post_id);\n }\n}\n```\n\n**Example 2**\n\n`findRecord` can be called with a single identifier argument instead of the combination\nof `type` (modelName) and `id` as separate arguments. You may recognize this combo as\nthe typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n model({ post_id: id }) {\n return this.store.findRecord({ type: 'post', id });\n }\n}\n```\n\n**Example 3**\n\nIf you have previously received an lid via an Identifier for this record, and the record\nhas already been assigned an id, you can find the record again using just the lid.\n\n```app/routes/post.js\nstore.findRecord({ lid });\n```\n\nIf the record is not yet available, the store will ask the adapter's `findRecord`\nmethod to retrieve and supply the necessary data. If the record is already present\nin the store, it depends on the reload behavior _when_ the returned promise\nresolves.\n\n### Preloading\n\nYou can optionally `preload` specific attributes and relationships that you know of\nby passing them via the passed `options`.\n\nFor example, if your Ember route looks like `/posts/1/comments/2` and your API route\nfor the comment also looks like `/posts/1/comments/2` if you want to fetch the comment\nwithout also fetching the post you can pass in the post to the `findRecord` call:\n\n```app/routes/post-comments.js\nimport Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n model({ post_id, comment_id: id }) {\n return this.store.findRecord({ type: 'comment', id, { preload: { post: post_id }} });\n }\n}\n```\n\nIn your adapter you can then access this id without triggering a network request via the\nsnapshot:\n\n```app/adapters/application.js\nimport EmberObject from '@ember/object';\n\nexport default class Adapter extends EmberObject {\n\n findRecord(store, schema, id, snapshot) {\n let type = schema.modelName;\n\n if (type === 'comment')\n let postId = snapshot.belongsTo('post', { id: true });\n\n return fetch(`./posts/${postId}/comments/${id}`)\n .then(response => response.json())\n }\n }\n}\n```\n\nThis could also be achieved by supplying the post id to the adapter via the adapterOptions\nproperty on the options hash.\n\n```app/routes/post-comments.js\nimport Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n model({ post_id, comment_id: id }) {\n return this.store.findRecord({ type: 'comment', id, { adapterOptions: { post: post_id }} });\n }\n}\n```\n\n```app/adapters/application.js\nimport EmberObject from '@ember/object';\n\nexport default class Adapter extends EmberObject {\n\n findRecord(store, schema, id, snapshot) {\n let type = schema.modelName;\n\n if (type === 'comment')\n let postId = snapshot.adapterOptions.post;\n\n return fetch(`./posts/${postId}/comments/${id}`)\n .then(response => response.json())\n }\n }\n}\n```\n\nIf you have access to the post model you can also pass the model itself to preload:\n\n```javascript\nlet post = await store.findRecord('post', 1);\nlet comment = await store.findRecord('comment', 2, { post: myPostModel });\n```\n\n### Reloading\n\nThe reload behavior is configured either via the passed `options` hash or\nthe result of the adapter's `shouldReloadRecord`.\n\nIf `{ reload: true }` is passed or `adapter.shouldReloadRecord` evaluates\nto `true`, then the returned promise resolves once the adapter returns\ndata, regardless if the requested record is already in the store:\n\n```js\nstore.push({\n data: {\n id: 1,\n type: 'post',\n revision: 1\n }\n});\n\n// adapter#findRecord resolves with\n// [\n// {\n// id: 1,\n// type: 'post',\n// revision: 2\n// }\n// ]\nstore.findRecord('post', 1, { reload: true }).then(function(post) {\n post.revision; // 2\n});\n```\n\nIf no reload is indicated via the above mentioned ways, then the promise\nimmediately resolves with the cached version in the store.\n\n### Background Reloading\n\nOptionally, if `adapter.shouldBackgroundReloadRecord` evaluates to `true`,\nthen a background reload is started, which updates the records' data, once\nit is available:\n\n```js\n// app/adapters/post.js\nimport ApplicationAdapter from \"./application\";\n\nexport default class PostAdapter extends ApplicationAdapter {\n shouldReloadRecord(store, snapshot) {\n return false;\n },\n\n shouldBackgroundReloadRecord(store, snapshot) {\n return true;\n }\n});\n\n// ...\n\nstore.push({\n data: {\n id: 1,\n type: 'post',\n revision: 1\n }\n});\n\nlet blogPost = store.findRecord('post', 1).then(function(post) {\n post.revision; // 1\n});\n\n// later, once adapter#findRecord resolved with\n// [\n// {\n// id: 1,\n// type: 'post',\n// revision: 2\n// }\n// ]\n\nblogPost.revision; // 2\n```\n\nIf you would like to force or prevent background reloading, you can set a\nboolean value for `backgroundReload` in the options object for\n`findRecord`.\n\n```app/routes/post/edit.js\nimport Route from '@ember/routing/route';\n\nexport default class PostEditRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { backgroundReload: false });\n }\n}\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to your adapter via the snapshot\n\n```app/routes/post/edit.js\nimport Route from '@ember/routing/route';\n\nexport default class PostEditRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, {\n adapterOptions: { subscribe: false }\n });\n }\n}\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default class PostAdapter extends MyCustomAdapter {\n findRecord(store, type, id, snapshot) {\n if (snapshot.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n}\n```\n\nSee [peekRecord](../methods/peekRecord?anchor=peekRecord) to get the cached version of a record.\n\n### Retrieving Related Model Records\n\nIf you use an adapter such as Ember's default\n[`JSONAPIAdapter`](/ember-data/release/classes/JSONAPIAdapter)\nthat supports the [JSON API specification](http://jsonapi.org/) and if your server\nendpoint supports the use of an\n['include' query parameter](http://jsonapi.org/format/#fetching-includes),\nyou can use `findRecord()` or `findAll()` to automatically retrieve additional records related to\nthe one you request by supplying an `include` parameter in the `options` object.\n\nFor example, given a `post` model that has a `hasMany` relationship with a `comment`\nmodel, when we retrieve a specific post we can have the server also return that post's\ncomments in the same request:\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { include: 'comments' });\n }\n}\n```\n\n```app/adapters/application.js\nimport EmberObject from '@ember/object';\n\nexport default class Adapter extends EmberObject {\n\n findRecord(store, schema, id, snapshot) {\n let type = schema.modelName;\n\n if (type === 'post')\n let includes = snapshot.adapterOptions.include;\n\n return fetch(`./posts/${postId}?include=${includes}`)\n .then(response => response.json())\n }\n }\n}\n```\n\nIn this case, the post's comments would then be available in your template as\n`model.comments`.\n\nMultiple relationships can be requested using an `include` parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the post's\ncomments and the authors of those comments the request would look like this:\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\n\nexport default class PostRoute extends Route {\n model(params) {\n return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });\n }\n}\n```\n\n### Retrieving Specific Fields by Type\n\nIf your server endpoint supports the use of a ['fields' query parameter](https://jsonapi.org/format/#fetching-sparse-fieldsets),\nyou can use pass those fields through to your server. At this point in time, this requires a few manual steps on your part.\n\n1. Implement `buildQuery` in your adapter.\n\n```app/adapters/application.js\nbuildQuery(snapshot) {\n let query = super.buildQuery(...arguments);\n\n let { fields } = snapshot.adapterOptions;\n\n if (fields) {\n query.fields = fields;\n }\n\n return query;\n}\n```\n\n2. Then pass through the applicable fields to your `findRecord` request.\n\nGiven a `post` model with attributes body, title, publishDate and meta, you can retrieve a filtered list of attributes.\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title' } });\n }\n});\n```\n\nMoreover, you can filter attributes on related models as well. If a `post` has a `belongsTo` relationship to a user,\njust include the relationship key and attributes.\n\n```app/routes/post.js\nimport Route from '@ember/routing/route';\nexport default Route.extend({\n model(params) {\n return this.store.findRecord('post', params.post_id, { adapterOptions: { fields: { post: 'body,title', user: 'name,email' } });\n }\n});\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "findRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "- either a string representing the modelName 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", - "type": "String|object" - }, - { - "name": "id", - "description": "- 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", - "type": "(String|Integer|Object)" - }, - { - "name": "options", - "description": "- if the first param is a string this will be the optional options for the request. See examples for available options.", - "type": "Object", - "optional": true - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1260, - "description": "Get the reference for the specified record.\n\nExample\n\n```javascript\nlet userRef = store.getReference('user', 1);\n\n// check if the user is loaded\nlet isLoaded = userRef.value() !== null;\n\n// get the record of the reference (null if not yet available)\nlet user = userRef.value();\n\n// get the identifier of the reference\nif (userRef.remoteType() === 'id') {\nlet id = userRef.id();\n}\n\n// load user (via store.find)\nuserRef.load().then(...)\n\n// or trigger a reload\nuserRef.reload().then(...)\n\n// provide data for reference\nuserRef.push({ id: 1, username: '@user' }).then(function(user) {\n userRef.value() === user;\n});\n```", - "itemtype": "method", - "name": "getReference", - "access": "public", - "tagname": "", - "params": [ - { - "name": "resource", - "description": "- modelName (string) or Identifier (object)", - "type": "String|object" - }, - { - "name": "id", - "description": "", - "type": "String|Integer" - } - ], - "since": "2.5.0", - "return": { - "description": "", - "type": "RecordReference" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1323, - "description": "Get a record by a given type and ID without triggering a fetch.\n\nThis method will synchronously return the record if it is available in the store,\notherwise it will return `null`. A record is available if it has been fetched earlier, or\npushed manually into the store.\n\nSee [findRecord](../methods/findRecord?anchor=findRecord) if you would like to request this record from the backend.\n\n_Note: This is a synchronous method and does not return a promise._\n\n**Example 1**\n\n```js\nlet post = store.peekRecord('post', 1);\n\npost.id; // 1\n```\n\n`peekRecord` can be called with a single identifier argument instead of the combination\nof `type` (modelName) and `id` as separate arguments. You may recognize this combo as\nthe typical pairing from [JSON:API](https://jsonapi.org/format/#document-resource-object-identification)\n\n**Example 2**\n\n```js\nlet post = store.peekRecord({ type: 'post', id });\npost.id; // 1\n```\n\nIf you have previously received an lid from an Identifier for this record, you can lookup the record again using\njust the lid.\n\n**Example 3**\n\n```js\nlet post = store.peekRecord({ lid });\npost.id; // 1\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "peekRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "- either a string representing the modelName 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", - "type": "String|object" - }, - { - "name": "id", - "description": "- optional only if the first param is a ResourceIdentifier, else the string id of the record to be retrieved.", - "type": "String|Integer" - } - ], - "return": { - "description": "record", - "type": "Model|null" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1401, - "description": "This method delegates a query to the adapter. This is the one place where\nadapter-level semantics are exposed to the application.\n\nEach time this method is called a new request is made through the adapter.\n\nExposing queries this way seems preferable to creating an abstract query\nlanguage for all server-side queries, and then require all adapters to\nimplement them.\n\n---\n\nIf you do something like this:\n\n```javascript\nstore.query('person', { page: 1 });\n```\n\nThe request made to the server will look something like this:\n\n```\nGET \"/api/v1/person?page=1\"\n```\n\n---\n\nIf you do something like this:\n\n```javascript\nstore.query('person', { ids: [1, 2, 3] });\n```\n\nThe request made to the server will look something like this:\n\n```\nGET \"/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3\"\ndecoded: \"/api/v1/person?ids[]=1&ids[]=2&ids[]=3\"\n```\n\nThis method returns a promise, which is resolved with a\n[`Collection`](/ember-data/release/classes/Collection)\nonce the server returns.", - "since": "1.13.0", - "itemtype": "method", - "name": "query", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "an opaque query to be used by the adapter", - "type": "Any" - }, - { - "name": "options", - "description": "optional, may include `adapterOptions` hash which will be passed to adapter.query", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1480, - "description": "This method makes a request for one record, where the `id` is not known\nbeforehand (if the `id` is known, use [`findRecord`](../methods/findRecord?anchor=findRecord)\ninstead).\n\nThis method can be used when it is certain that the server will return a\nsingle object for the primary data.\n\nEach time this method is called a new request is made through the adapter.\n\nLet's assume our API provides an endpoint for the currently logged in user\nvia:\n\n```\n// GET /api/current_user\n{\n user: {\n id: 1234,\n username: 'admin'\n }\n}\n```\n\nSince the specific `id` of the `user` is not known beforehand, we can use\n`queryRecord` to get the user:\n\n```javascript\nstore.queryRecord('user', {}).then(function(user) {\n let username = user.username;\n // do thing\n});\n```\n\nThe request is made through the adapters' `queryRecord`:\n\n```app/adapters/user.js\nimport Adapter from '@ember-data/adapter';\nimport $ from 'jquery';\n\nexport default class UserAdapter extends Adapter {\n queryRecord(modelName, query) {\n return $.getJSON('/api/current_user');\n }\n}\n```\n\nNote: the primary use case for `store.queryRecord` is when a single record\nis queried and the `id` is not known beforehand. In all other cases\n`store.query` and using the first item of the array is likely the preferred\nway:\n\n```\n// GET /users?username=unique\n{\n data: [{\n id: 1234,\n type: 'user',\n attributes: {\n username: \"unique\"\n }\n }]\n}\n```\n\n```javascript\nstore.query('user', { username: 'unique' }).then(function(users) {\n return users.firstObject;\n}).then(function(user) {\n let id = user.id;\n});\n```\n\nThis method returns a promise, which resolves with the found record.\n\nIf the adapter returns no data for the primary data of the payload, then\n`queryRecord` resolves with `null`:\n\n```\n// GET /users?username=unique\n{\n data: null\n}\n```\n\n```javascript\nstore.queryRecord('user', { username: 'unique' }).then(function(user) {\n // user is null\n});\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "queryRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "query", - "description": "an opaque query to be used by the adapter", - "type": "Any" - }, - { - "name": "options", - "description": "optional, may include `adapterOptions` hash which will be passed to adapter.queryRecord", - "type": "Object" - } - ], - "return": { - "description": "promise which resolves with the found record or `null`", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1602, - "description": "`findAll` asks the adapter's `findAll` method to find the records for the\ngiven type, and returns a promise which will resolve with all records of\nthis type present in the store, even if the adapter only returns a subset\nof them.\n\n```app/routes/authors.js\nimport Route from '@ember/routing/route';\n\nexport default class AuthorsRoute extends Route {\n model(params) {\n return this.store.findAll('author');\n }\n}\n```\n\n_When_ the returned promise resolves depends on the reload behavior,\nconfigured via the passed `options` hash and the result of the adapter's\n`shouldReloadAll` method.\n\n### Reloading\n\nIf `{ reload: true }` is passed or `adapter.shouldReloadAll` evaluates to\n`true`, then the returned promise resolves once the adapter returns data,\nregardless if there are already records in the store:\n\n```js\nstore.push({\n data: {\n id: 'first',\n type: 'author'\n }\n});\n\n// adapter#findAll resolves with\n// [\n// {\n// id: 'second',\n// type: 'author'\n// }\n// ]\nstore.findAll('author', { reload: true }).then(function(authors) {\n authors.getEach('id'); // ['first', 'second']\n});\n```\n\nIf no reload is indicated via the above mentioned ways, then the promise\nimmediately resolves with all the records currently loaded in the store.\n\n### Background Reloading\n\nOptionally, if `adapter.shouldBackgroundReloadAll` evaluates to `true`,\nthen a background reload is started. Once this resolves, the array with\nwhich the promise resolves, is updated automatically so it contains all the\nrecords in the store:\n\n```app/adapters/application.js\nimport Adapter from '@ember-data/adapter';\n\nexport default class ApplicationAdapter extends Adapter {\n shouldReloadAll(store, snapshotsArray) {\n return false;\n },\n\n shouldBackgroundReloadAll(store, snapshotsArray) {\n return true;\n }\n});\n\n// ...\n\nstore.push({\n data: {\n id: 'first',\n type: 'author'\n }\n});\n\nlet allAuthors;\nstore.findAll('author').then(function(authors) {\n authors.getEach('id'); // ['first']\n\n allAuthors = authors;\n});\n\n// later, once adapter#findAll resolved with\n// [\n// {\n// id: 'second',\n// type: 'author'\n// }\n// ]\n\nallAuthors.getEach('id'); // ['first', 'second']\n```\n\nIf you would like to force or prevent background reloading, you can set a\nboolean value for `backgroundReload` in the options object for\n`findAll`.\n\n```app/routes/post/edit.js\nimport Route from '@ember/routing/route';\n\nexport default class PostEditRoute extends Route {\n model() {\n return this.store.findAll('post', { backgroundReload: false });\n }\n}\n```\n\nIf you pass an object on the `adapterOptions` property of the options\nargument it will be passed to you adapter via the `snapshotRecordArray`\n\n```app/routes/posts.js\nimport Route from '@ember/routing/route';\n\nexport default class PostsRoute extends Route {\n model(params) {\n return this.store.findAll('post', {\n adapterOptions: { subscribe: false }\n });\n }\n}\n```\n\n```app/adapters/post.js\nimport MyCustomAdapter from './custom-adapter';\n\nexport default class UserAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n}\n```\n\nSee [peekAll](../methods/peekAll?anchor=peekAll) to get an array of current records in the\nstore, without waiting until a reload is finished.\n\n### Retrieving Related Model Records\n\nIf you use an adapter such as Ember's default\n[`JSONAPIAdapter`](/ember-data/release/classes/JSONAPIAdapter)\nthat supports the [JSON API specification](http://jsonapi.org/) and if your server\nendpoint supports the use of an\n['include' query parameter](http://jsonapi.org/format/#fetching-includes),\nyou can use `findAll()` to automatically retrieve additional records related to\nthose requested by supplying an `include` parameter in the `options` object.\n\nFor example, given a `post` model that has a `hasMany` relationship with a `comment`\nmodel, when we retrieve all of the post records we can have the server also return\nall of the posts' comments in the same request:\n\n```app/routes/posts.js\nimport Route from '@ember/routing/route';\n\nexport default class PostsRoute extends Route {\n model() {\n return this.store.findAll('post', { include: 'comments' });\n }\n}\n```\nMultiple relationships can be requested using an `include` parameter consisting of a\ncomma-separated list (without white-space) while nested relationships can be specified\nusing a dot-separated sequence of relationship names. So to request both the posts'\ncomments and the authors of those comments the request would look like this:\n\n```app/routes/posts.js\nimport Route from '@ember/routing/route';\n\nexport default class PostsRoute extends Route {\n model() {\n return this.store.findAll('post', { include: 'comments,comments.author' });\n }\n}\n```\n\nSee [query](../methods/query?anchor=query) to only get a subset of records from the server.", - "since": "1.13.0", - "itemtype": "method", - "name": "findAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - }, - { - "name": "options", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "promise", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1812, - "description": "This method returns a filtered array that contains all of the\nknown records for a given type in the store.\n\nNote that because it's just a filter, the result will contain any\nlocally created records of the type, however, it will not make a\nrequest to the backend to retrieve additional records. If you\nwould like to request all the records from the backend please use\n[store.findAll](../methods/findAll?anchor=findAll).\n\nAlso note that multiple calls to `peekAll` for a given type will always\nreturn the same `RecordArray`.\n\nExample\n\n```javascript\nlet localPosts = store.peekAll('post');\n```", - "since": "1.13.0", - "itemtype": "method", - "name": "peekAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "", - "type": "RecordArray" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1851, - "description": "This method unloads all records in the store.\nIt schedules unloading to happen during the next run loop.\n\nOptionally you can pass a type which unload all records for a given type.\n\n```javascript\nstore.unloadAll();\nstore.unloadAll('post');\n```", - "itemtype": "method", - "name": "unloadAll", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 1898, - "description": "Push some data for a given type into the store.\n\nThis method expects normalized [JSON API](http://jsonapi.org/) document. This means you have to follow [JSON API specification](http://jsonapi.org/format/) with few minor adjustments:\n- record's `type` should always be in singular, dasherized form\n- members (properties) should be camelCased\n\n[Your primary data should be wrapped inside `data` property](http://jsonapi.org/format/#document-top-level):\n\n```js\nstore.push({\n data: {\n // primary data for single record of type `Person`\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Daniel',\n lastName: 'Kmak'\n }\n }\n});\n```\n\n[Demo.](http://ember-twiddle.com/fb99f18cd3b4d3e2a4c7)\n\n`data` property can also hold an array (of records):\n\n```js\nstore.push({\n data: [\n // an array of records\n {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Daniel',\n lastName: 'Kmak'\n }\n },\n {\n id: '2',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n }\n }\n ]\n});\n```\n\n[Demo.](http://ember-twiddle.com/69cdbeaa3702159dc355)\n\nThere are some typical properties for `JSONAPI` payload:\n* `id` - mandatory, unique record's key\n* `type` - mandatory string which matches `model`'s dasherized name in singular form\n* `attributes` - object which holds data for record attributes - `attr`'s declared in model\n* `relationships` - object which must contain any of the following properties under each relationships' respective key (example path is `relationships.achievements.data`):\n - [`links`](http://jsonapi.org/format/#document-links)\n - [`data`](http://jsonapi.org/format/#document-resource-object-linkage) - place for primary data\n - [`meta`](http://jsonapi.org/format/#document-meta) - object which contains meta-information about relationship\n\nFor this model:\n\n```app/models/person.js\nimport Model, { attr, hasMany } from '@ember-data/model';\n\nexport default class PersonRoute extends Route {", - "attr": "('string') lastName;", - "hasmany": "('person') children;\n}\n```\n\nTo represent the children as IDs:\n\n```js\n{\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n data: [\n {\n id: '2',\n type: 'person'\n },\n {\n id: '3',\n type: 'person'\n },\n {\n id: '4',\n type: 'person'\n }\n ]\n }\n }\n }\n}\n```\n\n[Demo.](http://ember-twiddle.com/343e1735e034091f5bde)\n\nTo represent the children relationship as a URL:\n\n```js\n{\n data: {\n id: '1',\n type: 'person',\n attributes: {\n firstName: 'Tom',\n lastName: 'Dale'\n },\n relationships: {\n children: {\n links: {\n related: '/people/1/children'\n }\n }\n }\n }\n}\n```\n\nIf you're streaming data or implementing an adapter, make sure\nthat you have converted the incoming data into this form. The\nstore's [normalize](../methods/normalize?anchor=normalize) method is a convenience\nhelper for converting a json payload into the form Ember Data\nexpects.\n\n```js\nstore.push(store.normalize('person', data));\n```\n\nThis method can be used both to push in brand new\nrecords, as well as to update existing records.", - "itemtype": "method", - "name": "push", - "access": "public", - "tagname": "", - "params": [ - { - "name": "data", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "the record(s) that was created or\n updated." - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2070, - "description": "Push some data in the form of a json-api document into the store,\nwithout creating materialized records.", - "itemtype": "method", - "name": "_push", - "access": "private", - "tagname": "", - "params": [ - { - "name": "jsonApiDoc", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "identifiers for the primary records that had data loaded", - "type": "StableRecordIdentifier|Array" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2109, - "description": "Push some raw data into the store.\n\nThis method can be used both to push in brand new\nrecords, as well as to update existing records. You\ncan push in more than one type of object at once.\nAll objects should be in the format expected by the\nserializer.\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\nexport default class ApplicationSerializer extends RESTSerializer;\n```\n\n```js\nlet pushData = {\n posts: [\n { id: 1, postTitle: \"Great post\", commentIds: [2] }\n ],\n comments: [\n { id: 2, commentBody: \"Insightful comment\" }\n ]\n}\n\nstore.pushPayload(pushData);\n```\n\nBy default, the data will be deserialized using a default\nserializer (the application serializer if it exists).\n\nAlternatively, `pushPayload` will accept a model type which\nwill determine which serializer will process the payload.\n\n```app/serializers/application.js\nimport RESTSerializer from '@ember-data/serializer/rest';\n\n export default class ApplicationSerializer extends RESTSerializer;\n```\n\n```app/serializers/post.js\nimport JSONSerializer from '@ember-data/serializer/json';\n\nexport default JSONSerializer;\n```\n\n```js\nstore.pushPayload(pushData); // Will use the application serializer\nstore.pushPayload('post', pushData); // Will use the post serializer\n```", - "itemtype": "method", - "name": "pushPayload", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "Optionally, a model type used to determine which serializer will be used", - "type": "String" - }, - { - "name": "inputPayload", - "description": "", - "type": "Object" - } - ], - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2212, - "description": "Trigger a save for a Record.", - "itemtype": "method", - "name": "saveRecord", - "access": "public", - "tagname": "", - "params": [ - { - "name": "record", - "description": "", - "type": "RecordInstance" - }, - { - "name": "options", - "description": "" - } - ], - "return": { - "description": "", - "type": "Promise" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2273, - "description": "Instantiation hook allowing applications or addons to configure the store\nto utilize a custom Cache implementation.\n\nThis hook should not be called directly by consuming applications or libraries.\nUse `Store.cache` to access the Cache instance.", - "itemtype": "method", - "name": "createCache (hook)", - "access": "public", - "tagname": "", - "params": [ - { - "name": "storeWrapper", - "description": "" - } - ], - "return": { - "description": "", - "type": "Cache" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2297, - "description": "Returns the cache instance associated to this Store, instantiates the Cache\nif necessary via `Store.createCache`", - "itemtype": "property", - "name": "cache", - "type": "Cache", - "access": "public", - "tagname": "", - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2315, - "description": "`normalize` converts a json payload into the normalized form that\n[push](../methods/push?anchor=push) expects.\n\nExample\n\n```js\nsocket.on('message', function(message) {\n let modelName = message.model;\n let data = message.data;\n store.push(store.normalize(modelName, data));\n});\n```", - "itemtype": "method", - "name": "normalize", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "The name of the model type for this payload", - "type": "String" - }, - { - "name": "payload", - "description": "", - "type": "Object" - } - ], - "return": { - "description": "The normalized payload", - "type": "Object" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2355, - "description": "Returns an instance of the adapter for a given type. For\nexample, `adapterFor('person')` will return an instance of\nthe adapter located at `app/adapters/person.js`\n\nIf no `person` adapter is found, this method will look\nfor an `application` adapter (the default adapter for\nyour entire application).", - "itemtype": "method", - "name": "adapterFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "", - "type": "String" - } - ], - "return": { - "description": "Adapter" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/store/src/-private/store-service.ts", - "line": 2406, - "description": "Returns an instance of the serializer for a given type. For\nexample, `serializerFor('person')` will return an instance of\n`App.PersonSerializer`.\n\nIf no `App.PersonSerializer` is found, this method will look\nfor an `App.ApplicationSerializer` (the default serializer for\nyour entire application).\n\nIf a serializer cannot be found on the adapter, it will fall back\nto an instance of `JSONSerializer`.", - "itemtype": "method", - "name": "serializerFor", - "access": "public", - "tagname": "", - "params": [ - { - "name": "modelName", - "description": "the record to serialize", - "type": "String" - } - ], - "return": { - "description": "", - "type": "Serializer" - }, - "class": "Store", - "module": "@ember-data/store" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 92, - "description": "Run `method` without subscribing to any tracked properties\ncontrolled by EmberData.\n\nThis should rarely be used except by libraries that really\nknow what they are doing. It is most useful for wrapping\ncertain kinds of fetch/query logic from within a `Resource`\n`hook` or other similar pattern.", - "itemtype": "method", - "name": "untracked", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 115, - "description": "Run the method, subscribing to any tracked properties\nmanaged by EmberData that were accessed or written during\nthe method's execution as per-normal but while allowing\ninterleaving of reads and writes.\n\nThis is useful when for instance you want to perform\na mutation based on existing state that must be read first.", - "itemtype": "method", - "name": "transact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "result of invoking method" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - }, - { - "file": "../packages/tracking/src/-private.ts", - "line": 138, - "description": "A helpful utility for creating a new function that\nalways runs in a transaction. E.G. this \"memoizes\"\ncalling `transact(fn)`, currying args as necessary.", - "itemtype": "method", - "name": "memoTransact", - "access": "public", - "tagname": "", - "static": 1, - "params": [ - { - "name": "method", - "description": "" - } - ], - "return": { - "description": "a function that will invoke method in a transaction with any provided args and return its result" - }, - "class": "@ember-data/tracking", - "module": "@ember-data/tracking" - } - ], - "warnings": [ - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:38" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:62" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:76" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:86" - }, - { - "message": "param name missing: {StableDocumentIdentifier}", - "line": " ../ember-data-types/cache/cache.ts:121" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:121" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:132" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:147" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:160" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:212" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:223" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:306" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:330" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:340" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:350" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:362" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:393" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:403" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:413" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:424" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/cache/cache.ts:435" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/cache-store-wrapper.ts:73" - }, - { - "message": "unknown tag: recommended", - "line": " ../ember-data-types/q/ember-data-json-api.ts:35" - }, - { - "message": "unknown tag: ignored", - "line": " ../ember-data-types/q/ember-data-json-api.ts:53" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/minimum-serializer-interface.ts:45" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/minimum-serializer-interface.ts:112" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/minimum-serializer-interface.ts:168" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/minimum-serializer-interface.ts:210" - }, - { - "message": "unknown tag: service", - "line": " ../ember-data-types/q/schema-service.ts:8" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/schema-service.ts:59" - }, - { - "message": "unknown tag: attr", - "line": " ../ember-data-types/q/schema-service.ts:69" - }, - { - "message": "unknown tag: attr", - "line": " ../ember-data-types/q/schema-service.ts:69" - }, - { - "message": "unknown tag: attr", - "line": " ../ember-data-types/q/schema-service.ts:69" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/schema-service.ts:69" - }, - { - "message": "unknown tag: belongsto", - "line": " ../ember-data-types/q/schema-service.ts:112" - }, - { - "message": "unknown tag: hasmany", - "line": " ../ember-data-types/q/schema-service.ts:112" - }, - { - "message": "unknown tag: hasmany", - "line": " ../ember-data-types/q/schema-service.ts:112" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../ember-data-types/q/schema-service.ts:112" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/adapter/src/error.js:119" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/adapter/src/error.js:119" - }, - { - "message": "unknown tag: action", - "line": " ../packages/adapter/src/error.js:183" - }, - { - "message": "unknown tag: action", - "line": " ../packages/adapter/src/error.js:230" - }, - { - "message": "unknown tag: service", - "line": " ../packages/adapter/src/error.js:279" - }, - { - "message": "unknown tag: action", - "line": " ../packages/adapter/src/error.js:279" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/adapter/src/rest.ts:1497" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:14" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:14" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:133" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:259" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:292" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:314" - }, - { - "message": "param name missing: {StableDocumentIdentifier}", - "line": " ../packages/json-api/src/-private/cache.ts:388" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:388" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:401" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:474" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:489" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:545" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:558" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:891" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:946" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:959" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:976" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1023" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1067" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1079" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1092" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1106" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1120" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1134" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1149" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/json-api/src/-private/cache.ts:1167" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/references/belongs-to.ts:134" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/references/belongs-to.ts:228" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/belongs-to.ts:296" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/references/belongs-to.ts:346" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/references/belongs-to.ts:419" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/references/belongs-to.ts:474" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/references/belongs-to.ts:547" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/has-many.ts:153" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/has-many.ts:204" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/references/has-many.ts:293" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/has-many.ts:355" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/has-many.ts:459" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/has-many.ts:517" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/references/has-many.ts:592" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/attr.js:14" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/belongs-to.js:17" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/belongs-to.js:17" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/belongs-to.js:17" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/belongs-to.js:17" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/belongs-to.js:17" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/errors.ts:30" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/errors.ts:30" - }, - { - "message": "unknown tag: action", - "line": " ../packages/model/src/-private/errors.ts:399" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/has-many.js:20" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/many-array.ts:43" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/many-array.ts:43" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:100" - }, - { - "message": "unknown tag: action", - "line": " ../packages/model/src/-private/model.js:645" - }, - { - "message": "unknown tag: action", - "line": " ../packages/model/src/-private/model.js:645" - }, - { - "message": "unknown tag: action", - "line": " ../packages/model/src/-private/model.js:645" - }, - { - "message": "unknown tag: action", - "line": " ../packages/model/src/-private/model.js:685" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:775" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:775" - }, - { - "message": "unknown tag: action", - "line": " ../packages/model/src/-private/model.js:926" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:987" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1055" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1250" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1291" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:1291" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1480" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:1480" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1480" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1546" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:1546" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1546" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1601" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:1601" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1601" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1662" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:1662" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1662" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1744" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/-private/model.js:1744" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/-private/model.js:1744" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1744" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1880" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1880" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1880" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1944" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1944" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:1944" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:2001" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:2001" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/-private/model.js:2001" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/promise-many-array.ts:82" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/promise-many-array.ts:98" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/promise-many-array.ts:142" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/promise-many-array.ts:155" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/model/src/-private/promise-many-array.ts:166" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/model/src/index.ts:1" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/model/src/index.ts:1" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/model/src/index.ts:1" - }, - { - "message": "unknown tag: until", - "line": " ../packages/private-build-infra/virtual-packages/deprecations.js:73" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/request/src/-private/manager.ts:501" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/request/src/-private/manager.ts:528" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/request/src/-private/manager.ts:562" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/request/src/-private/types.ts:73" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/request/src/-private/types.ts:82" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/request/src/-private/types.ts:91" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/boolean.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/boolean.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/boolean.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/boolean.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/boolean.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/boolean.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/date.js:5" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/-private/transforms/date.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/date.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/number.js:9" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/-private/transforms/number.js:9" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/number.js:9" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/string.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/string.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/string.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/transform.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/transform.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/transform.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/-private/transforms/transform.js:5" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/serializer/src/json-api.js:13" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:470" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json-api.js:470" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/json-api.js:470" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/serializer/src/json.js:16" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/json.js:16" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:16" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:119" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:119" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:119" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:119" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:957" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/json.js:957" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/json.js:957" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/rest.js:489" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/serializer/src/rest.js:489" - }, - { - "message": "unknown tag: belongsto", - "line": " ../packages/serializer/src/rest.js:489" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/caches/identifier-cache.ts:344" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/caches/identifier-cache.ts:358" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/caches/identifier-cache.ts:392" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/caches/identifier-cache.ts:415" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/caches/identifier-cache.ts:455" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/caches/instance-cache.ts:48" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:50" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:77" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:104" - }, - { - "message": "param name missing: {StableDocumentIdentifier}", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:142" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:142" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:155" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:172" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:187" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:243" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:256" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:351" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:377" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:389" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:401" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:416" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:448" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:460" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:472" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:485" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/cache-manager.ts:498" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/managers/notification-manager.ts:101" - }, - { - "message": "replacing incorrect tag: function with method", - "line": " ../packages/store/src/-private/managers/record-array-manager.ts:22" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/network/request-cache.ts:195" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/network/request-cache.ts:210" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/store-service.ts:317" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/store-service.ts:349" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/store-service.ts:426" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/store/src/-private/store-service.ts:1898" - }, - { - "message": "unknown tag: attr", - "line": " ../packages/store/src/-private/store-service.ts:1898" - }, - { - "message": "unknown tag: hasmany", - "line": " ../packages/store/src/-private/store-service.ts:1898" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/store-service.ts:2212" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/store/src/-private/store-service.ts:2273" - }, - { - "message": "unknown tag: service", - "line": " ../packages/store/src/index.ts:1" - }, - { - "message": "replacing incorrect tag: function with method", - "line": " ../packages/tracking/src/-private.ts:92" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/tracking/src/-private.ts:92" - }, - { - "message": "replacing incorrect tag: function with method", - "line": " ../packages/tracking/src/-private.ts:115" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/tracking/src/-private.ts:115" - }, - { - "message": "replacing incorrect tag: returns with return", - "line": " ../packages/tracking/src/-private.ts:138" - }, - { - "message": "Missing item type\nServes as a reference to a `Resource` but does not contain\nany data itself.\n\nUsed to establish relationship linkages between `Resources` and\nto address data that may not be available synchronously.\n\n[JSON:API Spec](https://jsonapi.org/format/#document-resource-identifier-objects)", - "line": " ../ember-data-types/q/ember-data-json-api.ts:21" - }, - { - "message": "Missing item type\nWhile not officially part of the `JSON:API` spec,\n`ember-data` allows the use of `lid` as a local\nidentifier for a `Resource`.", - "line": " ../ember-data-types/q/ember-data-json-api.ts:35" - }, - { - "message": "Missing item type\nWhile valid in the `JSON:API` spec,\n`ember-data` ignores `meta` on `ResourceIdentifierObjects`", - "line": " ../ember-data-types/q/ember-data-json-api.ts:53" - }, - { - "message": "Missing item type\nServes as a reference to a resource created on the client\nbut not yet persisted.", - "line": " ../ember-data-types/q/ember-data-json-api.ts:63" - }, - { - "message": "Missing item type\nResources newly created on the client _may_\nnot have an `id` available to them prior\nto completion of their first successful `save`.\n\n`id` will be `null` in this case.", - "line": " ../ember-data-types/q/ember-data-json-api.ts:70" - }, - { - "message": "Missing item type\nResources newly created on the client _will always_\nhave an `lid` assigned immediately and available.", - "line": " ../ember-data-types/q/ember-data-json-api.ts:82" - }, - { - "message": "Missing item type\nContains the data for an existing resource in JSON:API format", - "line": " ../ember-data-types/q/ember-data-json-api.ts:112" - }, - { - "message": "Missing item type\nAn Identifier specific to a record which may or may not\nbe present in the cache.\n\nThe absence of an `id` DOES NOT indicate that this\nIdentifier is for a new client-created record as it\nmay also indicate that it was generated for a secondary\nindex and the primary `id` index is not yet known.", - "line": " ../ember-data-types/q/identifier.ts:31" - }, - { - "message": "Missing item type\nUsed when an Identifier is known to be the stable version", - "line": " ../ember-data-types/q/identifier.ts:44" - }, - { - "message": "Missing item type\nUsed when a StableRecordIdentifier was not created locally as part\nof a call to store.createRecord\n\nDistinguishing between this Identifier and one for a client created\nrecord that was created with an ID is generally speaking not possible\nat runtime, so anything with an ID typically narrows to this.", - "line": " ../ember-data-types/q/identifier.ts:53" - }, - { - "message": "Missing item type\nUsed when a StableRecordIdentifier was created locally\n(by a call to store.createRecord).\n\nIt is possible in rare circumstances to have a StableRecordIdentifier\nthat is not for a new record but does not have an ID. This would\nhappen if a user intentionally created one for use with a secondary-index\nprior to the record having been fully loaded.", - "line": " ../ember-data-types/q/identifier.ts:68" - }, - { - "message": "Missing item type", - "line": " ../ember-data-types/q/record-data-schemas.ts:8" - }, - { - "message": "Missing item type", - "line": " ../ember-data-types/q/record-data-schemas.ts:30" - }, - { - "message": "Missing item type\nThe field name on `this` record", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:79" - }, - { - "message": "Missing item type\nThe `type` of the related record", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:85" - }, - { - "message": "Missing item type\nThe field name on the opposing record", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:97" - }, - { - "message": "Missing item type\nThe `type` of `this` record", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:102" - }, - { - "message": "Missing item type\nWhether this relationship points back at the same type.\n\nIf the relationship is polymorphic, this will be true if\nit points back at the same abstract type.", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:130" - }, - { - "message": "Missing item type\nIf this is a reflexive relationship, this is true\nif the relationship also points back at the same\nfield.", - "line": " ../packages/graph/src/-private/graph/-edge-definition.ts:140" - }, - { - "message": "Missing item type\nThis method is called by `record.save`, and gets passed a\nresolver for the promise that `record.save` returns.\n\nIt schedules saving to happen at the end of the run loop.", - "line": " ../packages/legacy-compat/src/legacy-network-handler/fetch-manager.ts:78" - }, - { - "message": "Missing item type\nThis is a helper method that validates a JSON API top-level document\n\nThe format of a document is described here:\nhttp://jsonapi.org/format/#document-top-level", - "line": " ../packages/legacy-compat/src/legacy-network-handler/serializer-response.ts:10" - }, - { - "message": "Missing item type\nTag provides a cache for a getter\nthat recomputes only when a specific\ntracked property that it manages is dirtied.\n\nThis allows us to bust the cache for a value\nthat otherwise doesn't access anything tracked\nas well as control the timing of that notification.", - "line": " ../packages/model/src/-private/record-state.ts:24" - }, - { - "message": "Missing item type\nA decorattor that caches a getter while\nproviding the ability to bust that cache\nwhen we so choose in a way that notifies\nglimmer's tracking system.", - "line": " ../packages/model/src/-private/record-state.ts:78" - }, - { - "message": "Missing item type\nHistorically EmberData managed a state machine\nfor each record, the localState for which\nwas reflected onto Model.\n\nThis implements the flags and stateName for backwards compat\nwith the state tree that used to be possible (listed below).\n\nstateName and dirtyType are candidates for deprecation.\n\nroot\n empty\n deleted // hidden from stateName\n preloaded // hidden from stateName\n\n loading\n empty // hidden from stateName\n preloaded // hidden from stateName\n\n loaded\n saved\n updated\n uncommitted\n invalid\n inFlight\n created\n uncommitted\n invalid\n inFlight\n\n deleted\n saved\n new // hidden from stateName\n uncommitted\n invalid\n inFlight", - "line": " ../packages/model/src/-private/record-state.ts:108" - } - ] + ] } \ No newline at end of file