@ember-data/model 5.6.0-alpha.0 → 5.6.0-alpha.11

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.
Files changed (76) hide show
  1. package/addon-main.cjs +1 -1
  2. package/dist/-private.js +1 -3
  3. package/dist/-private.js.map +1 -1
  4. package/dist/hooks.js +1 -2
  5. package/dist/hooks.js.map +1 -1
  6. package/dist/index.js +1 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/migration-support.js +1 -388
  9. package/dist/migration-support.js.map +1 -1
  10. package/package.json +6 -34
  11. package/unstable-preview-types/-private.d.ts +1 -10
  12. package/unstable-preview-types/-private.d.ts.map +1 -1
  13. package/unstable-preview-types/hooks.d.ts +1 -2
  14. package/unstable-preview-types/hooks.d.ts.map +1 -1
  15. package/unstable-preview-types/index.d.ts +5 -37
  16. package/unstable-preview-types/index.d.ts.map +1 -1
  17. package/unstable-preview-types/migration-support.d.ts +2 -250
  18. package/unstable-preview-types/migration-support.d.ts.map +1 -1
  19. package/dist/has-many-BXU96bZ9.js +0 -682
  20. package/dist/has-many-BXU96bZ9.js.map +0 -1
  21. package/dist/hooks-o1U_cEA3.js +0 -75
  22. package/dist/hooks-o1U_cEA3.js.map +0 -1
  23. package/dist/model-Dkk-TZlL.js +0 -4899
  24. package/dist/model-Dkk-TZlL.js.map +0 -1
  25. package/dist/schema-provider-DyG6fJXt.js +0 -259
  26. package/dist/schema-provider-DyG6fJXt.js.map +0 -1
  27. package/unstable-preview-types/-private/attr.d.ts +0 -175
  28. package/unstable-preview-types/-private/attr.d.ts.map +0 -1
  29. package/unstable-preview-types/-private/attr.type-test.d.ts +0 -4
  30. package/unstable-preview-types/-private/attr.type-test.d.ts.map +0 -1
  31. package/unstable-preview-types/-private/belongs-to.d.ts +0 -181
  32. package/unstable-preview-types/-private/belongs-to.d.ts.map +0 -1
  33. package/unstable-preview-types/-private/belongs-to.type-test.d.ts +0 -4
  34. package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +0 -1
  35. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +0 -8
  36. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  37. package/unstable-preview-types/-private/errors.d.ts +0 -303
  38. package/unstable-preview-types/-private/errors.d.ts.map +0 -1
  39. package/unstable-preview-types/-private/has-many.d.ts +0 -169
  40. package/unstable-preview-types/-private/has-many.d.ts.map +0 -1
  41. package/unstable-preview-types/-private/has-many.type-test.d.ts +0 -4
  42. package/unstable-preview-types/-private/has-many.type-test.d.ts.map +0 -1
  43. package/unstable-preview-types/-private/hooks.d.ts +0 -13
  44. package/unstable-preview-types/-private/hooks.d.ts.map +0 -1
  45. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +0 -60
  46. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +0 -1
  47. package/unstable-preview-types/-private/model-for-mixin.d.ts +0 -6
  48. package/unstable-preview-types/-private/model-for-mixin.d.ts.map +0 -1
  49. package/unstable-preview-types/-private/model-methods.d.ts +0 -37
  50. package/unstable-preview-types/-private/model-methods.d.ts.map +0 -1
  51. package/unstable-preview-types/-private/model.d.ts +0 -1303
  52. package/unstable-preview-types/-private/model.d.ts.map +0 -1
  53. package/unstable-preview-types/-private/model.type-test.d.ts +0 -4
  54. package/unstable-preview-types/-private/model.type-test.d.ts.map +0 -1
  55. package/unstable-preview-types/-private/notify-changes.d.ts +0 -8
  56. package/unstable-preview-types/-private/notify-changes.d.ts.map +0 -1
  57. package/unstable-preview-types/-private/promise-belongs-to.d.ts +0 -46
  58. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +0 -1
  59. package/unstable-preview-types/-private/promise-many-array.d.ts +0 -136
  60. package/unstable-preview-types/-private/promise-many-array.d.ts.map +0 -1
  61. package/unstable-preview-types/-private/promise-proxy-base.d.ts +0 -5
  62. package/unstable-preview-types/-private/promise-proxy-base.d.ts.map +0 -1
  63. package/unstable-preview-types/-private/record-state.d.ts +0 -80
  64. package/unstable-preview-types/-private/record-state.d.ts.map +0 -1
  65. package/unstable-preview-types/-private/references/belongs-to.d.ts +0 -506
  66. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +0 -1
  67. package/unstable-preview-types/-private/references/has-many.d.ts +0 -518
  68. package/unstable-preview-types/-private/references/has-many.d.ts.map +0 -1
  69. package/unstable-preview-types/-private/schema-provider.d.ts +0 -65
  70. package/unstable-preview-types/-private/schema-provider.d.ts.map +0 -1
  71. package/unstable-preview-types/-private/type-utils.d.ts +0 -64
  72. package/unstable-preview-types/-private/type-utils.d.ts.map +0 -1
  73. package/unstable-preview-types/-private/util.d.ts +0 -8
  74. package/unstable-preview-types/-private/util.d.ts.map +0 -1
  75. package/unstable-preview-types/migration-support.type-test.d.ts +0 -4
  76. package/unstable-preview-types/migration-support.type-test.d.ts.map +0 -1
package/addon-main.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const { addonShim } = require('@warp-drive/build-config/addon-shim.cjs');
3
+ const { addonShim } = require('@warp-drive/core/addon-shim.cjs');
4
4
 
5
5
  module.exports = addonShim(__dirname);
package/dist/-private.js CHANGED
@@ -1,3 +1 @@
1
- export { a as attr, b as belongsTo, h as hasMany } from "./has-many-BXU96bZ9.js";
2
- export { E as Errors, L as LEGACY_SUPPORT, M as Model, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "./model-Dkk-TZlL.js";
3
- export { RelatedCollection as ManyArray } from '@ember-data/store/-private';
1
+ export * from '@warp-drive/legacy/model/-private';
@@ -1 +1 @@
1
- {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"-private.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/hooks.js CHANGED
@@ -1,2 +1 @@
1
- export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-o1U_cEA3.js";
2
- export { b as buildSchema } from "./schema-provider-DyG6fJXt.js";
1
+ export { buildSchema, instantiateRecord, modelFor, teardownRecord } from '@warp-drive/legacy/model';
package/dist/hooks.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -1,5 +1 @@
1
- export { a as attr, b as belongsTo, h as hasMany } from "./has-many-BXU96bZ9.js";
2
- export { M as default } from "./model-Dkk-TZlL.js";
3
- import '@ember-data/store/-private';
4
- export { i as instantiateRecord, m as modelFor, t as teardownRecord } from "./hooks-o1U_cEA3.js";
5
- export { M as ModelSchemaProvider } from "./schema-provider-DyG6fJXt.js";
1
+ export { attr, belongsTo, buildSchema, default, hasMany, instantiateRecord, modelFor, teardownRecord } from '@warp-drive/legacy/model';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,388 +1 @@
1
- import { recordIdentifierFor } from '@ember-data/store';
2
- import { getOrSetGlobal } from '@warp-drive/core-types/-private';
3
- import { Type } from '@warp-drive/core-types/symbols';
4
- import '@ember/object';
5
- import '@ember-data/store/-private';
6
- import '@ember/debug';
7
- import '@ember-data/request-utils/string';
8
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
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, R as RecordState, f as changedAttributes, g as belongsTo, i as createSnapshot } from "./model-Dkk-TZlL.js";
10
- import '@ember/application';
11
- import { b as buildSchema } from "./schema-provider-DyG6fJXt.js";
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
-
34
- // 'isDestroying', 'isDestroyed'
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
-
80
- const LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap());
81
- function legacySupport(record, options, prop) {
82
- let state = LegacySupport.get(record);
83
- if (!state) {
84
- state = {};
85
- LegacySupport.set(record, state);
86
- }
87
- switch (prop) {
88
- case '_createSnapshot':
89
- return createSnapshot;
90
- case 'adapterError':
91
- return record.currentState.adapterError;
92
- case 'belongsTo':
93
- return belongsTo;
94
- case 'changedAttributes':
95
- return changedAttributes;
96
- case 'constructor':
97
- return state._constructor = state._constructor || {
98
- isModel: true,
99
- name: `Record<${recordIdentifierFor(record).type}>`,
100
- modelName: recordIdentifierFor(record).type
101
- };
102
- case 'currentState':
103
- return state.recordState = state.recordState || new RecordState(record);
104
- case 'deleteRecord':
105
- return deleteRecord;
106
- case 'destroyRecord':
107
- return destroyRecord;
108
- case 'dirtyType':
109
- return record.currentState.dirtyType;
110
- case 'errors':
111
- // @ts-expect-error
112
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
113
- return state.errors = state.errors || Errors.create({
114
- __record: record
115
- });
116
- case 'hasDirtyAttributes':
117
- return record.currentState.isDirty;
118
- case 'hasMany':
119
- return hasMany;
120
- case 'isDeleted':
121
- return record.currentState.isDeleted;
122
- case 'isEmpty':
123
- return record.currentState.isEmpty;
124
- case 'isError':
125
- return record.currentState.isError;
126
- case 'isLoaded':
127
- return record.currentState.isLoaded;
128
- case 'isLoading':
129
- return record.currentState.isLoading;
130
- case 'isNew':
131
- return record.currentState.isNew;
132
- case 'isSaving':
133
- return record.currentState.isSaving;
134
- case 'isValid':
135
- return record.currentState.isValid;
136
- case 'reload':
137
- return reload;
138
- case 'rollbackAttributes':
139
- return rollbackAttributes;
140
- case 'save':
141
- return save;
142
- case 'serialize':
143
- return serialize;
144
- case 'unloadRecord':
145
- return unloadRecord;
146
- default:
147
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
148
- {
149
- throw new Error(`${prop} is not a supported legacy field`);
150
- }
151
- })() : {};
152
- }
153
- }
154
- legacySupport[Type] = '@legacy';
155
-
156
- /**
157
- * A function which adds the necessary fields to a schema and marks it as
158
- * being in LegacyMode. 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
- * Using this function require registering the derivations
198
- * it requires with the schema service.
199
- *
200
- * ```ts
201
- * import { registerDerivations } from '@ember-data/model/migration-support';
202
- *
203
- * registerDerivations(schema);
204
- * ```
205
- *
206
- * @method withDefaults
207
- * @for @ember-data/model/migration-support
208
- * @static
209
- * @param {LegacyResourceSchema} schema The schema to add legacy support to.
210
- * @return {LegacyResourceSchema} The schema with legacy support added.
211
- * @public
212
- */
213
- function withDefaults(schema) {
214
- schema.legacy = true;
215
- schema.identity = {
216
- kind: '@id',
217
- name: 'id'
218
- };
219
- LegacyFields.forEach(field => {
220
- schema.fields.push({
221
- type: '@legacy',
222
- name: field,
223
- kind: 'derived'
224
- });
225
- });
226
- schema.fields.push({
227
- name: 'isReloading',
228
- kind: '@local',
229
- type: 'boolean',
230
- options: {
231
- defaultValue: false
232
- }
233
- });
234
- schema.fields.push({
235
- name: 'isDestroying',
236
- kind: '@local',
237
- type: 'boolean',
238
- options: {
239
- defaultValue: false
240
- }
241
- });
242
- schema.fields.push({
243
- name: 'isDestroyed',
244
- kind: '@local',
245
- type: 'boolean',
246
- options: {
247
- defaultValue: false
248
- }
249
- });
250
- return schema;
251
- }
252
-
253
- /**
254
- * A function which registers the necessary derivations to support
255
- * the LegacyMode features of @ember-data/model while migrating to WarpDrive.
256
- *
257
- * This must be called in order to use the fields added by:
258
- *
259
- * ```ts
260
- * import { withDefaults } from '@ember-data/model/migration-support';
261
- * ```
262
- *
263
- * @method registerDerivations
264
- * @for @ember-data/model/migration-support
265
- * @static
266
- * @param {SchemaService} schema The schema service to register the derivations with.
267
- * @return {void}
268
- * @public
269
- */
270
- function registerDerivations(schema) {
271
- schema.registerDerivation(legacySupport);
272
- }
273
-
274
- /**
275
- * A class which provides a schema service that delegates between
276
- * a primary schema service and one that supports legacy model
277
- * classes as its schema source.
278
- *
279
- * When the primary schema service has a schema for the given
280
- * resource, it will be used. Otherwise, the fallback schema
281
- * service will be used.
282
- *
283
- * This can be used when incrementally migrating from Models to
284
- * SchemaRecords by enabling unmigrated Models to continue to
285
- * provide their own schema information to the application.
286
- *
287
- * ```ts
288
- * import { DelegatingSchemaService } from '@ember-data/model/migration-support';
289
- * import { SchemaService } from '@warp-drive/schema-record';
290
- *
291
- * class AppStore extends Store {
292
- * createSchemaService() {
293
- * const schema = new SchemaService();
294
- * return new DelegatingSchemaService(this, schema);
295
- * }
296
- * }
297
- * ```
298
- *
299
- * All calls to register resources, derivations, transformations, hash functions
300
- * etc. will be delegated to the primary schema service.
301
- *
302
- * @class DelegatingSchemaService
303
- * @extends SchemaService
304
- * @public
305
- */
306
-
307
- class DelegatingSchemaService {
308
- _preferred;
309
- _secondary;
310
- constructor(store, schema) {
311
- this._preferred = schema;
312
- this._secondary = buildSchema(store);
313
- }
314
- resourceTypes() {
315
- return Array.from(new Set(this._preferred.resourceTypes().concat(this._secondary.resourceTypes())));
316
- }
317
- hasResource(resource) {
318
- return this._preferred.hasResource(resource) || this._secondary.hasResource(resource);
319
- }
320
- hasTrait(type) {
321
- if (this._preferred.hasResource({
322
- type
323
- })) {
324
- return this._preferred.hasTrait(type);
325
- }
326
- return this._secondary.hasTrait(type);
327
- }
328
- resourceHasTrait(resource, trait) {
329
- if (this._preferred.hasResource(resource)) {
330
- return this._preferred.resourceHasTrait(resource, trait);
331
- }
332
- return this._secondary.resourceHasTrait(resource, trait);
333
- }
334
- fields(resource) {
335
- if (this._preferred.hasResource(resource)) {
336
- return this._preferred.fields(resource);
337
- }
338
- return this._secondary.fields(resource);
339
- }
340
- transformation(field) {
341
- return this._preferred.transformation(field);
342
- }
343
- hashFn(field) {
344
- return this._preferred.hashFn(field);
345
- }
346
- derivation(field) {
347
- return this._preferred.derivation(field);
348
- }
349
- resource(resource) {
350
- if (this._preferred.hasResource(resource)) {
351
- return this._preferred.resource(resource);
352
- }
353
- return this._secondary.resource(resource);
354
- }
355
- registerResources(schemas) {
356
- this._preferred.registerResources(schemas);
357
- }
358
- registerResource(schema) {
359
- this._preferred.registerResource(schema);
360
- }
361
- registerTransformation(transform) {
362
- this._preferred.registerTransformation(transform);
363
- }
364
- registerDerivation(derivation) {
365
- this._preferred.registerDerivation(derivation);
366
- }
367
- registerHashFn(hashFn) {
368
- this._preferred.registerHashFn(hashFn);
369
- }
370
- }
371
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
372
- DelegatingSchemaService.prototype.attributesDefinitionFor = function (resource) {
373
- if (this._preferred.hasResource(resource)) {
374
- return this._preferred.attributesDefinitionFor(resource);
375
- }
376
- return this._secondary.attributesDefinitionFor(resource);
377
- };
378
- DelegatingSchemaService.prototype.relationshipsDefinitionFor = function (resource) {
379
- if (this._preferred.hasResource(resource)) {
380
- return this._preferred.relationshipsDefinitionFor(resource);
381
- }
382
- return this._secondary.relationshipsDefinitionFor(resource);
383
- };
384
- DelegatingSchemaService.prototype.doesTypeExist = function (type) {
385
- return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;
386
- };
387
- }
388
- export { DelegatingSchemaService, registerDerivations, withDefaults };
1
+ export * from '@warp-drive/legacy/model/migration-support';
@@ -1 +1 @@
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 LegacyMode. 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 * Using this function require registering the derivations\n * it requires with the schema service.\n *\n * ```ts\n * import { registerDerivations } from '@ember-data/model/migration-support';\n *\n * registerDerivations(schema);\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 LegacyMode features of @ember-data/model while migrating to WarpDrive.\n *\n * This must be called in order to use the fields added by:\n *\n * ```ts\n * import { withDefaults } from '@ember-data/model/migration-support';\n * ```\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,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,UAAU,CAAC2B,0BAA0B,CAAEjB,QAAQ,CAAC;GAC7D;AACDZ,EAAAA,uBAAuB,CAAC2B,SAAS,CAACG,aAAa,GAAG,UAAU5E,IAAY,EAAE;AACxE,IAAA,OAAO,IAAI,CAAC+C,UAAU,CAAC6B,aAAa,GAAG5E,IAAI,CAAC,IAAI,IAAI,CAACgD,UAAU,CAAC4B,aAAa,GAAG5E,IAAI,CAAC,IAAI,KAAK;GAC/F;AACH;;;;"}
1
+ {"version":3,"file":"migration-support.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data/model",
3
- "version": "5.6.0-alpha.0",
3
+ "version": "5.6.0-alpha.11",
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"
@@ -41,55 +41,27 @@
41
41
  "types": "./unstable-preview-types/index.d.ts"
42
42
  }
43
43
  },
44
- "peerDependencies": {
45
- "ember-source": "3.28.12 || ^4.0.4 || ^5.0.0 || ^6.0.0",
46
- "@ember-data/graph": "5.6.0-alpha.0",
47
- "@ember-data/json-api": "5.6.0-alpha.0",
48
- "@ember-data/legacy-compat": "5.6.0-alpha.0",
49
- "@ember-data/store": "5.6.0-alpha.0",
50
- "@ember-data/request-utils": "5.6.0-alpha.0",
51
- "@warp-drive/core-types": "5.6.0-alpha.0"
52
- },
53
- "peerDependenciesMeta": {
54
- "@ember-data/json-api": {
55
- "optional": true
56
- },
57
- "@ember-data/graph": {
58
- "optional": true
59
- }
60
- },
44
+ "peerDependencies": {},
61
45
  "dependencies": {
62
46
  "@ember/edition-utils": "^1.2.0",
63
47
  "@embroider/macros": "^1.16.12",
64
48
  "ember-cli-string-utils": "^1.1.0",
65
49
  "ember-cli-test-info": "^1.0.0",
66
50
  "inflection": "~3.0.2",
67
- "@warp-drive/build-config": "5.6.0-alpha.0"
51
+ "@warp-drive/core": "5.6.0-alpha.11",
52
+ "@warp-drive/legacy": "5.6.0-alpha.11",
53
+ "@warp-drive/utilities": "5.6.0-alpha.11"
68
54
  },
69
55
  "devDependencies": {
70
56
  "@babel/core": "^7.26.10",
71
57
  "@babel/plugin-transform-typescript": "^7.27.0",
72
58
  "@babel/preset-env": "^7.26.9",
73
59
  "@babel/preset-typescript": "^7.27.0",
74
- "@ember-data/graph": "5.6.0-alpha.0",
75
- "@ember-data/json-api": "5.6.0-alpha.0",
76
- "@ember-data/legacy-compat": "5.6.0-alpha.0",
77
- "@ember-data/request": "5.6.0-alpha.0",
78
- "@ember-data/request-utils": "5.6.0-alpha.0",
79
- "@ember-data/store": "5.6.0-alpha.0",
80
- "@ember/test-waiters": "^4.1.0",
81
- "@glimmer/component": "^2.0.0",
82
- "@warp-drive/core-types": "5.6.0-alpha.0",
83
- "@warp-drive/internal-config": "5.6.0-alpha.0",
84
- "decorator-transforms": "^2.3.0",
85
- "ember-source": "~6.3.0",
60
+ "@warp-drive/internal-config": "5.6.0-alpha.11",
86
61
  "expect-type": "^1.2.1",
87
62
  "typescript": "^5.8.3",
88
63
  "vite": "^5.4.15"
89
64
  },
90
- "engines": {
91
- "node": ">= 18.20.8"
92
- },
93
65
  "volta": {
94
66
  "extends": "../../package.json"
95
67
  },
@@ -1,13 +1,4 @@
1
1
  declare module '@ember-data/model/-private' {
2
- export { attr } from '@ember-data/model/-private/attr';
3
- export { belongsTo } from '@ember-data/model/-private/belongs-to';
4
- export { hasMany } from '@ember-data/model/-private/has-many';
5
- export { Model } from '@ember-data/model/-private/model';
6
- export type { ModelStore } from '@ember-data/model/-private/model';
7
- export { Errors } from '@ember-data/model/-private/errors';
8
- export { RelatedCollection as ManyArray } from '@ember-data/store/-private';
9
- export { PromiseBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
10
- export { PromiseManyArray } from '@ember-data/model/-private/promise-many-array';
11
- export { lookupLegacySupport, LEGACY_SUPPORT } from '@ember-data/model/-private/legacy-relationships-support';
2
+ export * from '@warp-drive/legacy/model/-private';
12
3
  }
13
4
  //# sourceMappingURL=-private.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"-private.d.ts","sourceRoot":"","sources":["../src/-private.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"-private.d.ts","sourceRoot":"","sources":["../src/-private.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  declare module '@ember-data/model/hooks' {
2
- export { instantiateRecord, teardownRecord, modelFor } from '@ember-data/model/-private/hooks';
3
- export { buildSchema } from '@ember-data/model/-private/schema-provider';
2
+ export { instantiateRecord, teardownRecord, modelFor, buildSchema } from '@warp-drive/legacy/model';
4
3
  }
5
4
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,31 +1,6 @@
1
- /// <reference path="./hooks.d.ts" />
2
- /// <reference path="./migration-support.d.ts" />
3
1
  /// <reference path="./-private.d.ts" />
4
- /// <reference path="./migration-support.type-test.d.ts" />
5
- /// <reference path="./-private/util.d.ts" />
6
- /// <reference path="./-private/legacy-relationships-support.d.ts" />
7
- /// <reference path="./-private/hooks.d.ts" />
8
- /// <reference path="./-private/model.type-test.d.ts" />
9
- /// <reference path="./-private/record-state.d.ts" />
10
- /// <reference path="./-private/has-many.type-test.d.ts" />
11
- /// <reference path="./-private/promise-many-array.d.ts" />
12
- /// <reference path="./-private/has-many.d.ts" />
13
- /// <reference path="./-private/belongs-to.type-test.d.ts" />
14
- /// <reference path="./-private/attr.d.ts" />
15
- /// <reference path="./-private/attr.type-test.d.ts" />
16
- /// <reference path="./-private/promise-belongs-to.d.ts" />
17
- /// <reference path="./-private/model.d.ts" />
18
- /// <reference path="./-private/model-methods.d.ts" />
19
- /// <reference path="./-private/belongs-to.d.ts" />
20
- /// <reference path="./-private/type-utils.d.ts" />
21
- /// <reference path="./-private/errors.d.ts" />
22
- /// <reference path="./-private/model-for-mixin.d.ts" />
23
- /// <reference path="./-private/notify-changes.d.ts" />
24
- /// <reference path="./-private/promise-proxy-base.d.ts" />
25
- /// <reference path="./-private/schema-provider.d.ts" />
26
- /// <reference path="./-private/references/has-many.d.ts" />
27
- /// <reference path="./-private/references/belongs-to.d.ts" />
28
- /// <reference path="./-private/debug/assert-polymorphic-type.d.ts" />
2
+ /// <reference path="./migration-support.d.ts" />
3
+ /// <reference path="./hooks.d.ts" />
29
4
  declare module '@ember-data/model' {
30
5
  /**
31
6
  * This package provides a Presentation Model for resource data in an EmberData Cache.
@@ -45,7 +20,7 @@ declare module '@ember-data/model' {
45
20
 
46
21
  ### Defining a Model
47
22
 
48
- ```app/models/person.js
23
+ ```js [app/models/person.js]
49
24
  import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
50
25
 
51
26
  export default class PersonModel extends Model {
@@ -63,15 +38,8 @@ declare module '@ember-data/model' {
63
38
  of the file in the `app/models` folder and should be lowercase, singular
64
39
  and dasherized.
65
40
 
66
- @module @ember-data/model
67
- @main @ember-data/model
41
+ @module
68
42
  */
69
- export { Model as default, attr, belongsTo, hasMany } from '@ember-data/model/-private';
70
- export type { PromiseBelongsTo as AsyncBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
71
- export type { PromiseManyArray as AsyncHasMany } from '@ember-data/model/-private/promise-many-array';
72
- export type { RelatedCollection as ManyArray } from '@ember-data/store/-private';
73
- export type { RelatedCollection as HasMany } from '@ember-data/store/-private';
74
- export { instantiateRecord, teardownRecord, modelFor } from '@ember-data/model/-private/hooks';
75
- export { ModelSchemaProvider } from '@ember-data/model/-private/schema-provider';
43
+ export { default, attr, belongsTo, hasMany, instantiateRecord, teardownRecord, modelFor, buildSchema, type ManyArray, type HasMany, type AsyncHasMany, type AsyncBelongsTo, } from '@warp-drive/legacy/model';
76
44
  }
77
45
  //# sourceMappingURL=index.d.ts.map