@ember-data/model 5.4.0-alpha.70 → 5.4.0-alpha.71
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/{hooks-BNw6VdLr.js → hooks-BQaMzbZg.js} +1 -1
- package/dist/{hooks-BNw6VdLr.js.map → hooks-BQaMzbZg.js.map} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index.js +2 -2
- package/dist/migration-support.js +7 -7
- package/dist/migration-support.js.map +1 -1
- package/dist/{schema-provider-C5vR7TBr.js → schema-provider-Blw1xpOH.js} +5 -5
- package/dist/schema-provider-Blw1xpOH.js.map +1 -0
- package/package.json +17 -17
- package/unstable-preview-types/-private/schema-provider.d.ts +10 -4
- package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -1
- package/unstable-preview-types/migration-support.d.ts +10 -4
- package/unstable-preview-types/migration-support.d.ts.map +1 -1
- package/dist/schema-provider-C5vR7TBr.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setOwner, getOwner } from '@ember/application';
|
|
2
2
|
import { setRecordIdentifier, StoreMap, setCacheFor } from '@ember-data/store/-private';
|
|
3
|
-
import { g as getModelFactory } from "./schema-provider-
|
|
3
|
+
import { g as getModelFactory } from "./schema-provider-Blw1xpOH";
|
|
4
4
|
import { n as normalizeModelName } from "./model-CsbDNxap";
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
function instantiateRecord(identifier, createRecordArgs) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-
|
|
1
|
+
{"version":3,"file":"hooks-BQaMzbZg.js","sources":["../src/-private/hooks.ts"],"sourcesContent":["import { getOwner, setOwner } from '@ember/application';\n\nimport { setCacheFor, setRecordIdentifier, type Store, StoreMap } from '@ember-data/store/-private';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { Cache } from '@warp-drive/core-types/cache';\nimport type { TypeFromInstance, TypeFromInstanceOrString } from '@warp-drive/core-types/record';\n\nimport type { Model, ModelStore } from './model';\nimport { getModelFactory } from './schema-provider';\nimport { normalizeModelName } from './util';\n\nfunction recast(context: Store): asserts context is ModelStore {}\n\nexport function instantiateRecord(\n this: Store,\n identifier: StableRecordIdentifier,\n createRecordArgs: { [key: string]: unknown }\n): Model {\n const type = identifier.type;\n\n recast(this);\n\n const cache = this.cache;\n // TODO deprecate allowing unknown args setting\n const createOptions = {\n _createProps: createRecordArgs,\n // TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for\n _secretInit: {\n identifier,\n cache,\n store: this,\n cb: secretInit,\n },\n };\n\n // ensure that `getOwner(this)` works inside a model instance\n setOwner(createOptions, getOwner(this)!);\n const factory = getModelFactory(this, type);\n\n assert(`No model was found for '${type}'`, factory);\n return factory.class.create(createOptions);\n}\n\nexport function teardownRecord(record: Model): void {\n assert(\n `expected to receive an instance of Model from @ember-data/model. If using a custom model make sure you implement teardownRecord`,\n 'destroy' in record\n );\n record.destroy();\n}\n\nexport function modelFor<T>(type: TypeFromInstance<T>): typeof Model | void;\nexport function modelFor(type: string): typeof Model | void;\nexport function modelFor<T>(this: Store, modelName: TypeFromInstanceOrString<T>): typeof Model | void {\n assert(\n `Attempted to call store.modelFor(), but the store instance has already been destroyed.`,\n !this.isDestroyed && !this.isDestroying\n );\n assert(`You need to pass a model name to the store's modelFor method`, modelName);\n assert(\n `Please pass a proper model name to the store's modelFor method`,\n typeof modelName === 'string' && modelName.length\n );\n recast(this);\n\n const type = normalizeModelName(modelName);\n const maybeFactory = getModelFactory(this, type);\n const klass = maybeFactory && maybeFactory.class ? maybeFactory.class : null;\n\n const ignoreType = !klass || !klass.isModel || this._forceShim;\n if (!ignoreType) {\n return klass;\n }\n assert(`No model was found for '${type}' and no schema handles the type`, this.schema.hasResource({ type }));\n}\n\nfunction secretInit(record: Model, cache: Cache, identifier: StableRecordIdentifier, store: Store): void {\n setRecordIdentifier(record, identifier);\n StoreMap.set(record, store);\n setCacheFor(record, cache);\n}\n"],"names":["instantiateRecord","identifier","createRecordArgs","type","cache","createOptions","_createProps","_secretInit","store","cb","secretInit","setOwner","getOwner","factory","getModelFactory","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","class","create","teardownRecord","record","destroy","modelFor","modelName","isDestroyed","isDestroying","length","normalizeModelName","maybeFactory","klass","ignoreType","isModel","_forceShim","schema","hasResource","setRecordIdentifier","StoreMap","set","setCacheFor"],"mappings":";;;;;;AAcO,SAASA,iBAAiBA,CAE/BC,UAAkC,EAClCC,gBAA4C,EACrC;AACP,EAAA,MAAMC,IAAI,GAAGF,UAAU,CAACE,IAAI,CAAA;AAI5B,EAAA,MAAMC,KAAK,GAAG,IAAI,CAACA,KAAK,CAAA;AACxB;AACA,EAAA,MAAMC,aAAa,GAAG;AACpBC,IAAAA,YAAY,EAAEJ,gBAAgB;AAC9B;AACAK,IAAAA,WAAW,EAAE;MACXN,UAAU;MACVG,KAAK;AACLI,MAAAA,KAAK,EAAE,IAAI;AACXC,MAAAA,EAAE,EAAEC,UAAAA;AACN,KAAA;GACD,CAAA;;AAED;AACAC,EAAAA,QAAQ,CAACN,aAAa,EAAEO,QAAQ,CAAC,IAAI,CAAE,CAAC,CAAA;AACxC,EAAA,MAAMC,OAAO,GAAGC,eAAe,CAAC,IAAI,EAAEX,IAAI,CAAC,CAAA;EAE3CY,cAAA,CAAAC,eAAA,EAAAC,CAAAA,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,GAAA,CAAAC,IAAA,IAAA;AAAA,IAAA,IAAA,CAAAA,IAAA,EAAA;AAAA,MAAA,MAAA,IAAAC,KAAA,CAAQ,CAA0BlB,wBAAAA,EAAAA,IAAK,CAAE,CAAA,CAAA,CAAA,CAAA;AAAA,KAAA;AAAA,GAAA,EAAEU,OAAO,CAAA,GAAA,EAAA,CAAA;AAClD,EAAA,OAAOA,OAAO,CAACS,KAAK,CAACC,MAAM,CA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ED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-
|
|
2
|
-
export { b as buildSchema } from "./schema-provider-
|
|
1
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-BQaMzbZg";
|
|
2
|
+
export { b as buildSchema } from "./schema-provider-Blw1xpOH";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { a as attr, b as belongsTo, h as hasMany } from "./has-many-CR10J-rp";
|
|
2
2
|
export { M as default } from "./model-CsbDNxap";
|
|
3
|
-
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-
|
|
4
|
-
export { M as ModelSchemaProvider } from "./schema-provider-
|
|
3
|
+
export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-BQaMzbZg";
|
|
4
|
+
export { M as ModelSchemaProvider } from "./schema-provider-Blw1xpOH";
|
|
@@ -9,7 +9,7 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
|
9
9
|
import { u as unloadRecord, s as serialize, b as save, r as rollbackAttributes, c as reload, h as hasMany, E as Errors, d as destroyRecord, e as deleteRecord, f as RecordState, g as changedAttributes, i as belongsTo, j as createSnapshot } from "./model-CsbDNxap";
|
|
10
10
|
import 'ember-inflector';
|
|
11
11
|
import '@ember/application';
|
|
12
|
-
import { b as buildSchema } from "./schema-provider-
|
|
12
|
+
import { b as buildSchema } from "./schema-provider-Blw1xpOH";
|
|
13
13
|
|
|
14
14
|
// 'isDestroying', 'isDestroyed'
|
|
15
15
|
const LegacyFields = ['_createSnapshot', 'adapterError', 'belongsTo', 'changedAttributes', 'constructor', 'currentState', 'deleteRecord', 'destroyRecord', 'dirtyType', 'errors', 'hasDirtyAttributes', 'hasMany', 'isDeleted', 'isEmpty', 'isError', 'isLoaded', 'isLoading', 'isNew', 'isSaving', 'isValid', 'reload', 'rollbackAttributes', 'save', 'serialize', 'unloadRecord'];
|
|
@@ -160,14 +160,14 @@ class DelegatingSchemaService {
|
|
|
160
160
|
}
|
|
161
161
|
return this._secondary.fields(resource);
|
|
162
162
|
}
|
|
163
|
-
transformation(
|
|
164
|
-
return this._preferred.transformation(
|
|
163
|
+
transformation(field) {
|
|
164
|
+
return this._preferred.transformation(field);
|
|
165
165
|
}
|
|
166
|
-
hashFn(
|
|
167
|
-
return this._preferred.hashFn(
|
|
166
|
+
hashFn(field) {
|
|
167
|
+
return this._preferred.hashFn(field);
|
|
168
168
|
}
|
|
169
|
-
derivation(
|
|
170
|
-
return this._preferred.derivation(
|
|
169
|
+
derivation(field) {
|
|
170
|
+
return this._preferred.derivation(field);
|
|
171
171
|
}
|
|
172
172
|
resource(resource) {
|
|
173
173
|
if (this._preferred.hasResource(resource)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-support.js","sources":["../src/migration-support.ts"],"sourcesContent":["import type Store from '@ember-data/store';\nimport { recordIdentifierFor } from '@ember-data/store';\nimport type { SchemaService } from '@ember-data/store/types';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/build-config/deprecations';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';\nimport type { FieldSchema, ResourceSchema } from '@warp-drive/core-types/schema/fields';\nimport { Type } from '@warp-drive/core-types/symbols';\nimport type { WithPartial } from '@warp-drive/core-types/utils';\n\nimport { Errors } from './-private';\nimport type { MinimalLegacyRecord } from './-private/model-methods';\nimport {\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './-private/model-methods';\nimport RecordState from './-private/record-state';\nimport { buildSchema } from './hooks';\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\n// 'isDestroying', 'isDestroyed'\nconst LegacyFields = [\n '_createSnapshot',\n 'adapterError',\n 'belongsTo',\n 'changedAttributes',\n 'constructor',\n 'currentState',\n 'deleteRecord',\n 'destroyRecord',\n 'dirtyType',\n 'errors',\n 'hasDirtyAttributes',\n 'hasMany',\n 'isDeleted',\n 'isEmpty',\n 'isError',\n 'isLoaded',\n 'isLoading',\n 'isNew',\n 'isSaving',\n 'isValid',\n 'reload',\n 'rollbackAttributes',\n 'save',\n 'serialize',\n 'unloadRecord',\n];\n\nconst LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap<MinimalLegacyRecord, Record<string, unknown>>());\n\nfunction legacySupport(record: MinimalLegacyRecord, options: ObjectValue | null, prop: string): unknown {\n let state = LegacySupport.get(record);\n if (!state) {\n state = {};\n LegacySupport.set(record, state);\n }\n\n switch (prop) {\n case '_createSnapshot':\n return createSnapshot;\n case 'adapterError':\n return record.currentState.adapterError;\n case 'belongsTo':\n return belongsTo;\n case 'changedAttributes':\n return changedAttributes;\n case 'constructor':\n return (state._constructor = state._constructor || {\n isModel: true,\n name: `Record<${recordIdentifierFor(record).type}>`,\n modelName: recordIdentifierFor(record).type,\n });\n case 'currentState':\n return (state.recordState = state.recordState || new RecordState(record));\n case 'deleteRecord':\n return deleteRecord;\n case 'destroyRecord':\n return destroyRecord;\n case 'dirtyType':\n return record.currentState.dirtyType;\n case 'errors':\n // @ts-expect-error\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return (state.errors = state.errors || Errors.create({ __record: record }));\n case 'hasDirtyAttributes':\n return record.currentState.isDirty;\n case 'hasMany':\n return hasMany;\n case 'isDeleted':\n return record.currentState.isDeleted;\n case 'isEmpty':\n return record.currentState.isEmpty;\n case 'isError':\n return record.currentState.isError;\n case 'isLoaded':\n return record.currentState.isLoaded;\n case 'isLoading':\n return record.currentState.isLoading;\n case 'isNew':\n return record.currentState.isNew;\n case 'isSaving':\n return record.currentState.isSaving;\n case 'isValid':\n return record.currentState.isValid;\n case 'reload':\n return reload;\n case 'rollbackAttributes':\n return rollbackAttributes;\n case 'save':\n return save;\n case 'serialize':\n return serialize;\n case 'unloadRecord':\n return unloadRecord;\n default:\n assert(`${prop} is not a supported legacy field`, false);\n }\n}\nlegacySupport[Type] = '@legacy';\n\nexport function withDefaults(schema: WithPartial<ResourceSchema, 'legacy' | 'identity'>): ResourceSchema {\n schema.legacy = true;\n schema.identity = { kind: '@id', name: 'id' };\n\n LegacyFields.forEach((field) => {\n schema.fields.push({\n type: '@legacy',\n name: field,\n kind: 'derived',\n });\n });\n schema.fields.push({\n name: 'isReloading',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroying',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroyed',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n return schema as ResourceSchema;\n}\n\nexport function registerDerivations(schema: SchemaService) {\n schema.registerDerivation(legacySupport);\n}\n\nexport interface DelegatingSchemaService {\n attributesDefinitionFor?(resource: StableRecordIdentifier | { type: string }): AttributesSchema;\n relationshipsDefinitionFor?(resource: StableRecordIdentifier | { type: string }): RelationshipsSchema;\n doesTypeExist?(type: string): boolean;\n}\nexport class DelegatingSchemaService implements SchemaService {\n _preferred!: SchemaService;\n _secondary!: SchemaService;\n\n constructor(store: Store, schema: SchemaService) {\n this._preferred = schema;\n this._secondary = buildSchema(store);\n }\n hasResource(resource: StableRecordIdentifier | { type: string }): boolean {\n return this._preferred.hasResource(resource) || this._secondary.hasResource(resource);\n }\n hasTrait(type: string): boolean {\n if (this._preferred.hasResource({ type })) {\n return this._preferred.hasTrait(type);\n }\n return this._secondary.hasTrait(type);\n }\n resourceHasTrait(resource: StableRecordIdentifier | { type: string }, trait: string): boolean {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resourceHasTrait(resource, trait);\n }\n return this._secondary.resourceHasTrait(resource, trait);\n }\n fields(resource: StableRecordIdentifier | { type: string }): Map<string, FieldSchema> {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.fields(resource);\n }\n return this._secondary.fields(resource);\n }\n transformation(name: string): Transformation {\n return this._preferred.transformation(name);\n }\n hashFn(name: string): HashFn {\n return this._preferred.hashFn(name);\n }\n derivation(name: string): Derivation {\n return this._preferred.derivation(name);\n }\n resource(resource: StableRecordIdentifier | { type: string }): ResourceSchema {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resource(resource);\n }\n return this._secondary.resource(resource);\n }\n registerResources(schemas: ResourceSchema[]): void {\n this._preferred.registerResources(schemas);\n }\n registerResource(schema: ResourceSchema): void {\n this._preferred.registerResource(schema);\n }\n registerTransformation(transform: Transformation): void {\n this._preferred.registerTransformation(transform);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n this._preferred.registerDerivation(derivation);\n }\n registerHashFn(hashFn: HashFn): void {\n this._preferred.registerHashFn(hashFn);\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n DelegatingSchemaService.prototype.attributesDefinitionFor = function (\n resource: StableRecordIdentifier | { type: string }\n ) {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.attributesDefinitionFor!(resource);\n }\n\n return this._secondary.attributesDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.relationshipsDefinitionFor = function (\n resource: StableRecordIdentifier | { type: string }\n ) {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.relationshipsDefinitionFor!(resource);\n }\n\n return this._secondary.relationshipsDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.doesTypeExist = function (type: string) {\n return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;\n };\n}\n"],"names":["LegacyFields","LegacySupport","getOrSetGlobal","WeakMap","legacySupport","record","options","prop","state","get","set","createSnapshot","currentState","adapterError","belongsTo","changedAttributes","_constructor","isModel","name","recordIdentifierFor","type","modelName","recordState","RecordState","deleteRecord","destroyRecord","dirtyType","errors","Errors","create","__record","isDirty","hasMany","isDeleted","isEmpty","isError","isLoaded","isLoading","isNew","isSaving","isValid","reload","rollbackAttributes","save","serialize","unloadRecord","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","Type","withDefaults","schema","legacy","identity","kind","forEach","field","fields","push","defaultValue","registerDerivations","registerDerivation","DelegatingSchemaService","_preferred","_secondary","constructor","store","buildSchema","hasResource","resource","hasTrait","resourceHasTrait","trait","transformation","hashFn","derivation","registerResources","schemas","registerResource","registerTransformation","transform","registerHashFn","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist"],"mappings":";;;;;;;;;;;;;AAkCA;AACA,MAAMA,YAAY,GAAG,CACnB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,QAAQ,EACR,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,EACR,oBAAoB,EACpB,MAAM,EACN,WAAW,EACX,cAAc,CACf,CAAA;AAED,MAAMC,aAAa,GAAGC,cAAc,CAAC,eAAe,EAAE,IAAIC,OAAO,EAAgD,CAAC,CAAA;AAElH,SAASC,aAAaA,CAACC,MAA2B,EAAEC,OAA2B,EAAEC,IAAY,EAAW;AACtG,EAAA,IAAIC,KAAK,GAAGP,aAAa,CAACQ,GAAG,CAACJ,MAAM,CAAC,CAAA;EACrC,IAAI,CAACG,KAAK,EAAE;IACVA,KAAK,GAAG,EAAE,CAAA;AACVP,IAAAA,aAAa,CAACS,GAAG,CAACL,MAAM,EAAEG,KAAK,CA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AC,IAAI,KAAK,CAAA;GAC/F,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"migration-support.js","sources":["../src/migration-support.ts"],"sourcesContent":["import type Store from '@ember-data/store';\nimport { recordIdentifierFor } from '@ember-data/store';\nimport type { SchemaService } from '@ember-data/store/types';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/build-config/deprecations';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport { getOrSetGlobal } from '@warp-drive/core-types/-private';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';\nimport type {\n ArrayField,\n DerivedField,\n FieldSchema,\n GenericField,\n HashField,\n ObjectField,\n ResourceSchema,\n} from '@warp-drive/core-types/schema/fields';\nimport { Type } from '@warp-drive/core-types/symbols';\nimport type { WithPartial } from '@warp-drive/core-types/utils';\n\nimport { Errors } from './-private';\nimport type { MinimalLegacyRecord } from './-private/model-methods';\nimport {\n belongsTo,\n changedAttributes,\n createSnapshot,\n deleteRecord,\n destroyRecord,\n hasMany,\n reload,\n rollbackAttributes,\n save,\n serialize,\n unloadRecord,\n} from './-private/model-methods';\nimport RecordState from './-private/record-state';\nimport { buildSchema } from './hooks';\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\n// 'isDestroying', 'isDestroyed'\nconst LegacyFields = [\n '_createSnapshot',\n 'adapterError',\n 'belongsTo',\n 'changedAttributes',\n 'constructor',\n 'currentState',\n 'deleteRecord',\n 'destroyRecord',\n 'dirtyType',\n 'errors',\n 'hasDirtyAttributes',\n 'hasMany',\n 'isDeleted',\n 'isEmpty',\n 'isError',\n 'isLoaded',\n 'isLoading',\n 'isNew',\n 'isSaving',\n 'isValid',\n 'reload',\n 'rollbackAttributes',\n 'save',\n 'serialize',\n 'unloadRecord',\n];\n\nconst LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap<MinimalLegacyRecord, Record<string, unknown>>());\n\nfunction legacySupport(record: MinimalLegacyRecord, options: ObjectValue | null, prop: string): unknown {\n let state = LegacySupport.get(record);\n if (!state) {\n state = {};\n LegacySupport.set(record, state);\n }\n\n switch (prop) {\n case '_createSnapshot':\n return createSnapshot;\n case 'adapterError':\n return record.currentState.adapterError;\n case 'belongsTo':\n return belongsTo;\n case 'changedAttributes':\n return changedAttributes;\n case 'constructor':\n return (state._constructor = state._constructor || {\n isModel: true,\n name: `Record<${recordIdentifierFor(record).type}>`,\n modelName: recordIdentifierFor(record).type,\n });\n case 'currentState':\n return (state.recordState = state.recordState || new RecordState(record));\n case 'deleteRecord':\n return deleteRecord;\n case 'destroyRecord':\n return destroyRecord;\n case 'dirtyType':\n return record.currentState.dirtyType;\n case 'errors':\n // @ts-expect-error\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return (state.errors = state.errors || Errors.create({ __record: record }));\n case 'hasDirtyAttributes':\n return record.currentState.isDirty;\n case 'hasMany':\n return hasMany;\n case 'isDeleted':\n return record.currentState.isDeleted;\n case 'isEmpty':\n return record.currentState.isEmpty;\n case 'isError':\n return record.currentState.isError;\n case 'isLoaded':\n return record.currentState.isLoaded;\n case 'isLoading':\n return record.currentState.isLoading;\n case 'isNew':\n return record.currentState.isNew;\n case 'isSaving':\n return record.currentState.isSaving;\n case 'isValid':\n return record.currentState.isValid;\n case 'reload':\n return reload;\n case 'rollbackAttributes':\n return rollbackAttributes;\n case 'save':\n return save;\n case 'serialize':\n return serialize;\n case 'unloadRecord':\n return unloadRecord;\n default:\n assert(`${prop} is not a supported legacy field`, false);\n }\n}\nlegacySupport[Type] = '@legacy';\n\nexport function withDefaults(schema: WithPartial<ResourceSchema, 'legacy' | 'identity'>): ResourceSchema {\n schema.legacy = true;\n schema.identity = { kind: '@id', name: 'id' };\n\n LegacyFields.forEach((field) => {\n schema.fields.push({\n type: '@legacy',\n name: field,\n kind: 'derived',\n });\n });\n schema.fields.push({\n name: 'isReloading',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroying',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n schema.fields.push({\n name: 'isDestroyed',\n kind: '@local',\n type: 'boolean',\n options: { defaultValue: false },\n });\n return schema as ResourceSchema;\n}\n\nexport function registerDerivations(schema: SchemaService) {\n schema.registerDerivation(legacySupport);\n}\n\nexport interface DelegatingSchemaService {\n attributesDefinitionFor?(resource: StableRecordIdentifier | { type: string }): AttributesSchema;\n relationshipsDefinitionFor?(resource: StableRecordIdentifier | { type: string }): RelationshipsSchema;\n doesTypeExist?(type: string): boolean;\n}\nexport class DelegatingSchemaService implements SchemaService {\n _preferred!: SchemaService;\n _secondary!: SchemaService;\n\n constructor(store: Store, schema: SchemaService) {\n this._preferred = schema;\n this._secondary = buildSchema(store);\n }\n hasResource(resource: StableRecordIdentifier | { type: string }): boolean {\n return this._preferred.hasResource(resource) || this._secondary.hasResource(resource);\n }\n hasTrait(type: string): boolean {\n if (this._preferred.hasResource({ type })) {\n return this._preferred.hasTrait(type);\n }\n return this._secondary.hasTrait(type);\n }\n resourceHasTrait(resource: StableRecordIdentifier | { type: string }, trait: string): boolean {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resourceHasTrait(resource, trait);\n }\n return this._secondary.resourceHasTrait(resource, trait);\n }\n fields(resource: StableRecordIdentifier | { type: string }): Map<string, FieldSchema> {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.fields(resource);\n }\n return this._secondary.fields(resource);\n }\n transformation(field: GenericField | ObjectField | ArrayField | { type: string }): Transformation {\n return this._preferred.transformation(field);\n }\n hashFn(field: HashField | { type: string }): HashFn {\n return this._preferred.hashFn(field);\n }\n derivation(field: DerivedField | { type: string }): Derivation {\n return this._preferred.derivation(field);\n }\n resource(resource: StableRecordIdentifier | { type: string }): ResourceSchema {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resource(resource);\n }\n return this._secondary.resource(resource);\n }\n registerResources(schemas: ResourceSchema[]): void {\n this._preferred.registerResources(schemas);\n }\n registerResource(schema: ResourceSchema): void {\n this._preferred.registerResource(schema);\n }\n registerTransformation(transform: Transformation): void {\n this._preferred.registerTransformation(transform);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n this._preferred.registerDerivation(derivation);\n }\n registerHashFn(hashFn: HashFn): void {\n this._preferred.registerHashFn(hashFn);\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n DelegatingSchemaService.prototype.attributesDefinitionFor = function (\n resource: StableRecordIdentifier | { type: string }\n ) {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.attributesDefinitionFor!(resource);\n }\n\n return this._secondary.attributesDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.relationshipsDefinitionFor = function (\n resource: StableRecordIdentifier | { type: string }\n ) {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.relationshipsDefinitionFor!(resource);\n }\n\n return this._secondary.relationshipsDefinitionFor!(resource);\n };\n DelegatingSchemaService.prototype.doesTypeExist = function (type: string) {\n return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;\n };\n}\n"],"names":["LegacyFields","LegacySupport","getOrSetGlobal","WeakMap","legacySupport","record","options","prop","state","get","set","createSnapshot","currentState","adapterError","belongsTo","changedAttributes","_constructor","isModel","name","recordIdentifierFor","type","modelName","recordState","RecordState","deleteRecord","destroyRecord","dirtyType","errors","Errors","create","__record","isDirty","hasMany","isDeleted","isEmpty","isError","isLoaded","isLoading","isNew","isSaving","isValid","reload","rollbackAttributes","save","serialize","unloadRecord","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","Type","withDefaults","schema","legacy","identity","kind","forEach","field","fields","push","defaultValue","registerDerivations","registerDerivation","DelegatingSchemaService","_preferred","_secondary","constructor","store","buildSchema","hasResource","resource","hasTrait","resourceHasTrait","trait","transformation","hashFn","derivation","registerResources","schemas","registerResource","registerTransformation","transform","registerHashFn","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist"],"mappings":";;;;;;;;;;;;;AA0CA;AACA,MAAMA,YAAY,GAAG,CACnB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,QAAQ,EACR,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,EACR,oBAAoB,EACpB,MAAM,EACN,WAAW,EACX,cAAc,CACf,CAAA;AAED,MAAMC,aAAa,GAAGC,cAAc,CAAC,eAAe,EAAE,IAAIC,OAAO,EAAgD,CAAC,CAAA;AAElH,SAASC,aAAaA,CAACC,MAA2B,EAAEC,OAA2B,EAAEC,IAAY,EAAW;AACtG,EAAA,IAAIC,KAAK,GAAGP,aAAa,CAACQ,GAAG,CAACJ,MAAM,CAAC,CAAA;EACrC,IAAI,CAACG,KAAK,EAAE;IACVA,KAAK,GAAG,EAAE,CAAA;AACVP,IAAAA,aAAa,CAACS,GAAG,CAACL,MAAM,EAAEG,KAAK,CAAC,CAAA;AAClC,GAAA;AAEA,EAAA,QAAQD,IAAI;AACV,IAAA,KAAK,iBAAiB;AACpB,MAAA,OAAOI,cAAc,CAAA;AACvB,IAAA,KAAK,cAAc;AACjB,MAAA,OAAON,MAAM,CAACO,YAAY,CAACC,YAAY,CAAA;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAOC,SAAS,CAAA;AAClB,IAAA,KAAK,mBAAmB;AACtB,MAAA,OAAOC,iBAAiB,CAAA;AAC1B,IAAA,KAAK,aAAa;AAChB,MAAA,OAAQP,KAAK,CAACQ,YA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AAA;AAChCrB,EAAAA,uBAAuB,CAACsB,SAAS,CAACC,uBAAuB,GAAG,UAC1DhB,QAAmD,EACnD;IACA,IAAI,IAAI,CAACN,UAAU,CAACK,WAAW,CAACC,QAAQ,CAAC,EAAE;AACzC,MAAA,OAAO,IAAI,CAACN,UAAU,CAACsB,uBAAuB,CAAEhB,QAAQ,CAAC,CAAA;AAC3D,KAAA;AAEA,IAAA,OAAO,IAAI,CAACL,UAAU,CAACqB,uBAAuB,CAAEhB,QAAQ,CAAC,CAAA;GAC1D,CAAA;AACDP,EAAAA,uBAAuB,CAACsB,SAAS,CAACE,0BAA0B,GAAG,UAC7DjB,QAAmD,EACnD;IACA,IAAI,IAAI,CAACN,UAAU,CAACK,WAAW,CAACC,QAAQ,CAAC,EAAE;AACzC,MAAA,OAAO,IAAI,CAACN,UAAU,CAACuB,0BAA0B,CAAEjB,QAAQ,CAAC,CAAA;AAC9D,KAAA;AAEA,IAAA,OAAO,IAAI,CAACL,UAAU,CAACsB,0BAA0B,CAAEjB,QAAQ,CAAC,CAAA;GAC7D,CAAA;AACDP,EAAAA,uBAAuB,CAACsB,SAAS,CAACG,aAAa,GAAG,UAAUvE,IAAY,EAAE;AACxE,IAAA,OAAO,IAAI,CAAC+C,UAAU,CAACwB,aAAa,GAAGvE,IAAI,CAAC,IAAI,IAAI,CAACgD,UAAU,CAACuB,aAAa,GAAGvE,IAAI,CAAC,IAAI,KAAK,CAAA;GAC/F,CAAA;AACH;;;;"}
|
|
@@ -54,24 +54,24 @@ class ModelSchemaProvider {
|
|
|
54
54
|
})() : {};
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
-
transformation(
|
|
57
|
+
transformation(field) {
|
|
58
58
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
59
59
|
{
|
|
60
60
|
throw new Error(`transformation is not available with @ember-data/model's SchemaService`);
|
|
61
61
|
}
|
|
62
62
|
})() : {};
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
derivation(field) {
|
|
65
65
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
66
66
|
{
|
|
67
|
-
throw new Error(`
|
|
67
|
+
throw new Error(`derivation is not available with @ember-data/model's SchemaService`);
|
|
68
68
|
}
|
|
69
69
|
})() : {};
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
hashFn(field) {
|
|
72
72
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
73
73
|
{
|
|
74
|
-
throw new Error(`
|
|
74
|
+
throw new Error(`hashFn is not available with @ember-data/model's SchemaService`);
|
|
75
75
|
}
|
|
76
76
|
})() : {};
|
|
77
77
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-provider-Blw1xpOH.js","sources":["../src/-private/model-for-mixin.ts","../src/-private/schema-provider.ts"],"sourcesContent":["import { getOwner } from '@ember/application';\n\nimport type Store from '@ember-data/store';\n\nimport { Model, type ModelFactory } from './model';\n\n/*\n In case someone defined a relationship to a mixin, for example:\n ```ts\n class CommentModel extends Model {\n @belongsTo('commentable', { polymorphic: true }) owner;\n }\n\n let Commentable = Mixin.create({\n @hasMany('comment') comments;\n });\n ```\n we want to look up a Commentable class which has all the necessary\n relationship meta data. Thus, we look up the mixin and create a mock\n Model, so we can access the relationship CPs of the mixin (`comments`)\n in this case\n */\nexport default function modelForMixin(store: Store, normalizedModelName: string): ModelFactory | undefined {\n const owner = getOwner(store)!;\n const MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);\n const mixin = MaybeMixin && MaybeMixin.class;\n if (mixin) {\n const ModelForMixin = Model.extend(mixin) as unknown as { __isMixin: boolean; __mixin: typeof mixin };\n ModelForMixin.__isMixin = true;\n ModelForMixin.__mixin = mixin;\n //Cache the class as a model\n owner.register(`model:${normalizedModelName}`, ModelForMixin);\n }\n return owner.factoryFor(`model:${normalizedModelName}`) as ModelFactory | undefined;\n}\n","import { getOwner } from '@ember/application';\nimport { deprecate } from '@ember/debug';\n\nimport type Store from '@ember-data/store';\nimport type { SchemaService } from '@ember-data/store/types';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/build-config/deprecations';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';\nimport type {\n ArrayField,\n DerivedField,\n GenericField,\n HashField,\n LegacyAttributeField,\n LegacyFieldSchema,\n LegacyRelationshipSchema,\n ObjectField,\n ResourceSchema,\n} from '@warp-drive/core-types/schema/fields';\n\nimport type { FactoryCache, Model, ModelFactory, ModelStore } from './model';\nimport _modelForMixin from './model-for-mixin';\nimport { normalizeModelName } from './util';\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ntype InternalSchema = {\n schema: ResourceSchema;\n fields: Map<string, LegacyAttributeField | LegacyRelationshipSchema>;\n attributes: Record<string, LegacyAttributeField>;\n relationships: Record<string, LegacyRelationshipSchema>;\n};\n\nexport interface ModelSchemaProvider {\n attributesDefinitionFor(resource: RecordIdentifier | { type: string }): AttributesSchema;\n\n relationshipsDefinitionFor(resource: RecordIdentifier | { type: string }): RelationshipsSchema;\n\n doesTypeExist(type: string): boolean;\n}\nexport class ModelSchemaProvider implements SchemaService {\n declare store: ModelStore;\n declare _schemas: Map<string, InternalSchema>;\n declare _typeMisses: Set<string>;\n\n constructor(store: ModelStore) {\n this.store = store;\n this._schemas = new Map();\n this._typeMisses = new Set();\n }\n\n hasTrait(type: string): boolean {\n assert(`hasTrait is not available with @ember-data/model's SchemaService`);\n return false;\n }\n resourceHasTrait(resource: StableRecordIdentifier | { type: string }, trait: string): boolean {\n assert(`resourceHasTrait is not available with @ember-data/model's SchemaService`);\n return false;\n }\n transformation(field: GenericField | ObjectField | ArrayField | { type: string }): Transformation {\n assert(`transformation is not available with @ember-data/model's SchemaService`);\n }\n derivation(field: DerivedField | { type: string }): Derivation {\n assert(`derivation is not available with @ember-data/model's SchemaService`);\n }\n hashFn(field: HashField | { type: string }): HashFn {\n assert(`hashFn is not available with @ember-data/model's SchemaService`);\n }\n resource(resource: StableRecordIdentifier | { type: string }): ResourceSchema {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.schema;\n }\n registerResources(schemas: ResourceSchema[]): void {\n assert(`registerResources is not available with @ember-data/model's SchemaService`);\n }\n registerResource(schema: ResourceSchema): void {\n assert(`registerResource is not available with @ember-data/model's SchemaService`);\n }\n registerTransformation(transform: Transformation): void {\n assert(`registerTransformation is not available with @ember-data/model's SchemaService`);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n assert(`registerDerivation is not available with @ember-data/model's SchemaService`);\n }\n registerHashFn(hashFn: HashFn): void {\n assert(`registerHashFn is not available with @ember-data/model's SchemaService`);\n }\n _loadModelSchema(type: string) {\n const modelClass = this.store.modelFor(type) as typeof Model;\n const attributeMap = modelClass.attributes;\n\n const attributes = Object.create(null) as AttributesSchema;\n attributeMap.forEach((meta, name) => (attributes[name] = meta));\n const relationships = modelClass.relationshipsObject || null;\n const fields = new Map<string, LegacyAttributeField | LegacyRelationshipSchema>();\n\n for (const attr of Object.values(attributes)) {\n fields.set(attr.name, attr);\n }\n\n for (const rel of Object.values(relationships)) {\n fields.set(rel.name, rel);\n }\n\n const schema: ResourceSchema = {\n legacy: true,\n identity: { name: 'id', kind: '@id' },\n type,\n fields: Array.from(fields.values()),\n };\n\n const internalSchema: InternalSchema = {\n schema,\n attributes,\n relationships,\n fields,\n };\n\n this._schemas.set(type, internalSchema);\n\n return internalSchema;\n }\n\n fields(resource: RecordIdentifier | { type: string }): Map<string, LegacyFieldSchema> {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.fields;\n }\n\n hasResource(resource: { type: string }): boolean {\n const type = normalizeModelName(resource.type);\n\n if (this._schemas.has(type)) {\n return true;\n }\n\n if (this._typeMisses.has(type)) {\n return false;\n }\n\n const factory = getModelFactory(this.store, type);\n const exists = factory !== null;\n\n if (!exists) {\n this._typeMisses.add(type);\n return false;\n }\n\n return true;\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n ModelSchemaProvider.prototype.doesTypeExist = function (type: string): boolean {\n deprecate(`Use \\`schema.hasResource({ type })\\` instead of \\`schema.doesTypeExist(type)\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '5.0',\n for: 'ember-data',\n since: {\n available: '5.4',\n enabled: '5.4',\n },\n });\n return this.hasResource({ type });\n };\n\n ModelSchemaProvider.prototype.attributesDefinitionFor = function (\n resource: RecordIdentifier | { type: string }\n ): AttributesSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.attributesDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '5.0',\n for: 'ember-data',\n since: {\n available: '5.4',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.attributes;\n };\n\n ModelSchemaProvider.prototype.relationshipsDefinitionFor = function (\n resource: RecordIdentifier | { type: string }\n ): RelationshipsSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.relationshipsDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '5.0',\n for: 'ember-data',\n since: {\n available: '5.4',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.relationships;\n };\n}\n\nexport function buildSchema(store: Store): SchemaService {\n return new ModelSchemaProvider(store as ModelStore);\n}\n\nexport function getModelFactory(store: ModelStore, type: string): ModelFactory | null {\n if (!store._modelFactoryCache) {\n store._modelFactoryCache = Object.create(null) as FactoryCache;\n }\n const cache = store._modelFactoryCache;\n let factory: ModelFactory | undefined = cache[type];\n\n if (!factory) {\n const owner = getOwner(store)!;\n factory = owner.factoryFor(`model:${type}`) as ModelFactory | undefined;\n\n if (!factory) {\n //Support looking up mixins as base types for polymorphic relationships\n factory = _modelForMixin(store, type);\n }\n\n if (!factory) {\n // we don't cache misses in case someone wants to register a missing model\n return null;\n }\n\n const klass = factory.class;\n\n if (klass.isModel) {\n const hasOwnModelNameSet = klass.modelName && Object.prototype.hasOwnProperty.call(klass, 'modelName');\n if (!hasOwnModelNameSet) {\n Object.defineProperty(klass, 'modelName', { value: type });\n }\n }\n\n cache[type] = factory;\n }\n\n return factory;\n}\n"],"names":["modelForMixin","store","normalizedModelName","owner","getOwner","MaybeMixin","factoryFor","mixin","class","ModelForMixin","Model","extend","__isMixin","__mixin","register","ModelSchemaProvider","constructor","_schemas","Map","_typeMisses","Set","hasTrait","type","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","resourceHasTrait","resource","trait","transformation","field","derivation","hashFn","normalizeModelName","has","_loadModelSchema","get","schema","registerResources","schemas","registerResource","registerTransformation","transform","registerDerivation","registerHashFn","modelClass","modelFor","attributeMap","attributes","Object","create","forEach","meta","name","relationships","relationshipsObject","fields","attr","values","set","rel","legacy","identity","kind","Array","from","internalSchema","hasResource","factory","getModelFactory","exists","add","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","doesTypeExist","deprecate","id","until","for","since","available","enabled","attributesDefinitionFor","relationshipsDefinitionFor","buildSchema","_modelFactoryCache","cache","_modelForMixin","klass","isModel","hasOwnModelNameSet","modelName","hasOwnProperty","call","defineProperty","value"],"mappings":";;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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KAAA;AAEAqE,IAAAA,KAAK,CAACrE,IAAI,CAAC,GAAGkD,OAAO,CAAA;AACvB,GAAA;AAEA,EAAA,OAAOA,OAAO,CAAA;AAChB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/model",
|
|
3
|
-
"version": "5.4.0-alpha.
|
|
3
|
+
"version": "5.4.0-alpha.71",
|
|
4
4
|
"description": "A basic Ember implementation of a resource presentation layer for use with @ember-data/store",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"ember-data-logo-light.svg"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@ember-data/graph": "5.4.0-alpha.
|
|
38
|
-
"@ember-data/json-api": "5.4.0-alpha.
|
|
39
|
-
"@ember-data/legacy-compat": "5.4.0-alpha.
|
|
40
|
-
"@ember-data/store": "5.4.0-alpha.
|
|
41
|
-
"@ember-data/tracking": "5.4.0-alpha.
|
|
37
|
+
"@ember-data/graph": "5.4.0-alpha.71",
|
|
38
|
+
"@ember-data/json-api": "5.4.0-alpha.71",
|
|
39
|
+
"@ember-data/legacy-compat": "5.4.0-alpha.71",
|
|
40
|
+
"@ember-data/store": "5.4.0-alpha.71",
|
|
41
|
+
"@ember-data/tracking": "5.4.0-alpha.71",
|
|
42
42
|
"@ember/string": "^3.1.1",
|
|
43
|
-
"@warp-drive/core-types": "0.0.0-alpha.
|
|
43
|
+
"@warp-drive/core-types": "0.0.0-alpha.57",
|
|
44
44
|
"ember-inflector": "^4.0.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"ember-cli-string-utils": "^1.1.0",
|
|
93
93
|
"ember-cli-test-info": "^1.0.0",
|
|
94
94
|
"inflection": "~3.0.0",
|
|
95
|
-
"@warp-drive/build-config": "0.0.0-alpha.
|
|
95
|
+
"@warp-drive/build-config": "0.0.0-alpha.8",
|
|
96
96
|
"ember-cli-babel": "^8.2.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
@@ -100,18 +100,18 @@
|
|
|
100
100
|
"@babel/plugin-transform-typescript": "^7.24.5",
|
|
101
101
|
"@babel/preset-env": "^7.24.5",
|
|
102
102
|
"@babel/preset-typescript": "^7.24.1",
|
|
103
|
-
"@ember-data/graph": "5.4.0-alpha.
|
|
104
|
-
"@ember-data/json-api": "5.4.0-alpha.
|
|
105
|
-
"@ember-data/legacy-compat": "5.4.0-alpha.
|
|
106
|
-
"@ember-data/request": "5.4.0-alpha.
|
|
107
|
-
"@ember-data/request-utils": "5.4.0-alpha.
|
|
108
|
-
"@ember-data/store": "5.4.0-alpha.
|
|
109
|
-
"@ember-data/tracking": "5.4.0-alpha.
|
|
103
|
+
"@ember-data/graph": "5.4.0-alpha.71",
|
|
104
|
+
"@ember-data/json-api": "5.4.0-alpha.71",
|
|
105
|
+
"@ember-data/legacy-compat": "5.4.0-alpha.71",
|
|
106
|
+
"@ember-data/request": "5.4.0-alpha.71",
|
|
107
|
+
"@ember-data/request-utils": "5.4.0-alpha.71",
|
|
108
|
+
"@ember-data/store": "5.4.0-alpha.71",
|
|
109
|
+
"@ember-data/tracking": "5.4.0-alpha.71",
|
|
110
110
|
"@ember/test-waiters": "^3.1.0",
|
|
111
111
|
"@ember/string": "^3.1.1",
|
|
112
112
|
"@glimmer/component": "^1.1.2",
|
|
113
|
-
"@warp-drive/core-types": "0.0.0-alpha.
|
|
114
|
-
"@warp-drive/internal-config": "5.4.0-alpha.
|
|
113
|
+
"@warp-drive/core-types": "0.0.0-alpha.57",
|
|
114
|
+
"@warp-drive/internal-config": "5.4.0-alpha.71",
|
|
115
115
|
"decorator-transforms": "^2.0.0",
|
|
116
116
|
"ember-inflector": "^4.0.2",
|
|
117
117
|
"ember-source": "~5.8.0",
|
|
@@ -4,7 +4,7 @@ declare module '@ember-data/model/-private/schema-provider' {
|
|
|
4
4
|
import type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
5
5
|
import type { ObjectValue } from '@warp-drive/core-types/json/raw';
|
|
6
6
|
import type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';
|
|
7
|
-
import type { LegacyAttributeField, LegacyFieldSchema, LegacyRelationshipSchema, ResourceSchema } from '@warp-drive/core-types/schema/fields';
|
|
7
|
+
import type { ArrayField, DerivedField, GenericField, HashField, LegacyAttributeField, LegacyFieldSchema, LegacyRelationshipSchema, ObjectField, ResourceSchema } from '@warp-drive/core-types/schema/fields';
|
|
8
8
|
import type { ModelFactory, ModelStore } from '@ember-data/model/-private/model';
|
|
9
9
|
type AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;
|
|
10
10
|
type RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;
|
|
@@ -32,9 +32,15 @@ declare module '@ember-data/model/-private/schema-provider' {
|
|
|
32
32
|
resourceHasTrait(resource: StableRecordIdentifier | {
|
|
33
33
|
type: string;
|
|
34
34
|
}, trait: string): boolean;
|
|
35
|
-
transformation(
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
36
|
+
type: string;
|
|
37
|
+
}): Transformation;
|
|
38
|
+
derivation(field: DerivedField | {
|
|
39
|
+
type: string;
|
|
40
|
+
}): Derivation;
|
|
41
|
+
hashFn(field: HashField | {
|
|
42
|
+
type: string;
|
|
43
|
+
}): HashFn;
|
|
38
44
|
resource(resource: StableRecordIdentifier | {
|
|
39
45
|
type: string;
|
|
40
46
|
}): ResourceSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-provider.d.ts","sourceRoot":"","sources":["../../src/-private/schema-provider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK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;IAGnD,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;IAS7E,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI;IAGlD,gBAAgB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAG9C,sBAAsB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI;IAGvD,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,WAAW,GAAG,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI;IAG/F,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAGpC,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAoC7B,MAAM,CAAC,QAAQ,EAAE,gBAAgB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAUrF,WAAW,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO;CAqBjD;AA2DD,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAEvD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAkCpF"}
|
|
@@ -4,7 +4,7 @@ declare module '@ember-data/model/migration-support' {
|
|
|
4
4
|
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
5
5
|
import type { ObjectValue } from '@warp-drive/core-types/json/raw';
|
|
6
6
|
import type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';
|
|
7
|
-
import type { FieldSchema, ResourceSchema } from '@warp-drive/core-types/schema/fields';
|
|
7
|
+
import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, ObjectField, ResourceSchema } from '@warp-drive/core-types/schema/fields';
|
|
8
8
|
import type { WithPartial } from '@warp-drive/core-types/utils';
|
|
9
9
|
type AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;
|
|
10
10
|
type RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;
|
|
@@ -33,9 +33,15 @@ declare module '@ember-data/model/migration-support' {
|
|
|
33
33
|
fields(resource: StableRecordIdentifier | {
|
|
34
34
|
type: string;
|
|
35
35
|
}): Map<string, FieldSchema>;
|
|
36
|
-
transformation(
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
37
|
+
type: string;
|
|
38
|
+
}): Transformation;
|
|
39
|
+
hashFn(field: HashField | {
|
|
40
|
+
type: string;
|
|
41
|
+
}): HashFn;
|
|
42
|
+
derivation(field: DerivedField | {
|
|
43
|
+
type: string;
|
|
44
|
+
}): Derivation;
|
|
39
45
|
resource(resource: StableRecordIdentifier | {
|
|
40
46
|
type: string;
|
|
41
47
|
}): ResourceSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-support.d.ts","sourceRoot":"","sources":["../src/migration-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACjG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"migration-support.d.ts","sourceRoot":"","sources":["../src/migration-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,E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.js","sources":["../src/-private/model-for-mixin.ts","../src/-private/schema-provider.ts"],"sourcesContent":["import { getOwner } from '@ember/application';\n\nimport type Store from '@ember-data/store';\n\nimport { Model, type ModelFactory } from './model';\n\n/*\n In case someone defined a relationship to a mixin, for example:\n ```ts\n class CommentModel extends Model {\n @belongsTo('commentable', { polymorphic: true }) owner;\n }\n\n let Commentable = Mixin.create({\n @hasMany('comment') comments;\n });\n ```\n we want to look up a Commentable class which has all the necessary\n relationship meta data. Thus, we look up the mixin and create a mock\n Model, so we can access the relationship CPs of the mixin (`comments`)\n in this case\n */\nexport default function modelForMixin(store: Store, normalizedModelName: string): ModelFactory | undefined {\n const owner = getOwner(store)!;\n const MaybeMixin = owner.factoryFor(`mixin:${normalizedModelName}`);\n const mixin = MaybeMixin && MaybeMixin.class;\n if (mixin) {\n const ModelForMixin = Model.extend(mixin) as unknown as { __isMixin: boolean; __mixin: typeof mixin };\n ModelForMixin.__isMixin = true;\n ModelForMixin.__mixin = mixin;\n //Cache the class as a model\n owner.register(`model:${normalizedModelName}`, ModelForMixin);\n }\n return owner.factoryFor(`model:${normalizedModelName}`) as ModelFactory | undefined;\n}\n","import { getOwner } from '@ember/application';\nimport { deprecate } from '@ember/debug';\n\nimport type Store from '@ember-data/store';\nimport type { SchemaService } from '@ember-data/store/types';\nimport { ENABLE_LEGACY_SCHEMA_SERVICE } from '@warp-drive/build-config/deprecations';\nimport { assert } from '@warp-drive/build-config/macros';\nimport type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\nimport type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';\nimport type {\n LegacyAttributeField,\n LegacyFieldSchema,\n LegacyRelationshipSchema,\n ResourceSchema,\n} from '@warp-drive/core-types/schema/fields';\n\nimport type { FactoryCache, Model, ModelFactory, ModelStore } from './model';\nimport _modelForMixin from './model-for-mixin';\nimport { normalizeModelName } from './util';\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ntype InternalSchema = {\n schema: ResourceSchema;\n fields: Map<string, LegacyAttributeField | LegacyRelationshipSchema>;\n attributes: Record<string, LegacyAttributeField>;\n relationships: Record<string, LegacyRelationshipSchema>;\n};\n\nexport interface ModelSchemaProvider {\n attributesDefinitionFor(resource: RecordIdentifier | { type: string }): AttributesSchema;\n\n relationshipsDefinitionFor(resource: RecordIdentifier | { type: string }): RelationshipsSchema;\n\n doesTypeExist(type: string): boolean;\n}\nexport class ModelSchemaProvider implements SchemaService {\n declare store: ModelStore;\n declare _schemas: Map<string, InternalSchema>;\n declare _typeMisses: Set<string>;\n\n constructor(store: ModelStore) {\n this.store = store;\n this._schemas = new Map();\n this._typeMisses = new Set();\n }\n\n hasTrait(type: string): boolean {\n assert(`hasTrait is not available with @ember-data/model's SchemaService`);\n return false;\n }\n resourceHasTrait(resource: StableRecordIdentifier | { type: string }, trait: string): boolean {\n assert(`resourceHasTrait is not available with @ember-data/model's SchemaService`);\n return false;\n }\n transformation(name: string): Transformation {\n assert(`transformation is not available with @ember-data/model's SchemaService`);\n }\n hashFn(name: string): HashFn {\n assert(`hashFn is not available with @ember-data/model's SchemaService`);\n }\n derivation(name: string): Derivation {\n assert(`derivation is not available with @ember-data/model's SchemaService`);\n }\n resource(resource: StableRecordIdentifier | { type: string }): ResourceSchema {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.schema;\n }\n registerResources(schemas: ResourceSchema[]): void {\n assert(`registerResources is not available with @ember-data/model's SchemaService`);\n }\n registerResource(schema: ResourceSchema): void {\n assert(`registerResource is not available with @ember-data/model's SchemaService`);\n }\n registerTransformation(transform: Transformation): void {\n assert(`registerTransformation is not available with @ember-data/model's SchemaService`);\n }\n registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void {\n assert(`registerDerivation is not available with @ember-data/model's SchemaService`);\n }\n registerHashFn(hashFn: HashFn): void {\n assert(`registerHashFn is not available with @ember-data/model's SchemaService`);\n }\n _loadModelSchema(type: string) {\n const modelClass = this.store.modelFor(type) as typeof Model;\n const attributeMap = modelClass.attributes;\n\n const attributes = Object.create(null) as AttributesSchema;\n attributeMap.forEach((meta, name) => (attributes[name] = meta));\n const relationships = modelClass.relationshipsObject || null;\n const fields = new Map<string, LegacyAttributeField | LegacyRelationshipSchema>();\n\n for (const attr of Object.values(attributes)) {\n fields.set(attr.name, attr);\n }\n\n for (const rel of Object.values(relationships)) {\n fields.set(rel.name, rel);\n }\n\n const schema: ResourceSchema = {\n legacy: true,\n identity: { name: 'id', kind: '@id' },\n type,\n fields: Array.from(fields.values()),\n };\n\n const internalSchema: InternalSchema = {\n schema,\n attributes,\n relationships,\n fields,\n };\n\n this._schemas.set(type, internalSchema);\n\n return internalSchema;\n }\n\n fields(resource: RecordIdentifier | { type: string }): Map<string, LegacyFieldSchema> {\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.fields;\n }\n\n hasResource(resource: { type: string }): boolean {\n const type = normalizeModelName(resource.type);\n\n if (this._schemas.has(type)) {\n return true;\n }\n\n if (this._typeMisses.has(type)) {\n return false;\n }\n\n const factory = getModelFactory(this.store, type);\n const exists = factory !== null;\n\n if (!exists) {\n this._typeMisses.add(type);\n return false;\n }\n\n return true;\n }\n}\n\nif (ENABLE_LEGACY_SCHEMA_SERVICE) {\n ModelSchemaProvider.prototype.doesTypeExist = function (type: string): boolean {\n deprecate(`Use \\`schema.hasResource({ type })\\` instead of \\`schema.doesTypeExist(type)\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '5.0',\n for: 'ember-data',\n since: {\n available: '5.4',\n enabled: '5.4',\n },\n });\n return this.hasResource({ type });\n };\n\n ModelSchemaProvider.prototype.attributesDefinitionFor = function (\n resource: RecordIdentifier | { type: string }\n ): AttributesSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.attributesDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '5.0',\n for: 'ember-data',\n since: {\n available: '5.4',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.attributes;\n };\n\n ModelSchemaProvider.prototype.relationshipsDefinitionFor = function (\n resource: RecordIdentifier | { type: string }\n ): RelationshipsSchema {\n deprecate(`Use \\`schema.fields({ type })\\` instead of \\`schema.relationshipsDefinitionFor({ type })\\``, false, {\n id: 'ember-data:schema-service-updates',\n until: '5.0',\n for: 'ember-data',\n since: {\n available: '5.4',\n enabled: '5.4',\n },\n });\n const type = normalizeModelName(resource.type);\n\n if (!this._schemas.has(type)) {\n this._loadModelSchema(type);\n }\n\n return this._schemas.get(type)!.relationships;\n };\n}\n\nexport function buildSchema(store: Store): SchemaService {\n return new ModelSchemaProvider(store as ModelStore);\n}\n\nexport function getModelFactory(store: ModelStore, type: string): ModelFactory | null {\n if (!store._modelFactoryCache) {\n store._modelFactoryCache = Object.create(null) as FactoryCache;\n }\n const cache = store._modelFactoryCache;\n let factory: ModelFactory | undefined = cache[type];\n\n if (!factory) {\n const owner = getOwner(store)!;\n factory = owner.factoryFor(`model:${type}`) as ModelFactory | undefined;\n\n if (!factory) {\n //Support looking up mixins as base types for polymorphic relationships\n factory = _modelForMixin(store, type);\n }\n\n if (!factory) {\n // we don't cache misses in case someone wants to register a missing model\n return null;\n }\n\n const klass = factory.class;\n\n if (klass.isModel) {\n const hasOwnModelNameSet = klass.modelName && Object.prototype.hasOwnProperty.call(klass, 'modelName');\n if (!hasOwnModelNameSet) {\n Object.defineProperty(klass, 'modelName', { value: type });\n }\n }\n\n cache[type] = factory;\n }\n\n return factory;\n}\n"],"names":["modelForMixin","store","normalizedModelName","owner","getOwner","MaybeMixin","factoryFor","mixin","class","ModelForMixin","Model","extend","__isMixin","__mixin","register","ModelSchemaProvider","constructor","_schemas","Map","_typeMisses","Set","hasTrait","type","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","test","Error","resourceHasTrait","resource","trait","transformation","name","hashFn","derivation","normalizeModelName","has","_loadModelSchema","get","schema","registerResources","schemas","registerResource","registerTransformation","transform","registerDerivation","registerHashFn","modelClass","modelFor","attributeMap","attributes","Object","create","forEach","meta","relationships","relationshipsObject","fields","attr","values","set","rel","legacy","identity","kind","Array","from","internalSchema","hasResource","factory","getModelFactory","exists","add","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","doesTypeExist","deprecate","id","until","for","since","available","enabled","attributesDefinitionFor","relationshipsDefinitionFor","buildSchema","_modelFactoryCache","cache","_modelForMixin","klass","isModel","hasOwnModelNameSet","modelName","hasOwnProperty","call","defineProperty","value"],"mappings":";;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CAACC,KAAY,EAAEC,mBAA2B,EAA4B;AACzG,EAAA,MAAMC,KAAK,GAAGC,QAAQ,CAACH,KAAK,CAAE,CAAA;EAC9B,MAAMI,UAAU,GAAGF,KAAK,CAACG,UAAU,CAAE,CAAA,MAAA,EAAQJ,mBAAoB,CAAA,CAAC,CAAC,CAAA;AACnE,EAAA,MAAMK,KAAK,GAAGF,UAAU,IAAIA,UAAU,CAACG,KAAK,CAAA;AAC5C,EAAA,IAAID,KAAK,EAAE;AACT,IAAA,MAAME,aAAa,GAAGC,KAAK,CAACC,MAAM,CAACJ,KAAK,CAA6D,CAAA;IACrGE,aAAa,CAACG,SAAS,GAAG,IAAI,CAAA;IAC9BH,aAAa,CAACI,OAAO,GAAGN,KAAK,CAAA;AAC7B;IACAJ,KAAK,CAACW,QAAQ,CAAE,CAAA,MAAA,EAAQZ,mBAAoB,CAAC,CAAA,EA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