@ember-data/model 5.6.0-alpha.5 → 5.6.0-beta.1

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 (74) hide show
  1. package/addon-main.cjs +1 -1
  2. package/dist/-private.js +1 -2
  3. package/dist/hooks.js +1 -2
  4. package/dist/index.js +1 -667
  5. package/dist/migration-support.js +1 -381
  6. package/package.json +7 -31
  7. package/unstable-preview-types/-private.d.ts +3 -8
  8. package/unstable-preview-types/hooks.d.ts +3 -4
  9. package/unstable-preview-types/index.d.ts +31 -66
  10. package/unstable-preview-types/migration-support.d.ts +21 -263
  11. package/dist/-private.js.map +0 -1
  12. package/dist/errors-DsUSZ9m8.js +0 -2605
  13. package/dist/errors-DsUSZ9m8.js.map +0 -1
  14. package/dist/hooks-rXIjX2-H.js +0 -74
  15. package/dist/hooks-rXIjX2-H.js.map +0 -1
  16. package/dist/hooks.js.map +0 -1
  17. package/dist/index.js.map +0 -1
  18. package/dist/migration-support.js.map +0 -1
  19. package/dist/schema-provider-B6-5uzxP.js +0 -2229
  20. package/dist/schema-provider-B6-5uzxP.js.map +0 -1
  21. package/unstable-preview-types/-private/attr.d.ts +0 -167
  22. package/unstable-preview-types/-private/attr.d.ts.map +0 -1
  23. package/unstable-preview-types/-private/attr.type-test.d.ts +0 -4
  24. package/unstable-preview-types/-private/attr.type-test.d.ts.map +0 -1
  25. package/unstable-preview-types/-private/belongs-to.d.ts +0 -175
  26. package/unstable-preview-types/-private/belongs-to.d.ts.map +0 -1
  27. package/unstable-preview-types/-private/belongs-to.type-test.d.ts +0 -4
  28. package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +0 -1
  29. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +0 -8
  30. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  31. package/unstable-preview-types/-private/errors.d.ts +0 -292
  32. package/unstable-preview-types/-private/errors.d.ts.map +0 -1
  33. package/unstable-preview-types/-private/has-many.d.ts +0 -166
  34. package/unstable-preview-types/-private/has-many.d.ts.map +0 -1
  35. package/unstable-preview-types/-private/has-many.type-test.d.ts +0 -4
  36. package/unstable-preview-types/-private/has-many.type-test.d.ts.map +0 -1
  37. package/unstable-preview-types/-private/hooks.d.ts +0 -13
  38. package/unstable-preview-types/-private/hooks.d.ts.map +0 -1
  39. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +0 -60
  40. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +0 -1
  41. package/unstable-preview-types/-private/model-for-mixin.d.ts +0 -6
  42. package/unstable-preview-types/-private/model-for-mixin.d.ts.map +0 -1
  43. package/unstable-preview-types/-private/model-methods.d.ts +0 -37
  44. package/unstable-preview-types/-private/model-methods.d.ts.map +0 -1
  45. package/unstable-preview-types/-private/model.d.ts +0 -1272
  46. package/unstable-preview-types/-private/model.d.ts.map +0 -1
  47. package/unstable-preview-types/-private/model.type-test.d.ts +0 -4
  48. package/unstable-preview-types/-private/model.type-test.d.ts.map +0 -1
  49. package/unstable-preview-types/-private/notify-changes.d.ts +0 -8
  50. package/unstable-preview-types/-private/notify-changes.d.ts.map +0 -1
  51. package/unstable-preview-types/-private/promise-belongs-to.d.ts +0 -42
  52. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +0 -1
  53. package/unstable-preview-types/-private/promise-many-array.d.ts +0 -128
  54. package/unstable-preview-types/-private/promise-many-array.d.ts.map +0 -1
  55. package/unstable-preview-types/-private/promise-proxy-base.d.ts +0 -5
  56. package/unstable-preview-types/-private/promise-proxy-base.d.ts.map +0 -1
  57. package/unstable-preview-types/-private/record-state.d.ts +0 -80
  58. package/unstable-preview-types/-private/record-state.d.ts.map +0 -1
  59. package/unstable-preview-types/-private/references/belongs-to.d.ts +0 -497
  60. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +0 -1
  61. package/unstable-preview-types/-private/references/has-many.d.ts +0 -506
  62. package/unstable-preview-types/-private/references/has-many.d.ts.map +0 -1
  63. package/unstable-preview-types/-private/schema-provider.d.ts +0 -65
  64. package/unstable-preview-types/-private/schema-provider.d.ts.map +0 -1
  65. package/unstable-preview-types/-private/type-utils.d.ts +0 -59
  66. package/unstable-preview-types/-private/type-utils.d.ts.map +0 -1
  67. package/unstable-preview-types/-private/util.d.ts +0 -8
  68. package/unstable-preview-types/-private/util.d.ts.map +0 -1
  69. package/unstable-preview-types/-private.d.ts.map +0 -1
  70. package/unstable-preview-types/hooks.d.ts.map +0 -1
  71. package/unstable-preview-types/index.d.ts.map +0 -1
  72. package/unstable-preview-types/migration-support.d.ts.map +0 -1
  73. package/unstable-preview-types/migration-support.type-test.d.ts +0 -4
  74. package/unstable-preview-types/migration-support.type-test.d.ts.map +0 -1
@@ -1,381 +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 { E as Errors } from "./errors-DsUSZ9m8.js";
5
- import '@ember-data/store/-private';
6
- import { b as buildSchema, u as unloadRecord, s as serialize, a as save, r as rollbackAttributes, c as reload, h as hasMany, d as destroyRecord, e as deleteRecord, R as RecordState, f as changedAttributes, i as belongsTo, j as createSnapshot } from "./schema-provider-B6-5uzxP.js";
7
- import '@ember/application';
8
- import '@ember/debug';
9
- import '@ember-data/request-utils/string';
10
- import { macroCondition, getGlobalConfig } from '@embroider/macros';
11
-
12
- /**
13
- * This module provides support for migrating away from @ember-data/model
14
- * to @warp-drive/schema-record.
15
- *
16
- * It includes:
17
- *
18
- * - A `withDefaults` function to assist in creating a schema in LegacyMode
19
- * - A `registerDerivations` function to register the derivations necessary to support LegacyMode
20
- * - A `DelegatingSchemaService` that can be used to provide a schema service that works with both
21
- * @ember-data/model and @warp-drive/schema-record simultaneously for migration purposes.
22
- * - A `WithLegacy` type util that can be used to create a type that includes the legacy
23
- * properties and methods of a record.
24
- *
25
- * Using LegacyMode features on a SchemaRecord *requires* the use of these derivations and schema
26
- * additions. LegacyMode is not intended to be a long-term solution, but rather a stepping stone
27
- * to assist in more rapidly adopting modern WarpDrive features.
28
- *
29
- * @module
30
- */
31
-
32
- // 'isDestroying', 'isDestroyed'
33
- 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'];
34
-
35
- /**
36
- * A Type utility that enables quickly adding type information for the fields
37
- * defined by `import { withDefaults } from '@ember-data/model/migration-support'`.
38
- *
39
- * Example:
40
- *
41
- * ```ts
42
- * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
43
- * import { Type } from '@warp-drive/core-types/symbols';
44
- * import type { HasMany } from '@ember-data/model';
45
- *
46
- * export const UserSchema = withDefaults({
47
- * type: 'user',
48
- * fields: [
49
- * { name: 'firstName', kind: 'attribute' },
50
- * { name: 'lastName', kind: 'attribute' },
51
- * { name: 'age', kind: 'attribute' },
52
- * { name: 'friends',
53
- * kind: 'hasMany',
54
- * type: 'user',
55
- * options: { inverse: 'friends', async: false }
56
- * },
57
- * { name: 'bestFriend',
58
- * kind: 'belongsTo',
59
- * type: 'user',
60
- * options: { inverse: null, async: false }
61
- * },
62
- * ],
63
- * });
64
- *
65
- * export type User = WithLegacy<{
66
- * firstName: string;
67
- * lastName: string;
68
- * age: number;
69
- * friends: HasMany<User>;
70
- * bestFriend: User | null;
71
- * [Type]: 'user';
72
- * }>
73
- * ```
74
- *
75
- */
76
-
77
- const LegacySupport = getOrSetGlobal('LegacySupport', new WeakMap());
78
- function legacySupport(record, options, prop) {
79
- let state = LegacySupport.get(record);
80
- if (!state) {
81
- state = {};
82
- LegacySupport.set(record, state);
83
- }
84
- switch (prop) {
85
- case '_createSnapshot':
86
- return createSnapshot;
87
- case 'adapterError':
88
- return record.currentState.adapterError;
89
- case 'belongsTo':
90
- return belongsTo;
91
- case 'changedAttributes':
92
- return changedAttributes;
93
- case 'constructor':
94
- return state._constructor = state._constructor || {
95
- isModel: true,
96
- name: `Record<${recordIdentifierFor(record).type}>`,
97
- modelName: recordIdentifierFor(record).type
98
- };
99
- case 'currentState':
100
- return state.recordState = state.recordState || new RecordState(record);
101
- case 'deleteRecord':
102
- return deleteRecord;
103
- case 'destroyRecord':
104
- return destroyRecord;
105
- case 'dirtyType':
106
- return record.currentState.dirtyType;
107
- case 'errors':
108
- // @ts-expect-error
109
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
110
- return state.errors = state.errors || Errors.create({
111
- __record: record
112
- });
113
- case 'hasDirtyAttributes':
114
- return record.currentState.isDirty;
115
- case 'hasMany':
116
- return hasMany;
117
- case 'isDeleted':
118
- return record.currentState.isDeleted;
119
- case 'isEmpty':
120
- return record.currentState.isEmpty;
121
- case 'isError':
122
- return record.currentState.isError;
123
- case 'isLoaded':
124
- return record.currentState.isLoaded;
125
- case 'isLoading':
126
- return record.currentState.isLoading;
127
- case 'isNew':
128
- return record.currentState.isNew;
129
- case 'isSaving':
130
- return record.currentState.isSaving;
131
- case 'isValid':
132
- return record.currentState.isValid;
133
- case 'reload':
134
- return reload;
135
- case 'rollbackAttributes':
136
- return rollbackAttributes;
137
- case 'save':
138
- return save;
139
- case 'serialize':
140
- return serialize;
141
- case 'unloadRecord':
142
- return unloadRecord;
143
- default:
144
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
145
- {
146
- throw new Error(`${prop} is not a supported legacy field`);
147
- }
148
- })() : {};
149
- }
150
- }
151
- legacySupport[Type] = '@legacy';
152
-
153
- /**
154
- * A function which adds the necessary fields to a schema and marks it as
155
- * being in LegacyMode. This is used to support the legacy features of
156
- * @ember-data/model while migrating to WarpDrive.
157
- *
158
- * Example:
159
- *
160
- * ```ts
161
- * import { withDefaults, WithLegacy } from '@ember-data/model/migration-support';
162
- * import { Type } from '@warp-drive/core-types/symbols';
163
- * import type { HasMany } from '@ember-data/model';
164
- *
165
- * export const UserSchema = withDefaults({
166
- * type: 'user',
167
- * fields: [
168
- * { name: 'firstName', kind: 'attribute' },
169
- * { name: 'lastName', kind: 'attribute' },
170
- * { name: 'age', kind: 'attribute' },
171
- * { name: 'friends',
172
- * kind: 'hasMany',
173
- * type: 'user',
174
- * options: { inverse: 'friends', async: false }
175
- * },
176
- * { name: 'bestFriend',
177
- * kind: 'belongsTo',
178
- * type: 'user',
179
- * options: { inverse: null, async: false }
180
- * },
181
- * ],
182
- * });
183
- *
184
- * export type User = WithLegacy<{
185
- * firstName: string;
186
- * lastName: string;
187
- * age: number;
188
- * friends: HasMany<User>;
189
- * bestFriend: User | null;
190
- * [Type]: 'user';
191
- * }>
192
- * ```
193
- *
194
- * Using this function require registering the derivations
195
- * it requires with the schema service.
196
- *
197
- * ```ts
198
- * import { registerDerivations } from '@ember-data/model/migration-support';
199
- *
200
- * registerDerivations(schema);
201
- * ```
202
- *
203
- * @param {LegacyResourceSchema} schema The schema to add legacy support to.
204
- * @return {LegacyResourceSchema} The schema with legacy support added.
205
- * @public
206
- */
207
- function withDefaults(schema) {
208
- schema.legacy = true;
209
- schema.identity = {
210
- kind: '@id',
211
- name: 'id'
212
- };
213
- LegacyFields.forEach(field => {
214
- schema.fields.push({
215
- type: '@legacy',
216
- name: field,
217
- kind: 'derived'
218
- });
219
- });
220
- schema.fields.push({
221
- name: 'isReloading',
222
- kind: '@local',
223
- type: 'boolean',
224
- options: {
225
- defaultValue: false
226
- }
227
- });
228
- schema.fields.push({
229
- name: 'isDestroying',
230
- kind: '@local',
231
- type: 'boolean',
232
- options: {
233
- defaultValue: false
234
- }
235
- });
236
- schema.fields.push({
237
- name: 'isDestroyed',
238
- kind: '@local',
239
- type: 'boolean',
240
- options: {
241
- defaultValue: false
242
- }
243
- });
244
- return schema;
245
- }
246
-
247
- /**
248
- * A function which registers the necessary derivations to support
249
- * the LegacyMode features of @ember-data/model while migrating to WarpDrive.
250
- *
251
- * This must be called in order to use the fields added by:
252
- *
253
- * ```ts
254
- * import { withDefaults } from '@ember-data/model/migration-support';
255
- * ```
256
- *
257
- * @param {SchemaService} schema The schema service to register the derivations with.
258
- * @return {void}
259
- * @public
260
- */
261
- function registerDerivations(schema) {
262
- schema.registerDerivation(legacySupport);
263
- }
264
-
265
- /**
266
- * A class which provides a schema service that delegates between
267
- * a primary schema service and one that supports legacy model
268
- * classes as its schema source.
269
- *
270
- * When the primary schema service has a schema for the given
271
- * resource, it will be used. Otherwise, the fallback schema
272
- * service will be used.
273
- *
274
- * This can be used when incrementally migrating from Models to
275
- * SchemaRecords by enabling unmigrated Models to continue to
276
- * provide their own schema information to the application.
277
- *
278
- * ```ts
279
- * import { DelegatingSchemaService } from '@ember-data/model/migration-support';
280
- * import { SchemaService } from '@warp-drive/schema-record';
281
- *
282
- * class AppStore extends Store {
283
- * createSchemaService() {
284
- * const schema = new SchemaService();
285
- * return new DelegatingSchemaService(this, schema);
286
- * }
287
- * }
288
- * ```
289
- *
290
- * All calls to register resources, derivations, transformations, hash functions
291
- * etc. will be delegated to the primary schema service.
292
- *
293
- * @class DelegatingSchemaService
294
- * @public
295
- */
296
-
297
- class DelegatingSchemaService {
298
- _preferred;
299
- _secondary;
300
- constructor(store, schema) {
301
- this._preferred = schema;
302
- this._secondary = buildSchema(store);
303
- }
304
- isDelegated(resource) {
305
- return !this._preferred.hasResource(resource) && this._secondary.hasResource(resource);
306
- }
307
- resourceTypes() {
308
- return Array.from(new Set(this._preferred.resourceTypes().concat(this._secondary.resourceTypes())));
309
- }
310
- hasResource(resource) {
311
- return this._preferred.hasResource(resource) || this._secondary.hasResource(resource);
312
- }
313
- hasTrait(type) {
314
- if (this._preferred.hasResource({
315
- type
316
- })) {
317
- return this._preferred.hasTrait(type);
318
- }
319
- return this._secondary.hasTrait(type);
320
- }
321
- resourceHasTrait(resource, trait) {
322
- if (this._preferred.hasResource(resource)) {
323
- return this._preferred.resourceHasTrait(resource, trait);
324
- }
325
- return this._secondary.resourceHasTrait(resource, trait);
326
- }
327
- fields(resource) {
328
- if (this._preferred.hasResource(resource)) {
329
- return this._preferred.fields(resource);
330
- }
331
- return this._secondary.fields(resource);
332
- }
333
- transformation(field) {
334
- return this._preferred.transformation(field);
335
- }
336
- hashFn(field) {
337
- return this._preferred.hashFn(field);
338
- }
339
- derivation(field) {
340
- return this._preferred.derivation(field);
341
- }
342
- resource(resource) {
343
- if (this._preferred.hasResource(resource)) {
344
- return this._preferred.resource(resource);
345
- }
346
- return this._secondary.resource(resource);
347
- }
348
- registerResources(schemas) {
349
- this._preferred.registerResources(schemas);
350
- }
351
- registerResource(schema) {
352
- this._preferred.registerResource(schema);
353
- }
354
- registerTransformation(transform) {
355
- this._preferred.registerTransformation(transform);
356
- }
357
- registerDerivation(derivation) {
358
- this._preferred.registerDerivation(derivation);
359
- }
360
- registerHashFn(hashFn) {
361
- this._preferred.registerHashFn(hashFn);
362
- }
363
- }
364
- if (macroCondition(getGlobalConfig().WarpDrive.deprecations.ENABLE_LEGACY_SCHEMA_SERVICE)) {
365
- DelegatingSchemaService.prototype.attributesDefinitionFor = function (resource) {
366
- if (this._preferred.hasResource(resource)) {
367
- return this._preferred.attributesDefinitionFor(resource);
368
- }
369
- return this._secondary.attributesDefinitionFor(resource);
370
- };
371
- DelegatingSchemaService.prototype.relationshipsDefinitionFor = function (resource) {
372
- if (this._preferred.hasResource(resource)) {
373
- return this._preferred.relationshipsDefinitionFor(resource);
374
- }
375
- return this._secondary.relationshipsDefinitionFor(resource);
376
- };
377
- DelegatingSchemaService.prototype.doesTypeExist = function (type) {
378
- return this._preferred.doesTypeExist?.(type) || this._secondary.doesTypeExist?.(type) || false;
379
- };
380
- }
381
- export { DelegatingSchemaService, registerDerivations, withDefaults };
1
+ export * from '@warp-drive/legacy/model/migration-support';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-data/model",
3
- "version": "5.6.0-alpha.5",
3
+ "version": "5.6.0-beta.1",
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,50 +41,26 @@
41
41
  "types": "./unstable-preview-types/index.d.ts"
42
42
  }
43
43
  },
44
- "peerDependencies": {
45
- "@ember-data/graph": "5.6.0-alpha.5",
46
- "@ember-data/json-api": "5.6.0-alpha.5",
47
- "@ember-data/legacy-compat": "5.6.0-alpha.5",
48
- "@ember-data/store": "5.6.0-alpha.5",
49
- "@ember-data/request-utils": "5.6.0-alpha.5",
50
- "@warp-drive/core-types": "5.6.0-alpha.5"
51
- },
52
- "peerDependenciesMeta": {
53
- "@ember-data/json-api": {
54
- "optional": true
55
- },
56
- "@ember-data/graph": {
57
- "optional": true
58
- }
59
- },
44
+ "peerDependencies": {},
60
45
  "dependencies": {
61
46
  "@ember/edition-utils": "^1.2.0",
62
47
  "@embroider/macros": "^1.16.12",
63
48
  "ember-cli-string-utils": "^1.1.0",
64
49
  "ember-cli-test-info": "^1.0.0",
65
50
  "inflection": "~3.0.2",
66
- "@warp-drive/build-config": "5.6.0-alpha.5"
51
+ "@warp-drive/core": "5.6.0-beta.0",
52
+ "@warp-drive/legacy": "5.6.0-beta.0",
53
+ "@warp-drive/utilities": "5.6.0-beta.0"
67
54
  },
68
55
  "devDependencies": {
69
56
  "@babel/core": "^7.26.10",
70
57
  "@babel/plugin-transform-typescript": "^7.27.0",
71
58
  "@babel/preset-env": "^7.26.9",
72
59
  "@babel/preset-typescript": "^7.27.0",
73
- "@ember-data/graph": "5.6.0-alpha.5",
74
- "@ember-data/json-api": "5.6.0-alpha.5",
75
- "@ember-data/legacy-compat": "5.6.0-alpha.5",
76
- "@ember-data/request": "5.6.0-alpha.5",
77
- "@ember-data/request-utils": "5.6.0-alpha.5",
78
- "@ember-data/store": "5.6.0-alpha.5",
79
- "@ember/test-waiters": "^4.1.0",
80
- "@glimmer/component": "^2.0.0",
81
- "@warp-drive/core-types": "5.6.0-alpha.5",
82
- "@warp-drive/internal-config": "5.6.0-alpha.5",
83
- "decorator-transforms": "^2.3.0",
84
- "ember-source": "~6.3.0",
60
+ "@warp-drive/internal-config": "5.6.0-beta.1",
85
61
  "expect-type": "^1.2.1",
86
62
  "typescript": "^5.8.3",
87
- "vite": "^5.4.15"
63
+ "vite": "^7.0.0"
88
64
  },
89
65
  "volta": {
90
66
  "extends": "../../package.json"
@@ -1,9 +1,4 @@
1
1
  declare module '@ember-data/model/-private' {
2
- export type { ModelStore } from '@ember-data/model/-private/model';
3
- export { Errors } from '@ember-data/model/-private/errors';
4
- export { RelatedCollection as ManyArray } from '@ember-data/store/-private';
5
- export { PromiseBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
6
- export { PromiseManyArray } from '@ember-data/model/-private/promise-many-array';
7
- export { lookupLegacySupport, LEGACY_SUPPORT } from '@ember-data/model/-private/legacy-relationships-support';
8
- }
9
- //# sourceMappingURL=-private.d.ts.map
2
+ export * from "@warp-drive/legacy/model/-private";
3
+
4
+ }
@@ -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';
4
- }
5
- //# sourceMappingURL=hooks.d.ts.map
2
+ export { instantiateRecord, teardownRecord, modelFor, buildSchema } from "@warp-drive/legacy/model";
3
+
4
+ }
@@ -1,80 +1,45 @@
1
- /// <reference path="./hooks.d.ts" />
2
1
  /// <reference path="./-private.d.ts" />
3
- /// <reference path="./migration-support.type-test.d.ts" />
4
2
  /// <reference path="./migration-support.d.ts" />
5
- /// <reference path="./-private/model-methods.d.ts" />
6
- /// <reference path="./-private/belongs-to.d.ts" />
7
- /// <reference path="./-private/legacy-relationships-support.d.ts" />
8
- /// <reference path="./-private/has-many.type-test.d.ts" />
9
- /// <reference path="./-private/promise-belongs-to.d.ts" />
10
- /// <reference path="./-private/util.d.ts" />
11
- /// <reference path="./-private/record-state.d.ts" />
12
- /// <reference path="./-private/hooks.d.ts" />
13
- /// <reference path="./-private/notify-changes.d.ts" />
14
- /// <reference path="./-private/promise-many-array.d.ts" />
15
- /// <reference path="./-private/belongs-to.type-test.d.ts" />
16
- /// <reference path="./-private/errors.d.ts" />
17
- /// <reference path="./-private/model-for-mixin.d.ts" />
18
- /// <reference path="./-private/attr.type-test.d.ts" />
19
- /// <reference path="./-private/attr.d.ts" />
20
- /// <reference path="./-private/has-many.d.ts" />
21
- /// <reference path="./-private/type-utils.d.ts" />
22
- /// <reference path="./-private/schema-provider.d.ts" />
23
- /// <reference path="./-private/model.type-test.d.ts" />
24
- /// <reference path="./-private/model.d.ts" />
25
- /// <reference path="./-private/promise-proxy-base.d.ts" />
26
- /// <reference path="./-private/references/belongs-to.d.ts" />
27
- /// <reference path="./-private/references/has-many.d.ts" />
28
- /// <reference path="./-private/debug/assert-polymorphic-type.d.ts" />
3
+ /// <reference path="./hooks.d.ts" />
29
4
  declare module '@ember-data/model' {
30
5
  /**
31
- * This package provides a Presentation Model for resource data in an EmberData Cache.
32
- *
33
- * Models are defined as classes extending from `import Model from '@ember-data/model';` and the
34
- * attributes and relationships on these classes are parsed at runtime to supply static "schema"
35
- * to EmberData's SchemaService.
36
- *
37
- * Resource data for individual resources fetched from your API is presented to the UI via instances
38
- * of the `Model`s you define. An instantiated `Model` is referred to as a `record`.
6
+ * This package provides a Presentation Model for resource data in an EmberData Cache.
7
+ *
8
+ * Models are defined as classes extending from `import Model from '@ember-data/model';` and the
9
+ * attributes and relationships on these classes are parsed at runtime to supply static "schema"
10
+ * to EmberData's SchemaService.
11
+ *
12
+ * Resource data for individual resources fetched from your API is presented to the UI via instances
13
+ * of the `Model`s you define. An instantiated `Model` is referred to as a `record`.
14
+
15
+ When we refer to the `ModelClass` as opposed to a `Model` or `Record` we are referring
16
+ specifically to the class definition and the static schema methods present on it.
39
17
 
40
- When we refer to the `ModelClass` as opposed to a `Model` or `Record` we are referring
41
- specifically to the class definition and the static schema methods present on it.
18
+ When we refer to a `record` we refer to a specific class instance presenting
19
+ the resource data for a given `type` and `id`.
42
20
 
43
- When we refer to a `record` we refer to a specific class instance presenting
44
- the resource data for a given `type` and `id`.
21
+ ### Defining a Model
45
22
 
46
- ### Defining a Model
23
+ ```js [app/models/person.js]
24
+ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
47
25
 
48
- ```js [app/models/person.js]
49
- import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
26
+ export default class PersonModel extends Model {
27
+ @attr name;
50
28
 
51
- export default class PersonModel extends Model {
52
- @attr name;
29
+ @belongsTo('pet', { inverse: 'owners', async: false }) dog;
53
30
 
54
- @belongsTo('pet', { inverse: 'owners', async: false }) dog;
31
+ @hasMany('person', { inverse: 'friends', async: true }) friends;
32
+ }
33
+ ```
55
34
 
56
- @hasMany('person', { inverse: 'friends', async: true }) friends;
57
- }
58
- ```
35
+ ### modelName convention
59
36
 
60
- ### modelName convention
37
+ By convention, the name of a given model (its `type`) matches the name
38
+ of the file in the `app/models` folder and should be lowercase, singular
39
+ and dasherized.
61
40
 
62
- By convention, the name of a given model (its `type`) matches the name
63
- of the file in the `app/models` folder and should be lowercase, singular
64
- and dasherized.
41
+ @module
42
+ */
43
+ export { default, attr, belongsTo, hasMany, instantiateRecord, teardownRecord, modelFor, buildSchema, type ManyArray, type HasMany, type AsyncHasMany, type AsyncBelongsTo } from "@warp-drive/legacy/model";
65
44
 
66
- @module
67
- */
68
- export { attr } from '@ember-data/model/-private/attr';
69
- export { belongsTo } from '@ember-data/model/-private/belongs-to';
70
- export { hasMany } from '@ember-data/model/-private/has-many';
71
- export { Model } from '@ember-data/model/-private/model';
72
- export { Model as default } from '@ember-data/model/-private/model';
73
- export type { PromiseBelongsTo as AsyncBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
74
- export type { PromiseManyArray as AsyncHasMany } from '@ember-data/model/-private/promise-many-array';
75
- export type { RelatedCollection as ManyArray } from '@ember-data/store/-private';
76
- export type { RelatedCollection as HasMany } from '@ember-data/store/-private';
77
- export { instantiateRecord, teardownRecord, modelFor } from '@ember-data/model/-private/hooks';
78
- export { ModelSchemaProvider } from '@ember-data/model/-private/schema-provider';
79
- }
80
- //# sourceMappingURL=index.d.ts.map
45
+ }