@ember-data/model 5.4.0-alpha.4 → 5.4.0-alpha.41
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.
- package/addon/-private.js +2 -2
- package/addon/has-many-B3FpdTTp.js +655 -0
- package/addon/has-many-B3FpdTTp.js.map +1 -0
- package/addon/{hooks-62d36619.js → hooks-CHMQx9Ce.js} +34 -15
- package/addon/hooks-CHMQx9Ce.js.map +1 -0
- package/addon/hooks.js +1 -1
- package/addon/index.js +3 -3
- package/addon/index.js.map +1 -1
- package/addon/migration-support.js +118 -0
- package/addon/migration-support.js.map +1 -0
- package/addon/{model-e642556d.js → model-DvL_NWQw.js} +2035 -1881
- package/addon/model-DvL_NWQw.js.map +1 -0
- package/addon/util-CSYkrwfb.js +35 -0
- package/addon/util-CSYkrwfb.js.map +1 -0
- package/addon-main.js +1 -0
- package/package.json +88 -37
- package/unstable-preview-types/-private/attr.d.ts +174 -0
- package/unstable-preview-types/-private/attr.d.ts.map +1 -0
- package/unstable-preview-types/-private/attr.type-test.d.ts +4 -0
- package/unstable-preview-types/-private/attr.type-test.d.ts.map +1 -0
- package/unstable-preview-types/-private/belongs-to.d.ts +180 -0
- package/unstable-preview-types/-private/belongs-to.d.ts.map +1 -0
- package/unstable-preview-types/-private/belongs-to.type-test.d.ts +4 -0
- package/unstable-preview-types/-private/belongs-to.type-test.d.ts.map +1 -0
- package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts +8 -0
- package/unstable-preview-types/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
- package/unstable-preview-types/-private/errors.d.ts +308 -0
- package/unstable-preview-types/-private/errors.d.ts.map +1 -0
- package/unstable-preview-types/-private/has-many.d.ts +169 -0
- package/unstable-preview-types/-private/has-many.d.ts.map +1 -0
- package/unstable-preview-types/-private/has-many.type-test.d.ts +4 -0
- package/unstable-preview-types/-private/has-many.type-test.d.ts.map +1 -0
- package/unstable-preview-types/-private/hooks.d.ts +13 -0
- package/unstable-preview-types/-private/hooks.d.ts.map +1 -0
- package/unstable-preview-types/-private/legacy-relationships-support.d.ts +64 -0
- package/unstable-preview-types/-private/legacy-relationships-support.d.ts.map +1 -0
- package/unstable-preview-types/-private/many-array.d.ts +198 -0
- package/unstable-preview-types/-private/many-array.d.ts.map +1 -0
- package/unstable-preview-types/-private/model-for-mixin.d.ts +6 -0
- package/unstable-preview-types/-private/model-for-mixin.d.ts.map +1 -0
- package/unstable-preview-types/-private/model-methods.d.ts +36 -0
- package/unstable-preview-types/-private/model-methods.d.ts.map +1 -0
- package/unstable-preview-types/-private/model.d.ts +108 -0
- package/unstable-preview-types/-private/model.type-test.d.ts +4 -0
- package/unstable-preview-types/-private/model.type-test.d.ts.map +1 -0
- package/unstable-preview-types/-private/notify-changes.d.ts +8 -0
- package/unstable-preview-types/-private/notify-changes.d.ts.map +1 -0
- package/unstable-preview-types/-private/promise-belongs-to.d.ts +47 -0
- package/unstable-preview-types/-private/promise-belongs-to.d.ts.map +1 -0
- package/unstable-preview-types/-private/promise-many-array.d.ts +129 -0
- package/unstable-preview-types/-private/promise-many-array.d.ts.map +1 -0
- package/unstable-preview-types/-private/promise-proxy-base.d.ts +35 -0
- package/unstable-preview-types/-private/record-state.d.ts +91 -0
- package/unstable-preview-types/-private/record-state.d.ts.map +1 -0
- package/unstable-preview-types/-private/references/belongs-to.d.ts +503 -0
- package/unstable-preview-types/-private/references/belongs-to.d.ts.map +1 -0
- package/unstable-preview-types/-private/references/has-many.d.ts +515 -0
- package/unstable-preview-types/-private/references/has-many.d.ts.map +1 -0
- package/unstable-preview-types/-private/schema-provider.d.ts +27 -0
- package/unstable-preview-types/-private/schema-provider.d.ts.map +1 -0
- package/unstable-preview-types/-private/util.d.ts +11 -0
- package/unstable-preview-types/-private/util.d.ts.map +1 -0
- package/unstable-preview-types/-private.d.ts +12 -0
- package/unstable-preview-types/-private.d.ts.map +1 -0
- package/unstable-preview-types/hooks.d.ts +5 -0
- package/unstable-preview-types/hooks.d.ts.map +1 -0
- package/unstable-preview-types/index.d.ts +75 -0
- package/unstable-preview-types/index.d.ts.map +1 -0
- package/unstable-preview-types/migration-support.d.ts +11 -0
- package/unstable-preview-types/migration-support.d.ts.map +1 -0
- package/addon/has-many-d1ca9997.js +0 -507
- package/addon/has-many-d1ca9997.js.map +0 -1
- package/addon/hooks-62d36619.js.map +0 -1
- package/addon/model-e642556d.js.map +0 -1
|
@@ -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;
|
|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AM;IAON;;;;;;;;;;;;;;;;;;;;;MAqBE;IACF,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlD;;;;;;;;;;;;;;;;;MAiBE;IAEF;;;;;;;MAOE;IACF,YAAY,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,CAAC;IASvC,OAAO;CAGjB"}
|
|
@@ -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,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(this: MinimalLegacyRecord): void;
|
|
25
|
+
export function unloadRecord(this: MinimalLegacyRecord): void;
|
|
26
|
+
export function belongsTo(this: MinimalLegacyRecord, prop: string): BelongsToReference;
|
|
27
|
+
export function hasMany(this: MinimalLegacyRecord, prop: string): HasManyReference;
|
|
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-meth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,mBAAmB,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAErF;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAEjF;AAED,wBAAgB,MAAM,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAsBhH;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,GAAG,qBAAqB,CAE/F;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAG5G;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAKzE;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAW1G;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUnH;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAalF"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
declare module '@ember-data/model/-private/model' {
|
|
2
|
+
import type EmberObject from '@ember/object';
|
|
3
|
+
|
|
4
|
+
import type { Errors } from '@ember-data/model/-private/errors';
|
|
5
|
+
import type Store from '@ember-data/store';
|
|
6
|
+
|
|
7
|
+
import type { AttributeSchema, RelationshipSchema, RelationshipsSchema } from '@warp-drive/core-types/schema';
|
|
8
|
+
import type { JsonApiError } from '@ember-data/store/-types/q/record-data-json-api';
|
|
9
|
+
import type HasManyReference from '@ember-data/model/-private/references/has-many';
|
|
10
|
+
import type BelongsToReference from '@ember-data/model/-private/references/belongs-to';
|
|
11
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
12
|
+
import type { LegacySupport } from '@ember-data/model/-private/legacy-relationships-support';
|
|
13
|
+
import type { Cache } from '@warp-drive/core-types/cache';
|
|
14
|
+
import type RecordState from '@ember-data/model/-private/record-state';
|
|
15
|
+
|
|
16
|
+
export type ModelCreateArgs = {
|
|
17
|
+
_createProps: Record<string, unknown>;
|
|
18
|
+
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
19
|
+
_secretInit: {
|
|
20
|
+
identifier: StableRecordIdentifier;
|
|
21
|
+
cache: Cache;
|
|
22
|
+
store: Store;
|
|
23
|
+
cb: (record: Model, cache: Cache, identifier: StableRecordIdentifier, store: Store) => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
class Model extends EmberObject {
|
|
28
|
+
store: Store;
|
|
29
|
+
errors: Errors;
|
|
30
|
+
currentState: RecordState;
|
|
31
|
+
adapterError?: Error;
|
|
32
|
+
toString(): string;
|
|
33
|
+
save(): Promise<this>;
|
|
34
|
+
hasMany<T extends keyof this & string>(key: T): HasManyReference<this, T>;
|
|
35
|
+
belongsTo<T extends keyof this & string>(key: T): BelongsToReference<this, T>;
|
|
36
|
+
eachRelationship<T extends Model, K extends keyof T & string>(
|
|
37
|
+
callback: (this: T, key: K, meta: RelationshipSchema) => void,
|
|
38
|
+
binding?: T
|
|
39
|
+
): void;
|
|
40
|
+
eachAttribute<T extends Model, K extends keyof T & string>(
|
|
41
|
+
callback: (this: T, key: K, meta: AttributeSchema) => void,
|
|
42
|
+
binding?: T
|
|
43
|
+
): void;
|
|
44
|
+
invalidErrorsChanged(errors: JsonApiError[]): void;
|
|
45
|
+
rollbackAttributes(): void;
|
|
46
|
+
changedAttributes(): Record<string, [unknown, unknown]>;
|
|
47
|
+
id: string;
|
|
48
|
+
isValid: boolean;
|
|
49
|
+
isSaving: boolean;
|
|
50
|
+
isNew: boolean;
|
|
51
|
+
isEmpty: boolean;
|
|
52
|
+
isDeleted: boolean;
|
|
53
|
+
hasDirtyAttributes: boolean;
|
|
54
|
+
isLoaded: boolean;
|
|
55
|
+
isLoading: boolean;
|
|
56
|
+
isReloading: boolean;
|
|
57
|
+
dirtyType: string;
|
|
58
|
+
deleteRecord(): void;
|
|
59
|
+
unloadRecord(): void;
|
|
60
|
+
serialize(): Record<string, unknown>;
|
|
61
|
+
|
|
62
|
+
static modelName: string;
|
|
63
|
+
static fields: Map<keyof this & string, 'attribute' | 'belongsTo' | 'hasMany'>;
|
|
64
|
+
static attributes: Map<keyof this & string, AttributeSchema>;
|
|
65
|
+
static relationshipsByName: Map<keyof this & string, RelationshipSchema>;
|
|
66
|
+
static eachAttribute<K extends keyof this & string>(
|
|
67
|
+
callback: (this: ModelSchema<this>, key: K, attribute: AttributeSchema) => void,
|
|
68
|
+
binding?: T
|
|
69
|
+
): void;
|
|
70
|
+
static eachRelationship<K extends keyof this & string>(
|
|
71
|
+
callback: (this: ModelSchema<this>, key: K, relationship: RelationshipSchema) => void,
|
|
72
|
+
binding?: T
|
|
73
|
+
): void;
|
|
74
|
+
static eachTransformedAttribute<K extends keyof this & string>(
|
|
75
|
+
callback: (this: ModelSchema<this>, key: K, type: string) => void,
|
|
76
|
+
binding?: T
|
|
77
|
+
): void;
|
|
78
|
+
static determineRelationshipType(
|
|
79
|
+
knownSide: RelationshipSchema,
|
|
80
|
+
store: Store
|
|
81
|
+
): 'oneToOne' | 'manyToOne' | 'oneToMany' | 'manyToMany' | 'oneToNone' | 'manyToNone';
|
|
82
|
+
|
|
83
|
+
static toString(): string;
|
|
84
|
+
static isModel: true;
|
|
85
|
+
static relationshipsObject: RelationshipsSchema;
|
|
86
|
+
static extend(...mixins: unknown[]): typeof Model;
|
|
87
|
+
static create(createArgs: ModelCreateArgs): Model;
|
|
88
|
+
static __isMixin?: true;
|
|
89
|
+
static __mixin?: unknown;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface Model {
|
|
93
|
+
constructor: typeof Model;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { Model };
|
|
97
|
+
|
|
98
|
+
export type StaticModel = typeof Model;
|
|
99
|
+
|
|
100
|
+
export const LEGACY_SUPPORT: Map<StableRecordIdentifier | Model, LegacySupport>;
|
|
101
|
+
|
|
102
|
+
export type ModelFactory = { class: StaticModel };
|
|
103
|
+
export type FactoryCache = Record<string, ModelFactory>;
|
|
104
|
+
// we put this on the store for interop because it's used by modelFor and
|
|
105
|
+
// instantiateRecord as well.
|
|
106
|
+
export type ModelStore = Store & { _modelFactoryCache: FactoryCache };
|
|
107
|
+
|
|
108
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.type-test.d.ts","sourceRoot":"","sources":["../../src/-private/model.type-test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare module '@ember-data/model/-private/notify-changes' {
|
|
2
|
+
import type Store from '@ember-data/store';
|
|
3
|
+
import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager';
|
|
4
|
+
import type { StableRecordIdentifier } from '@warp-drive/core-types';
|
|
5
|
+
import type { Model } from '@ember-data/model/-private/model';
|
|
6
|
+
export default function notifyChanges(identifier: StableRecordIdentifier, value: NotificationType, key: string | undefined, record: Model, store: Store): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=notify-changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify-changes.d.ts","sourceRoot":"","sources":["../../src/-private/notify-changes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0DAA0D,CAAC;AACjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIrE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,UAAU,EAAE,sBAAsB,EAClC,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,MAAM,EAAE,KAAK,EACb,KAAK,EAAE,KAAK,QAuBb"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare module '@ember-data/model/-private/promise-belongs-to' {
|
|
2
|
+
/// <reference types="ember-source/types" />
|
|
3
|
+
/// <reference types="ember-source/types" />
|
|
4
|
+
import type PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
5
|
+
import type ObjectProxy from '@ember/object/proxy';
|
|
6
|
+
import type Store from '@ember-data/store';
|
|
7
|
+
import type { OpaqueRecordInstance } from '@ember-data/store/-types/q/record-instance';
|
|
8
|
+
import type { TypeFromInstanceOrString } from '@warp-drive/core-types/record';
|
|
9
|
+
import type { LegacySupport } from '@ember-data/model/-private/legacy-relationships-support';
|
|
10
|
+
export interface BelongsToProxyMeta<T = unknown> {
|
|
11
|
+
key: string;
|
|
12
|
+
store: Store;
|
|
13
|
+
legacySupport: LegacySupport;
|
|
14
|
+
modelName: TypeFromInstanceOrString<T>;
|
|
15
|
+
}
|
|
16
|
+
export interface BelongsToProxyCreateArgs<T = unknown> {
|
|
17
|
+
promise: Promise<T | null>;
|
|
18
|
+
content?: T | null;
|
|
19
|
+
_belongsToState: BelongsToProxyMeta<T>;
|
|
20
|
+
}
|
|
21
|
+
interface PromiseObjectType<T> extends PromiseProxyMixin<T | null>, ObjectProxy<T> {
|
|
22
|
+
new <PT>(...args: unknown[]): PromiseObjectType<PT>;
|
|
23
|
+
}
|
|
24
|
+
class PromiseObjectType<T> {
|
|
25
|
+
}
|
|
26
|
+
const Extended: PromiseObjectType<OpaqueRecordInstance>;
|
|
27
|
+
/**
|
|
28
|
+
@module @ember-data/model
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
A PromiseBelongsTo is a PromiseObject that also proxies certain method calls
|
|
32
|
+
to the underlying belongsTo model.
|
|
33
|
+
Right now we proxy:
|
|
34
|
+
* `reload()`
|
|
35
|
+
@class PromiseBelongsTo
|
|
36
|
+
@extends PromiseObject
|
|
37
|
+
@private
|
|
38
|
+
*/
|
|
39
|
+
class PromiseBelongsTo<T = unknown> extends Extended<T> {
|
|
40
|
+
_belongsToState: BelongsToProxyMeta<T>;
|
|
41
|
+
get id(): string | null;
|
|
42
|
+
get meta(): void;
|
|
43
|
+
reload(options: Record<string, unknown>): Promise<this>;
|
|
44
|
+
}
|
|
45
|
+
export { PromiseBelongsTo };
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=promise-belongs-to.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-belongs-to.d.ts","sourceRoot":"","sources":["../../src/-private/promise-belongs-to.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,iBAAiB,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAEvF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGpE,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;CACxC;AACD,MAAM,WAAW,wBAAwB,CAAC,CAAC,GAAG,OAAO;IACnD,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IACnB,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CACxC;AAED,UAAU,iBAAiB,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;IAEhF,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACrD;AAED,OAAO,OAAO,iBAAiB,CAAC,CAAC;CAAI;AAErC,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,oBAAoB,CACe,CAAC;AAEtE;;GAEG;AAEH;;;;;;;;EAQE;AACF,cAAM,gBAAgB,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IAC7C,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAE/C,IACI,EAAE,IAAI,MAAM,GAAG,IAAI,CAKtB;IAKD,IACI,IAAI,SAWP;IAEK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAM9D;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
declare module '@ember-data/model/-private/promise-many-array' {
|
|
2
|
+
import type { BaseFinderOptions } from '@ember-data/store/-types/q/store';
|
|
3
|
+
import type ManyArray from '@ember-data/model/-private/many-array';
|
|
4
|
+
export interface HasManyProxyCreateArgs<T = unknown> {
|
|
5
|
+
promise: Promise<ManyArray<T>>;
|
|
6
|
+
content?: ManyArray<T>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
@module @ember-data/model
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
This class is returned as the result of accessing an async hasMany relationship
|
|
13
|
+
on an instance of a Model extending from `@ember-data/model`.
|
|
14
|
+
|
|
15
|
+
A PromiseManyArray is an iterable proxy that allows templates to consume related
|
|
16
|
+
ManyArrays and update once their contents are no longer pending.
|
|
17
|
+
|
|
18
|
+
In your JS code you should resolve the promise first.
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const comments = await post.comments;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
@class PromiseManyArray
|
|
25
|
+
@public
|
|
26
|
+
*/
|
|
27
|
+
export default class PromiseManyArray<T = unknown> {
|
|
28
|
+
promise: Promise<ManyArray<T>> | null;
|
|
29
|
+
isDestroyed: boolean;
|
|
30
|
+
content: ManyArray<T> | null;
|
|
31
|
+
constructor(promise: Promise<ManyArray<T>>, content?: ManyArray<T>);
|
|
32
|
+
/**
|
|
33
|
+
* Retrieve the length of the content
|
|
34
|
+
* @property length
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
get length(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Iterate the proxied content. Called by the glimmer iterator in #each
|
|
40
|
+
* We do not guarantee that forEach will always be available. This
|
|
41
|
+
* may eventually be made to use Symbol.Iterator once glimmer supports it.
|
|
42
|
+
*
|
|
43
|
+
* @method forEach
|
|
44
|
+
* @param cb
|
|
45
|
+
* @return
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
forEach(cb: (item: T, index: number, array: T[]) => void): void;
|
|
49
|
+
/**
|
|
50
|
+
* Reload the relationship
|
|
51
|
+
* @method reload
|
|
52
|
+
* @public
|
|
53
|
+
* @param options
|
|
54
|
+
* @return
|
|
55
|
+
*/
|
|
56
|
+
reload(options: Omit<BaseFinderOptions, ''>): this;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the loading promise is still pending
|
|
59
|
+
*
|
|
60
|
+
* @property {boolean} isPending
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
isPending: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the loading promise rejected
|
|
66
|
+
*
|
|
67
|
+
* @property {boolean} isRejected
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
isRejected: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the loading promise succeeded
|
|
73
|
+
*
|
|
74
|
+
* @property {boolean} isFulfilled
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
isFulfilled: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the loading promise completed (resolved or rejected)
|
|
80
|
+
*
|
|
81
|
+
* @property {boolean} isSettled
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
isSettled: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* chain this promise
|
|
87
|
+
*
|
|
88
|
+
* @method then
|
|
89
|
+
* @public
|
|
90
|
+
* @param success
|
|
91
|
+
* @param fail
|
|
92
|
+
* @return Promise
|
|
93
|
+
*/
|
|
94
|
+
then(s: Parameters<Promise<ManyArray<T>>['then']>[0], f?: Parameters<Promise<ManyArray<T>>['then']>[1]): Promise<unknown>;
|
|
95
|
+
/**
|
|
96
|
+
* catch errors thrown by this promise
|
|
97
|
+
* @method catch
|
|
98
|
+
* @public
|
|
99
|
+
* @param callback
|
|
100
|
+
* @return Promise
|
|
101
|
+
*/
|
|
102
|
+
catch(cb: Parameters<Promise<ManyArray<T>>['catch']>[0]): Promise<unknown>;
|
|
103
|
+
/**
|
|
104
|
+
* run cleanup after this promise completes
|
|
105
|
+
*
|
|
106
|
+
* @method finally
|
|
107
|
+
* @public
|
|
108
|
+
* @param callback
|
|
109
|
+
* @return Promise
|
|
110
|
+
*/
|
|
111
|
+
finally(cb: Parameters<Promise<ManyArray<T>>['finally']>[0]): Promise<ManyArray<T>>;
|
|
112
|
+
destroy(): void;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieve the links for this relationship
|
|
115
|
+
* @property links
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
get links(): import("@warp-drive/core-types/spec/raw").Links | null | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Retrieve the meta for this relationship
|
|
121
|
+
* @property meta
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
get meta(): Record<string, unknown> | null | undefined;
|
|
125
|
+
_update(promise: Promise<ManyArray<T>>, content?: ManyArray<T>): void;
|
|
126
|
+
static create<T>({ promise, content }: HasManyProxyCreateArgs<T>): PromiseManyArray<T>;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=promise-many-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-many-array.d.ts","sourceRoot":"","sources":["../../src/-private/promise-many-array.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAI1E,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,OAAO;IACjD,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACxB;AAED;;GAEG;AACH;;;;;;;;;;;;;;;EAeE;AACF,MAAM,CAAC,OAAO,OAAO,gBAAgB,CAAC,CAAC,GAAG,OAAO;IACvC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;gBAEzB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,C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,CAAC,CAAC;IAQ9D,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC;CAGvF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare module '@ember-data/model/-private/promise-proxy-base' {
|
|
2
|
+
import ObjectProxy from '@ember/object/proxy';
|
|
3
|
+
|
|
4
|
+
export interface PromiseObject<T> extends Promise<T> {}
|
|
5
|
+
export class PromiseObject<T> extends ObjectProxy<T> {
|
|
6
|
+
content?: T | null;
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* If the proxied promise is rejected this will contain the reason
|
|
10
|
+
* provided.
|
|
11
|
+
*/
|
|
12
|
+
reason: string | Error;
|
|
13
|
+
/*
|
|
14
|
+
* Once the proxied promise has settled this will become `false`.
|
|
15
|
+
*/
|
|
16
|
+
isPending: boolean;
|
|
17
|
+
/*
|
|
18
|
+
* Once the proxied promise has settled this will become `true`.
|
|
19
|
+
*/
|
|
20
|
+
isSettled: boolean;
|
|
21
|
+
/*
|
|
22
|
+
* Will become `true` if the proxied promise is rejected.
|
|
23
|
+
*/
|
|
24
|
+
isRejected: boolean;
|
|
25
|
+
/*
|
|
26
|
+
* Will become `true` if the proxied promise is fulfilled.
|
|
27
|
+
*/
|
|
28
|
+
isFulfilled: boolean;
|
|
29
|
+
/*
|
|
30
|
+
* The promise whose fulfillment value is being proxied by this object.
|
|
31
|
+
*/
|
|
32
|
+
promise: Promise<T>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|