@ember-data-mirror/serializer 5.6.0-alpha.2 → 5.6.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/{json-CVTR4xWv.js → json-CYP2BhR9.js} +42 -89
- package/dist/json-CYP2BhR9.js.map +1 -0
- package/dist/json-api.js +14 -31
- package/dist/json-api.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/rest.js +30 -59
- package/dist/rest.js.map +1 -1
- package/dist/transform.js +9 -32
- package/dist/transform.js.map +1 -1
- package/package.json +13 -16
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts +1 -4
- package/unstable-preview-types/-private/embedded-records-mixin.d.ts.map +1 -1
- package/unstable-preview-types/-private/transforms/boolean.d.ts +2 -5
- package/unstable-preview-types/-private/transforms/boolean.d.ts.map +1 -1
- package/unstable-preview-types/-private/transforms/date.d.ts +1 -4
- package/unstable-preview-types/-private/transforms/date.d.ts.map +1 -1
- package/unstable-preview-types/-private/transforms/number.d.ts +1 -4
- package/unstable-preview-types/-private/transforms/number.d.ts.map +1 -1
- package/unstable-preview-types/-private/transforms/string.d.ts +1 -4
- package/unstable-preview-types/-private/transforms/string.d.ts.map +1 -1
- package/unstable-preview-types/-private/transforms/transform.d.ts +4 -9
- package/unstable-preview-types/-private/transforms/transform.d.ts.map +1 -1
- package/unstable-preview-types/index.d.ts +7 -12
- package/unstable-preview-types/index.d.ts.map +1 -1
- package/unstable-preview-types/json-api.d.ts +9 -24
- package/unstable-preview-types/json-api.d.ts.map +1 -1
- package/unstable-preview-types/json.d.ts +19 -62
- package/unstable-preview-types/json.d.ts.map +1 -1
- package/unstable-preview-types/rest.d.ts +11 -24
- package/unstable-preview-types/rest.d.ts.map +1 -1
- package/unstable-preview-types/transform.d.ts +0 -3
- package/unstable-preview-types/transform.d.ts.map +1 -1
- package/dist/json-CVTR4xWv.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-CYP2BhR9.js","sources":["../src/-private/utils.ts","../src/json.js"],"sourcesContent":["type Coercable = string | number | boolean | null | undefined | symbol;\n\nexport function coerceId(id: Coercable): string | null {\n if (id === null || id === undefined || id === '') {\n return null;\n } else if (typeof id === 'string') {\n return id;\n } else if (typeof id === 'symbol') {\n return id.toString();\n } else {\n return String(id);\n }\n}\n","import { getOwner } from '@ember/application';\nimport { warn } from '@ember/debug';\n\nimport { dasherize, singularize } from '@ember-data-mirror/request-utils/string';\nimport { assert } from '@warp-drive-mirror/build-config/macros';\n\nimport Serializer from '.';\nimport { coerceId } from './-private/utils';\n\nconst SOURCE_POINTER_REGEXP = /^\\/?data\\/(attributes|relationships)\\/(.*)/;\nconst SOURCE_POINTER_PRIMARY_REGEXP = /^\\/?data/;\nconst PRIMARY_ATTRIBUTE_KEY = 'base';\n\n/**\n * <blockquote style=\"margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;\">\n <p>\n ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n <a href=\"/ember-data/release/classes/%3CInterface%3E%20Handler\">Handler</a> instead to be used with the <a href=\"https://github.com/emberjs/data/tree/main/packages/request#readme\">RequestManager</a>\n </p>\n </blockquote>\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n By default, EmberData uses and recommends the `JSONAPISerializer`.\n\n `JSONSerializer` is useful for simpler or legacy backends that may\n not support the http://jsonapi.org/ spec.\n\n For example, given the following `User` model and JSON payload:\n\n ```js [app/models/user.js]\n import Model, { attr, belongsTo, hasMany } from '@ember-data-mirror/model';\n\n export default class UserModel extends Model {\n @hasMany('user') friends;\n @belongsTo('location') house;\n\n @attr('string') name;\n }\n ```\n\n ```js\n {\n id: 1,\n name: 'Sebastian',\n friends: [3, 4],\n links: {\n house: '/houses/lefkada'\n }\n }\n ```\n\n `JSONSerializer` will normalize the JSON payload to the JSON API format that the\n Ember Data store expects.\n\n You can customize how JSONSerializer processes its payload by passing options in\n the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:\n\n - To customize how a single record is normalized, use the `normalize` hook.\n - To customize how `JSONSerializer` normalizes the whole server response, use the\n `normalizeResponse` hook.\n - To customize how `JSONSerializer` normalizes a specific response from the server,\n use one of the many specific `normalizeResponse` hooks.\n - To customize how `JSONSerializer` normalizes your id, attributes or relationships,\n use the `extractId`, `extractAttributes` and `extractRelationships` hooks.\n\n The `JSONSerializer` normalization process follows these steps:\n\n 1. `normalizeResponse`\n - entry method to the serializer.\n 2. `normalizeCreateRecordResponse`\n - a `normalizeResponse` for a specific operation is called.\n 3. `normalizeSingleResponse`|`normalizeArrayResponse`\n - for methods like `createRecord` we expect a single record back, while for methods like `findAll` we expect multiple records back.\n 4. `normalize`\n - `normalizeArrayResponse` iterates and calls `normalize` for each of its records while `normalizeSingle`\n calls it once. This is the method you most likely want to subclass.\n 5. `extractId` | `extractAttributes` | `extractRelationships`\n - `normalize` delegates to these methods to\n turn the record payload into the JSON API format.\n\n @class JSONSerializer\n @public\n*/\nconst JSONSerializer = Serializer.extend({\n /**\n The `primaryKey` is used when serializing and deserializing\n data. Ember Data always uses the `id` property to store the id of\n the record. The external source may not always follow this\n convention. In these cases it is useful to override the\n `primaryKey` property to match the `primaryKey` of your external\n store.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n primaryKey = '_id'\n }\n ```\n\n @property primaryKey\n @type {String}\n @public\n @default 'id'\n */\n primaryKey: 'id',\n\n /**\n The `attrs` object can be used to declare a simple mapping between\n property names on `Model` records and payload keys in the\n serialized JSON object representing the record. An object with the\n property `key` can also be used to designate the attribute's key on\n the response payload.\n\n Example\n\n ```js [app/models/person.js]\n import Model, { attr } from '@ember-data-mirror/model';\n\n export default class PersonModel extends Model {\n @attr('string') firstName;\n @attr('string') lastName;\n @attr('string') occupation;\n @attr('boolean') admin;\n }\n ```\n\n ```js [app/serializers/person.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PersonSerializer extends JSONSerializer {\n attrs = {\n admin: 'is_admin',\n occupation: { key: 'career' }\n }\n }\n ```\n\n You can also remove attributes and relationships by setting the `serialize`\n key to `false` in your mapping object.\n\n Example\n\n ```js [app/serializers/person.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n attrs = {\n admin: { serialize: false },\n occupation: { key: 'career' }\n }\n }\n ```\n\n When serialized:\n\n ```javascript\n {\n \"firstName\": \"Harry\",\n \"lastName\": \"Houdini\",\n \"career\": \"magician\"\n }\n ```\n\n Note that the `admin` is now not included in the payload.\n\n Setting `serialize` to `true` enforces serialization for hasMany\n relationships even if it's neither a many-to-many nor many-to-none\n relationship.\n\n @property attrs\n @public\n @type {Object}\n */\n mergedProperties: ['attrs'],\n\n /**\n Given a subclass of `Model` and a JSON object this method will\n iterate through each attribute of the `Model` and invoke the\n `Transform#deserialize` method on the matching property of the\n JSON object. This method is typically called after the\n serializer's `normalize` method.\n\n @private\n @param {Model} typeClass\n @param {Object} data The data to transform\n @return {Object} data The transformed data object\n */\n applyTransforms(typeClass, data) {\n const attributes = typeClass.attributes;\n\n typeClass.eachTransformedAttribute((key, typeClass) => {\n if (data[key] === undefined) {\n return;\n }\n\n const transform = this.transformFor(typeClass);\n const transformMeta = attributes.get(key);\n data[key] = transform.deserialize(data[key], transformMeta.options);\n });\n\n return data;\n },\n\n /**\n The `normalizeResponse` method is used to normalize a payload from the\n server to a JSON-API Document.\n\n http://jsonapi.org/format/#document-structure\n\n This method delegates to a more specific normalize method based on\n the `requestType`.\n\n To override this method with a custom one, make sure to call\n `return super.normalizeResponse(store, primaryModelClass, payload, id, requestType)` with your\n pre-processed data.\n\n Here's an example of using `normalizeResponse` manually:\n\n ```javascript\n socket.on('message', function(message) {\n let data = message.data;\n let modelClass = store.modelFor(data.modelName);\n let serializer = store.serializerFor(data.modelName);\n let normalized = serializer.normalizeSingleResponse(store, modelClass, data, data.id);\n\n store.push(normalized);\n });\n ```\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeResponse(store, primaryModelClass, payload, id, requestType) {\n switch (requestType) {\n case 'findRecord':\n return this.normalizeFindRecordResponse(...arguments);\n case 'queryRecord':\n return this.normalizeQueryRecordResponse(...arguments);\n case 'findAll':\n return this.normalizeFindAllResponse(...arguments);\n case 'findBelongsTo':\n return this.normalizeFindBelongsToResponse(...arguments);\n case 'findHasMany':\n return this.normalizeFindHasManyResponse(...arguments);\n case 'findMany':\n return this.normalizeFindManyResponse(...arguments);\n case 'query':\n return this.normalizeQueryResponse(...arguments);\n case 'createRecord':\n return this.normalizeCreateRecordResponse(...arguments);\n case 'deleteRecord':\n return this.normalizeDeleteRecordResponse(...arguments);\n case 'updateRecord':\n return this.normalizeUpdateRecordResponse(...arguments);\n }\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `queryRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeQueryRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findAll`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindAllResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findBelongsTo`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindBelongsToResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findHasMany`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindHasManyResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `findMany`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeFindManyResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `query`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeQueryResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeArrayResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `createRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeCreateRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSaveResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `deleteRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeDeleteRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSaveResponse(...arguments);\n },\n\n /**\n Called by the default normalizeResponse implementation when the\n type of request is `updateRecord`\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeUpdateRecordResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSaveResponse(...arguments);\n },\n\n /**\n normalizeUpdateRecordResponse, normalizeCreateRecordResponse and\n normalizeDeleteRecordResponse delegate to this method by default.\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeSaveResponse(store, primaryModelClass, payload, id, requestType) {\n return this.normalizeSingleResponse(...arguments);\n },\n\n /**\n normalizeQueryResponse and normalizeFindRecordResponse delegate to this\n method by default.\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeSingleResponse(store, primaryModelClass, payload, id, requestType) {\n return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, true);\n },\n\n /**\n normalizeQueryResponse, normalizeFindManyResponse, and normalizeFindHasManyResponse delegate\n to this method by default.\n\n @since 1.13.0\n @public\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @return {Object} JSON-API Document\n */\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, false);\n },\n\n /**\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @param {Boolean} isSingle\n @return {Object} JSON-API Document\n @private\n */\n _normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {\n const documentHash = {\n data: null,\n included: [],\n };\n\n const meta = this.extractMeta(store, primaryModelClass, payload);\n if (meta) {\n assert(\n 'The `meta` returned from `extractMeta` has to be an object, not \"' + typeof meta + '\".',\n typeof meta === 'object'\n );\n documentHash.meta = meta;\n }\n\n if (isSingle) {\n const { data, included } = this.normalize(primaryModelClass, payload);\n documentHash.data = data;\n if (included) {\n documentHash.included = included;\n }\n } else {\n const ret = new Array(payload.length);\n for (let i = 0, l = payload.length; i < l; i++) {\n const item = payload[i];\n const { data, included } = this.normalize(primaryModelClass, item);\n if (included) {\n documentHash.included = documentHash.included.concat(included);\n }\n ret[i] = data;\n }\n\n documentHash.data = ret;\n }\n\n return documentHash;\n },\n\n /**\n Normalizes a part of the JSON payload returned by\n the server. You should override this method, munge the hash\n and call super if you have generic normalization to do.\n\n It takes the type of the record that is being normalized\n (as a Model class), the property where the hash was\n originally found, and the hash to normalize.\n\n You can use this method, for example, to normalize underscored keys to camelized\n or other general-purpose normalizations.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n import { underscore } from '<app-name>/utils/string-utils';\n import { get } from '@ember/object';\n\n export default class ApplicationSerializer extends JSONSerializer {\n normalize(typeClass, hash) {\n let fields = typeClass.fields;\n\n fields.forEach(function(type, field) {\n let payloadField = underscore(field);\n if (field === payloadField) { return; }\n\n hash[field] = hash[payloadField];\n delete hash[payloadField];\n });\n\n return super.normalize(...arguments);\n }\n }\n ```\n\n @public\n @param {Model} typeClass\n @param {Object} hash\n @return {Object}\n */\n normalize(modelClass, resourceHash) {\n let data = null;\n\n if (resourceHash) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash);\n if (typeof resourceHash.links === 'object') {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.links);\n }\n\n data = {\n id: this.extractId(modelClass, resourceHash),\n type: modelClass.modelName,\n attributes: this.extractAttributes(modelClass, resourceHash),\n relationships: this.extractRelationships(modelClass, resourceHash),\n };\n\n if (resourceHash.lid) {\n data.lid = resourceHash.lid;\n }\n\n this.applyTransforms(modelClass, data.attributes);\n }\n\n return { data };\n },\n\n /**\n Returns the resource's ID.\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {String}\n */\n extractId(modelClass, resourceHash) {\n const primaryKey = this.primaryKey;\n const id = resourceHash[primaryKey];\n return coerceId(id);\n },\n\n /**\n Returns the resource's attributes formatted as a JSON-API \"attributes object\".\n\n http://jsonapi.org/format/#document-resource-object-attributes\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractAttributes(modelClass, resourceHash) {\n let attributeKey;\n const attributes = {};\n\n modelClass.eachAttribute((key) => {\n attributeKey = this.keyForAttribute(key, 'deserialize');\n if (resourceHash[attributeKey] !== undefined) {\n attributes[key] = resourceHash[attributeKey];\n }\n });\n\n return attributes;\n },\n\n /**\n Returns a relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @public\n @param {Object} relationshipModelName\n @param {Object} relationshipHash\n @return {Object}\n */\n extractRelationship(relationshipModelName, relationshipHash) {\n if (!relationshipHash) {\n return null;\n }\n /*\n When `relationshipHash` is an object it usually means that the relationship\n is polymorphic. It could however also be embedded resources that the\n EmbeddedRecordsMixin has be able to process.\n */\n if (relationshipHash && typeof relationshipHash === 'object' && !Array.isArray(relationshipHash)) {\n if (relationshipHash.id) {\n relationshipHash.id = coerceId(relationshipHash.id);\n }\n\n const modelClass = this.store.modelFor(relationshipModelName);\n if (relationshipHash.type && !modelClass.fields.has('type')) {\n relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);\n }\n\n return relationshipHash;\n }\n return { id: coerceId(relationshipHash), type: dasherize(singularize(relationshipModelName)) };\n },\n\n /**\n Returns a polymorphic relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n `relationshipOptions` is a hash which contains more information about the\n polymorphic relationship which should be extracted:\n - `resourceHash` complete hash of the resource the relationship should be\n extracted from\n - `relationshipKey` key under which the value for the relationship is\n extracted from the resourceHash\n - `relationshipMeta` meta information about the relationship\n\n @public\n @param {Object} relationshipModelName\n @param {Object} relationshipHash\n @param {Object} relationshipOptions\n @return {Object}\n */\n extractPolymorphicRelationship(relationshipModelName, relationshipHash, relationshipOptions) {\n return this.extractRelationship(relationshipModelName, relationshipHash);\n },\n\n /**\n Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractRelationships(modelClass, resourceHash) {\n const relationships = {};\n\n modelClass.eachRelationship((key, relationshipMeta) => {\n let relationship = null;\n const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');\n if (resourceHash[relationshipKey] !== undefined) {\n let data = null;\n const relationshipHash = resourceHash[relationshipKey];\n if (relationshipMeta.kind === 'belongsTo') {\n if (relationshipMeta.options.polymorphic) {\n // extracting a polymorphic belongsTo may need more information\n // than the type and the hash (which might only be an id) for the\n // relationship, hence we pass the key, resource and\n // relationshipMeta too\n data = this.extractPolymorphicRelationship(relationshipMeta.type, relationshipHash, {\n key,\n resourceHash,\n relationshipMeta,\n });\n } else {\n data = this.extractRelationship(relationshipMeta.type, relationshipHash);\n }\n } else if (relationshipMeta.kind === 'hasMany') {\n if (relationshipHash) {\n data = new Array(relationshipHash.length);\n if (relationshipMeta.options.polymorphic) {\n for (let i = 0, l = relationshipHash.length; i < l; i++) {\n const item = relationshipHash[i];\n data[i] = this.extractPolymorphicRelationship(relationshipMeta.type, item, {\n key,\n resourceHash,\n relationshipMeta,\n });\n }\n } else {\n for (let i = 0, l = relationshipHash.length; i < l; i++) {\n const item = relationshipHash[i];\n data[i] = this.extractRelationship(relationshipMeta.type, item);\n }\n }\n }\n }\n relationship = { data };\n }\n\n const linkKey = this.keyForLink(key, relationshipMeta.kind);\n if (resourceHash.links && resourceHash.links[linkKey] !== undefined) {\n const related = resourceHash.links[linkKey];\n relationship = relationship || {};\n relationship.links = { related };\n }\n\n if (relationship) {\n relationships[key] = relationship;\n }\n });\n\n return relationships;\n },\n\n /**\n Dasherizes the model name in the payload\n\n @public\n @param {String} key\n @return {String} the model's modelName\n */\n modelNameFromPayloadKey(key) {\n return dasherize(singularize(key));\n },\n\n /**\n @private\n */\n normalizeRelationships(typeClass, hash) {\n let payloadKey;\n\n if (this.keyForRelationship) {\n typeClass.eachRelationship((key, relationship) => {\n payloadKey = this.keyForRelationship(key, relationship.kind, 'deserialize');\n if (key === payloadKey) {\n return;\n }\n if (hash[payloadKey] === undefined) {\n return;\n }\n\n hash[key] = hash[payloadKey];\n delete hash[payloadKey];\n });\n }\n },\n\n /**\n @private\n */\n normalizeUsingDeclaredMapping(modelClass, hash) {\n const attrs = this.attrs;\n let normalizedKey;\n let payloadKey;\n\n if (attrs) {\n for (const key in attrs) {\n normalizedKey = payloadKey = this._getMappedKey(key, modelClass);\n\n if (hash[payloadKey] === undefined) {\n continue;\n }\n\n if (modelClass.attributes.has(key)) {\n normalizedKey = this.keyForAttribute(key, 'deserialize');\n }\n\n if (modelClass.relationshipsByName.has(key)) {\n normalizedKey = this.keyForRelationship(key, modelClass, 'deserialize');\n }\n\n if (payloadKey !== normalizedKey) {\n hash[normalizedKey] = hash[payloadKey];\n delete hash[payloadKey];\n }\n }\n }\n },\n\n /**\n Looks up the property key that was set by the custom `attr` mapping\n passed to the serializer.\n\n @private\n @param {String} key\n @return {String} key\n */\n _getMappedKey(key, modelClass) {\n warn(\n 'There is no attribute or relationship with the name `' +\n key +\n '` on `' +\n modelClass.modelName +\n '`. Check your serializers attrs hash.',\n modelClass.attributes.has(key) || modelClass.relationshipsByName.has(key),\n {\n id: 'ds.serializer.no-mapped-attrs-key',\n }\n );\n\n const attrs = this.attrs;\n let mappedKey;\n if (attrs && attrs[key]) {\n mappedKey = attrs[key];\n //We need to account for both the { title: 'post_title' } and\n //{ title: { key: 'post_title' }} forms\n if (mappedKey.key) {\n mappedKey = mappedKey.key;\n }\n if (typeof mappedKey === 'string') {\n key = mappedKey;\n }\n }\n\n return key;\n },\n\n /**\n Check attrs.key.serialize property to inform if the `key`\n can be serialized\n\n @private\n @param {String} key\n @return {Boolean} true if the key can be serialized\n */\n _canSerialize(key) {\n const attrs = this.attrs;\n\n return !attrs || !attrs[key] || attrs[key].serialize !== false;\n },\n\n /**\n When attrs.key.serialize is set to true then\n it takes priority over the other checks and the related\n attribute/relationship will be serialized\n\n @private\n @param {String} key\n @return {Boolean} true if the key must be serialized\n */\n _mustSerialize(key) {\n const attrs = this.attrs;\n\n return attrs && attrs[key] && attrs[key].serialize === true;\n },\n\n /**\n Check if the given hasMany relationship should be serialized\n\n By default only many-to-many and many-to-none relationships are serialized.\n This could be configured per relationship by Serializer's `attrs` object.\n\n @public\n @param {Snapshot} snapshot\n @param {String} key\n @param {RelationshipSchema} relationship\n @return {Boolean} true if the hasMany relationship should be serialized\n */\n shouldSerializeHasMany(snapshot, key, relationship) {\n const schema = this.store.modelFor(snapshot.modelName);\n const relationshipType = schema.determineRelationshipType(relationship, this.store);\n if (this._mustSerialize(key)) {\n return true;\n }\n return this._canSerialize(key) && (relationshipType === 'manyToNone' || relationshipType === 'manyToMany');\n },\n\n // SERIALIZE\n /**\n Called when a record is saved in order to convert the\n record into JSON.\n\n By default, it creates a JSON object with a key for\n each attribute and belongsTo relationship.\n\n For example, consider this model:\n\n ```js [app/models/comment.js]\n import Model, { attr, belongsTo } from '@ember-data-mirror/model';\n\n export default class CommentModel extends Model {\n @attr title;\n @attr body;\n\n @belongsTo('user') author;\n }\n ```\n\n The default serialization would create a JSON object like:\n\n ```javascript\n {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n \"author\": 12\n }\n ```\n\n By default, attributes are passed through as-is, unless\n you specified an attribute type (`attr('date')`). If\n you specify a transform, the JavaScript value will be\n serialized when inserted into the JSON hash.\n\n By default, belongs-to relationships are converted into\n IDs when inserted into the JSON hash.\n\n ## IDs\n\n `serialize` takes an options hash with a single option:\n `includeId`. If this option is `true`, `serialize` will,\n by default include the ID in the JSON object it builds.\n\n The adapter passes in `includeId: true` when serializing\n a record for `createRecord`, but not for `updateRecord`.\n\n ## Customization\n\n Your server may expect a different JSON format than the\n built-in serialization format.\n\n In that case, you can implement `serialize` yourself and\n return a JSON hash of your choosing.\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n ```\n\n ## Customizing an App-Wide Serializer\n\n If you want to define a serializer for your entire\n application, you'll probably want to use `eachAttribute`\n and `eachRelationship` on the record.\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n import { singularize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n\n function serverAttributeName(attribute) {\n return attribute.underscore().toUpperCase();\n }\n\n function serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + \"_IDS\";\n }\n ```\n\n This serializer will generate JSON that looks like this:\n\n ```javascript\n {\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n }\n ```\n\n ## Tweaking the Default JSON\n\n If you just want to do some small tweaks on the default JSON,\n you can call `super.serialize` first and make the tweaks on\n the returned JSON.\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.subject = json.title;\n delete json.title;\n\n return json;\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} options\n @return {Object} json\n */\n serialize(snapshot, options) {\n const json = {};\n\n if (options && options.includeId) {\n const id = snapshot.id;\n if (id) {\n json[this.primaryKey] = id;\n }\n }\n\n snapshot.eachAttribute((key, attribute) => {\n this.serializeAttribute(snapshot, json, key, attribute);\n });\n\n snapshot.eachRelationship((key, relationship) => {\n if (relationship.kind === 'belongsTo') {\n this.serializeBelongsTo(snapshot, json, relationship);\n } else if (relationship.kind === 'hasMany') {\n this.serializeHasMany(snapshot, json, relationship);\n }\n });\n\n return json;\n },\n\n /**\n You can use this method to customize how a serialized record is added to the complete\n JSON hash to be sent to the server. By default the JSON Serializer does not namespace\n the payload and just sends the raw serialized JSON object.\n If your server expects namespaced keys, you should consider using the RESTSerializer.\n Otherwise you can override this method to customize how the record is added to the hash.\n The hash property should be modified by reference.\n\n For example, your server may expect underscored root objects.\n\n ```js [app/serializers/application.js]\n import RESTSerializer from '@ember-data-mirror/serializer/rest';\n import { underscoren} from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends RESTSerializer {\n serializeIntoHash(data, type, snapshot, options) {\n let root = underscore(type.modelName);\n data[root] = this.serialize(snapshot, options);\n }\n }\n ```\n\n @public\n @param {Object} hash\n @param {Model} typeClass\n @param {Snapshot} snapshot\n @param {Object} options\n */\n serializeIntoHash(hash, typeClass, snapshot, options) {\n Object.assign(hash, this.serialize(snapshot, options));\n },\n\n /**\n `serializeAttribute` can be used to customize how `attr`\n properties are serialized\n\n For example if you wanted to ensure all your attributes were always\n serialized as properties on an `attributes` object you could\n write:\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class ApplicationSerializer extends JSONSerializer {\n serializeAttribute(snapshot, json, key, attributes) {\n json.attributes = json.attributes || {};\n super.serializeAttribute(snapshot, json.attributes, key, attributes);\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {String} key\n @param {Object} attribute\n */\n serializeAttribute(snapshot, json, key, attribute) {\n if (this._canSerialize(key)) {\n const type = attribute.type;\n let value = snapshot.attr(key);\n if (type) {\n const transform = this.transformFor(type);\n value = transform.serialize(value, attribute.options);\n }\n\n // if provided, use the mapping provided by `attrs` in\n // the serializer\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(key, schema);\n\n if (payloadKey === key && this.keyForAttribute) {\n payloadKey = this.keyForAttribute(key, 'serialize');\n }\n\n json[payloadKey] = value;\n }\n },\n\n /**\n `serializeBelongsTo` can be used to customize how `belongsTo`\n properties are serialized.\n\n Example\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serializeBelongsTo(snapshot, json, relationship) {\n let key = relationship.name;\n let belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForRelationship ? this.keyForRelationship(key, \"belongsTo\", \"serialize\") : key;\n\n json[key] = !belongsTo ? null : belongsTo.record.toJSON();\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializeBelongsTo(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this._canSerialize(name)) {\n const belongsToId = snapshot.belongsTo(name, { id: true });\n\n // if provided, use the mapping provided by `attrs` in\n // the serializer\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name && this.keyForRelationship) {\n payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');\n }\n\n //Need to check whether the id is there for new&async records\n if (!belongsToId) {\n json[payloadKey] = null;\n } else {\n json[payloadKey] = belongsToId;\n }\n\n if (relationship.options.polymorphic) {\n this.serializePolymorphicType(snapshot, json, relationship);\n }\n }\n },\n\n /**\n `serializeHasMany` can be used to customize how `hasMany`\n properties are serialized.\n\n Example\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n serializeHasMany(snapshot, json, relationship) {\n let key = relationship.name;\n if (key === 'comments') {\n return;\n } else {\n super.serializeHasMany(...arguments);\n }\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializeHasMany(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this.shouldSerializeHasMany(snapshot, name, relationship)) {\n const hasMany = snapshot.hasMany(name, { ids: true });\n if (hasMany !== undefined) {\n // if provided, use the mapping provided by `attrs` in\n // the serializer\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name && this.keyForRelationship) {\n payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');\n }\n\n json[payloadKey] = hasMany;\n // TODO support for polymorphic manyToNone and manyToMany relationships\n }\n }\n },\n\n /**\n You can use this method to customize how polymorphic objects are\n serialized. Objects are considered to be polymorphic if\n `{ polymorphic: true }` is pass as the second argument to the\n `belongsTo` function.\n\n Example\n\n ```js [app/serializers/comment.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class CommentSerializer extends JSONSerializer {\n serializePolymorphicType(snapshot, json, relationship) {\n let key = relationship.name;\n let belongsTo = snapshot.belongsTo(key);\n\n key = this.keyForAttribute ? this.keyForAttribute(key, 'serialize') : key;\n\n if (!belongsTo) {\n json[key + '_type'] = null;\n } else {\n json[key + '_type'] = belongsTo.modelName;\n }\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} json\n @param {Object} relationship\n */\n serializePolymorphicType() {},\n\n /**\n `extractMeta` is used to deserialize any meta information in the\n adapter payload. By default Ember Data expects meta information to\n be located on the `meta` property of the payload object.\n\n Example\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n extractMeta(store, typeClass, payload) {\n if (payload && payload.hasOwnProperty('_pagination')) {\n let meta = payload._pagination;\n delete payload._pagination;\n return meta;\n }\n }\n }\n ```\n\n @public\n @param {Store} store\n @param {Model} modelClass\n @param {Object} payload\n */\n extractMeta(store, modelClass, payload) {\n if (payload && payload['meta'] !== undefined) {\n const meta = payload.meta;\n delete payload.meta;\n return meta;\n }\n },\n\n /**\n `extractErrors` is used to extract model errors when a call\n to `Model#save` fails with an `InvalidError`. By default\n Ember Data expects error information to be located on the `errors`\n property of the payload object.\n\n This serializer expects this `errors` object to be an Array similar\n to the following, compliant with the https://jsonapi.org/format/#errors specification:\n\n ```js\n {\n \"errors\": [\n {\n \"detail\": \"This username is already taken!\",\n \"source\": {\n \"pointer\": \"data/attributes/username\"\n }\n }, {\n \"detail\": \"Doesn't look like a valid email.\",\n \"source\": {\n \"pointer\": \"data/attributes/email\"\n }\n }\n ]\n }\n ```\n\n The key `detail` provides a textual description of the problem.\n Alternatively, the key `title` can be used for the same purpose.\n\n The nested keys `source.pointer` detail which specific element\n of the request data was invalid.\n\n Note that JSON-API also allows for object-level errors to be placed\n in an object with pointer `data`, signifying that the problem\n cannot be traced to a specific attribute:\n\n ```javascript\n {\n \"errors\": [\n {\n \"detail\": \"Some generic non property error message\",\n \"source\": {\n \"pointer\": \"data\"\n }\n }\n ]\n }\n ```\n\n When turn into a `Errors` object, you can read these errors\n through the property `base`:\n\n ```handlebars\n {{#each @model.errors.base as |error|}}\n <div class=\"error\">\n {{error.message}}\n </div>\n {{/each}}\n ```\n\n Example of alternative implementation, overriding the default\n behavior to deal with a different format of errors:\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n\n export default class PostSerializer extends JSONSerializer {\n extractErrors(store, typeClass, payload, id) {\n if (payload && typeof payload === 'object' && payload._problems) {\n payload = payload._problems;\n this.normalizeErrors(typeClass, payload);\n }\n return payload;\n }\n }\n ```\n\n @public\n @param {Store} store\n @param {Model} typeClass\n @param {Object} payload\n @param {(String|Number)} id\n @return {Object} json The deserialized errors\n */\n extractErrors(store, typeClass, payload, id) {\n if (payload && typeof payload === 'object' && payload.errors) {\n // the default assumption is that errors is already in JSON:API format\n const extracted = {};\n\n payload.errors.forEach((error) => {\n if (error.source && error.source.pointer) {\n let key = error.source.pointer.match(SOURCE_POINTER_REGEXP);\n\n if (key) {\n key = key[2];\n } else if (error.source.pointer.search(SOURCE_POINTER_PRIMARY_REGEXP) !== -1) {\n key = PRIMARY_ATTRIBUTE_KEY;\n }\n\n if (key) {\n extracted[key] = extracted[key] || [];\n extracted[key].push(error.detail || error.title);\n }\n }\n });\n\n // if the user has an attrs hash, convert keys using it\n this.normalizeUsingDeclaredMapping(typeClass, extracted);\n\n // for each attr and relationship, make sure that we use\n // the normalized key\n typeClass.eachAttribute((name) => {\n const key = this.keyForAttribute(name, 'deserialize');\n if (key !== name && extracted[key] !== undefined) {\n extracted[name] = extracted[key];\n delete extracted[key];\n }\n });\n\n typeClass.eachRelationship((name) => {\n const key = this.keyForRelationship(name, 'deserialize');\n if (key !== name && extracted[key] !== undefined) {\n extracted[name] = extracted[key];\n delete extracted[key];\n }\n });\n\n return extracted;\n }\n\n return payload;\n },\n\n /**\n `keyForAttribute` can be used to define rules for how to convert an\n attribute name in your model to a key in your JSON.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONSerializer {\n keyForAttribute(attr, method) {\n return underscore(attr).toUpperCase();\n }\n }\n ```\n\n @public\n @param {String} key\n @param {String} method\n @return {String} normalized key\n */\n keyForAttribute(key, method) {\n return key;\n },\n\n /**\n `keyForRelationship` can be used to define a custom key when\n serializing and deserializing relationship properties. By default\n `JSONSerializer` does not provide an implementation of this method.\n\n Example\n\n ```js [app/serializers/post.js]\n import JSONSerializer from '@ember-data-mirror/serializer/json';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class PostSerializer extends JSONSerializer {\n keyForRelationship(key, relationship, method) {\n return `rel_${underscore(key)}`;\n }\n }\n ```\n\n @public\n @param {String} key\n @param {String} typeClass\n @param {String} method\n @return {String} normalized key\n */\n keyForRelationship(key, typeClass, method) {\n return key;\n },\n\n /**\n `keyForLink` can be used to define a custom key when deserializing link\n properties.\n\n @public\n @param {String} key\n @param {String} kind `belongsTo` or `hasMany`\n @return {String} normalized key\n */\n keyForLink(key, kind) {\n return key;\n },\n\n // HELPERS\n\n /**\n @private\n @param {String} attributeType\n @param {Boolean} skipAssertion\n @return {Transform} transform\n */\n transformFor(attributeType, skipAssertion) {\n const transform = getOwner(this).lookup('transform:' + attributeType);\n\n assert(`Unable to find the transform for \\`attr('${attributeType}')\\``, skipAssertion || !!transform);\n\n return transform;\n },\n});\n\nexport default JSONSerializer;\n"],"names":["coerceId","id","undefined","toString","String","SOURCE_POINTER_REGEXP","SOURCE_POINTER_PRIMARY_REGEXP","PRIMARY_ATTRIBUTE_KEY","JSONSerializer","Serializer","extend","primaryKey","mergedProperties","applyTransforms","typeClass","data","attributes","eachTransformedAttribute","key","transform","transformFor","transformMeta","get","deserialize","options","normalizeResponse","store","primaryModelClass","payload","requestType","normalizeFindRecordResponse","arguments","normalizeQueryRecordResponse","normalizeFindAllResponse","normalizeFindBelongsToResponse","normalizeFindHasManyResponse","normalizeFindManyResponse","normalizeQueryResponse","normalizeCreateRecordResponse","normalizeDeleteRecordResponse","normalizeUpdateRecordResponse","normalizeSingleResponse","normalizeArrayResponse","normalizeSaveResponse","_normalizeResponse","isSingle","documentHash","included","meta","extractMeta","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","normalize","ret","Array","length","i","l","item","concat","modelClass","resourceHash","normalizeUsingDeclaredMapping","links","extractId","type","modelName","extractAttributes","relationships","extractRelationships","lid","attributeKey","eachAttribute","keyForAttribute","extractRelationship","relationshipModelName","relationshipHash","isArray","modelFor","fields","has","modelNameFromPayloadKey","dasherize","singularize","extractPolymorphicRelationship","relationshipOptions","eachRelationship","relationshipMeta","relationship","relationshipKey","keyForRelationship","kind","polymorphic","linkKey","keyForLink","related","normalizeRelationships","hash","payloadKey","attrs","normalizedKey","_getMappedKey","relationshipsByName","warn","mappedKey","_canSerialize","serialize","_mustSerialize","shouldSerializeHasMany","snapshot","schema","relationshipType","determineRelationshipType","json","includeId","attribute","serializeAttribute","serializeBelongsTo","serializeHasMany","serializeIntoHash","Object","assign","value","attr","name","belongsToId","belongsTo","serializePolymorphicType","hasMany","ids","extractErrors","errors","extracted","forEach","error","source","pointer","match","search","push","detail","title","method","attributeType","skipAssertion","getOwner","lookup"],"mappings":";;;;;;AAEO,SAASA,QAAQA,CAACC,EAAa,EAAiB;EACrD,IAAIA,EAAE,KAAK,IAAI,IAAIA,EAAE,KAAKC,SAAS,IAAID,EAAE,KAAK,EAAE,EAAE;AAChD,IAAA,OAAO,IAAI;AACb,GAAC,MAAM,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;AACjC,IAAA,OAAOA,EAAE;AACX,GAAC,MAAM,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;AACjC,IAAA,OAAOA,EAAE,CAACE,QAAQ,EAAE;AACtB,GAAC,MAAM;IACL,OAAOC,MAAM,CAACH,EAAE,CAAC;AACnB;AACF;;ACHA,MAAMI,qBAAqB,GAAG,4CAA4C;AAC1E,MAAMC,6BAA6B,GAAG,UAAU;AAChD,MAAMC,qBAAqB,GAAG,MAAM;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAMC,cAAc,GAAGC,UAAU,CAACC,MAAM,CAAC;AACvC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEC,EAAAA,UAAU,EAAE,IAAI;AAEhB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAeEC,gBAAgB,EAAE,CAAC,OAAO,CAAC;AAE3B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEEC,EAAAA,eAAeA,CAACC,SAAS,EAAEC,IAAI,EAAE;AAC/B,IAAA,MAAMC,UAAU,GAAGF,SAAS,CAACE,UAAU;AAEvCF,IAAAA,SAAS,CAACG,wBAAwB,CAAC,CAACC,GAAG,EAAEJ,SAAS,KAAK;AACrD,MAAA,IAAIC,IAAI,CAACG,GAAG,CAAC,KAAKhB,SAAS,EAAE;AAC3B,QAAA;AACF;AAEA,MAAA,MAAMiB,SAAS,GAAG,IAAI,CAACC,YAAY,CAACN,SAAS,CAAC;AAC9C,MAAA,MAAMO,aAAa,GAAGL,UAAU,CAACM,GAAG,CAACJ,GAAG,CAAC;AACzCH,MAAAA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuCEL,EAAAA,SAASA,CAACG,QAAQ,EAAE1F,OAAO,EAAE;IAC3B,MAAM8F,IAAI,GAAG,EAAE;AAEf,IAAA,IAAI9F,OAAO,IAAIA,OAAO,CAAC+F,SAAS,EAAE;AAChC,MAAA,MAAMtH,EAAE,GAAGiH,QAAQ,CAACjH,EAAE;AACtB,MAAA,IAAIA,EAAE,EAAE;AACNqH,QAAAA,IAAI,CAAC,IAAI,CAAC3G,UAAU,CAAC,GAAGV,EAAE;AAC5B;AACF;AAEAiH,IAAAA,QAAQ,CAACrC,aAAa,CAAC,CAAC3D,GAAG,EAAEsG,SAAS,KAAK;MACzC,IAAI,CAACC,kBAAkB,CAACP,QAAQ,EAAEI,IAAI,EAAEpG,GAAG,EAAEsG,SAAS,CAAC;AACzD,KAAC,CAAC;AAEFN,IAAAA,QAAQ,CAACvB,gBAAgB,CAAC,CAACzE,GAAG,EAAE2E,YAAY,KAAK;AAC/C,MAAA,IAAIA,YAAY,CAACG,IAAI,KAAK,WAAW,EAAE;QACrC,IAAI,CAAC0B,kBAAkB,CAACR,QAAQ,EAAEI,IAAI,EAAEzB,YAAY,CAAC;AACvD,OAAC,MAAM,IAAIA,YAAY,CAACG,IA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A;AACA;AACA;AAKEkD,EAAAA,eAAeA,CAAC5D,GAAG,EAAEiI,MAAM,EAAE;AAC3B,IAAA,OAAOjI,GAAG;GACX;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKE6E,EAAAA,kBAAkBA,CAAC7E,GAAG,EAAEJ,SAAS,EAAEqI,MAAM,EAAE;AACzC,IAAA,OAAOjI,GAAG;GACX;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAEEiF,EAAAA,UAAUA,CAACjF,GAAG,EAAE8E,IAAI,EAAE;AACpB,IAAA,OAAO9E,GAAG;GACX;AAED;;AAEA;AACF;AACA;AACA;AACA;AACA;AACEE,EAAAA,YAAYA,CAACgI,aAAa,EAAEC,aAAa,EAAE;AACzC,IAAA,MAAMlI,SAAS,GAAGmI,QAAQ,CAAC,IAAI,CAAC,CAACC,MAAM,CAAC,YAAY,GAAGH,aAAa,CAAC;IAErElG,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,MAAA,IAAA,CAAAA,IAAA,EAAA;AAAA,QAAA,MAAA,IAAAC,KAAA,CAAO,CAA4C4F,yCAAAA,EAAAA,aAAa,CAAM,IAAA,CAAA,CAAA;AAAA;AAAA,KAAA,EAAEC,aAAa,IAAI,CAAC,CAAClI,SAAS,CAAA,GAAA,EAAA;AAEpG,IAAA,OAAOA,SAAS;AAClB;AACF,CAAC;;;;"}
|
package/dist/json-api.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
2
|
import { dasherize, pluralize, singularize } from '@ember-data-mirror/request-utils/string';
|
|
3
|
-
import { J as JSONSerializer } from "./json-
|
|
3
|
+
import { J as JSONSerializer } from "./json-CYP2BhR9.js";
|
|
4
4
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @module @ember-data-mirror/serializer/json-api
|
|
8
|
-
*/
|
|
9
5
|
const JSONAPISerializer = JSONSerializer.extend({
|
|
10
6
|
/**
|
|
11
|
-
@method _normalizeDocumentHelper
|
|
12
7
|
@param {Object} documentHash
|
|
13
8
|
@return {Object}
|
|
14
9
|
@private
|
|
@@ -39,7 +34,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
39
34
|
return documentHash;
|
|
40
35
|
},
|
|
41
36
|
/**
|
|
42
|
-
@method _normalizeRelationshipDataHelper
|
|
43
37
|
@param {Object} relationshipDataHash
|
|
44
38
|
@return {Object}
|
|
45
39
|
@private
|
|
@@ -49,7 +43,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
49
43
|
return relationshipDataHash;
|
|
50
44
|
},
|
|
51
45
|
/**
|
|
52
|
-
@method _normalizeResourceHelper
|
|
53
46
|
@param {Object} resourceHash
|
|
54
47
|
@return {Object}
|
|
55
48
|
@private
|
|
@@ -80,8 +73,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
80
73
|
},
|
|
81
74
|
/**
|
|
82
75
|
Normalize some data and push it into the store.
|
|
83
|
-
@
|
|
84
|
-
@public
|
|
76
|
+
@public
|
|
85
77
|
@param {Store} store
|
|
86
78
|
@param {Object} payload
|
|
87
79
|
*/
|
|
@@ -90,7 +82,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
90
82
|
store.push(normalizedPayload);
|
|
91
83
|
},
|
|
92
84
|
/**
|
|
93
|
-
@method _normalizeResponse
|
|
94
85
|
@param {Store} store
|
|
95
86
|
@param {Model} primaryModelClass
|
|
96
87
|
@param {Object} payload
|
|
@@ -137,8 +128,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
137
128
|
/**
|
|
138
129
|
Returns a relationship formatted as a JSON-API "relationship object".
|
|
139
130
|
http://jsonapi.org/format/#document-resource-object-relationships
|
|
140
|
-
|
|
141
|
-
@public
|
|
131
|
+
@public
|
|
142
132
|
@param {Object} relationshipHash
|
|
143
133
|
@return {Object}
|
|
144
134
|
*/
|
|
@@ -158,8 +148,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
158
148
|
/**
|
|
159
149
|
Returns the resource's relationships formatted as a JSON-API "relationships object".
|
|
160
150
|
http://jsonapi.org/format/#document-resource-object-relationships
|
|
161
|
-
|
|
162
|
-
@public
|
|
151
|
+
@public
|
|
163
152
|
@param {Object} modelClass
|
|
164
153
|
@param {Object} resourceHash
|
|
165
154
|
@return {Object}
|
|
@@ -187,7 +176,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
187
176
|
return relationships;
|
|
188
177
|
},
|
|
189
178
|
/**
|
|
190
|
-
@method _extractType
|
|
191
179
|
@param {Model} modelClass
|
|
192
180
|
@param {Object} resourceHash
|
|
193
181
|
@return {String}
|
|
@@ -201,8 +189,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
201
189
|
the format Ember Data uses internally for the model name.
|
|
202
190
|
For example the key `posts` would be converted to `post` and the
|
|
203
191
|
key `studentAssesments` would be converted to `student-assesment`.
|
|
204
|
-
@
|
|
205
|
-
@public
|
|
192
|
+
@public
|
|
206
193
|
@param {String} key
|
|
207
194
|
@return {String} the model's modelName
|
|
208
195
|
*/
|
|
@@ -213,8 +200,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
213
200
|
Converts the model name to a pluralized version of the model name.
|
|
214
201
|
For example `post` would be converted to `posts` and
|
|
215
202
|
`student-assesment` would be converted to `student-assesments`.
|
|
216
|
-
@
|
|
217
|
-
@public
|
|
203
|
+
@public
|
|
218
204
|
@param {String} modelName
|
|
219
205
|
@return {String}
|
|
220
206
|
*/
|
|
@@ -250,7 +236,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
250
236
|
attribute keys.
|
|
251
237
|
This behaviour can be easily customized by extending this method.
|
|
252
238
|
Example
|
|
253
|
-
```app/serializers/application.js
|
|
239
|
+
```js [app/serializers/application.js]
|
|
254
240
|
import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';
|
|
255
241
|
import { dasherize } from '<app-name>/utils/string-utils';
|
|
256
242
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
@@ -259,8 +245,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
259
245
|
}
|
|
260
246
|
}
|
|
261
247
|
```
|
|
262
|
-
@
|
|
263
|
-
@public
|
|
248
|
+
@public
|
|
264
249
|
@param {String} key
|
|
265
250
|
@param {String} method
|
|
266
251
|
@return {String} normalized key
|
|
@@ -276,7 +261,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
276
261
|
relationship properties.
|
|
277
262
|
This behaviour can be easily customized by extending this method.
|
|
278
263
|
Example
|
|
279
|
-
```app/serializers/post.js
|
|
264
|
+
```js [app/serializers/post.js]
|
|
280
265
|
import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';
|
|
281
266
|
import { underscore } from '<app-name>/utils/string-utils';
|
|
282
267
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
@@ -285,7 +270,6 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
285
270
|
}
|
|
286
271
|
}
|
|
287
272
|
```
|
|
288
|
-
@method keyForRelationship
|
|
289
273
|
@public
|
|
290
274
|
@param {String} key
|
|
291
275
|
@param {String} typeClass
|
|
@@ -299,7 +283,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
299
283
|
Called when a record is saved in order to convert the
|
|
300
284
|
record into JSON.
|
|
301
285
|
For example, consider this model:
|
|
302
|
-
```app/models/comment.js
|
|
286
|
+
```js [app/models/comment.js]
|
|
303
287
|
import Model, { attr, belongsTo } from '@ember-data-mirror/model';
|
|
304
288
|
export default class CommentModel extends Model {
|
|
305
289
|
@attr title;
|
|
@@ -350,7 +334,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
350
334
|
If your API's format differs greatly from the JSON:API spec, you should
|
|
351
335
|
consider authoring your own adapter and serializer instead of extending
|
|
352
336
|
this class.
|
|
353
|
-
```app/serializers/post.js
|
|
337
|
+
```js [app/serializers/post.js]
|
|
354
338
|
import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';
|
|
355
339
|
export default class PostSerializer extends JSONAPISerializer {
|
|
356
340
|
serialize(snapshot, options) {
|
|
@@ -370,7 +354,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
370
354
|
If you want to define a serializer for your entire
|
|
371
355
|
application, you'll probably want to use `eachAttribute`
|
|
372
356
|
and `eachRelationship` on the record.
|
|
373
|
-
```app/serializers/application.js
|
|
357
|
+
```js [app/serializers/application.js]
|
|
374
358
|
import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';
|
|
375
359
|
import { underscore, singularize } from '<app-name>/utils/string-utils';
|
|
376
360
|
export default class ApplicationSerializer extends JSONAPISerializer {
|
|
@@ -409,7 +393,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
409
393
|
If you just want to do some small tweaks on the default JSON:API formatted response,
|
|
410
394
|
you can call `super.serialize` first and make the tweaks
|
|
411
395
|
on the returned object.
|
|
412
|
-
```app/serializers/post.js
|
|
396
|
+
```js [app/serializers/post.js]
|
|
413
397
|
import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';
|
|
414
398
|
export default class PostSerializer extends JSONAPISerializer {
|
|
415
399
|
serialize(snapshot, options) {
|
|
@@ -420,8 +404,7 @@ const JSONAPISerializer = JSONSerializer.extend({
|
|
|
420
404
|
}
|
|
421
405
|
}
|
|
422
406
|
```
|
|
423
|
-
@
|
|
424
|
-
@public
|
|
407
|
+
@public
|
|
425
408
|
@param {Snapshot} snapshot
|
|
426
409
|
@param {Object} options
|
|
427
410
|
@return {Object} json
|
package/dist/json-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-api.js","sources":["../src/json-api.js"],"sourcesContent":["/**\n * @module @ember-data-mirror/serializer/json-api\n */\nimport { warn } from '@ember/debug';\n\nimport { dasherize, pluralize, singularize } from '@ember-data-mirror/request-utils/string';\nimport { DEBUG } from '@warp-drive-mirror/build-config/env';\nimport { assert } from '@warp-drive-mirror/build-config/macros';\n\nimport JSONSerializer from './json';\n\n/**\n * <blockquote style=\"margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;\">\n <p>\n ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n <a href=\"/ember-data/release/classes/%3CInterface%3E%20Handler\">Handler</a> instead to be used with the <a href=\"https://github.com/emberjs/data/tree/main/packages/request#readme\">RequestManager</a>\n </p>\n </blockquote>\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.\n\n This serializer normalizes a JSON API payload that looks like:\n\n ```app/models/player.js\n import Model, { attr, belongsTo } from '@ember-data-mirror/model';\n\n export default class Player extends Model {\n @attr('string') name;\n @attr('string') skill;\n @attr('number') gamesPlayed;\n @belongsTo('club') club;\n }\n ```\n\n ```app/models/club.js\n import Model, { attr, hasMany } from '@ember-data-mirror/model';\n\n export default class Club extends Model {\n @attr('string') name;\n @attr('string') location;\n @hasMany('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```\n\n @main @ember-data-mirror/serializer/json-api\n @since 1.13.0\n @class JSONAPISerializer\n @public\n @extends JSONSerializer\n*/\nconst JSONAPISerializer = JSONSerializer.extend({\n /**\n @method _normalizeDocumentHelper\n @param {Object} documentHash\n @return {Object}\n @private\n */\n _normalizeDocumentHelper(documentHash) {\n if (Array.isArray(documentHash.data)) {\n const ret = new Array(documentHash.data.length);\n\n for (let i = 0; i < documentHash.data.length; i++) {\n const data = documentHash.data[i];\n ret[i] = this._normalizeResourceHelper(data);\n }\n\n documentHash.data = ret;\n } else if (documentHash.data && typeof documentHash.data === 'object') {\n documentHash.data = this._normalizeResourceHelper(documentHash.data);\n }\n\n if (Array.isArray(documentHash.included)) {\n const ret = new Array();\n for (let i = 0; i < documentHash.included.length; i++) {\n const included = documentHash.included[i];\n const normalized = this._normalizeResourceHelper(included);\n if (normalized !== null) {\n // can be null when unknown type is encountered\n ret.push(normalized);\n }\n }\n\n documentHash.included = ret;\n }\n\n return documentHash;\n },\n\n /**\n @method _normalizeRelationshipDataHelper\n @param {Object} relationshipDataHash\n @return {Object}\n @private\n */\n _normalizeRelationshipDataHelper(relationshipDataHash) {\n relationshipDataHash.type = this.modelNameFromPayloadKey(relationshipDataHash.type);\n\n return relationshipDataHash;\n },\n\n /**\n @method _normalizeResourceHelper\n @param {Object} resourceHash\n @return {Object}\n @private\n */\n _normalizeResourceHelper(resourceHash) {\n assert(this.warnMessageForUndefinedType(), resourceHash.type);\n\n const type = this.modelNameFromPayloadKey(resourceHash.type);\n\n if (!this.store.schema.hasResource({ type })) {\n if (DEBUG) {\n warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {\n id: 'ds.serializer.model-for-type-missing',\n });\n }\n return null;\n }\n\n const modelClass = this.store.modelFor(type);\n const serializer = this.store.serializerFor(type);\n const { data } = serializer.normalize(modelClass, resourceHash);\n return data;\n },\n\n /**\n Normalize some data and push it into the store.\n\n @method pushPayload\n @public\n @param {Store} store\n @param {Object} payload\n */\n pushPayload(store, payload) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n store.push(normalizedPayload);\n },\n\n /**\n @method _normalizeResponse\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @param {Boolean} isSingle\n @return {Object} JSON-API Document\n @private\n */\n _normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n return normalizedPayload;\n },\n\n normalizeQueryRecordResponse() {\n const normalized = this._super(...arguments);\n\n assert(\n 'Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.',\n !Array.isArray(normalized.data)\n );\n\n return normalized;\n },\n\n extractAttributes(modelClass, resourceHash) {\n const attributes = {};\n\n if (resourceHash.attributes) {\n modelClass.eachAttribute((key) => {\n const attributeKey = this.keyForAttribute(key, 'deserialize');\n if (resourceHash.attributes[attributeKey] !== undefined) {\n attributes[key] = resourceHash.attributes[attributeKey];\n }\n if (DEBUG) {\n if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${attributeKey}'. This is most likely because Ember Data's JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement 'keyForAttribute(key) { return key; }' to prevent Ember Data from customizing your attribute keys.`,\n false\n );\n }\n }\n });\n }\n\n return attributes;\n },\n\n /**\n Returns a relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @method extractRelationship\n @public\n @param {Object} relationshipHash\n @return {Object}\n */\n extractRelationship(relationshipHash) {\n if (Array.isArray(relationshipHash.data)) {\n const ret = new Array(relationshipHash.data.length);\n\n for (let i = 0; i < relationshipHash.data.length; i++) {\n const data = relationshipHash.data[i];\n ret[i] = this._normalizeRelationshipDataHelper(data);\n }\n\n relationshipHash.data = ret;\n } else if (relationshipHash.data && typeof relationshipHash.data === 'object') {\n relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);\n }\n\n return relationshipHash;\n },\n\n /**\n Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @method extractRelationships\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractRelationships(modelClass, resourceHash) {\n const relationships = {};\n\n if (resourceHash.relationships) {\n modelClass.eachRelationship((key, relationshipMeta) => {\n const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');\n if (resourceHash.relationships[relationshipKey] !== undefined) {\n const relationshipHash = resourceHash.relationships[relationshipKey];\n relationships[key] = this.extractRelationship(relationshipHash);\n }\n if (DEBUG) {\n if (\n resourceHash.relationships[relationshipKey] === undefined &&\n resourceHash.relationships[key] !== undefined\n ) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${relationshipKey}'. This is most likely because Ember Data's JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement 'keyForRelationship(key) { return key; }' to prevent Ember Data from customizing your relationship keys.`,\n false\n );\n }\n }\n });\n }\n\n return relationships;\n },\n\n /**\n @method _extractType\n @param {Model} modelClass\n @param {Object} resourceHash\n @return {String}\n @private\n */\n _extractType(modelClass, resourceHash) {\n return this.modelNameFromPayloadKey(resourceHash.type);\n },\n\n /**\n Dasherizes and singularizes the model name in the payload to match\n the format Ember Data uses internally for the model name.\n\n For example the key `posts` would be converted to `post` and the\n key `studentAssesments` would be converted to `student-assesment`.\n\n @method modelNameFromPayloadKey\n @public\n @param {String} key\n @return {String} the model's modelName\n */\n modelNameFromPayloadKey(key) {\n return dasherize(singularize(key));\n },\n\n /**\n Converts the model name to a pluralized version of the model name.\n\n For example `post` would be converted to `posts` and\n `student-assesment` would be converted to `student-assesments`.\n\n @method payloadKeyFromModelName\n @public\n @param {String} modelName\n @return {String}\n */\n payloadKeyFromModelName(modelName) {\n return pluralize(modelName);\n },\n\n normalize(modelClass, resourceHash) {\n if (resourceHash.attributes) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.attributes);\n }\n\n if (resourceHash.relationships) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);\n }\n\n const data = {\n id: this.extractId(modelClass, resourceHash),\n type: this._extractType(modelClass, resourceHash),\n attributes: this.extractAttributes(modelClass, resourceHash),\n relationships: this.extractRelationships(modelClass, resourceHash),\n };\n\n if (resourceHash.lid) {\n data.lid = resourceHash.lid;\n }\n\n this.applyTransforms(modelClass, data.attributes);\n\n return { data };\n },\n\n /**\n `keyForAttribute` can be used to define rules for how to convert an\n attribute name in your model to a key in your JSON.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as the word separator in the JSON\n attribute keys.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n import { dasherize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForAttribute(attr, method) {\n return dasherize(attr).toUpperCase();\n }\n }\n ```\n\n @method keyForAttribute\n @public\n @param {String} key\n @param {String} method\n @return {String} normalized key\n */\n keyForAttribute(key, method) {\n return dasherize(key);\n },\n\n /**\n `keyForRelationship` can be used to define a custom key when\n serializing and deserializing relationship properties.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as word separators in\n relationship properties.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data-mirror/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 @method keyForRelationship\n @public\n @param {String} key\n @param {String} typeClass\n @param {String} method\n @return {String} normalized key\n */\n keyForRelationship(key, typeClass, method) {\n return dasherize(key);\n },\n\n /**\n Called when a record is saved in order to convert the\n record into JSON.\n\n For example, consider this model:\n\n ```app/models/comment.js\n import Model, { attr, belongsTo } from '@ember-data-mirror/model';\n\n export default class CommentModel extends Model {\n @attr title;\n @attr body;\n\n @belongsTo('user', { async: false, inverse: null })\n author;\n }\n ```\n\n The default serialization would create a JSON-API resource object like:\n\n ```javascript\n {\n \"data\": {\n \"type\": \"comments\",\n \"attributes\": {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n },\n \"relationships\": {\n \"author\": {\n \"data\": {\n \"id\": \"12\",\n \"type\": \"users\"\n }\n }\n }\n }\n }\n ```\n\n By default, attributes are passed through as-is, unless\n you specified an attribute type (`attr('date')`). If\n you specify a transform, the JavaScript value will be\n serialized when inserted into the attributes hash.\n\n Belongs-to relationships are converted into JSON-API\n resource identifier objects.\n\n ## IDs\n\n `serialize` takes an options hash with a single option:\n `includeId`. If this option is `true`, `serialize` will,\n by default include the ID in the JSON object it builds.\n\n The JSONAPIAdapter passes in `includeId: true` when serializing a record\n for `createRecord` or `updateRecord`.\n\n ## Customization\n\n Your server may expect data in a different format than the\n built-in serialization format.\n\n In that case, you can implement `serialize` yourself and\n return data formatted to match your API's expectations, or override\n the invoked adapter method and do the serialization in the adapter directly\n by using the provided snapshot.\n\n If your API's format differs greatly from the JSON:API spec, you should\n consider authoring your own adapter and serializer instead of extending\n this class.\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n ```\n\n ## Customizing an App-Wide Serializer\n\n If you want to define a serializer for your entire\n application, you'll probably want to use `eachAttribute`\n and `eachRelationship` on the record.\n\n ```app/serializers/application.js\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n import { underscore, singularize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n\n function serverAttributeName(attribute) {\n return underscore(attribute).toUpperCase();\n }\n\n function serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + '_IDS';\n }\n ```\n\n This serializer will generate JSON that looks like this:\n\n ```javascript\n {\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n }\n ```\n\n ## Tweaking the Default Formatting\n\n If you just want to do some small tweaks on the default JSON:API formatted response,\n you can call `super.serialize` first and make the tweaks\n on the returned object.\n\n ```app/serializers/post.js\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.data.attributes.subject = json.data.attributes.title;\n delete json.data.attributes.title;\n\n return json;\n }\n }\n ```\n\n @method serialize\n @public\n @param {Snapshot} snapshot\n @param {Object} options\n @return {Object} json\n */\n serialize(snapshot, options) {\n const data = this._super(...arguments);\n data.type = this.payloadKeyFromModelName(snapshot.modelName);\n\n return { data };\n },\n\n serializeAttribute(snapshot, json, key, attribute) {\n const type = attribute.type;\n\n if (this._canSerialize(key)) {\n json.attributes = json.attributes || {};\n\n let value = snapshot.attr(key);\n if (type) {\n const transform = this.transformFor(type);\n value = transform.serialize(value, attribute.options);\n }\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(key, schema);\n\n if (payloadKey === key) {\n payloadKey = this.keyForAttribute(key, 'serialize');\n }\n\n json.attributes[payloadKey] = value;\n }\n },\n\n serializeBelongsTo(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this._canSerialize(name)) {\n const belongsTo = snapshot.belongsTo(name);\n const belongsToIsNotNew = belongsTo && !belongsTo.isNew;\n\n if (belongsTo === null || belongsToIsNotNew) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name) {\n payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');\n }\n\n let data = null;\n if (belongsTo) {\n const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);\n\n data = {\n type: payloadType,\n id: belongsTo.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n\n serializeHasMany(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this.shouldSerializeHasMany(snapshot, name, relationship)) {\n const hasMany = snapshot.hasMany(name);\n if (hasMany !== undefined) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name && this.keyForRelationship) {\n payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');\n }\n\n // only serialize has many relationships that are not new\n const nonNewHasMany = hasMany.filter((item) => !item.isNew);\n const data = new Array(nonNewHasMany.length);\n\n for (let i = 0; i < nonNewHasMany.length; i++) {\n const item = hasMany[i];\n const payloadType = this.payloadKeyFromModelName(item.modelName);\n\n data[i] = {\n type: payloadType,\n id: item.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n});\n\nif (DEBUG) {\n JSONAPISerializer.reopen({\n init(...args) {\n this._super(...args);\n\n assert(\n `You've used the EmbeddedRecordsMixin in ${this.toString()} which is not fully compatible with the JSON:API specification. Please confirm that this works for your specific API and add \\`this.isEmbeddedRecordsMixinCompatible = true\\` to your serializer.`,\n !this.isEmbeddedRecordsMixin || this.isEmbeddedRecordsMixinCompatible === true\n );\n\n const constructor = this.constructor;\n warn(\n `You've defined 'extractMeta' in ${constructor.toString()} which is not used for serializers extending JSONAPISerializer. Read more at https://api.emberjs.com/ember-data/release/classes/JSONAPISerializer on how to customize meta when using JSON API.`,\n this.extractMeta === JSONSerializer.prototype.extractMeta,\n {\n id: 'ds.serializer.json-api.extractMeta',\n }\n );\n },\n warnMessageForUndefinedType() {\n return (\n 'Encountered a resource object with an undefined type (resolved resource using ' +\n this.constructor.toString() +\n ')'\n );\n },\n warnMessageNoModelForType(modelName, originalType, usedLookup) {\n return `Encountered a resource object with type \"${originalType}\", but no model was found for model name \"${modelName}\" (resolved model name using '${this.constructor.toString()}.${usedLookup}(\"${originalType}\")').`;\n },\n });\n}\n\nexport default JSONAPISerializer;\n"],"names":["JSONAPISerializer","JSONSerializer","extend","_normalizeDocumentHelper","documentHash","Array","isArray","data","ret","length","i","_normalizeResourceHelper","included","normalized","push","_normalizeRelationshipDataHelper","relationshipDataHash","type","modelNameFromPayloadKey","resourceHash","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","warnMessageForUndefinedType","store","schema","hasResource","warn","warnMessageNoModelForType","id","modelClass","modelFor","serializer","serializerFor","normalize","pushPayload","payload","normalizedPayload","_normalizeResponse","primaryModelClass","requestType","isSingle","normalizeQueryRecordResponse","_super","arguments","extractAttributes","attributes","eachAttribute","key","attributeKey","keyForAttribute","undefined","modelName","extractRelationship","relationshipHash","extractRelationships","relationships","eachRelationship","relationshipMeta","relationshipKey","keyForRelationship","kind","_extractType","dasherize","singularize","payloadKeyFromModelName","pluralize","normalizeUsingDeclaredMapping","extractId","lid","applyTransforms","method","typeClass","serialize","snapshot","options","serializeAttribute","json","attribute","_canSerialize","value","attr","transform","transformFor","payloadKey","_getMappedKey","serializeBelongsTo","relationship","name","belongsTo","belongsToIsNotNew","isNew","payloadType","serializeHasMany","shouldSerializeHasMany","hasMany","nonNewHasMany","filter","item","reopen","init","args","toString","isEmbeddedRecordsMixin","isEmbeddedRecordsMixinCompatible","constructor","extractMeta","prototype","originalType","usedLookup"],"mappings":";;;;;AAAA;AACA;AACA;AAsIA,MAAMA,iBAAiB,GAAGC,cAAc,CAACC,MAAM,CAAC;AAC9C;AACF;AACA;AACA;AACA;AACA;EACEC,wBAAwBA,CAACC,YAAY,EAAE;IACrC,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAACG,IAAI,CAAC,EAAE;MACpC,MAAMC,GAAG,GAAG,IAAIH,KAAK,CAACD,YAAY,CAACG,IAAI,CAACE,MAAM,CAAC;AAE/C,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACG,IAAI,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;AACjD,QAAA,MAAMH,IAAI,GAAGH,YAAY,CAACG,IAAI,CAACG,CAAC,CAAC;QACjCF,GAAG,CAACE,CAAC,CAAC,GAAG,IAAI,CAACC,wBAAwB,CAACJ,IAAI,CAAC;AAC9C;MAE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A;AACA;AACA;AAME+C,EAAAA,eAAeA,CAACF,GAAG,EAAEuB,MAAM,EAAE;IAC3B,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEY,EAAAA,kBAAkBA,CAACZ,GAAG,EAAEwB,SAAS,EAAED,MAAM,EAAE;IACzC,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuCEyB,EAAAA,SAASA,CAACC,QAAQ,EAAEC,OAAO,EAAE;IAC3B,MAAMxE,IAAI,GAAG,IAAI,CAACwC,MAAM,CAAC,GAAGC,SAAS,CAAC;IACtCzC,IAAI,CAACU,IAAI,GAAG,IAAI,CAACoD,uBAAuB,CAACS,QAAQ,CAACtB,SAAS,CAAC;IAE5D,OAAO;AAAEjD,MAAAA;KAAM;GAChB;EAEDyE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A,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,QAAA,IAAA,CAAAA,IAAA,EAAA;UAAA,MAAAC,IAAAA,KAAA,CACE,CAA2C,wCAAA,EAAA,IAAI,CAACgF,QAAQ,EAAE,CAAmM,iMAAA,CAAA,CAAA;AAAA;OAC7P,EAAA,CAAC,IAAI,CAACC,sBAAsB,IAAI,IAAI,CAACC,gCAAgC,KAAK,IAAI,CAAA,GAAA,EAAA;AAGhF,MAAA,MAAMC,WAAW,GAAG,IAAI,CAACA,WAAW;AACpC9E,MAAAA,IAAI,CACF,CAAmC8E,gCAAAA,EAAAA,WAAW,CAACH,QAAQ,EAAE,CAAiM,+LAAA,CAAA,EAC1P,IAAI,CAACI,WAAW,KAAK7G,cAAc,CAAC8G,SAAS,CAACD,WAAW,EACzD;AACE7E,QAAAA,EAAE,EAAE;AACN,OACF,CAAC;KACF;AACDN,IAAAA,2BAA2BA,GAAG;MAC5B,OACE,gFAAgF,GAChF,IAAI,CAACkF,WAAW,CAACH,QAAQ,EAAE,GAC3B,GAAG;KAEN;AACD1E,IAAAA,yBAAyBA,CAACwB,SAAS,EAAEwD,YAAY,EAAEC,UAAU,EAAE;AAC7D,MAAA,OAAO,4CAA4CD,YAAY,CAAA,0CAAA,EAA6CxD,SAAS,CAAA,8BAAA,EAAiC,IAAI,CAACqD,WAAW,CAACH,QAAQ,EAAE,CAAA,CAAA,EAAIO,UAAU,CAAA,EAAA,EAAKD,YAAY,CAAO,KAAA,CAAA;AACzN;AACF,GAAC,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"json-api.js","sources":["../src/json-api.js"],"sourcesContent":["import { warn } from '@ember/debug';\n\nimport { dasherize, pluralize, singularize } from '@ember-data-mirror/request-utils/string';\nimport { DEBUG } from '@warp-drive-mirror/build-config/env';\nimport { assert } from '@warp-drive-mirror/build-config/macros';\n\nimport JSONSerializer from './json';\n\n/**\n * <blockquote style=\"margin: 1em; padding: .1em 1em .1em 1em; border-left: solid 1em #E34C32; background: #e0e0e0;\">\n <p>\n ⚠️ <strong>This is LEGACY documentation</strong> for a feature that is no longer encouraged to be used.\n If starting a new app or thinking of implementing a new adapter, consider writing a\n <a href=\"/ember-data/release/classes/%3CInterface%3E%20Handler\">Handler</a> instead to be used with the <a href=\"https://github.com/emberjs/data/tree/main/packages/request#readme\">RequestManager</a>\n </p>\n </blockquote>\n\n In EmberData a Serializer is used to serialize and deserialize\n records when they are transferred in and out of an external source.\n This process involves normalizing property names, transforming\n attribute values and serializing relationships.\n\n `JSONAPISerializer` supports the http://jsonapi.org/ spec and is the\n serializer recommended by Ember Data.\n\n This serializer normalizes a JSON API payload that looks like:\n\n ```js [app/models/player.js]\n import Model, { attr, belongsTo } from '@ember-data-mirror/model';\n\n export default class Player extends Model {\n @attr('string') name;\n @attr('string') skill;\n @attr('number') gamesPlayed;\n @belongsTo('club') club;\n }\n ```\n\n ```js [app/models/club.js]\n import Model, { attr, hasMany } from '@ember-data-mirror/model';\n\n export default class Club extends Model {\n @attr('string') name;\n @attr('string') location;\n @hasMany('player') players;\n }\n ```\n\n ```js\n {\n \"data\": [\n {\n \"attributes\": {\n \"name\": \"Benfica\",\n \"location\": \"Portugal\"\n },\n \"id\": \"1\",\n \"relationships\": {\n \"players\": {\n \"data\": [\n {\n \"id\": \"3\",\n \"type\": \"players\"\n }\n ]\n }\n },\n \"type\": \"clubs\"\n }\n ],\n \"included\": [\n {\n \"attributes\": {\n \"name\": \"Eusebio Silva Ferreira\",\n \"skill\": \"Rocket shot\",\n \"games-played\": 431\n },\n \"id\": \"3\",\n \"relationships\": {\n \"club\": {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"clubs\"\n }\n }\n },\n \"type\": \"players\"\n }\n ]\n }\n ```\n\n to the format that the Ember Data store expects.\n\n ### Customizing meta\n\n Since a JSON API Document can have meta defined in multiple locations you can\n use the specific serializer hooks if you need to customize the meta.\n\n One scenario would be to camelCase the meta keys of your payload. The example\n below shows how this could be done using `normalizeArrayResponse` and\n `extractRelationship`.\n\n ```js [app/serializers/application.js]\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {\n let normalizedDocument = super.normalizeArrayResponse(...arguments);\n\n // Customize document meta\n normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);\n\n return normalizedDocument;\n }\n\n extractRelationship(relationshipHash) {\n let normalizedRelationship = super.extractRelationship(...arguments);\n\n // Customize relationship meta\n normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);\n\n return normalizedRelationship;\n }\n }\n ```\n\n @since 1.13.0\n @class JSONAPISerializer\n @public\n*/\nconst JSONAPISerializer = JSONSerializer.extend({\n /**\n @param {Object} documentHash\n @return {Object}\n @private\n */\n _normalizeDocumentHelper(documentHash) {\n if (Array.isArray(documentHash.data)) {\n const ret = new Array(documentHash.data.length);\n\n for (let i = 0; i < documentHash.data.length; i++) {\n const data = documentHash.data[i];\n ret[i] = this._normalizeResourceHelper(data);\n }\n\n documentHash.data = ret;\n } else if (documentHash.data && typeof documentHash.data === 'object') {\n documentHash.data = this._normalizeResourceHelper(documentHash.data);\n }\n\n if (Array.isArray(documentHash.included)) {\n const ret = new Array();\n for (let i = 0; i < documentHash.included.length; i++) {\n const included = documentHash.included[i];\n const normalized = this._normalizeResourceHelper(included);\n if (normalized !== null) {\n // can be null when unknown type is encountered\n ret.push(normalized);\n }\n }\n\n documentHash.included = ret;\n }\n\n return documentHash;\n },\n\n /**\n @param {Object} relationshipDataHash\n @return {Object}\n @private\n */\n _normalizeRelationshipDataHelper(relationshipDataHash) {\n relationshipDataHash.type = this.modelNameFromPayloadKey(relationshipDataHash.type);\n\n return relationshipDataHash;\n },\n\n /**\n @param {Object} resourceHash\n @return {Object}\n @private\n */\n _normalizeResourceHelper(resourceHash) {\n assert(this.warnMessageForUndefinedType(), resourceHash.type);\n\n const type = this.modelNameFromPayloadKey(resourceHash.type);\n\n if (!this.store.schema.hasResource({ type })) {\n if (DEBUG) {\n warn(this.warnMessageNoModelForType(type, resourceHash.type, 'modelNameFromPayloadKey'), false, {\n id: 'ds.serializer.model-for-type-missing',\n });\n }\n return null;\n }\n\n const modelClass = this.store.modelFor(type);\n const serializer = this.store.serializerFor(type);\n const { data } = serializer.normalize(modelClass, resourceHash);\n return data;\n },\n\n /**\n Normalize some data and push it into the store.\n\n @public\n @param {Store} store\n @param {Object} payload\n */\n pushPayload(store, payload) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n store.push(normalizedPayload);\n },\n\n /**\n @param {Store} store\n @param {Model} primaryModelClass\n @param {Object} payload\n @param {String|Number} id\n @param {String} requestType\n @param {Boolean} isSingle\n @return {Object} JSON-API Document\n @private\n */\n _normalizeResponse(store, primaryModelClass, payload, id, requestType, isSingle) {\n const normalizedPayload = this._normalizeDocumentHelper(payload);\n return normalizedPayload;\n },\n\n normalizeQueryRecordResponse() {\n const normalized = this._super(...arguments);\n\n assert(\n 'Expected the primary data returned by the serializer for a `queryRecord` response to be a single object but instead it was an array.',\n !Array.isArray(normalized.data)\n );\n\n return normalized;\n },\n\n extractAttributes(modelClass, resourceHash) {\n const attributes = {};\n\n if (resourceHash.attributes) {\n modelClass.eachAttribute((key) => {\n const attributeKey = this.keyForAttribute(key, 'deserialize');\n if (resourceHash.attributes[attributeKey] !== undefined) {\n attributes[key] = resourceHash.attributes[attributeKey];\n }\n if (DEBUG) {\n if (resourceHash.attributes[attributeKey] === undefined && resourceHash.attributes[key] !== undefined) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${attributeKey}'. This is most likely because Ember Data's JSON API serializer dasherizes attribute keys by default. You should subclass JSONAPISerializer and implement 'keyForAttribute(key) { return key; }' to prevent Ember Data from customizing your attribute keys.`,\n false\n );\n }\n }\n });\n }\n\n return attributes;\n },\n\n /**\n Returns a relationship formatted as a JSON-API \"relationship object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @public\n @param {Object} relationshipHash\n @return {Object}\n */\n extractRelationship(relationshipHash) {\n if (Array.isArray(relationshipHash.data)) {\n const ret = new Array(relationshipHash.data.length);\n\n for (let i = 0; i < relationshipHash.data.length; i++) {\n const data = relationshipHash.data[i];\n ret[i] = this._normalizeRelationshipDataHelper(data);\n }\n\n relationshipHash.data = ret;\n } else if (relationshipHash.data && typeof relationshipHash.data === 'object') {\n relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);\n }\n\n return relationshipHash;\n },\n\n /**\n Returns the resource's relationships formatted as a JSON-API \"relationships object\".\n\n http://jsonapi.org/format/#document-resource-object-relationships\n\n @public\n @param {Object} modelClass\n @param {Object} resourceHash\n @return {Object}\n */\n extractRelationships(modelClass, resourceHash) {\n const relationships = {};\n\n if (resourceHash.relationships) {\n modelClass.eachRelationship((key, relationshipMeta) => {\n const relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');\n if (resourceHash.relationships[relationshipKey] !== undefined) {\n const relationshipHash = resourceHash.relationships[relationshipKey];\n relationships[key] = this.extractRelationship(relationshipHash);\n }\n if (DEBUG) {\n if (\n resourceHash.relationships[relationshipKey] === undefined &&\n resourceHash.relationships[key] !== undefined\n ) {\n assert(\n `Your payload for '${modelClass.modelName}' contains '${key}', but your serializer is setup to look for '${relationshipKey}'. This is most likely because Ember Data's JSON API serializer dasherizes relationship keys by default. You should subclass JSONAPISerializer and implement 'keyForRelationship(key) { return key; }' to prevent Ember Data from customizing your relationship keys.`,\n false\n );\n }\n }\n });\n }\n\n return relationships;\n },\n\n /**\n @param {Model} modelClass\n @param {Object} resourceHash\n @return {String}\n @private\n */\n _extractType(modelClass, resourceHash) {\n return this.modelNameFromPayloadKey(resourceHash.type);\n },\n\n /**\n Dasherizes and singularizes the model name in the payload to match\n the format Ember Data uses internally for the model name.\n\n For example the key `posts` would be converted to `post` and the\n key `studentAssesments` would be converted to `student-assesment`.\n\n @public\n @param {String} key\n @return {String} the model's modelName\n */\n modelNameFromPayloadKey(key) {\n return dasherize(singularize(key));\n },\n\n /**\n Converts the model name to a pluralized version of the model name.\n\n For example `post` would be converted to `posts` and\n `student-assesment` would be converted to `student-assesments`.\n\n @public\n @param {String} modelName\n @return {String}\n */\n payloadKeyFromModelName(modelName) {\n return pluralize(modelName);\n },\n\n normalize(modelClass, resourceHash) {\n if (resourceHash.attributes) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.attributes);\n }\n\n if (resourceHash.relationships) {\n this.normalizeUsingDeclaredMapping(modelClass, resourceHash.relationships);\n }\n\n const data = {\n id: this.extractId(modelClass, resourceHash),\n type: this._extractType(modelClass, resourceHash),\n attributes: this.extractAttributes(modelClass, resourceHash),\n relationships: this.extractRelationships(modelClass, resourceHash),\n };\n\n if (resourceHash.lid) {\n data.lid = resourceHash.lid;\n }\n\n this.applyTransforms(modelClass, data.attributes);\n\n return { data };\n },\n\n /**\n `keyForAttribute` can be used to define rules for how to convert an\n attribute name in your model to a key in your JSON.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as the word separator in the JSON\n attribute keys.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```js [app/serializers/application.js]\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n import { dasherize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForAttribute(attr, method) {\n return dasherize(attr).toUpperCase();\n }\n }\n ```\n\n @public\n @param {String} key\n @param {String} method\n @return {String} normalized key\n */\n keyForAttribute(key, method) {\n return dasherize(key);\n },\n\n /**\n `keyForRelationship` can be used to define a custom key when\n serializing and deserializing relationship properties.\n By default `JSONAPISerializer` follows the format used on the examples of\n http://jsonapi.org/format and uses dashes as word separators in\n relationship properties.\n\n This behaviour can be easily customized by extending this method.\n\n Example\n\n ```js [app/serializers/post.js]\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n import { underscore } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n keyForRelationship(key, relationship, method) {\n return underscore(key);\n }\n }\n ```\n @public\n @param {String} key\n @param {String} typeClass\n @param {String} method\n @return {String} normalized key\n */\n keyForRelationship(key, typeClass, method) {\n return dasherize(key);\n },\n\n /**\n Called when a record is saved in order to convert the\n record into JSON.\n\n For example, consider this model:\n\n ```js [app/models/comment.js]\n import Model, { attr, belongsTo } from '@ember-data-mirror/model';\n\n export default class CommentModel extends Model {\n @attr title;\n @attr body;\n\n @belongsTo('user', { async: false, inverse: null })\n author;\n }\n ```\n\n The default serialization would create a JSON-API resource object like:\n\n ```javascript\n {\n \"data\": {\n \"type\": \"comments\",\n \"attributes\": {\n \"title\": \"Rails is unagi\",\n \"body\": \"Rails? Omakase? O_O\",\n },\n \"relationships\": {\n \"author\": {\n \"data\": {\n \"id\": \"12\",\n \"type\": \"users\"\n }\n }\n }\n }\n }\n ```\n\n By default, attributes are passed through as-is, unless\n you specified an attribute type (`attr('date')`). If\n you specify a transform, the JavaScript value will be\n serialized when inserted into the attributes hash.\n\n Belongs-to relationships are converted into JSON-API\n resource identifier objects.\n\n ## IDs\n\n `serialize` takes an options hash with a single option:\n `includeId`. If this option is `true`, `serialize` will,\n by default include the ID in the JSON object it builds.\n\n The JSONAPIAdapter passes in `includeId: true` when serializing a record\n for `createRecord` or `updateRecord`.\n\n ## Customization\n\n Your server may expect data in a different format than the\n built-in serialization format.\n\n In that case, you can implement `serialize` yourself and\n return data formatted to match your API's expectations, or override\n the invoked adapter method and do the serialization in the adapter directly\n by using the provided snapshot.\n\n If your API's format differs greatly from the JSON:API spec, you should\n consider authoring your own adapter and serializer instead of extending\n this class.\n\n ```js [app/serializers/post.js]\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {\n POST_TTL: snapshot.attr('title'),\n POST_BDY: snapshot.attr('body'),\n POST_CMS: snapshot.hasMany('comments', { ids: true })\n };\n\n if (options.includeId) {\n json.POST_ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n ```\n\n ## Customizing an App-Wide Serializer\n\n If you want to define a serializer for your entire\n application, you'll probably want to use `eachAttribute`\n and `eachRelationship` on the record.\n\n ```js [app/serializers/application.js]\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n import { underscore, singularize } from '<app-name>/utils/string-utils';\n\n export default class ApplicationSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = {};\n\n snapshot.eachAttribute((name) => {\n json[serverAttributeName(name)] = snapshot.attr(name);\n });\n\n snapshot.eachRelationship((name, relationship) => {\n if (relationship.kind === 'hasMany') {\n json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });\n }\n });\n\n if (options.includeId) {\n json.ID_ = snapshot.id;\n }\n\n return json;\n }\n }\n\n function serverAttributeName(attribute) {\n return underscore(attribute).toUpperCase();\n }\n\n function serverHasManyName(name) {\n return serverAttributeName(singularize(name)) + '_IDS';\n }\n ```\n\n This serializer will generate JSON that looks like this:\n\n ```javascript\n {\n \"TITLE\": \"Rails is omakase\",\n \"BODY\": \"Yep. Omakase.\",\n \"COMMENT_IDS\": [ \"1\", \"2\", \"3\" ]\n }\n ```\n\n ## Tweaking the Default Formatting\n\n If you just want to do some small tweaks on the default JSON:API formatted response,\n you can call `super.serialize` first and make the tweaks\n on the returned object.\n\n ```js [app/serializers/post.js]\n import JSONAPISerializer from '@ember-data-mirror/serializer/json-api';\n\n export default class PostSerializer extends JSONAPISerializer {\n serialize(snapshot, options) {\n let json = super.serialize(...arguments);\n\n json.data.attributes.subject = json.data.attributes.title;\n delete json.data.attributes.title;\n\n return json;\n }\n }\n ```\n\n @public\n @param {Snapshot} snapshot\n @param {Object} options\n @return {Object} json\n */\n serialize(snapshot, options) {\n const data = this._super(...arguments);\n data.type = this.payloadKeyFromModelName(snapshot.modelName);\n\n return { data };\n },\n\n serializeAttribute(snapshot, json, key, attribute) {\n const type = attribute.type;\n\n if (this._canSerialize(key)) {\n json.attributes = json.attributes || {};\n\n let value = snapshot.attr(key);\n if (type) {\n const transform = this.transformFor(type);\n value = transform.serialize(value, attribute.options);\n }\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(key, schema);\n\n if (payloadKey === key) {\n payloadKey = this.keyForAttribute(key, 'serialize');\n }\n\n json.attributes[payloadKey] = value;\n }\n },\n\n serializeBelongsTo(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this._canSerialize(name)) {\n const belongsTo = snapshot.belongsTo(name);\n const belongsToIsNotNew = belongsTo && !belongsTo.isNew;\n\n if (belongsTo === null || belongsToIsNotNew) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name) {\n payloadKey = this.keyForRelationship(name, 'belongsTo', 'serialize');\n }\n\n let data = null;\n if (belongsTo) {\n const payloadType = this.payloadKeyFromModelName(belongsTo.modelName);\n\n data = {\n type: payloadType,\n id: belongsTo.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n\n serializeHasMany(snapshot, json, relationship) {\n const name = relationship.name;\n\n if (this.shouldSerializeHasMany(snapshot, name, relationship)) {\n const hasMany = snapshot.hasMany(name);\n if (hasMany !== undefined) {\n json.relationships = json.relationships || {};\n\n const schema = this.store.modelFor(snapshot.modelName);\n let payloadKey = this._getMappedKey(name, schema);\n if (payloadKey === name && this.keyForRelationship) {\n payloadKey = this.keyForRelationship(name, 'hasMany', 'serialize');\n }\n\n // only serialize has many relationships that are not new\n const nonNewHasMany = hasMany.filter((item) => !item.isNew);\n const data = new Array(nonNewHasMany.length);\n\n for (let i = 0; i < nonNewHasMany.length; i++) {\n const item = hasMany[i];\n const payloadType = this.payloadKeyFromModelName(item.modelName);\n\n data[i] = {\n type: payloadType,\n id: item.id,\n };\n }\n\n json.relationships[payloadKey] = { data };\n }\n }\n },\n});\n\nif (DEBUG) {\n JSONAPISerializer.reopen({\n init(...args) {\n this._super(...args);\n\n assert(\n `You've used the EmbeddedRecordsMixin in ${this.toString()} which is not fully compatible with the JSON:API specification. Please confirm that this works for your specific API and add \\`this.isEmbeddedRecordsMixinCompatible = true\\` to your serializer.`,\n !this.isEmbeddedRecordsMixin || this.isEmbeddedRecordsMixinCompatible === true\n );\n\n const constructor = this.constructor;\n warn(\n `You've defined 'extractMeta' in ${constructor.toString()} which is not used for serializers extending JSONAPISerializer. Read more at https://api.emberjs.com/ember-data/release/classes/JSONAPISerializer on how to customize meta when using JSON API.`,\n this.extractMeta === JSONSerializer.prototype.extractMeta,\n {\n id: 'ds.serializer.json-api.extractMeta',\n }\n );\n },\n warnMessageForUndefinedType() {\n return (\n 'Encountered a resource object with an undefined type (resolved resource using ' +\n this.constructor.toString() +\n ')'\n );\n },\n warnMessageNoModelForType(modelName, originalType, usedLookup) {\n return `Encountered a resource object with type \"${originalType}\", but no model was found for model name \"${modelName}\" (resolved model name using '${this.constructor.toString()}.${usedLookup}(\"${originalType}\")').`;\n },\n });\n}\n\nexport default JSONAPISerializer;\n"],"names":["JSONAPISerializer","JSONSerializer","extend","_normalizeDocumentHelper","documentHash","Array","isArray","data","ret","length","i","_normalizeResourceHelper","included","normalized","push","_normalizeRelationshipDataHelper","relationshipDataHash","type","modelNameFromPayloadKey","resourceHash","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","warnMessageForUndefinedType","store","schema","hasResource","warn","warnMessageNoModelForType","id","modelClass","modelFor","serializer","serializerFor","normalize","pushPayload","payload","normalizedPayload","_normalizeResponse","primaryModelClass","requestType","isSingle","normalizeQueryRecordResponse","_super","arguments","extractAttributes","attributes","eachAttribute","key","attributeKey","keyForAttribute","undefined","modelName","extractRelationship","relationshipHash","extractRelationships","relationships","eachRelationship","relationshipMeta","relationshipKey","keyForRelationship","kind","_extractType","dasherize","singularize","payloadKeyFromModelName","pluralize","normalizeUsingDeclaredMapping","extractId","lid","applyTransforms","method","typeClass","serialize","snapshot","options","serializeAttribute","json","attribute","_canSerialize","value","attr","transform","transformFor","payloadKey","_getMappedKey","serializeBelongsTo","relationship","name","belongsTo","belongsToIsNotNew","isNew","payloadType","serializeHasMany","shouldSerializeHasMany","hasMany","nonNewHasMany","filter","item","reopen","init","args","toString","isEmbeddedRecordsMixin","isEmbeddedRecordsMixinCompatible","constructor","extractMeta","prototype","originalType","usedLookup"],"mappings":";;;;;AAmIA,MAAMA,iBAAiB,GAAGC,cAAc,CAACC,MAAM,CAAC;AAC9C;AACF;AACA;AACA;AACA;EACEC,wBAAwBA,CAACC,YAAY,EAAE;IACrC,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAACG,IAAI,CAAC,EAAE;MACpC,MAAMC,GAAG,GAAG,IAAIH,KAAK,CAACD,YAAY,CAACG,IAAI,CAACE,MAAM,CAAC;AAE/C,MAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACG,IAAI,CAACE,MAAM,EAAEC,CAAC,EAAE,EAAE;AACjD,QAAA,MAAMH,IAAI,GAAGH,YAAY,CAACG,IAAI,CAACG,CAAC,CAAC;QACjCF,GAAG,CAACE,CAAC,CAAC,GAAG,IAAI,CAACC,wBAAwB,CAACJ,IAAI,CAAC;AAC9C;MAEAH,YAAY,CAACG,IAAI,GAAGC,GAAG;AACzB,KAAC,MAAM,IAAIJ,YAAY,CAACG,IAAI,IAAI,OAAOH,YAAY,CAACG,IAAI,KAAK,QAAQ,EAAE;MACrEH,YAAY,CAACG,IAAI,GAAG,IAAI,CAACI,wBAAwB,CAACP,YAAY,CAACG,IAAI,CAAC;AACtE;IAEA,IAAIF,KAAK,CAACC,OAAO,CAACF,YAAY,CAACQ,QAAQ,CAAC,EAAE;AACxC,MAAA,MAAMJ,GAAG,GAAG,IAAIH,KAAK,EAAE;AACvB,MAAA,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACQ,QAAQ,CAACH,MAAM,EAAEC,CAAC,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AAa,EAAE;MAC9B,IAAI,CAACW,6BAA6B,CAACrC,UAAU,EAAEf,YAAY,CAACyC,aAAa,CAAC;AAC5E;AAEA,IAAA,MAAMrD,IAAI,GAAG;MACX0B,EAAE,EAAE,IAAI,CAACuC,SAAS,CAACtC,UAAU,EAAEf,YAAY,CAAC;MAC5CF,IAAI,EAAE,IAAI,CAACiD,YAAY,CAAChC,UAAU,EAAEf,YAAY,CAAC;MACjD+B,UAAU,EAAE,IAAI,CAACD,iBAAiB,CAACf,UAAU,EAAEf,YAAY,CAAC;AAC5DyC,MAAAA,aAAa,EAAE,IAAI,CAACD,oBAAoB,CAACzB,UAAU,EAAEf,YAAY;KAClE;IAED,IAAIA,YAAY,CAACsD,GAAG,EAAE;AACpBlE,MAAAA,IAAI,CAACkE,GAAG,GAAGtD,YAAY,CAACsD,GAAG;AAC7B;IAEA,IAAI,CAACC,eAAe,CAACxC,UAAU,EAAE3B,IAAI,CAAC2C,UAAU,CAAC;IAEjD,OAAO;AAAE3C,MAAAA;KAAM;GAChB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAME+C,EAAAA,eAAeA,CAACF,GAAG,EAAEuB,MAAM,EAAE;IAC3B,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKEY,EAAAA,kBAAkBA,CAACZ,GAAG,EAAEwB,SAAS,EAAED,MAAM,EAAE;IACzC,OAAOR,SAAS,CAACf,GAAG,CAAC;GACtB;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAuCEyB,EAAAA,SAASA,CAACC,QAAQ,EAAEC,OAAO,EAAE;IAC3B,MAAMxE,IAAI,GAAG,IAAI,CAACwC,MAAM,CAAC,GAAGC,SAAS,CAAC;IACtCzC,IAAI,CAACU,IAAI,GAAG,IAAI,CAACoD,uBAAuB,CAACS,QAAQ,CAACtB,SAAS,CAAC;IAE5D,OAAO;AAAEjD,MAAAA;KAAM;GAChB;EAEDyE,kBAAkBA,CAACF,QAAQ,EAAEG,IAAI,EAAE7B,GAAG,EAAE8B,SAAS,EAAE;AACjD,IAAA,MAAMjE,IAAI,GAAGiE,SAAS,CAACjE,IAAI;AAE3B,IAAA,IAAI,IAAI,CAACkE,aAAa,CAAC/B,GAAG,CAAC,EAAE;MAC3B6B,IAAI,CAAC/B,UAAU,GAAG+B,IAAI,CAAC/B,UAAU,IAAI,EAAE;AAEvC,MAAA,IAAIkC,KAAK,GAAGN,QAAQ,CAACO,IAAI,CAACjC,GAAG,CAAC;AAC9B,MAAA,IAAInC,IAAI,EAAE;AACR,QAAA,MAAMqE,SAAS,GAAG,IAAI,CAACC,YAAY,CAACtE,IAAI,CAAC;QACzCmE,KAAK,GAAGE,SAAS,CAACT,SAAS,CAACO,KAAK,EAAEF,SAAS,CAACH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