@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,506 +0,0 @@
1
- declare module '@ember-data/model/-private/references/has-many' {
2
- import type { CollectionEdge, Graph } from '@ember-data/graph/-private';
3
- import type Store from '@ember-data/store';
4
- import type { RelatedCollection as ManyArray } from '@ember-data/store/-private';
5
- import type { BaseFinderOptions } from '@ember-data/store/types';
6
- import type { StableRecordIdentifier } from '@warp-drive/core-types';
7
- import type { TypeFromInstanceOrString } from '@warp-drive/core-types/record';
8
- import type { CollectionResourceDocument, CollectionResourceRelationship, ExistingResourceObject, LinkObject, Meta, PaginationLinks } from '@warp-drive/core-types/spec/json-api-raw';
9
- import type { IsUnknown } from '@ember-data/model/-private/belongs-to';
10
- import type { MaybeHasManyFields } from '@ember-data/model/-private/type-utils';
11
- interface ResourceIdentifier {
12
- links?: {
13
- related?: string | LinkObject;
14
- };
15
- meta?: Meta;
16
- }
17
- type ArrayItemType<T> = T extends (infer U)[] ? U : never;
18
- /**
19
- A `HasManyReference` is a low-level API that allows access
20
- and manipulation of a hasMany relationship.
21
-
22
- It is especially useful when you're dealing with `async` relationships
23
- from `@ember-data/model` as it allows synchronous access to
24
- the relationship data if loaded, as well as APIs for loading, reloading
25
- the data or accessing available information without triggering a load.
26
-
27
- It may also be useful when using `sync` relationships with `@ember-data/model`
28
- that need to be loaded/reloaded with more precise timing than marking the
29
- relationship as `async` and relying on autofetch would have allowed.
30
-
31
- However,keep in mind that marking a relationship as `async: false` will introduce
32
- bugs into your application if the data is not always guaranteed to be available
33
- by the time the relationship is accessed. Ergo, it is recommended when using this
34
- approach to utilize `links` for unloaded relationship state instead of identifiers.
35
-
36
- Reference APIs are entangled with the relationship's underlying state,
37
- thus any getters or cached properties that utilize these will properly
38
- invalidate if the relationship state changes.
39
-
40
- References are "stable", meaning that multiple calls to retrieve the reference
41
- for a given relationship will always return the same HasManyReference.
42
-
43
- @class HasManyReference
44
- @public
45
- */
46
- export default class HasManyReference<T = unknown, K extends string = IsUnknown<T> extends true ? string : MaybeHasManyFields<T>, Related = K extends keyof T ? ArrayItemType<Awaited<T[K]>> : unknown> {
47
- graph: Graph;
48
- store: Store;
49
- hasManyRelationship: CollectionEdge;
50
- /**
51
- * The field name on the parent record for this has-many relationship.
52
- *
53
- * @property key
54
- * @type {String}
55
- * @public
56
- */
57
- key: K;
58
- /**
59
- * The type of resource this relationship will contain.
60
- *
61
- * @property type
62
- * @type {String}
63
- * @public
64
- */
65
- type: TypeFromInstanceOrString<Related>;
66
- ___token: object;
67
- ___identifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>;
68
- ___relatedTokenMap: Map<StableRecordIdentifier, object>;
69
- _ref: number;
70
- constructor(store: Store, graph: Graph, parentIdentifier: StableRecordIdentifier<TypeFromInstanceOrString<T>>, hasManyRelationship: CollectionEdge, key: K);
71
- /**
72
- * This method should never be called by user code.
73
- *
74
- * @internal
75
- */
76
- destroy(): void;
77
- /**
78
- * An array of identifiers for the records that this reference refers to.
79
- *
80
- * @property identifiers
81
- * @type {StableRecordIdentifier[]}
82
- * @public
83
- */
84
- get identifiers(): StableRecordIdentifier<TypeFromInstanceOrString<Related>>[];
85
- _resource(): CollectionResourceRelationship;
86
- /**
87
- This returns a string that represents how the reference will be
88
- looked up when it is loaded. If the relationship has a link it will
89
- use the "link" otherwise it defaults to "id".
90
-
91
- Example
92
-
93
- ```js [app/models/post.js]
94
- import Model, { hasMany } from '@ember-data/model';
95
-
96
- export default class PostModel extends Model {
97
- @hasMany('comment', { async: true, inverse: null }) comments;
98
- }
99
- ```
100
-
101
- ```javascript
102
- let post = store.push({
103
- data: {
104
- type: 'post',
105
- id: 1,
106
- relationships: {
107
- comments: {
108
- data: [{ type: 'comment', id: 1 }]
109
- }
110
- }
111
- }
112
- });
113
-
114
- let commentsRef = post.hasMany('comments');
115
-
116
- // get the identifier of the reference
117
- if (commentsRef.remoteType() === "ids") {
118
- let ids = commentsRef.ids();
119
- } else if (commentsRef.remoteType() === "link") {
120
- let link = commentsRef.link();
121
- }
122
- ```
123
-
124
- @public
125
- @return {String} The name of the remote type. This should either be `link` or `ids`
126
- */
127
- remoteType(): 'link' | 'ids';
128
- /**
129
- `ids()` returns an array of the record IDs in this relationship.
130
-
131
- Example
132
-
133
- ```js [app/models/post.js]
134
- import Model, { hasMany } from '@ember-data/model';
135
-
136
- export default class PostModel extends Model {
137
- @hasMany('comment', { async: true, inverse: null }) comments;
138
- }
139
- ```
140
-
141
- ```javascript
142
- let post = store.push({
143
- data: {
144
- type: 'post',
145
- id: 1,
146
- relationships: {
147
- comments: {
148
- data: [{ type: 'comment', id: 1 }]
149
- }
150
- }
151
- }
152
- });
153
-
154
- let commentsRef = post.hasMany('comments');
155
-
156
- commentsRef.ids(); // ['1']
157
- ```
158
-
159
- @public
160
- @return {Array} The ids in this has-many relationship
161
- */
162
- ids(): Array<string | null>;
163
- /**
164
- The link Ember Data will use to fetch or reload this belongs-to
165
- relationship. By default it uses only the "related" resource linkage.
166
-
167
- Example
168
-
169
- ```javascript
170
- // models/blog.js
171
- import Model, { belongsTo } from '@ember-data/model';
172
- export default Model.extend({
173
- user: belongsTo('user', { async: true, inverse: null })
174
- });
175
-
176
- let blog = store.push({
177
- data: {
178
- type: 'blog',
179
- id: 1,
180
- relationships: {
181
- user: {
182
- links: {
183
- related: '/articles/1/author'
184
- }
185
- }
186
- }
187
- }
188
- });
189
- let userRef = blog.belongsTo('user');
190
-
191
- // get the identifier of the reference
192
- if (userRef.remoteType() === "link") {
193
- let link = userRef.link();
194
- }
195
- ```
196
-
197
- @public
198
- @return {String} The link Ember Data will use to fetch or reload this belongs-to relationship.
199
- */
200
- link(): string | null;
201
- /**
202
- * any links that have been received for this relationship
203
- *
204
- * @public
205
- * @return
206
- */
207
- links(): PaginationLinks | null;
208
- /**
209
- The meta data for the has-many relationship.
210
-
211
- Example
212
-
213
- ```javascript
214
- // models/blog.js
215
- import Model, { hasMany } from '@ember-data/model';
216
- export default Model.extend({
217
- users: hasMany('user', { async: true, inverse: null })
218
- });
219
-
220
- let blog = store.push({
221
- data: {
222
- type: 'blog',
223
- id: 1,
224
- relationships: {
225
- users: {
226
- links: {
227
- related: {
228
- href: '/articles/1/authors'
229
- },
230
- },
231
- meta: {
232
- lastUpdated: 1458014400000
233
- }
234
- }
235
- }
236
- }
237
- });
238
-
239
- let usersRef = blog.hasMany('user');
240
-
241
- usersRef.meta() // { lastUpdated: 1458014400000 }
242
- ```
243
-
244
- @public
245
- @return {Object|null} The meta information for the belongs-to relationship.
246
- */
247
- meta(): Meta | null;
248
- /**
249
- `push` can be used to update the data in the relationship and EmberData
250
- will treat the new data as the canonical value of this relationship on
251
- the backend. An empty array will signify the canonical value should be
252
- empty.
253
-
254
- Example model
255
-
256
- ```js [app/models/post.js]
257
- import Model, { hasMany } from '@ember-data/model';
258
-
259
- export default class PostModel extends Model {
260
- @hasMany('comment', { async: true, inverse: null }) comments;
261
- }
262
- ```
263
-
264
- Setup some initial state, note we haven't loaded the comments yet:
265
-
266
- ```js
267
- const post = store.push({
268
- data: {
269
- type: 'post',
270
- id: '1',
271
- relationships: {
272
- comments: {
273
- data: [{ type: 'comment', id: '1' }]
274
- }
275
- }
276
- }
277
- });
278
-
279
- const commentsRef = post.hasMany('comments');
280
- commentsRef.ids(); // ['1']
281
- ```
282
-
283
- Update the state using `push`, note we can do this even without
284
- having loaded these comments yet by providing resource identifiers.
285
-
286
- Both full resources and resource identifiers are supported.
287
-
288
- ```js
289
- await commentsRef.push({
290
- data: [
291
- { type: 'comment', id: '2' },
292
- { type: 'comment', id: '3' },
293
- ]
294
- });
295
-
296
- commentsRef.ids(); // ['2', '3']
297
- ```
298
-
299
- For convenience, you can also pass in an array of resources or resource identifiers
300
- without wrapping them in the `data` property:
301
-
302
- ```js
303
- await commentsRef.push([
304
- { type: 'comment', id: '4' },
305
- { type: 'comment', id: '5' },
306
- ]);
307
-
308
- commentsRef.ids(); // ['4', '5']
309
- ```
310
-
311
- When using the `data` property, you may also include other resource data via included,
312
- as well as provide new links and meta to the relationship.
313
-
314
- ```js
315
- await commentsRef.push({
316
- links: {
317
- related: '/posts/1/comments'
318
- },
319
- meta: {
320
- total: 2
321
- },
322
- data: [
323
- { type: 'comment', id: '4' },
324
- { type: 'comment', id: '5' },
325
- ],
326
- included: [
327
- { type: 'other-thing', id: '1', attributes: { foo: 'bar' },
328
- ]
329
- });
330
- ```
331
-
332
- By default, the store will attempt to fetch any unloaded records before resolving
333
- the returned promise with the ManyArray.
334
-
335
- Alternatively, pass `true` as the second argument to avoid fetching unloaded records
336
- and instead the promise will resolve with void without attempting to fetch. This is
337
- particularly useful if you want to update the state of the relationship without
338
- forcing the load of all of the associated records.
339
-
340
- @public
341
- @param {Array|Object} doc a JSONAPI document object describing the new value of this relationship.
342
- @param {Boolean} [skipFetch] if `true`, do not attempt to fetch unloaded records
343
- @return {Promise<ManyArray | void>}
344
- */
345
- push(doc: ExistingResourceObject[] | CollectionResourceDocument, skipFetch?: boolean): Promise<ManyArray<Related> | void>;
346
- _isLoaded(): boolean | undefined;
347
- /**
348
- `value()` synchronously returns the current value of the has-many
349
- relationship. Unlike `record.relationshipName`, calling
350
- `value()` on a reference does not trigger a fetch if the async
351
- relationship is not yet loaded. If the relationship is not loaded
352
- it will always return `null`.
353
-
354
- Example
355
-
356
- ```js [app/models/post.js]
357
- import Model, { hasMany } from '@ember-data/model';
358
-
359
- export default class PostModel extends Model {
360
- @hasMany('comment', { async: true, inverse: null }) comments;
361
- }
362
- ```
363
-
364
- ```javascript
365
- let post = store.push({
366
- data: {
367
- type: 'post',
368
- id: 1,
369
- relationships: {
370
- comments: {
371
- data: [{ type: 'comment', id: 1 }]
372
- }
373
- }
374
- }
375
- });
376
-
377
- let commentsRef = post.hasMany('comments');
378
-
379
- post.comments.then(function(comments) {
380
- commentsRef.value() === comments
381
- })
382
- ```
383
-
384
- @public
385
- @return {ManyArray}
386
- */
387
- value(): ManyArray<Related> | null;
388
- /**
389
- Loads the relationship if it is not already loaded. If the
390
- relationship is already loaded this method does not trigger a new
391
- load. This causes a request to the specified
392
- relationship link or reloads all items currently in the relationship.
393
-
394
- Example
395
-
396
- ```js [app/models/post.js]
397
- import Model, { hasMany } from '@ember-data/model';
398
-
399
- export default class PostModel extends Model {
400
- @hasMany('comment', { async: true, inverse: null }) comments;
401
- }
402
- ```
403
-
404
- ```javascript
405
- let post = store.push({
406
- data: {
407
- type: 'post',
408
- id: 1,
409
- relationships: {
410
- comments: {
411
- data: [{ type: 'comment', id: 1 }]
412
- }
413
- }
414
- }
415
- });
416
-
417
- let commentsRef = post.hasMany('comments');
418
-
419
- commentsRef.load().then(function(comments) {
420
- //...
421
- });
422
- ```
423
-
424
- You may also pass in an options object whose properties will be
425
- fed forward. This enables you to pass `adapterOptions` into the
426
- request given to the adapter via the reference.
427
-
428
- Example
429
-
430
- ```javascript
431
- commentsRef.load({ adapterOptions: { isPrivate: true } })
432
- .then(function(comments) {
433
- //...
434
- });
435
- ```
436
-
437
- ```js [app/adapters/comment.js]
438
- export default ApplicationAdapter.extend({
439
- findMany(store, type, id, snapshots) {
440
- // In the adapter you will have access to adapterOptions.
441
- let adapterOptions = snapshots[0].adapterOptions;
442
- }
443
- });
444
- ```
445
-
446
- @public
447
- @param {Object} options the options to pass in.
448
- @return {Promise} a promise that resolves with the ManyArray in
449
- this has-many relationship.
450
- */
451
- load(options?: BaseFinderOptions): Promise<ManyArray<Related>>;
452
- /**
453
- Reloads this has-many relationship. This causes a request to the specified
454
- relationship link or reloads all items currently in the relationship.
455
-
456
- Example
457
-
458
- ```js [app/models/post.js]
459
- import Model, { hasMany } from '@ember-data/model';
460
-
461
- export default class PostModel extends Model {
462
- @hasMany('comment', { async: true, inverse: null }) comments;
463
- }
464
- ```
465
-
466
- ```javascript
467
- let post = store.push({
468
- data: {
469
- type: 'post',
470
- id: 1,
471
- relationships: {
472
- comments: {
473
- data: [{ type: 'comment', id: 1 }]
474
- }
475
- }
476
- }
477
- });
478
-
479
- let commentsRef = post.hasMany('comments');
480
-
481
- commentsRef.reload().then(function(comments) {
482
- //...
483
- });
484
- ```
485
-
486
- You may also pass in an options object whose properties will be
487
- fed forward. This enables you to pass `adapterOptions` into the
488
- request given to the adapter via the reference. A full example
489
- can be found in the `load` method.
490
-
491
- Example
492
-
493
- ```javascript
494
- commentsRef.reload({ adapterOptions: { isPrivate: true } })
495
- ```
496
-
497
- @public
498
- @param {Object} options the options to pass in.
499
- @return {Promise} a promise that resolves with the ManyArray in this has-many relationship.
500
- */
501
- reload(options?: BaseFinderOptions): Promise<ManyArray<Related>>;
502
- }
503
- export function isMaybeResource(object: ExistingResourceObject | ResourceIdentifier): object is ExistingResourceObject;
504
- export {};
505
- }
506
- //# sourceMappingURL=has-many.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has-many.d.ts","sourceRoot":"","sources":["../../../src/-private/references/has-many.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EAAE,iBAAiB,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,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AG,IAAI;IAclC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAapE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CAMjE;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,sBAAsB,GAAG,kBAAkB,GAAG,MAAM,IAAI,sBAAsB,CAGrH"}
@@ -1,65 +0,0 @@
1
- declare module '@ember-data/model/-private/schema-provider' {
2
- import type Store from '@ember-data/store';
3
- import type { SchemaService } from '@ember-data/store/types';
4
- import type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
5
- import type { ObjectValue } from '@warp-drive/core-types/json/raw';
6
- import type { Derivation, HashFn, Transformation } from '@warp-drive/core-types/schema/concepts';
7
- import type { ArrayField, DerivedField, GenericField, HashField, LegacyAttributeField, LegacyField, LegacyRelationshipField, ObjectField, ObjectSchema, ResourceSchema } from '@warp-drive/core-types/schema/fields';
8
- import type { ModelFactory, ModelStore } from '@ember-data/model/-private/model';
9
- type AttributesSchema = ReturnType<Exclude<SchemaService['attributesDefinitionFor'], undefined>>;
10
- type RelationshipsSchema = ReturnType<Exclude<SchemaService['relationshipsDefinitionFor'], undefined>>;
11
- type InternalSchema = {
12
- schema: ResourceSchema;
13
- fields: Map<string, LegacyAttributeField | LegacyRelationshipField>;
14
- attributes: Record<string, LegacyAttributeField>;
15
- relationships: Record<string, LegacyRelationshipField>;
16
- };
17
- export interface ModelSchemaProvider {
18
- attributesDefinitionFor(resource: RecordIdentifier | {
19
- type: string;
20
- }): AttributesSchema;
21
- relationshipsDefinitionFor(resource: RecordIdentifier | {
22
- type: string;
23
- }): RelationshipsSchema;
24
- doesTypeExist(type: string): boolean;
25
- }
26
- export class ModelSchemaProvider implements SchemaService {
27
- store: ModelStore;
28
- _schemas: Map<string, InternalSchema>;
29
- _typeMisses: Set<string>;
30
- constructor(store: ModelStore);
31
- resourceTypes(): Readonly<string[]>;
32
- hasTrait(type: string): boolean;
33
- resourceHasTrait(resource: StableRecordIdentifier | {
34
- type: string;
35
- }, trait: string): boolean;
36
- transformation(field: GenericField | ObjectField | ArrayField | {
37
- type: string;
38
- }): Transformation;
39
- derivation(field: DerivedField | {
40
- type: string;
41
- }): Derivation;
42
- hashFn(field: HashField | {
43
- type: string;
44
- }): HashFn;
45
- resource(resource: StableRecordIdentifier | {
46
- type: string;
47
- }): ResourceSchema | ObjectSchema;
48
- registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
49
- registerResource(schema: ResourceSchema | ObjectSchema): void;
50
- registerTransformation(transform: Transformation): void;
51
- registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void;
52
- registerHashFn(hashFn: HashFn): void;
53
- _loadModelSchema(type: string): InternalSchema;
54
- fields(resource: RecordIdentifier | {
55
- type: string;
56
- }): Map<string, LegacyField>;
57
- hasResource(resource: {
58
- type: string;
59
- }): boolean;
60
- }
61
- export function buildSchema(store: Store): SchemaService;
62
- export function getModelFactory(store: ModelStore, type: string): ModelFactory | null;
63
- export {};
64
- }
65
- //# sourceMappingURL=schema-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-provider.d.ts","sourceRoot":"","sources":["../../src/-private/schema-provider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iC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GAAG,CAAC,MAAM,EAAE,WAAW,CAAC;IAU/E,WAAW,CAAC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO;CAqBjD;AA2DD,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CAEvD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAkCpF"}
@@ -1,59 +0,0 @@
1
- declare module '@ember-data/model/-private/type-utils' {
2
- import type { RelatedCollection } from '@ember-data/store/-private';
3
- import type { TypedRecordInstance } from '@warp-drive/core-types/record';
4
- import type { Type } from '@warp-drive/core-types/symbols';
5
- import type { Model } from '@ember-data/model/-private/model';
6
- import type { PromiseBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
7
- import type { PromiseManyArray } from '@ember-data/model/-private/promise-many-array';
8
- type ExcludeNull<T> = Exclude<T, null> extends never ? T : Exclude<T, null>;
9
- type GetMappedKey<M, V> = {
10
- [K in keyof M]-?: ExcludeNull<M[K]> extends V ? K : never;
11
- }[keyof M] & string;
12
- /**
13
- * Get the keys of fields that are maybe defined as `belongsTo` relationships
14
- *
15
- * "Maybe" because getter/computed fields might be returning values that look
16
- * like relationships, but are not.
17
- *
18
- */
19
- export type MaybeBelongsToFields<ThisType> = _TrueKeys<ThisType> extends never ? string : _MaybeBelongsToFields<ThisType>;
20
- export type _MaybeBelongsToFields<ThisType> = GetMappedKey<ThisType, PromiseBelongsTo | TypedRecordInstance>;
21
- /**
22
- * Get the keys of fields that are maybe defined as `hasMany` relationships
23
- *
24
- * "Maybe" because getter/computed fields might be returning values that look
25
- * like relationships, but are not.
26
- *
27
- */
28
- export type MaybeHasManyFields<ThisType> = _TrueKeys<ThisType> extends never ? string : _MaybeHasManyFields<ThisType>;
29
- type _MaybeHasManyFields<ThisType> = GetMappedKey<ThisType, RelatedCollection | PromiseManyArray>;
30
- /**
31
- * Get the keys of fields that are maybe defined as `attr` fields
32
- *
33
- * "Maybe" because getter/computed fields might be returning values that look
34
- * like attributes, but are not.
35
- *
36
- * This is computed by excluding the keys that are defined as `belongsTo` or `hasMany`
37
- * as well as the keys on EmberObject and the Model base class
38
- *
39
- */
40
- export type MaybeAttrFields<ThisType> = Exclude<_TrueKeys<ThisType>, _MaybeBelongsToFields<ThisType> | _MaybeHasManyFields<ThisType>>;
41
- /**
42
- * Get the keys of fields that are maybe defined as relationships
43
- *
44
- * "Maybe" because getter/computed fields might be returning values that look
45
- * like relationships, but are not.
46
- *
47
- */
48
- export type MaybeRelationshipFields<ThisType> = _TrueKeys<ThisType> extends never ? string : _MaybeBelongsToFields<ThisType> | _MaybeHasManyFields<ThisType>;
49
- type _TrueKeys<ThisType> = Exclude<keyof ThisType & string, (keyof Model & string) | typeof Type>;
50
- export type isSubClass<ThisType> = _TrueKeys<ThisType> extends never ? false : true;
51
- /**
52
- * Get the keys of all fields defined on the given subclass of Model
53
- * that don't exist on EmberObject or Model.
54
- *
55
- */
56
- export type SubclassKeys<ThisType> = _TrueKeys<ThisType> extends never ? string : _TrueKeys<ThisType>;
57
- export {};
58
- }
59
- //# sourceMappingURL=type-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../src/-private/type-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,KAAK,WAAW,CAAC,CAAC,IAAI,OAAO,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AAQ,IAAI,OAAO,CAAC,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AAClG,MAAM,MAAM,UAAU,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC;AACpF;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- declare module '@ember-data/model/-private/util' {
2
- export type DecoratorPropertyDescriptor = (PropertyDescriptor & {
3
- initializer?: () => unknown;
4
- }) | undefined;
5
- export function isElementDescriptor(args: unknown[]): args is [object, string, DecoratorPropertyDescriptor];
6
- export function normalizeModelName(type: string): string;
7
- }
8
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/-private/util.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,2BAA2B,GAAG,CAAC,kBAAkB,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC,GAAG,SAAS,CAAC;AAE7G,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,2BAA2B,CAAC,CAkB1G;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsBvD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"-private.d.ts","sourceRoot":"","sources":["../src/-private.ts"],"names":[],"mappings":"AAAA,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 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,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,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEpD,YAAY,EAAE,gBAAgB,IAAI,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACxF,YAAY,EAAE,gBAAgB,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACtF,YAAY,EAAE,iBAAiB,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACjF,YAAY,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC"}