@ember-data/model 5.5.0-alpha.2 → 5.5.0-alpha.21

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 (102) hide show
  1. package/LICENSE.md +19 -7
  2. package/README.md +21 -2
  3. package/addon-main.cjs +5 -0
  4. package/blueprints/model/index.js +18 -5
  5. package/blueprints/model-test/index.js +16 -10
  6. package/blueprints/model-test/qunit-files/__root__/__path__/__test__.js +4 -5
  7. package/dist/-private.js +3 -0
  8. package/{addon → dist}/-private.js.map +1 -1
  9. package/dist/has-many-CwEZBhUG.js +682 -0
  10. package/dist/has-many-CwEZBhUG.js.map +1 -0
  11. package/dist/hooks-C6_7V3O3.js +75 -0
  12. package/dist/hooks-C6_7V3O3.js.map +1 -0
  13. package/dist/hooks.js +2 -0
  14. package/{addon → dist}/hooks.js.map +1 -1
  15. package/dist/index.js +5 -0
  16. package/{addon → dist}/index.js.map +1 -1
  17. package/dist/migration-support.js +213 -0
  18. package/dist/migration-support.js.map +1 -0
  19. package/{addon/model-b638e17c.js → dist/model-B9PHp6Pe.js} +2555 -2455
  20. package/dist/model-B9PHp6Pe.js.map +1 -0
  21. package/dist/schema-provider-WdyaNQ3o.js +259 -0
  22. package/dist/schema-provider-WdyaNQ3o.js.map +1 -0
  23. package/logos/NCC-1701-a-blue.svg +4 -0
  24. package/logos/NCC-1701-a-gold.svg +4 -0
  25. package/logos/NCC-1701-a-gold_100.svg +1 -0
  26. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  27. package/logos/NCC-1701-a.svg +4 -0
  28. package/logos/README.md +4 -0
  29. package/logos/docs-badge.svg +2 -0
  30. package/logos/ember-data-logo-dark.svg +12 -0
  31. package/logos/ember-data-logo-light.svg +12 -0
  32. package/logos/github-header.svg +444 -0
  33. package/logos/social1.png +0 -0
  34. package/logos/social2.png +0 -0
  35. package/logos/warp-drive-logo-dark.svg +4 -0
  36. package/logos/warp-drive-logo-gold.svg +4 -0
  37. package/package.json +62 -58
  38. package/unstable-preview-types/-private/attr.d.ts +175 -0
  39. package/unstable-preview-types/-private/attr.d.ts.map +1 -0
  40. package/unstable-preview-types/-private/attr.type-test.d.ts +4 -0
  41. package/unstable-preview-types/-private/attr.type-test.d.ts.map +1 -0
  42. package/unstable-preview-types/-private/belongs-to.d.ts +181 -0
  43. package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -0
  44. package/unstable-preview-types/-private/belongs-to.type-test.d.ts +4 -0
  45. package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +1 -0
  46. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +8 -0
  47. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  48. package/unstable-preview-types/-private/errors.d.ts +303 -0
  49. package/unstable-preview-types/-private/errors.d.ts.map +1 -0
  50. package/unstable-preview-types/-private/has-many.d.ts +169 -0
  51. package/unstable-preview-types/-private/has-many.d.ts.map +1 -0
  52. package/unstable-preview-types/-private/has-many.type-test.d.ts +4 -0
  53. package/unstable-preview-types/-private/has-many.type-test.d.ts.map +1 -0
  54. package/unstable-preview-types/-private/hooks.d.ts +13 -0
  55. package/unstable-preview-types/-private/hooks.d.ts.map +1 -0
  56. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +60 -0
  57. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -0
  58. package/unstable-preview-types/-private/model-for-mixin.d.ts +6 -0
  59. package/unstable-preview-types/-private/model-for-mixin.d.ts.map +1 -0
  60. package/unstable-preview-types/-private/model-methods.d.ts +37 -0
  61. package/unstable-preview-types/-private/model-methods.d.ts.map +1 -0
  62. package/unstable-preview-types/-private/model.d.ts +1303 -0
  63. package/unstable-preview-types/-private/model.d.ts.map +1 -0
  64. package/unstable-preview-types/-private/model.type-test.d.ts +4 -0
  65. package/unstable-preview-types/-private/model.type-test.d.ts.map +1 -0
  66. package/unstable-preview-types/-private/notify-changes.d.ts +8 -0
  67. package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -0
  68. package/unstable-preview-types/-private/promise-belongs-to.d.ts +46 -0
  69. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -0
  70. package/unstable-preview-types/-private/promise-many-array.d.ts +132 -0
  71. package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -0
  72. package/unstable-preview-types/-private/promise-proxy-base.d.ts +5 -0
  73. package/unstable-preview-types/-private/promise-proxy-base.d.ts.map +1 -0
  74. package/unstable-preview-types/-private/record-state.d.ts +80 -0
  75. package/unstable-preview-types/-private/record-state.d.ts.map +1 -0
  76. package/unstable-preview-types/-private/references/belongs-to.d.ts +503 -0
  77. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -0
  78. package/unstable-preview-types/-private/references/has-many.d.ts +515 -0
  79. package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -0
  80. package/unstable-preview-types/-private/schema-provider.d.ts +65 -0
  81. package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -0
  82. package/unstable-preview-types/-private/type-utils.d.ts +64 -0
  83. package/unstable-preview-types/-private/type-utils.d.ts.map +1 -0
  84. package/unstable-preview-types/-private/util.d.ts +8 -0
  85. package/unstable-preview-types/-private/util.d.ts.map +1 -0
  86. package/unstable-preview-types/-private.d.ts +13 -0
  87. package/unstable-preview-types/-private.d.ts.map +1 -0
  88. package/unstable-preview-types/hooks.d.ts +5 -0
  89. package/unstable-preview-types/hooks.d.ts.map +1 -0
  90. package/unstable-preview-types/index.d.ts +76 -0
  91. package/unstable-preview-types/index.d.ts.map +1 -0
  92. package/unstable-preview-types/migration-support.d.ts +64 -0
  93. package/unstable-preview-types/migration-support.d.ts.map +1 -0
  94. package/addon/-private.js +0 -2
  95. package/addon/has-many-774c4c4b.js +0 -507
  96. package/addon/has-many-774c4c4b.js.map +0 -1
  97. package/addon/hooks-6d5c2fc2.js +0 -157
  98. package/addon/hooks-6d5c2fc2.js.map +0 -1
  99. package/addon/hooks.js +0 -1
  100. package/addon/index.js +0 -3
  101. package/addon/model-b638e17c.js.map +0 -1
  102. package/addon-main.js +0 -93
@@ -0,0 +1,303 @@
1
+ declare module '@ember-data/model/-private/errors' {
2
+ import { type NativeArray } from '@ember/array';
3
+ import ArrayProxy from '@ember/array/proxy';
4
+ import type RecordState from '@ember-data/model/-private/record-state';
5
+ type ValidationError = {
6
+ attribute: string;
7
+ message: string;
8
+ };
9
+ /**
10
+ @module @ember-data/model
11
+ */
12
+ interface ArrayProxyWithCustomOverrides<T> extends Omit<ArrayProxy<T>, 'clear' | 'content'> {
13
+ content: NativeArray<T>;
14
+ clear(): void;
15
+ _has(name: string): boolean;
16
+ }
17
+ const ArrayProxyWithCustomOverrides: new <T>() => ArrayProxyWithCustomOverrides<T>;
18
+ /**
19
+ Holds validation errors for a given record, organized by attribute names.
20
+
21
+ This class is not directly instantiable.
22
+
23
+ Every `Model` has an `errors` property that is an instance of
24
+ `Errors`. This can be used to display validation error
25
+ messages returned from the server when a `record.save()` rejects.
26
+
27
+ For Example, if you had a `User` model that looked like this:
28
+
29
+ ```app/models/user.js
30
+ import Model, { attr } from '@ember-data/model';
31
+
32
+ export default class UserModel extends Model {
33
+ @attr('string') username;
34
+ @attr('string') email;
35
+ }
36
+ ```
37
+ And you attempted to save a record that did not validate on the backend:
38
+
39
+ ```javascript
40
+ let user = store.createRecord('user', {
41
+ username: 'tomster',
42
+ email: 'invalidEmail'
43
+ });
44
+ user.save();
45
+ ```
46
+
47
+ Your backend would be expected to return an error response that described
48
+ the problem, so that error messages can be generated on the app.
49
+
50
+ API responses will be translated into instances of `Errors` differently,
51
+ depending on the specific combination of adapter and serializer used. You
52
+ may want to check the documentation or the source code of the libraries
53
+ that you are using, to know how they expect errors to be communicated.
54
+
55
+ Errors can be displayed to the user by accessing their property name
56
+ to get an array of all the error objects for that property. Each
57
+ error object is a JavaScript object with two keys:
58
+
59
+ - `message` A string containing the error message from the backend
60
+ - `attribute` The name of the property associated with this error message
61
+
62
+ ```handlebars
63
+ <label>Username: <Input @value={{@model.username}} /> </label>
64
+ {{#each @model.errors.username as |error|}}
65
+ <div class="error">
66
+ {{error.message}}
67
+ </div>
68
+ {{/each}}
69
+
70
+ <label>Email: <Input @value={{@model.email}} /> </label>
71
+ {{#each @model.errors.email as |error|}}
72
+ <div class="error">
73
+ {{error.message}}
74
+ </div>
75
+ {{/each}}
76
+ ```
77
+
78
+ You can also access the special `messages` property on the error
79
+ object to get an array of all the error strings.
80
+
81
+ ```handlebars
82
+ {{#each @model.errors.messages as |message|}}
83
+ <div class="error">
84
+ {{message}}
85
+ </div>
86
+ {{/each}}
87
+ ```
88
+
89
+ @class Errors
90
+ @public
91
+ @extends Ember.ArrayProxy
92
+ */
93
+ export class Errors extends ArrayProxyWithCustomOverrides<ValidationError> {
94
+ __record: {
95
+ currentState: RecordState;
96
+ };
97
+ /**
98
+ @property errorsByAttributeName
99
+ @type {MapWithDefault}
100
+ @private
101
+ */
102
+ get errorsByAttributeName(): Map<string, NativeArray<ValidationError>>;
103
+ /**
104
+ Returns errors for a given attribute
105
+
106
+ ```javascript
107
+ let user = store.createRecord('user', {
108
+ username: 'tomster',
109
+ email: 'invalidEmail'
110
+ });
111
+ user.save().catch(function(){
112
+ user.errors.errorsFor('email'); // returns:
113
+ // [{attribute: "email", message: "Doesn't look like a valid email."}]
114
+ });
115
+ ```
116
+
117
+ @method errorsFor
118
+ @public
119
+ @param {String} attribute
120
+ @return {Array}
121
+ */
122
+ errorsFor(attribute: string): NativeArray<ValidationError>;
123
+ /**
124
+ An array containing all of the error messages for this
125
+ record. This is useful for displaying all errors to the user.
126
+
127
+ ```handlebars
128
+ {{#each @model.errors.messages as |message|}}
129
+ <div class="error">
130
+ {{message}}
131
+ </div>
132
+ {{/each}}
133
+ ```
134
+
135
+ @property messages
136
+ @public
137
+ @type {Array}
138
+ */
139
+ messages: string[];
140
+ /**
141
+ @property content
142
+ @type {Array}
143
+ @private
144
+ */
145
+ get content(): NativeArray<ValidationError>;
146
+ /**
147
+ @method unknownProperty
148
+ @private
149
+ */
150
+ unknownProperty(attribute: string): NativeArray<ValidationError> | undefined;
151
+ /**
152
+ Total number of errors.
153
+
154
+ @property length
155
+ @type {Number}
156
+ @public
157
+ @readOnly
158
+ */
159
+ /**
160
+ `true` if we have no errors.
161
+
162
+ @property isEmpty
163
+ @type {Boolean}
164
+ @public
165
+ @readOnly
166
+ */
167
+ isEmpty: boolean;
168
+ /**
169
+ Manually adds errors to the record. This will trigger the `becameInvalid` event/ lifecycle method on
170
+ the record and transition the record into an `invalid` state.
171
+
172
+ Example
173
+ ```javascript
174
+ let errors = user.errors;
175
+
176
+ // add multiple errors
177
+ errors.add('password', [
178
+ 'Must be at least 12 characters',
179
+ 'Must contain at least one symbol',
180
+ 'Cannot contain your name'
181
+ ]);
182
+
183
+ errors.errorsFor('password');
184
+ // =>
185
+ // [
186
+ // { attribute: 'password', message: 'Must be at least 12 characters' },
187
+ // { attribute: 'password', message: 'Must contain at least one symbol' },
188
+ // { attribute: 'password', message: 'Cannot contain your name' },
189
+ // ]
190
+
191
+ // add a single error
192
+ errors.add('username', 'This field is required');
193
+
194
+ errors.errorsFor('username');
195
+ // =>
196
+ // [
197
+ // { attribute: 'username', message: 'This field is required' },
198
+ // ]
199
+ ```
200
+ @method add
201
+ @public
202
+ @param {string} attribute - the property name of an attribute or relationship
203
+ @param {string[]|string} messages - an error message or array of error messages for the attribute
204
+ */
205
+ add(attribute: string, messages: string[] | string): void;
206
+ /**
207
+ @method _findOrCreateMessages
208
+ @private
209
+ */
210
+ _findOrCreateMessages(attribute: string, messages: string | string[]): ValidationError[];
211
+ /**
212
+ Manually removes all errors for a given member from the record.
213
+ This will transition the record into a `valid` state, and
214
+ triggers the `becameValid` event and lifecycle method.
215
+
216
+ Example:
217
+
218
+ ```javascript
219
+ let errors = user.errors;
220
+ errors.add('phone', ['error-1', 'error-2']);
221
+
222
+ errors.errorsFor('phone');
223
+ // =>
224
+ // [
225
+ // { attribute: 'phone', message: 'error-1' },
226
+ // { attribute: 'phone', message: 'error-2' },
227
+ // ]
228
+
229
+ errors.remove('phone');
230
+
231
+ errors.errorsFor('phone');
232
+ // => undefined
233
+ ```
234
+ @method remove
235
+ @public
236
+ @param {string} member - the property name of an attribute or relationship
237
+ */
238
+ remove(attribute: string): void;
239
+ /**
240
+ Manually clears all errors for the record.
241
+ This will transition the record into a `valid` state, and
242
+ will trigger the `becameValid` event and lifecycle method.
243
+
244
+ Example:
245
+
246
+ ```javascript
247
+ let errors = user.errors;
248
+ errors.add('username', ['error-a']);
249
+ errors.add('phone', ['error-1', 'error-2']);
250
+
251
+ errors.errorsFor('username');
252
+ // =>
253
+ // [
254
+ // { attribute: 'username', message: 'error-a' },
255
+ // ]
256
+
257
+ errors.errorsFor('phone');
258
+ // =>
259
+ // [
260
+ // { attribute: 'phone', message: 'error-1' },
261
+ // { attribute: 'phone', message: 'error-2' },
262
+ // ]
263
+
264
+ errors.clear();
265
+
266
+ errors.errorsFor('username');
267
+ // => undefined
268
+
269
+ errors.errorsFor('phone');
270
+ // => undefined
271
+
272
+ errors.messages
273
+ // => []
274
+ ```
275
+ @method clear
276
+ @public
277
+ */
278
+ clear(): void;
279
+ /**
280
+ Checks if there are error messages for the given attribute.
281
+
282
+ ```app/controllers/user/edit.js
283
+ export default class UserEditController extends Controller {
284
+ @action
285
+ save(user) {
286
+ if (user.errors.has('email')) {
287
+ return alert('Please update your email before attempting to save.');
288
+ }
289
+ user.save();
290
+ }
291
+ }
292
+ ```
293
+
294
+ @method has
295
+ @public
296
+ @param {String} attribute
297
+ @return {Boolean} true if there some errors on given attribute
298
+ */
299
+ has(attribute: string): boolean;
300
+ }
301
+ export {};
302
+ }
303
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/-private/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,UAAU,MAAM,oBAAoB,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CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI;IAUzD;;;MAGE;IACF,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,eAAe,EAAE;IAqBxF;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM;IAwBxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,KAAK,IAAI,IAAI;IAqBb;;;;;;;;;;;;;;;;;;;MAmBE;IACF,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;CAGhC"}
@@ -0,0 +1,169 @@
1
+ declare module '@ember-data/model/-private/has-many' {
2
+ import type { TypeFromInstance } from '@warp-drive/core-types/record';
3
+ import type { NoNull, RelationshipDecorator, RelationshipOptions } from '@ember-data/model/-private/belongs-to';
4
+ /**
5
+ `hasMany` is used to define Many-To-One and Many-To-Many, and Many-To-None
6
+ relationships on a [Model](/ember-data/release/classes/Model).
7
+
8
+ `hasMany` takes a configuration hash as a second parameter, currently
9
+ supported options are:
10
+
11
+ - `async`: (*required*) A boolean value used to whether this is a sync (false) or async (true) relationship.
12
+ - `inverse`: (*required*) A string used to identify the inverse property on a related model, or `null`.
13
+ - `polymorphic`: (*optional*) A boolean value to mark the relationship as polymorphic
14
+ - `as`: (*optional*) A string used to the abstract type "this" record satisfies for polymorphism.
15
+
16
+ ### Examples
17
+
18
+ To a **many-to-one** (or one-to-many) relationship, use
19
+ `belongsTo` in combination with `hasMany`:
20
+
21
+ ```js
22
+ // app/models/post.js
23
+ import Model, { hasMany } from '@ember-data/model';
24
+
25
+ export default class Post extends Model {
26
+ @hasMany('comment', { async: false, inverse: 'post' }) comments;
27
+ }
28
+
29
+
30
+ // app/models/comment.js
31
+ import Model, { belongsTo } from '@ember-data/model';
32
+
33
+ export default class Comment extends Model {
34
+ @belongsTo('post', { async: false, inverse: 'comments' }) post;
35
+ }
36
+ ```
37
+
38
+ To a **many-to-many** relationship with managed inverses, use `hasMany` for both sides:
39
+
40
+ ```js
41
+ // app/models/post.js
42
+ import Model, { hasMany } from '@ember-data/model';
43
+
44
+ export default class Post extends Model {
45
+ @hasMany('tag', { async: true, inverse: 'posts' }) tags;
46
+ }
47
+
48
+ // app/models/tag.js
49
+ import Model, { hasMany } from '@ember-data/model';
50
+
51
+ export default class Tag extends Model {
52
+ @hasMany('post', { async: true, inverse: 'tags' }) posts;
53
+ }
54
+ ```
55
+
56
+ To a **many-to-many** relationship without managed inverses, use `hasMany` for both sides
57
+ with `null` as the inverse:
58
+
59
+ ```js
60
+ // app/models/post.js
61
+ import Model, { hasMany } from '@ember-data/model';
62
+
63
+ export default class Post extends Model {
64
+ @hasMany('tag', { async: true, inverse: null }) tags;
65
+ }
66
+
67
+ // app/models/tag.js
68
+ import Model, { hasMany } from '@ember-data/model';
69
+
70
+ export default class Tag extends Model {
71
+ @hasMany('post', { async: true, inverse: null }) posts;
72
+ }
73
+ ```
74
+
75
+ To a many-to-none relationship between two models, use
76
+ `hasMany` with inverse set to `null` on just one side::
77
+
78
+ ```js
79
+ // app/models/post.js
80
+ import Model, { hasMany } from '@ember-data/model';
81
+
82
+ export default class Post extends Model {
83
+ @hasMany('category', { async: true, inverse: null }) categories;
84
+ }
85
+ ```
86
+
87
+ #### Sync vs Async Relationships
88
+
89
+ EmberData fulfills relationships using resource data available in
90
+ the cache.
91
+
92
+ Sync relationships point directly to the known related resources.
93
+
94
+ When a relationship is declared as async, if any of the known related
95
+ resources have not been loaded, they will be fetched. The property
96
+ on the record when accessed provides a promise that resolves once
97
+ all resources are loaded.
98
+
99
+ Async relationships may take advantage of links. On access, if the related
100
+ link has not been loaded, or if any known resources are not available in
101
+ the cache, the fresh state will be fetched using the link.
102
+
103
+ In contrast to async relationship, accessing a sync relationship
104
+ will error on access when any of the known related resources have
105
+ not been loaded.
106
+
107
+ If you are using `links` with sync relationships, you have to use
108
+ the HasMany reference API to fetch or refresh related resources
109
+ that aren't loaded. For instance, for a `comments` relationship:
110
+
111
+ ```js
112
+ post.hasMany('comments').reload();
113
+ ```
114
+
115
+ #### Polymorphic Relationships
116
+
117
+ To a polymorphic relationship, use `hasMany` with the `polymorphic`
118
+ option set to `true`:
119
+
120
+ ```js
121
+ // app/models/comment.js
122
+ import Model, { belongsTo } from '@ember-data/model';
123
+
124
+ export default class Comment extends Model {
125
+ @belongsTo('commentable', { async: false, inverse: 'comments', polymorphic: true }) parent;
126
+ }
127
+ ```
128
+
129
+ `'commentable'` here is referred to as the "abstract type" for the polymorphic
130
+ relationship.
131
+
132
+ Polymorphic relationships with `inverse: null` will accept any type of record as their content.
133
+ Polymorphic relationships with `inverse` set to a string will only accept records with a matching
134
+ inverse relationships declaring itself as satisfying the abstract type.
135
+
136
+ Below, 'as' is used to the that 'post' record satisfies the abstract type 'commentable'
137
+ for this relationship.
138
+
139
+ ```js
140
+ // app/models/post.js
141
+ import Model, { hasMany } from '@ember-data/model';
142
+
143
+ export default class Post extends Model {
144
+ @hasMany('comment', { async: false, inverse: 'parent', as: 'commentable' }) comments;
145
+ }
146
+ ```
147
+
148
+ Note: every Model that declares an inverse to a polymorphic relationship must
149
+ itself exactly the same. This is because polymorphism is based on structural
150
+ traits.
151
+
152
+ Polymorphic to polymorphic relationships are supported. Both sides of the relationship
153
+ must be declared as polymorphic, and the `as` option must be used to the abstract
154
+ type each record satisfies on both sides.
155
+
156
+ @method hasMany
157
+ @public
158
+ @static
159
+ @for @ember-data/model
160
+ @param {string} type (optional) the name of the related resource
161
+ @param {object} options (optional) a hash of options
162
+ @return {PropertyDescriptor} relationship
163
+ */
164
+ export function hasMany(): never;
165
+ export function hasMany(type: string): never;
166
+ export function hasMany<T>(type: TypeFromInstance<NoNull<T>>, options: RelationshipOptions<T, boolean>): RelationshipDecorator<T>;
167
+ export function hasMany(type: string, options: RelationshipOptions<unknown, boolean>): RelationshipDecorator<unknown>;
168
+ }
169
+ //# sourceMappingURL=has-many.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-many.d.ts","sourceRoot":"","sources":["../../src/-private/has-many.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAgFvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+JE;AACF,wBAAgB,OAAO,IAAI,KAAK,CAAC;AACjC,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;AAC7C,wBAAgB,OAAO,CAAC,CAAC,EACvB,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACjC,OAAO,EAAE,mBAAmB,CAAC,CAAC,EAAE,OAAO,CAAC,GACvC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAK5B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare module '@ember-data/model/-private/has-many.type-test' {
2
+ export {};
3
+ }
4
+ //# sourceMappingURL=has-many.type-test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-many.type-test.d.ts","sourceRoot":"","sources":["../../src/-private/has-many.type-test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ declare module '@ember-data/model/-private/hooks' {
2
+ import { type Store } from '@ember-data/store/-private';
3
+ import type { StableRecordIdentifier } from '@warp-drive/core-types';
4
+ import type { TypeFromInstance } from '@warp-drive/core-types/record';
5
+ import type { Model } from '@ember-data/model/-private/model';
6
+ export function instantiateRecord(this: Store, identifier: StableRecordIdentifier, createRecordArgs: {
7
+ [key: string]: unknown;
8
+ }): Model;
9
+ export function teardownRecord(record: Model): void;
10
+ export function modelFor<T>(type: TypeFromInstance<T>): typeof Model | void;
11
+ export function modelFor(type: string): typeof Model | void;
12
+ }
13
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/-private/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoC,KAAK,KAAK,EAAY,MAAM,4BAA4B,CAAC;AAEpG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAA4B,MAAM,+BAA+B,CAAC;AAEhG,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,SAAS,CAAC;AAMjD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,KAAK,EACX,UAAU,EAAE,sBAAsB,EAClC,gBAAgB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAC3C,KAAK,CAwBP;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAMlD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,GAAG,IAAI,CAAC;AAC5E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,KAAK,GAAG,IAAI,CAAC"}
@@ -0,0 +1,60 @@
1
+ declare module '@ember-data/model/-private/legacy-relationships-support' {
2
+ import type { CollectionEdge, Graph, ResourceEdge, UpgradedMeta } from '@ember-data/graph/-private';
3
+ import type Store from '@ember-data/store';
4
+ import type { LiveArray } from '@ember-data/store/-private';
5
+ import { RelatedCollection as ManyArray } from '@ember-data/store/-private';
6
+ import type { BaseFinderOptions } from '@ember-data/store/types';
7
+ import type { StableRecordIdentifier } from '@warp-drive/core-types';
8
+ import type { Cache } from '@warp-drive/core-types/cache';
9
+ import type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';
10
+ import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
11
+ import type { OpaqueRecordInstance, TypeFromInstanceOrString } from '@warp-drive/core-types/record';
12
+ import type { CollectionResourceRelationship, InnerRelationshipDocument, SingleResourceRelationship } from '@warp-drive/core-types/spec/json-api-raw';
13
+ import type { MinimalLegacyRecord } from '@ember-data/model/-private/model-methods';
14
+ import type { BelongsToProxyCreateArgs } from '@ember-data/model/-private/promise-belongs-to';
15
+ import { PromiseBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
16
+ import type { HasManyProxyCreateArgs } from '@ember-data/model/-private/promise-many-array';
17
+ import { PromiseManyArray } from '@ember-data/model/-private/promise-many-array';
18
+ import BelongsToReference from '@ember-data/model/-private/references/belongs-to';
19
+ import HasManyReference from '@ember-data/model/-private/references/has-many';
20
+ export const LEGACY_SUPPORT: Map<StableRecordIdentifier | MinimalLegacyRecord, LegacySupport>;
21
+ export function lookupLegacySupport(record: MinimalLegacyRecord): LegacySupport;
22
+ export class LegacySupport {
23
+ record: MinimalLegacyRecord;
24
+ store: Store;
25
+ graph: Graph;
26
+ cache: Cache;
27
+ references: Record<string, BelongsToReference | HasManyReference>;
28
+ identifier: StableRecordIdentifier;
29
+ _manyArrayCache: Record<string, ManyArray>;
30
+ _relationshipPromisesCache: Record<string, Promise<ManyArray | OpaqueRecordInstance>>;
31
+ _relationshipProxyCache: Record<string, PromiseManyArray | PromiseBelongsTo | undefined>;
32
+ _pending: Record<string, Promise<StableRecordIdentifier | null> | undefined>;
33
+ isDestroying: boolean;
34
+ isDestroyed: boolean;
35
+ constructor(record: MinimalLegacyRecord);
36
+ _syncArray(array: LiveArray): void;
37
+ mutate(mutation: LocalRelationshipOperation): void;
38
+ _findBelongsTo(key: string, resource: SingleResourceRelationship, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null>;
39
+ reloadBelongsTo(key: string, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null>;
40
+ getBelongsTo(key: string, options?: BaseFinderOptions): PromiseBelongsTo | OpaqueRecordInstance | null;
41
+ setDirtyBelongsTo(key: string, value: OpaqueRecordInstance | null): void;
42
+ _getCurrentState<T>(identifier: StableRecordIdentifier, field: string): [StableRecordIdentifier<TypeFromInstanceOrString<T>>[], CollectionRelationship];
43
+ getManyArray<T>(key: string, definition?: UpgradedMeta): ManyArray<T>;
44
+ fetchAsyncHasMany(key: string, relationship: CollectionEdge, manyArray: ManyArray, options?: BaseFinderOptions): Promise<ManyArray>;
45
+ reloadHasMany<T>(key: string, options?: BaseFinderOptions): Promise<ManyArray<T>> | PromiseManyArray<T>;
46
+ getHasMany(key: string, options?: BaseFinderOptions): PromiseManyArray | ManyArray;
47
+ _updatePromiseProxyFor(kind: 'hasMany', key: string, args: HasManyProxyCreateArgs): PromiseManyArray;
48
+ _updatePromiseProxyFor(kind: 'belongsTo', key: string, args: BelongsToProxyCreateArgs): PromiseBelongsTo;
49
+ _updatePromiseProxyFor(kind: 'belongsTo', key: string, args: {
50
+ promise: Promise<OpaqueRecordInstance | null>;
51
+ }): PromiseBelongsTo;
52
+ referenceFor(kind: 'belongsTo', name: string): BelongsToReference;
53
+ referenceFor(kind: 'hasMany', name: string): HasManyReference;
54
+ _findHasManyByJsonApiResource(resource: CollectionResourceRelationship, parentIdentifier: StableRecordIdentifier, relationship: CollectionEdge, options?: BaseFinderOptions): Promise<void | unknown[]> | void;
55
+ _findBelongsToByJsonApiResource(resource: SingleResourceRelationship, parentIdentifier: StableRecordIdentifier, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<StableRecordIdentifier | null>;
56
+ destroy(): void;
57
+ }
58
+ export function areAllInverseRecordsLoaded(store: Store, resource: InnerRelationshipDocument): boolean;
59
+ }
60
+ //# sourceMappingURL=legacy-relationships-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-relationships-support.d.ts","sourceRoot":"","sources":["../../src/-private/legacy-relationships-support.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAa,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/G,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAOL,iBAAiB,IAAI,SAAS,EAG/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEpG,OAAO,KAAK,EACV,8BAA8B,EAC9B,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,OAA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AAY,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB;IACjE,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAuC7D,6BAA6B,CAC3B,QAAQ,EAAE,8BAA8B,EACxC,gBAAgB,EAAE,sBAAsB,EACxC,YAAY,EAAE,cAAc,EAC5B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,IAAI,GAAG,OAAO,EAAE,CAAC,GAAG,IAAI;IAqFnC,+BAA+B,CAC7B,QAAQ,EAAE,0BAA0B,EACpC,gBAAgB,EAAE,sBAAsB,EACxC,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IA4GzC,OAAO;CAyBR;AAiHD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,yBAAyB,GAAG,OAAO,CAgBrG"}
@@ -0,0 +1,6 @@
1
+ declare module '@ember-data/model/-private/model-for-mixin' {
2
+ import type Store from '@ember-data/store';
3
+ import { type ModelFactory } from '@ember-data/model/-private/model';
4
+ export default function modelForMixin(store: Store, normalizedModelName: string): ModelFactory | undefined;
5
+ }
6
+ //# sourceMappingURL=model-for-mixin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-for-mixin.d.ts","sourceRoot":"","sources":["../../src/-private/model-for-mixin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAkBnD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAYzG"}
@@ -0,0 +1,37 @@
1
+ declare module '@ember-data/model/-private/model-methods' {
2
+ import type { Snapshot } from '@ember-data/legacy-compat/-private';
3
+ import type Store from '@ember-data/store';
4
+ import type { ChangedAttributesHash } from '@warp-drive/core-types/cache';
5
+ import { RecordStore } from '@warp-drive/core-types/symbols';
6
+ import type { Errors } from '@ember-data/model/-private/errors';
7
+ import type RecordState from '@ember-data/model/-private/record-state';
8
+ import type BelongsToReference from '@ember-data/model/-private/references/belongs-to';
9
+ import type HasManyReference from '@ember-data/model/-private/references/has-many';
10
+ import type { MaybeBelongsToFields, MaybeHasManyFields } from '@ember-data/model/-private/type-utils';
11
+ export interface MinimalLegacyRecord {
12
+ errors: Errors;
13
+ ___recordState: RecordState;
14
+ currentState: RecordState;
15
+ isDestroyed: boolean;
16
+ isDestroying: boolean;
17
+ isReloading: boolean;
18
+ isValid: boolean;
19
+ [RecordStore]: Store;
20
+ deleteRecord(): void;
21
+ unloadRecord(): void;
22
+ save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
23
+ destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
24
+ }
25
+ export function rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;
26
+ export function unloadRecord<T extends MinimalLegacyRecord>(this: T): void;
27
+ export function belongsTo<T extends MinimalLegacyRecord, K extends MaybeBelongsToFields<T>>(this: T, prop: K): BelongsToReference<T, K>;
28
+ export function hasMany<T extends MinimalLegacyRecord, K extends MaybeHasManyFields<T>>(this: T, prop: K): HasManyReference<T, K>;
29
+ export function reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
30
+ export function changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash;
31
+ export function serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown;
32
+ export function deleteRecord<T extends MinimalLegacyRecord>(this: T): void;
33
+ export function save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
34
+ export function destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
35
+ export function createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T>;
36
+ }
37
+ //# sourceMappingURL=model-methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-methods.d.ts","sourceRoot":"","sources":["../../src/-private/model-methods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAI3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE7E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,WAAW,CAAC;IAC5B,YAAY,EAAE,WAAW,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAErB,YAAY,IAAI,IAAI,CAAC;IACrB,YAAY,IAAI,IAAI,CAAC;IACrB,IAAI,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,aAAa,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CA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