@ember-data/model 5.5.0-alpha.21 → 5.5.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/migration-support.js +162 -0
- package/dist/migration-support.js.map +1 -1
- package/package.json +16 -16
- package/unstable-preview-types/index.d.ts +1 -0
- package/unstable-preview-types/migration-support.d.ts +197 -3
- package/unstable-preview-types/migration-support.d.ts.map +1 -1
- package/unstable-preview-types/migration-support.type-test.d.ts +4 -0
- package/unstable-preview-types/migration-support.type-test.d.ts.map +1 -0
package/README.md
CHANGED
|
@@ -10,8 +10,73 @@ import { u as unloadRecord, s as serialize, b as save, r as rollbackAttributes,
|
|
|
10
10
|
import '@ember/application';
|
|
11
11
|
import { b as buildSchema } from "./schema-provider-WdyaNQ3o.js";
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* This module provides support for migrating away from @ember-data/model
|
|
15
|
+
* to @warp-drive/schema-record.
|
|
16
|
+
*
|
|
17
|
+
* It includes:
|
|
18
|
+
*
|
|
19
|
+
* - A `withDefaults` function to assist in creating a schema in LegacyMode
|
|
20
|
+
* - A `registerDerivations` function to register the derivations necessary to support LegacyMode
|
|
21
|
+
* - A `DelegatingSchemaService` that can be used to provide a schema service that works with both
|
|
22
|
+
* @ember-data/model and @warp-drive/schema-record simultaneously for migration purposes.
|
|
23
|
+
* - A `WithLegacy` type util that can be used to create a type that includes the legacy
|
|
24
|
+
* properties and methods of a record.
|
|
25
|
+
*
|
|
26
|
+
* Using LegacyMode features on a SchemaRecord *requires* the use of these derivations and schema
|
|
27
|
+
* additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone
|
|
28
|
+
* to assist in more rapidly adopting modern WarpDrive features.
|
|
29
|
+
*
|
|
30
|
+
* @module @ember-data/model/migration-support
|
|
31
|
+
* @main @ember-data/model/migration-support
|
|
32
|
+
*/
|
|
33
|
+
|
|
13
34
|
// 'isDestroying', 'isDestroyed'
|
|
14
35
|
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'];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A Type utility that enables quickly adding type information for the fields
|
|
39
|
+
* defined by `import { withDefaults } from '@ember-data/model/migration-support'`.
|
|
40
|
+
*
|
|
41
|
+
* Example:
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
|
|
45
|
+
* import { Type } from '@warp-drive/core-types/symbols';
|
|
46
|
+
* import type { HasMany } from '@ember-data/model';
|
|
47
|
+
*
|
|
48
|
+
* export const UserSchema = withDefaults({
|
|
49
|
+
* type: 'user',
|
|
50
|
+
* fields: [
|
|
51
|
+
* { name: 'firstName', kind: 'attribute' },
|
|
52
|
+
* { name: 'lastName', kind: 'attribute' },
|
|
53
|
+
* { name: 'age', kind: 'attribute' },
|
|
54
|
+
* { name: 'friends',
|
|
55
|
+
* kind: 'hasMany',
|
|
56
|
+
* type: 'user',
|
|
57
|
+
* options: { inverse: 'friends', async: false }
|
|
58
|
+
* },
|
|
59
|
+
* { name: 'bestFriend',
|
|
60
|
+
* kind: 'belongsTo',
|
|
61
|
+
* type: 'user',
|
|
62
|
+
* options: { inverse: null, async: false }
|
|
63
|
+
* },
|
|
64
|
+
* ],
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* export type User = WithLegacy<{
|
|
68
|
+
* firstName: string;
|
|
69
|
+
* lastName: string;
|
|
70
|
+
* age: number;
|
|
71
|
+
* friends: HasMany<User>;
|
|
72
|
+
* bestFriend: User | null;
|
|
73
|
+
* [Type]: 'user';
|
|
74
|
+
* }>
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @typedoc
|
|
78
|
+
*/
|
|
79
|
+
|
|
15
80
|
const LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap());
|
|
16
81
|
function legacySupport(record, options, prop) {
|
|
17
82
|
let state = LegacySupport.get(record);
|
|
@@ -87,6 +152,55 @@ function legacySupport(record, options, prop) {
|
|
|
87
152
|
}
|
|
88
153
|
}
|
|
89
154
|
legacySupport[Type] = '@legacy';
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* A function which adds the necessary fields to a schema and marks it as
|
|
158
|
+
* being in legacy mode. This is used to support the legacy features of
|
|
159
|
+
* @ember-data/model while migrating to WarpDrive.
|
|
160
|
+
*
|
|
161
|
+
* Example:
|
|
162
|
+
*
|
|
163
|
+
* ```ts
|
|
164
|
+
* import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
|
|
165
|
+
* import { Type } from '@warp-drive/core-types/symbols';
|
|
166
|
+
* import type { HasMany } from '@ember-data/model';
|
|
167
|
+
*
|
|
168
|
+
* export const UserSchema = withDefaults({
|
|
169
|
+
* type: 'user',
|
|
170
|
+
* fields: [
|
|
171
|
+
* { name: 'firstName', kind: 'attribute' },
|
|
172
|
+
* { name: 'lastName', kind: 'attribute' },
|
|
173
|
+
* { name: 'age', kind: 'attribute' },
|
|
174
|
+
* { name: 'friends',
|
|
175
|
+
* kind: 'hasMany',
|
|
176
|
+
* type: 'user',
|
|
177
|
+
* options: { inverse: 'friends', async: false }
|
|
178
|
+
* },
|
|
179
|
+
* { name: 'bestFriend',
|
|
180
|
+
* kind: 'belongsTo',
|
|
181
|
+
* type: 'user',
|
|
182
|
+
* options: { inverse: null, async: false }
|
|
183
|
+
* },
|
|
184
|
+
* ],
|
|
185
|
+
* });
|
|
186
|
+
*
|
|
187
|
+
* export type User = WithLegacy<{
|
|
188
|
+
* firstName: string;
|
|
189
|
+
* lastName: string;
|
|
190
|
+
* age: number;
|
|
191
|
+
* friends: HasMany<User>;
|
|
192
|
+
* bestFriend: User | null;
|
|
193
|
+
* [Type]: 'user';
|
|
194
|
+
* }>
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* @method withDefaults
|
|
198
|
+
* @for @ember-data/model/migration-support
|
|
199
|
+
* @static
|
|
200
|
+
* @param {LegacyResourceSchema} schema The schema to add legacy support to.
|
|
201
|
+
* @return {LegacyResourceSchema} The schema with legacy support added.
|
|
202
|
+
* @public
|
|
203
|
+
*/
|
|
90
204
|
function withDefaults(schema) {
|
|
91
205
|
schema.legacy = true;
|
|
92
206
|
schema.identity = {
|
|
@@ -126,9 +240,57 @@ function withDefaults(schema) {
|
|
|
126
240
|
});
|
|
127
241
|
return schema;
|
|
128
242
|
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* A function which registers the necessary derivations to support
|
|
246
|
+
* the legacy features of @ember-data/model while migrating to WarpDrive.
|
|
247
|
+
*
|
|
248
|
+
* This must be called in order to use the fields added by `withDefaults`.
|
|
249
|
+
*
|
|
250
|
+
* @method registerDerivations
|
|
251
|
+
* @for @ember-data/model/migration-support
|
|
252
|
+
* @static
|
|
253
|
+
* @param {SchemaService} schema The schema service to register the derivations with.
|
|
254
|
+
* @return {void}
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
129
257
|
function registerDerivations(schema) {
|
|
130
258
|
schema.registerDerivation(legacySupport);
|
|
131
259
|
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* A class which provides a schema service that delegates between
|
|
263
|
+
* a primary schema service and one that supports legacy model
|
|
264
|
+
* classes as its schema source.
|
|
265
|
+
*
|
|
266
|
+
* When the primary schema service has a schema for the given
|
|
267
|
+
* resource, it will be used. Otherwise, the fallback schema
|
|
268
|
+
* service will be used.
|
|
269
|
+
*
|
|
270
|
+
* This can be used when incrementally migrating from Models to
|
|
271
|
+
* SchemaRecords by enabling unmigrated Models to continue to
|
|
272
|
+
* provide their own schema information to the application.
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* import { DelegatingSchemaService } from '@ember-data/model/migration-support';
|
|
276
|
+
* import { SchemaService } from '@warp-drive/schema-record';
|
|
277
|
+
*
|
|
278
|
+
* class AppStore extends Store {
|
|
279
|
+
* createSchemaService() {
|
|
280
|
+
* const schema = new SchemaService();
|
|
281
|
+
* return new DelegatingSchemaService(this, schema);
|
|
282
|
+
* }
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* All calls to register resources, derivations, transformations, hash functions
|
|
287
|
+
* etc. will be delegated to the primary schema service.
|
|
288
|
+
*
|
|
289
|
+
* @class DelegatingSchemaService
|
|
290
|
+
* @extends SchemaService
|
|
291
|
+
* @public
|
|
292
|
+
*/
|
|
293
|
+
|
|
132
294
|
class DelegatingSchemaService {
|
|
133
295
|
_preferred;
|
|
134
296
|
_secondary;
|
|
@@ -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 { TypedRecordInstance } from '@warp-drive/core-types/record';\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 ObjectSchema,\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\nexport type WithLegacyDerivations<T extends TypedRecordInstance> = T &\n MinimalLegacyRecord & {\n belongsTo: typeof belongsTo;\n hasMany: typeof hasMany;\n };\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\n resourceTypes(): Readonly<string[]> {\n return Array.from(new Set(this._preferred.resourceTypes().concat(this._secondary.resourceTypes())));\n }\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 | ObjectSchema {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resource(resource);\n }\n return this._secondary.resource(resource);\n }\n registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void {\n this._preferred.registerResources(schemas);\n }\n registerResource(schema: ResourceSchema | ObjectSchema): 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","resourceTypes","Array","from","Set","concat","hasResource","resource","hasTrait","resourceHasTrait","trait","transformation","hashFn","derivation","registerResources","schemas","registerResource","registerTransformation","transform","registerHashFn","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist"],"mappings":";;;;;;;;;;;;AAkDA;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,WAA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Aa,GAAG5E,IAAI,CAAC,IAAI,KAAK;GAC/F;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"migration-support.js","sources":["../src/migration-support.ts"],"sourcesContent":["/**\n * This module provides support for migrating away from @ember-data/model\n * to @warp-drive/schema-record.\n *\n * It includes:\n *\n * - A `withDefaults` function to assist in creating a schema in LegacyMode\n * - A `registerDerivations` function to register the derivations necessary to support LegacyMode\n * - A `DelegatingSchemaService` that can be used to provide a schema service that works with both\n * @ember-data/model and @warp-drive/schema-record simultaneously for migration purposes.\n * - A `WithLegacy` type util that can be used to create a type that includes the legacy\n * properties and methods of a record.\n *\n * Using LegacyMode features on a SchemaRecord *requires* the use of these derivations and schema\n * additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone\n * to assist in more rapidly adopting modern WarpDrive features.\n *\n * @module @ember-data/model/migration-support\n * @main @ember-data/model/migration-support\n */\nimport type { Snapshot } from '@ember-data/legacy-compat/-private';\nimport 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 { ChangedAttributesHash } from '@warp-drive/core-types/cache';\nimport type { ObjectValue } from '@warp-drive/core-types/json/raw';\nimport type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';\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 LegacyResourceSchema,\n ObjectField,\n ObjectSchema,\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 type BelongsToReference from './-private/references/belongs-to';\nimport type HasManyReference from './-private/references/has-many';\nimport type { _MaybeBelongsToFields, MaybeHasManyFields } from './-private/type-utils';\nimport { buildSchema } from './hooks';\n\nexport type WithLegacyDerivations<T extends TypedRecordInstance> = T &\n MinimalLegacyRecord & {\n belongsTo: typeof belongsTo;\n hasMany: typeof hasMany;\n };\n\ntype AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;\ntype RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;\n\ninterface LegacyModeRecord<T extends TypedRecordInstance> {\n id: string | null;\n\n serialize(options?: Record<string, unknown>): unknown;\n destroyRecord(options?: Record<string, unknown>): Promise<this>;\n unloadRecord(): void;\n changedAttributes(): ChangedAttributesHash;\n rollbackAttributes(): void;\n _createSnapshot(): Snapshot<T>;\n save(options?: Record<string, unknown>): Promise<this>;\n reload(options?: Record<string, unknown>): Promise<T>;\n belongsTo<K extends _MaybeBelongsToFields<T>>(prop: K): BelongsToReference<T, K>;\n hasMany<K extends MaybeHasManyFields<T>>(prop: K): HasManyReference<T, K>;\n deleteRecord(): void;\n\n adapterError: unknown;\n constructor: { modelName: TypeFromInstance<T> };\n currentState: RecordState;\n dirtyType: 'deleted' | 'created' | 'updated' | '';\n errors: unknown;\n hasDirtyAttributes: boolean;\n isDeleted: boolean;\n isEmpty: boolean;\n isError: boolean;\n isLoaded: boolean;\n isLoading: boolean;\n isDestroying: boolean;\n isDestroyed: boolean;\n isNew: boolean;\n isSaving: boolean;\n isValid: boolean;\n}\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] as const;\n\n/**\n * A Type utility that enables quickly adding type information for the fields\n * defined by `import { withDefaults } from '@ember-data/model/migration-support'`.\n *\n * Example:\n *\n * ```ts\n * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';\n * import { Type } from '@warp-drive/core-types/symbols';\n * import type { HasMany } from '@ember-data/model';\n *\n * export const UserSchema = withDefaults({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * { name: 'age', kind: 'attribute' },\n * { name: 'friends',\n * kind: 'hasMany',\n * type: 'user',\n * options: { inverse: 'friends', async: false }\n * },\n * { name: 'bestFriend',\n * kind: 'belongsTo',\n * type: 'user',\n * options: { inverse: null, async: false }\n * },\n * ],\n * });\n *\n * export type User = WithLegacy<{\n * firstName: string;\n * lastName: string;\n * age: number;\n * friends: HasMany<User>;\n * bestFriend: User | null;\n * [Type]: 'user';\n * }>\n * ```\n *\n * @typedoc\n */\nexport type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;\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\n/**\n * A function which adds the necessary fields to a schema and marks it as\n * being in legacy mode. This is used to support the legacy features of\n * @ember-data/model while migrating to WarpDrive.\n *\n * Example:\n *\n * ```ts\n * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';\n * import { Type } from '@warp-drive/core-types/symbols';\n * import type { HasMany } from '@ember-data/model';\n *\n * export const UserSchema = withDefaults({\n * type: 'user',\n * fields: [\n * { name: 'firstName', kind: 'attribute' },\n * { name: 'lastName', kind: 'attribute' },\n * { name: 'age', kind: 'attribute' },\n * { name: 'friends',\n * kind: 'hasMany',\n * type: 'user',\n * options: { inverse: 'friends', async: false }\n * },\n * { name: 'bestFriend',\n * kind: 'belongsTo',\n * type: 'user',\n * options: { inverse: null, async: false }\n * },\n * ],\n * });\n *\n * export type User = WithLegacy<{\n * firstName: string;\n * lastName: string;\n * age: number;\n * friends: HasMany<User>;\n * bestFriend: User | null;\n * [Type]: 'user';\n * }>\n * ```\n *\n * @method withDefaults\n * @for @ember-data/model/migration-support\n * @static\n * @param {LegacyResourceSchema} schema The schema to add legacy support to.\n * @return {LegacyResourceSchema} The schema with legacy support added.\n * @public\n */\nexport function withDefaults(schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>): LegacyResourceSchema {\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 LegacyResourceSchema;\n}\n\n/**\n * A function which registers the necessary derivations to support\n * the legacy features of @ember-data/model while migrating to WarpDrive.\n *\n * This must be called in order to use the fields added by `withDefaults`.\n *\n * @method registerDerivations\n * @for @ember-data/model/migration-support\n * @static\n * @param {SchemaService} schema The schema service to register the derivations with.\n * @return {void}\n * @public\n */\nexport function registerDerivations(schema: SchemaService) {\n schema.registerDerivation(legacySupport);\n}\n\n/**\n * A class which provides a schema service that delegates between\n * a primary schema service and one that supports legacy model\n * classes as its schema source.\n *\n * When the primary schema service has a schema for the given\n * resource, it will be used. Otherwise, the fallback schema\n * service will be used.\n *\n * This can be used when incrementally migrating from Models to\n * SchemaRecords by enabling unmigrated Models to continue to\n * provide their own schema information to the application.\n *\n * ```ts\n * import { DelegatingSchemaService } from '@ember-data/model/migration-support';\n * import { SchemaService } from '@warp-drive/schema-record';\n *\n * class AppStore extends Store {\n * createSchemaService() {\n * const schema = new SchemaService();\n * return new DelegatingSchemaService(this, schema);\n * }\n * }\n * ```\n *\n * All calls to register resources, derivations, transformations, hash functions\n * etc. will be delegated to the primary schema service.\n *\n * @class DelegatingSchemaService\n * @extends SchemaService\n * @public\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\n resourceTypes(): Readonly<string[]> {\n return Array.from(new Set(this._preferred.resourceTypes().concat(this._secondary.resourceTypes())));\n }\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 | ObjectSchema {\n if (this._preferred.hasResource(resource)) {\n return this._preferred.resource(resource);\n }\n return this._secondary.resource(resource);\n }\n registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void {\n this._preferred.registerResources(schemas);\n }\n registerResource(schema: ResourceSchema | ObjectSchema): 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","resourceTypes","Array","from","Set","concat","hasResource","resource","hasTrait","resourceHasTrait","trait","transformation","hashFn","derivation","registerResources","schemas","registerResource","registerTransformation","transform","registerHashFn","deprecations","ENABLE_LEGACY_SCHEMA_SERVICE","prototype","attributesDefinitionFor","relationshipsDefinitionFor","doesTypeExist"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0FA;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,CACN;;AAEV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,MAAMC,aAAa,GAAGC,cAAc,CAAC,eAAe,EAAE,IAAIC,OAAO,EAAgD,CAAC;AAElH,SAASC,aAAaA,CAACC,MAA2B,EAAEC,OAA2B,EAAEC,IAAY,EAAW;AACtG,EAAA,IAAIC,KAAK,GAAGP,aAAa,CAACQ,GAAG,CAACJ,MAAM,CAAC;EACrC,IAAI,CAACG,KAAK,EAAE;IACVA,KAAK,GAAG,EAAE;AACVP,IAAAA,aAAa,CAACS,GAAG,CAACL,MAAM,EAAEG,KAAK,CAAC;AAClC;AAEA,EAAA,QAAQD,IAAI;AACV,IAAA,KAAK,iBAAiB;AACpB,MAAA,OAAOI,cAAc;AACvB,IAAA,KAAK,cAAc;AACjB,MAAA,OAAON,MAAM,CAACO,YAAY,CAACC,YAAY;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAOC,SAAS;A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
+
"version": "5.5.0-alpha.23",
|
|
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"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
|
|
46
|
-
"@ember-data/graph": "5.5.0-alpha.
|
|
47
|
-
"@ember-data/json-api": "5.5.0-alpha.
|
|
48
|
-
"@ember-data/legacy-compat": "5.5.0-alpha.
|
|
49
|
-
"@ember-data/store": "5.5.0-alpha.
|
|
50
|
-
"@ember-data/request-utils": "5.5.0-alpha.
|
|
51
|
-
"@warp-drive/core-types": "5.5.0-alpha.
|
|
46
|
+
"@ember-data/graph": "5.5.0-alpha.23",
|
|
47
|
+
"@ember-data/json-api": "5.5.0-alpha.23",
|
|
48
|
+
"@ember-data/legacy-compat": "5.5.0-alpha.23",
|
|
49
|
+
"@ember-data/store": "5.5.0-alpha.23",
|
|
50
|
+
"@ember-data/request-utils": "5.5.0-alpha.23",
|
|
51
|
+
"@warp-drive/core-types": "5.5.0-alpha.23"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"@ember-data/json-api": {
|
|
@@ -64,23 +64,23 @@
|
|
|
64
64
|
"ember-cli-string-utils": "^1.1.0",
|
|
65
65
|
"ember-cli-test-info": "^1.0.0",
|
|
66
66
|
"inflection": "~3.0.2",
|
|
67
|
-
"@warp-drive/build-config": "5.5.0-alpha.
|
|
67
|
+
"@warp-drive/build-config": "5.5.0-alpha.23"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@babel/core": "^7.26.10",
|
|
71
71
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
72
72
|
"@babel/preset-env": "^7.26.9",
|
|
73
73
|
"@babel/preset-typescript": "^7.27.0",
|
|
74
|
-
"@ember-data/graph": "5.5.0-alpha.
|
|
75
|
-
"@ember-data/json-api": "5.5.0-alpha.
|
|
76
|
-
"@ember-data/legacy-compat": "5.5.0-alpha.
|
|
77
|
-
"@ember-data/request": "5.5.0-alpha.
|
|
78
|
-
"@ember-data/request-utils": "5.5.0-alpha.
|
|
79
|
-
"@ember-data/store": "5.5.0-alpha.
|
|
74
|
+
"@ember-data/graph": "5.5.0-alpha.23",
|
|
75
|
+
"@ember-data/json-api": "5.5.0-alpha.23",
|
|
76
|
+
"@ember-data/legacy-compat": "5.5.0-alpha.23",
|
|
77
|
+
"@ember-data/request": "5.5.0-alpha.23",
|
|
78
|
+
"@ember-data/request-utils": "5.5.0-alpha.23",
|
|
79
|
+
"@ember-data/store": "5.5.0-alpha.23",
|
|
80
80
|
"@ember/test-waiters": "^4.1.0",
|
|
81
81
|
"@glimmer/component": "^2.0.0",
|
|
82
|
-
"@warp-drive/core-types": "5.5.0-alpha.
|
|
83
|
-
"@warp-drive/internal-config": "5.5.0-alpha.
|
|
82
|
+
"@warp-drive/core-types": "5.5.0-alpha.23",
|
|
83
|
+
"@warp-drive/internal-config": "5.5.0-alpha.23",
|
|
84
84
|
"decorator-transforms": "^2.3.0",
|
|
85
85
|
"ember-source": "~6.3.0",
|
|
86
86
|
"expect-type": "^1.2.1",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference path="./-private.d.ts" />
|
|
2
2
|
/// <reference path="./migration-support.d.ts" />
|
|
3
3
|
/// <reference path="./hooks.d.ts" />
|
|
4
|
+
/// <reference path="./migration-support.type-test.d.ts" />
|
|
4
5
|
/// <reference path="./-private/attr.type-test.d.ts" />
|
|
5
6
|
/// <reference path="./-private/model.d.ts" />
|
|
6
7
|
/// <reference path="./-private/notify-changes.d.ts" />
|
|
@@ -1,22 +1,216 @@
|
|
|
1
1
|
declare module '@ember-data/model/migration-support' {
|
|
2
|
+
/**
|
|
3
|
+
* This module provides support for migrating away from @ember-data/model
|
|
4
|
+
* to @warp-drive/schema-record.
|
|
5
|
+
*
|
|
6
|
+
* It includes:
|
|
7
|
+
*
|
|
8
|
+
* - A `withDefaults` function to assist in creating a schema in LegacyMode
|
|
9
|
+
* - A `registerDerivations` function to register the derivations necessary to support LegacyMode
|
|
10
|
+
* - A `DelegatingSchemaService` that can be used to provide a schema service that works with both
|
|
11
|
+
* @ember-data/model and @warp-drive/schema-record simultaneously for migration purposes.
|
|
12
|
+
* - A `WithLegacy` type util that can be used to create a type that includes the legacy
|
|
13
|
+
* properties and methods of a record.
|
|
14
|
+
*
|
|
15
|
+
* Using LegacyMode features on a SchemaRecord *requires* the use of these derivations and schema
|
|
16
|
+
* additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone
|
|
17
|
+
* to assist in more rapidly adopting modern WarpDrive features.
|
|
18
|
+
*
|
|
19
|
+
* @module @ember-data/model/migration-support
|
|
20
|
+
* @main @ember-data/model/migration-support
|
|
21
|
+
*/
|
|
22
|
+
import type { Snapshot } from '@ember-data/legacy-compat/-private';
|
|
2
23
|
import type Store from '@ember-data/store';
|
|
3
24
|
import type { SchemaService } from '@ember-data/store/types';
|
|
4
25
|
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
26
|
+
import type { ChangedAttributesHash } from '@warp-drive/core-types/cache';
|
|
5
27
|
import type { ObjectValue } from '@warp-drive/core-types/json/raw';
|
|
6
|
-
import type { TypedRecordInstance } from '@warp-drive/core-types/record';
|
|
28
|
+
import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
|
|
7
29
|
import type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';
|
|
8
|
-
import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, ObjectField, ObjectSchema, ResourceSchema } from '@warp-drive/core-types/schema/fields';
|
|
30
|
+
import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyResourceSchema, ObjectField, ObjectSchema, ResourceSchema } from '@warp-drive/core-types/schema/fields';
|
|
9
31
|
import type { WithPartial } from '@warp-drive/core-types/utils';
|
|
10
32
|
import type { MinimalLegacyRecord } from '@ember-data/model/-private/model-methods';
|
|
11
33
|
import { belongsTo, hasMany } from '@ember-data/model/-private/model-methods';
|
|
34
|
+
import RecordState from '@ember-data/model/-private/record-state';
|
|
35
|
+
import type BelongsToReference from '@ember-data/model/-private/references/belongs-to';
|
|
36
|
+
import type HasManyReference from '@ember-data/model/-private/references/has-many';
|
|
37
|
+
import type { _MaybeBelongsToFields, MaybeHasManyFields } from '@ember-data/model/-private/type-utils';
|
|
12
38
|
export type WithLegacyDerivations<T extends TypedRecordInstance> = T & MinimalLegacyRecord & {
|
|
13
39
|
belongsTo: typeof belongsTo;
|
|
14
40
|
hasMany: typeof hasMany;
|
|
15
41
|
};
|
|
16
42
|
type AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;
|
|
17
43
|
type RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;
|
|
18
|
-
|
|
44
|
+
interface LegacyModeRecord<T extends TypedRecordInstance> {
|
|
45
|
+
id: string | null;
|
|
46
|
+
serialize(options?: Record<string, unknown>): unknown;
|
|
47
|
+
destroyRecord(options?: Record<string, unknown>): Promise<this>;
|
|
48
|
+
unloadRecord(): void;
|
|
49
|
+
changedAttributes(): ChangedAttributesHash;
|
|
50
|
+
rollbackAttributes(): void;
|
|
51
|
+
_createSnapshot(): Snapshot<T>;
|
|
52
|
+
save(options?: Record<string, unknown>): Promise<this>;
|
|
53
|
+
reload(options?: Record<string, unknown>): Promise<T>;
|
|
54
|
+
belongsTo<K extends _MaybeBelongsToFields<T>>(prop: K): BelongsToReference<T, K>;
|
|
55
|
+
hasMany<K extends MaybeHasManyFields<T>>(prop: K): HasManyReference<T, K>;
|
|
56
|
+
deleteRecord(): void;
|
|
57
|
+
adapterError: unknown;
|
|
58
|
+
constructor: {
|
|
59
|
+
modelName: TypeFromInstance<T>;
|
|
60
|
+
};
|
|
61
|
+
currentState: RecordState;
|
|
62
|
+
dirtyType: 'deleted' | 'created' | 'updated' | '';
|
|
63
|
+
errors: unknown;
|
|
64
|
+
hasDirtyAttributes: boolean;
|
|
65
|
+
isDeleted: boolean;
|
|
66
|
+
isEmpty: boolean;
|
|
67
|
+
isError: boolean;
|
|
68
|
+
isLoaded: boolean;
|
|
69
|
+
isLoading: boolean;
|
|
70
|
+
isDestroying: boolean;
|
|
71
|
+
isDestroyed: boolean;
|
|
72
|
+
isNew: boolean;
|
|
73
|
+
isSaving: boolean;
|
|
74
|
+
isValid: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A Type utility that enables quickly adding type information for the fields
|
|
78
|
+
* defined by `import { withDefaults } from '@ember-data/model/migration-support'`.
|
|
79
|
+
*
|
|
80
|
+
* Example:
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
|
|
84
|
+
* import { Type } from '@warp-drive/core-types/symbols';
|
|
85
|
+
* import type { HasMany } from '@ember-data/model';
|
|
86
|
+
*
|
|
87
|
+
* export const UserSchema = withDefaults({
|
|
88
|
+
* type: 'user',
|
|
89
|
+
* fields: [
|
|
90
|
+
* { name: 'firstName', kind: 'attribute' },
|
|
91
|
+
* { name: 'lastName', kind: 'attribute' },
|
|
92
|
+
* { name: 'age', kind: 'attribute' },
|
|
93
|
+
* { name: 'friends',
|
|
94
|
+
* kind: 'hasMany',
|
|
95
|
+
* type: 'user',
|
|
96
|
+
* options: { inverse: 'friends', async: false }
|
|
97
|
+
* },
|
|
98
|
+
* { name: 'bestFriend',
|
|
99
|
+
* kind: 'belongsTo',
|
|
100
|
+
* type: 'user',
|
|
101
|
+
* options: { inverse: null, async: false }
|
|
102
|
+
* },
|
|
103
|
+
* ],
|
|
104
|
+
* });
|
|
105
|
+
*
|
|
106
|
+
* export type User = WithLegacy<{
|
|
107
|
+
* firstName: string;
|
|
108
|
+
* lastName: string;
|
|
109
|
+
* age: number;
|
|
110
|
+
* friends: HasMany<User>;
|
|
111
|
+
* bestFriend: User | null;
|
|
112
|
+
* [Type]: 'user';
|
|
113
|
+
* }>
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @typedoc
|
|
117
|
+
*/
|
|
118
|
+
export type WithLegacy<T extends TypedRecordInstance> = T & LegacyModeRecord<T>;
|
|
119
|
+
/**
|
|
120
|
+
* A function which adds the necessary fields to a schema and marks it as
|
|
121
|
+
* being in legacy mode. This is used to support the legacy features of
|
|
122
|
+
* @ember-data/model while migrating to WarpDrive.
|
|
123
|
+
*
|
|
124
|
+
* Example:
|
|
125
|
+
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
|
|
128
|
+
* import { Type } from '@warp-drive/core-types/symbols';
|
|
129
|
+
* import type { HasMany } from '@ember-data/model';
|
|
130
|
+
*
|
|
131
|
+
* export const UserSchema = withDefaults({
|
|
132
|
+
* type: 'user',
|
|
133
|
+
* fields: [
|
|
134
|
+
* { name: 'firstName', kind: 'attribute' },
|
|
135
|
+
* { name: 'lastName', kind: 'attribute' },
|
|
136
|
+
* { name: 'age', kind: 'attribute' },
|
|
137
|
+
* { name: 'friends',
|
|
138
|
+
* kind: 'hasMany',
|
|
139
|
+
* type: 'user',
|
|
140
|
+
* options: { inverse: 'friends', async: false }
|
|
141
|
+
* },
|
|
142
|
+
* { name: 'bestFriend',
|
|
143
|
+
* kind: 'belongsTo',
|
|
144
|
+
* type: 'user',
|
|
145
|
+
* options: { inverse: null, async: false }
|
|
146
|
+
* },
|
|
147
|
+
* ],
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* export type User = WithLegacy<{
|
|
151
|
+
* firstName: string;
|
|
152
|
+
* lastName: string;
|
|
153
|
+
* age: number;
|
|
154
|
+
* friends: HasMany<User>;
|
|
155
|
+
* bestFriend: User | null;
|
|
156
|
+
* [Type]: 'user';
|
|
157
|
+
* }>
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @method withDefaults
|
|
161
|
+
* @for @ember-data/model/migration-support
|
|
162
|
+
* @static
|
|
163
|
+
* @param {LegacyResourceSchema} schema The schema to add legacy support to.
|
|
164
|
+
* @return {LegacyResourceSchema} The schema with legacy support added.
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
export function withDefaults(schema: WithPartial<LegacyResourceSchema, 'legacy' | 'identity'>): LegacyResourceSchema;
|
|
168
|
+
/**
|
|
169
|
+
* A function which registers the necessary derivations to support
|
|
170
|
+
* the legacy features of @ember-data/model while migrating to WarpDrive.
|
|
171
|
+
*
|
|
172
|
+
* This must be called in order to use the fields added by `withDefaults`.
|
|
173
|
+
*
|
|
174
|
+
* @method registerDerivations
|
|
175
|
+
* @for @ember-data/model/migration-support
|
|
176
|
+
* @static
|
|
177
|
+
* @param {SchemaService} schema The schema service to register the derivations with.
|
|
178
|
+
* @return {void}
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
19
181
|
export function registerDerivations(schema: SchemaService): void;
|
|
182
|
+
/**
|
|
183
|
+
* A class which provides a schema service that delegates between
|
|
184
|
+
* a primary schema service and one that supports legacy model
|
|
185
|
+
* classes as its schema source.
|
|
186
|
+
*
|
|
187
|
+
* When the primary schema service has a schema for the given
|
|
188
|
+
* resource, it will be used. Otherwise, the fallback schema
|
|
189
|
+
* service will be used.
|
|
190
|
+
*
|
|
191
|
+
* This can be used when incrementally migrating from Models to
|
|
192
|
+
* SchemaRecords by enabling unmigrated Models to continue to
|
|
193
|
+
* provide their own schema information to the application.
|
|
194
|
+
*
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { DelegatingSchemaService } from '@ember-data/model/migration-support';
|
|
197
|
+
* import { SchemaService } from '@warp-drive/schema-record';
|
|
198
|
+
*
|
|
199
|
+
* class AppStore extends Store {
|
|
200
|
+
* createSchemaService() {
|
|
201
|
+
* const schema = new SchemaService();
|
|
202
|
+
* return new DelegatingSchemaService(this, schema);
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* All calls to register resources, derivations, transformations, hash functions
|
|
208
|
+
* etc. will be delegated to the primary schema service.
|
|
209
|
+
*
|
|
210
|
+
* @class DelegatingSchemaService
|
|
211
|
+
* @extends SchemaService
|
|
212
|
+
* @public
|
|
213
|
+
*/
|
|
20
214
|
export interface DelegatingSchemaService {
|
|
21
215
|
attributesDefinitionFor?(resource: StableRecordIdentifier | {
|
|
22
216
|
type: string;
|
|
@@ -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,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"migration-support.d.ts","sourceRoot":"","sources":["../src/migration-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,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,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,O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