@ember-data/model 5.4.0-alpha.6 → 5.4.0-alpha.60

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 (78) hide show
  1. package/README.md +19 -0
  2. package/addon/-private.js +2 -2
  3. package/addon/has-many-BuTJfT5a.js +652 -0
  4. package/addon/has-many-BuTJfT5a.js.map +1 -0
  5. package/addon/{hooks-7a58334b.js → hooks-BMoEt0SI.js} +34 -15
  6. package/addon/hooks-BMoEt0SI.js.map +1 -0
  7. package/addon/hooks.js +1 -1
  8. package/addon/index.js +3 -3
  9. package/addon/index.js.map +1 -1
  10. package/addon/migration-support.js +118 -0
  11. package/addon/migration-support.js.map +1 -0
  12. package/addon/{model-520a761c.js → model-DJ9C4aZ-.js} +2159 -2113
  13. package/addon/model-DJ9C4aZ-.js.map +1 -0
  14. package/addon/util-CSYkrwfb.js +35 -0
  15. package/addon/util-CSYkrwfb.js.map +1 -0
  16. package/addon-main.js +1 -0
  17. package/ember-data-logo-dark.svg +12 -0
  18. package/ember-data-logo-light.svg +12 -0
  19. package/package.json +88 -37
  20. package/unstable-preview-types/-private/attr.d.ts +174 -0
  21. package/unstable-preview-types/-private/attr.d.ts.map +1 -0
  22. package/unstable-preview-types/-private/attr.type-test.d.ts +4 -0
  23. package/unstable-preview-types/-private/attr.type-test.d.ts.map +1 -0
  24. package/unstable-preview-types/-private/belongs-to.d.ts +180 -0
  25. package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -0
  26. package/unstable-preview-types/-private/belongs-to.type-test.d.ts +4 -0
  27. package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +1 -0
  28. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +8 -0
  29. package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  30. package/unstable-preview-types/-private/errors.d.ts +308 -0
  31. package/unstable-preview-types/-private/errors.d.ts.map +1 -0
  32. package/unstable-preview-types/-private/has-many.d.ts +169 -0
  33. package/unstable-preview-types/-private/has-many.d.ts.map +1 -0
  34. package/unstable-preview-types/-private/has-many.type-test.d.ts +4 -0
  35. package/unstable-preview-types/-private/has-many.type-test.d.ts.map +1 -0
  36. package/unstable-preview-types/-private/hooks.d.ts +13 -0
  37. package/unstable-preview-types/-private/hooks.d.ts.map +1 -0
  38. package/unstable-preview-types/-private/legacy-relationships-support.d.ts +64 -0
  39. package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -0
  40. package/unstable-preview-types/-private/many-array.d.ts +198 -0
  41. package/unstable-preview-types/-private/many-array.d.ts.map +1 -0
  42. package/unstable-preview-types/-private/model-for-mixin.d.ts +6 -0
  43. package/unstable-preview-types/-private/model-for-mixin.d.ts.map +1 -0
  44. package/unstable-preview-types/-private/model-methods.d.ts +36 -0
  45. package/unstable-preview-types/-private/model-methods.d.ts.map +1 -0
  46. package/unstable-preview-types/-private/model.d.ts +1303 -0
  47. package/unstable-preview-types/-private/model.d.ts.map +1 -0
  48. package/unstable-preview-types/-private/model.type-test.d.ts +4 -0
  49. package/unstable-preview-types/-private/model.type-test.d.ts.map +1 -0
  50. package/unstable-preview-types/-private/notify-changes.d.ts +8 -0
  51. package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -0
  52. package/unstable-preview-types/-private/promise-belongs-to.d.ts +49 -0
  53. package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -0
  54. package/unstable-preview-types/-private/promise-many-array.d.ts +131 -0
  55. package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -0
  56. package/unstable-preview-types/-private/promise-proxy-base.d.ts +35 -0
  57. package/unstable-preview-types/-private/record-state.d.ts +91 -0
  58. package/unstable-preview-types/-private/record-state.d.ts.map +1 -0
  59. package/unstable-preview-types/-private/references/belongs-to.d.ts +503 -0
  60. package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -0
  61. package/unstable-preview-types/-private/references/has-many.d.ts +515 -0
  62. package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -0
  63. package/unstable-preview-types/-private/schema-provider.d.ts +27 -0
  64. package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -0
  65. package/unstable-preview-types/-private/util.d.ts +11 -0
  66. package/unstable-preview-types/-private/util.d.ts.map +1 -0
  67. package/unstable-preview-types/-private.d.ts +12 -0
  68. package/unstable-preview-types/-private.d.ts.map +1 -0
  69. package/unstable-preview-types/hooks.d.ts +5 -0
  70. package/unstable-preview-types/hooks.d.ts.map +1 -0
  71. package/unstable-preview-types/index.d.ts +75 -0
  72. package/unstable-preview-types/index.d.ts.map +1 -0
  73. package/unstable-preview-types/migration-support.d.ts +11 -0
  74. package/unstable-preview-types/migration-support.d.ts.map +1 -0
  75. package/addon/has-many-665b8730.js +0 -507
  76. package/addon/has-many-665b8730.js.map +0 -1
  77. package/addon/hooks-7a58334b.js.map +0 -1
  78. package/addon/model-520a761c.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-many.d.ts","sourceRoot":"","sources":["../../src/-private/has-many.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAkFvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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":"AAGA,OAAO,EAAoC,KAAK,KAAK,EAAY,MAAM,4BAA4B,CAAC;AACpG,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,64 @@
1
+ declare module '@ember-data/model/-private/legacy-relationships-support' {
2
+ import type { UpgradedMeta } from '@ember-data/graph/-private/-edge-definition';
3
+ import type { CollectionEdge } from '@ember-data/graph/-private/edges/collection';
4
+ import type { ResourceEdge } from '@ember-data/graph/-private/edges/resource';
5
+ import type { Graph } from '@ember-data/graph/-private/graph';
6
+ import type Store from '@ember-data/store';
7
+ import type { Cache } from '@ember-data/store/-types/q/cache';
8
+ import type { JsonApiRelationship } from '@ember-data/store/-types/q/record-data-json-api';
9
+ import type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';
10
+ import type { BaseFinderOptions } from '@ember-data/store/-types/q/store';
11
+ import type { StableRecordIdentifier } from '@warp-drive/core-types';
12
+ import type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';
13
+ import type { LocalRelationshipOperation } from '@warp-drive/core-types/graph';
14
+ import type { CollectionResourceRelationship, SingleResourceRelationship } from '@warp-drive/core-types/spec/raw';
15
+ import type { ManyArray } from '@ember-data/model/-private';
16
+ import RelatedCollection from '@ember-data/model/-private/many-array';
17
+ import type { MinimalLegacyRecord } from '@ember-data/model/-private/model-methods';
18
+ import type { BelongsToProxyCreateArgs } from '@ember-data/model/-private/promise-belongs-to';
19
+ import { PromiseBelongsTo } from '@ember-data/model/-private/promise-belongs-to';
20
+ import type { HasManyProxyCreateArgs } from '@ember-data/model/-private/promise-many-array';
21
+ import PromiseManyArray from '@ember-data/model/-private/promise-many-array';
22
+ import BelongsToReference from '@ember-data/model/-private/references/belongs-to';
23
+ import HasManyReference from '@ember-data/model/-private/references/has-many';
24
+ export const LEGACY_SUPPORT: Map<StableRecordIdentifier | MinimalLegacyRecord, LegacySupport>;
25
+ export function lookupLegacySupport(record: MinimalLegacyRecord): LegacySupport;
26
+ export class LegacySupport {
27
+ record: MinimalLegacyRecord;
28
+ store: Store;
29
+ graph: Graph;
30
+ cache: Cache;
31
+ references: Record<string, BelongsToReference | HasManyReference>;
32
+ identifier: StableRecordIdentifier;
33
+ _manyArrayCache: Record<string, RelatedCollection>;
34
+ _relationshipPromisesCache: Record<string, Promise<RelatedCollection | OpaqueRecordInstance>>;
35
+ _relationshipProxyCache: Record<string, PromiseManyArray | PromiseBelongsTo | undefined>;
36
+ _pending: Record<string, Promise<StableRecordIdentifier | null> | undefined>;
37
+ isDestroying: boolean;
38
+ isDestroyed: boolean;
39
+ constructor(record: MinimalLegacyRecord);
40
+ _syncArray(array: RelatedCollection): void;
41
+ mutate(mutation: LocalRelationshipOperation): void;
42
+ _findBelongsTo(key: string, resource: SingleResourceRelationship, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null>;
43
+ reloadBelongsTo(key: string, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null>;
44
+ getBelongsTo(key: string, options?: BaseFinderOptions): PromiseBelongsTo | OpaqueRecordInstance | null;
45
+ setDirtyBelongsTo(key: string, value: OpaqueRecordInstance | null): void;
46
+ _getCurrentState(identifier: StableRecordIdentifier, field: string): [StableRecordIdentifier[], CollectionRelationship];
47
+ getManyArray<T>(key: string, definition?: UpgradedMeta): RelatedCollection<T>;
48
+ fetchAsyncHasMany(key: string, relationship: CollectionEdge, manyArray: RelatedCollection, options?: BaseFinderOptions): Promise<RelatedCollection>;
49
+ reloadHasMany<T>(key: string, options?: BaseFinderOptions): Promise<ManyArray<T>> | PromiseManyArray<T>;
50
+ getHasMany(key: string, options?: BaseFinderOptions): PromiseManyArray | RelatedCollection;
51
+ _updatePromiseProxyFor(kind: 'hasMany', key: string, args: HasManyProxyCreateArgs): PromiseManyArray;
52
+ _updatePromiseProxyFor(kind: 'belongsTo', key: string, args: BelongsToProxyCreateArgs): PromiseBelongsTo;
53
+ _updatePromiseProxyFor(kind: 'belongsTo', key: string, args: {
54
+ promise: Promise<OpaqueRecordInstance | null>;
55
+ }): PromiseBelongsTo;
56
+ referenceFor(kind: 'belongsTo', name: string): BelongsToReference;
57
+ referenceFor(kind: 'hasMany', name: string): HasManyReference;
58
+ _findHasManyByJsonApiResource(resource: CollectionResourceRelationship, parentIdentifier: StableRecordIdentifier, relationship: CollectionEdge, options?: BaseFinderOptions): Promise<void | unknown[]> | void;
59
+ _findBelongsToByJsonApiResource(resource: SingleResourceRelationship, parentIdentifier: StableRecordIdentifier, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<StableRecordIdentifier | null>;
60
+ destroy(): void;
61
+ }
62
+ export function areAllInverseRecordsLoaded(store: Store, resource: JsonApiRelationship): boolean;
63
+ }
64
+ //# 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":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAa,MAAM,kCAAkC,CAAC;AAGzE,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAS3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,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AC9B,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;IA6FzC,OAAO;CAyBR;AA0GD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAgB/F"}
@@ -0,0 +1,198 @@
1
+ declare module '@ember-data/model/-private/many-array' {
2
+ import type Store from '@ember-data/store';
3
+ import type { NativeProxy } from '@ember-data/store/-private';
4
+ import { MUTATE, RecordArray } from '@ember-data/store/-private';
5
+ import type { CreateRecordProperties } from '@ember-data/store/-private/store-service';
6
+ import type { Cache } from '@ember-data/store/-types/q/cache';
7
+ import type { ModelSchema } from '@ember-data/store/-types/q/ds-model';
8
+ import type { BaseFinderOptions } from '@ember-data/store/-types/q/store';
9
+ import type { Signal } from '@ember-data/tracking/-private';
10
+ import type { StableRecordIdentifier } from '@warp-drive/core-types';
11
+ import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
12
+ import type { Links, PaginationLinks } from '@warp-drive/core-types/spec/raw';
13
+ import type { LegacySupport } from '@ember-data/model/-private/legacy-relationships-support';
14
+ export interface ManyArrayCreateArgs {
15
+ identifiers: StableRecordIdentifier[];
16
+ type: string;
17
+ store: Store;
18
+ allowMutation: boolean;
19
+ manager: LegacySupport;
20
+ identifier: StableRecordIdentifier;
21
+ cache: Cache;
22
+ meta: Record<string, unknown> | null;
23
+ links: Links | PaginationLinks | null;
24
+ key: string;
25
+ isPolymorphic: boolean;
26
+ isAsync: boolean;
27
+ _inverseIsAsync: boolean;
28
+ isLoaded: boolean;
29
+ }
30
+ /**
31
+ A `ManyArray` is a `MutableArray` that represents the contents of a has-many
32
+ relationship.
33
+
34
+ The `ManyArray` is instantiated lazily the first time the relationship is
35
+ requested.
36
+
37
+ This class is not intended to be directly instantiated by consuming applications.
38
+
39
+ ### Inverses
40
+
41
+ Often, the relationships in Ember Data applications will have
42
+ an inverse. For example, imagine the following models are
43
+ defined:
44
+
45
+ ```app/models/post.js
46
+ import Model, { hasMany } from '@ember-data/model';
47
+
48
+ export default class PostModel extends Model {
49
+ @hasMany('comment') comments;
50
+ }
51
+ ```
52
+
53
+ ```app/models/comment.js
54
+ import Model, { belongsTo } from '@ember-data/model';
55
+
56
+ export default class CommentModel extends Model {
57
+ @belongsTo('post') post;
58
+ }
59
+ ```
60
+
61
+ If you created a new instance of `Post` and added
62
+ a `Comment` record to its `comments` has-many
63
+ relationship, you would expect the comment's `post`
64
+ property to be set to the post that contained
65
+ the has-many.
66
+
67
+ We call the record to which a relationship belongs-to the
68
+ relationship's _owner_.
69
+
70
+ @class ManyArray
71
+ @public
72
+ */
73
+ export default class RelatedCollection<T = unknown> extends RecordArray<T> {
74
+ isAsync: boolean;
75
+ /**
76
+ The loading state of this array
77
+
78
+ @property {Boolean} isLoaded
79
+ @public
80
+ */
81
+ isLoaded: boolean;
82
+ /**
83
+ `true` if the relationship is polymorphic, `false` otherwise.
84
+
85
+ @property {Boolean} isPolymorphic
86
+ @private
87
+ */
88
+ isPolymorphic: boolean;
89
+ _inverseIsAsync: boolean;
90
+ /**
91
+ Metadata associated with the request for async hasMany relationships.
92
+
93
+ Example
94
+
95
+ Given that the server returns the following JSON payload when fetching a
96
+ hasMany relationship:
97
+
98
+ ```js
99
+ {
100
+ "comments": [{
101
+ "id": 1,
102
+ "comment": "This is the first comment",
103
+ }, {
104
+ // ...
105
+ }],
106
+
107
+ "meta": {
108
+ "page": 1,
109
+ "total": 5
110
+ }
111
+ }
112
+ ```
113
+
114
+ You can then access the meta data via the `meta` property:
115
+
116
+ ```js
117
+ let comments = await post.comments;
118
+ let meta = comments.meta;
119
+
120
+ // meta.page => 1
121
+ // meta.total => 5
122
+ ```
123
+
124
+ @property {Object | null} meta
125
+ @public
126
+ */
127
+ meta: Record<string, unknown> | null;
128
+ /**
129
+ * Retrieve the links for this relationship
130
+ *
131
+ @property {Object | null} links
132
+ @public
133
+ */
134
+ links: Links | PaginationLinks | null;
135
+ identifier: StableRecordIdentifier;
136
+ cache: Cache;
137
+ _manager: LegacySupport;
138
+ store: Store;
139
+ key: string;
140
+ type: ModelSchema;
141
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
142
+ constructor(options: ManyArrayCreateArgs);
143
+ [MUTATE](target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: Signal): unknown;
144
+ notify(): void;
145
+ /**
146
+ Reloads all of the records in the manyArray. If the manyArray
147
+ holds a relationship that was originally fetched using a links url
148
+ EmberData will revisit the original links url to repopulate the
149
+ relationship.
150
+
151
+ If the ManyArray holds the result of a `store.query()` reload will
152
+ re-run the original query.
153
+
154
+ Example
155
+
156
+ ```javascript
157
+ let user = store.peekRecord('user', '1')
158
+ await login(user);
159
+
160
+ let permissions = await user.permissions;
161
+ await permissions.reload();
162
+ ```
163
+
164
+ @method reload
165
+ @public
166
+ */
167
+ reload(options?: BaseFinderOptions): Promise<this>;
168
+ /**
169
+ Saves all of the records in the `ManyArray`.
170
+
171
+ Example
172
+
173
+ ```javascript
174
+ let inbox = await store.findRecord('inbox', '1');
175
+ let messages = await inbox.messages;
176
+ messages.forEach((message) => {
177
+ message.isRead = true;
178
+ });
179
+ messages.save();
180
+ ```
181
+
182
+ @method save
183
+ @public
184
+ @return {PromiseArray} promise
185
+ */
186
+ /**
187
+ Create a child record within the owner
188
+
189
+ @method createRecord
190
+ @public
191
+ @param {Object} hash
192
+ @return {Model} record
193
+ */
194
+ createRecord(hash: CreateRecordProperties<T>): T;
195
+ destroy(): void;
196
+ }
197
+ }
198
+ //# sourceMappingURL=many-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"many-array.d.ts","sourceRoot":"","sources":["../../src/-private/many-array.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAGL,MAAM,EAEN,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ixin' {
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,36 @@
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
+ export interface MinimalLegacyRecord {
11
+ errors: Errors;
12
+ ___recordState: RecordState;
13
+ currentState: RecordState;
14
+ isDestroyed: boolean;
15
+ isDestroying: boolean;
16
+ isReloading: boolean;
17
+ isValid: boolean;
18
+ [RecordStore]: Store;
19
+ deleteRecord(): void;
20
+ unloadRecord(): void;
21
+ save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
22
+ destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
23
+ }
24
+ export function rollbackAttributes<T extends MinimalLegacyRecord>(this: T): void;
25
+ export function unloadRecord<T extends MinimalLegacyRecord>(this: T): void;
26
+ export function belongsTo<T extends MinimalLegacyRecord, K extends keyof T & string>(this: T, prop: K): BelongsToReference<T, K>;
27
+ export function hasMany<T extends MinimalLegacyRecord, K extends keyof T & string>(this: T, prop: K): HasManyReference<T, K>;
28
+ export function reload<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
29
+ export function changedAttributes<T extends MinimalLegacyRecord>(this: T): ChangedAttributesHash;
30
+ export function serialize<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): unknown;
31
+ export function deleteRecord<T extends MinimalLegacyRecord>(this: T): void;
32
+ export function save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
33
+ export function destroyRecord<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<T>;
34
+ export function createSnapshot<T extends MinimalLegacyRecord>(this: T): Snapshot<T>;
35
+ }
36
+ //# 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":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAG3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D,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,E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