@ember-data/store 5.4.0-alpha.31 → 5.4.0-alpha.33
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/package.json +9 -9
- package/unstable-preview-types/-private/cache-handler.d.ts +101 -99
- package/unstable-preview-types/-private/caches/cache-utils.d.ts +11 -9
- package/unstable-preview-types/-private/caches/identifier-cache.d.ts +181 -179
- package/unstable-preview-types/-private/caches/instance-cache.d.ts +63 -61
- package/unstable-preview-types/-private/caches/resource-utils.d.ts +12 -10
- package/unstable-preview-types/-private/document.d.ts +146 -144
- package/unstable-preview-types/-private/index.d.ts +18 -16
- package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +178 -176
- package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +19 -17
- package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +29 -27
- package/unstable-preview-types/-private/managers/cache-manager.d.ts +442 -440
- package/unstable-preview-types/-private/managers/notification-manager.d.ts +98 -96
- package/unstable-preview-types/-private/managers/record-array-manager.d.ts +97 -95
- package/unstable-preview-types/-private/network/request-cache.d.ts +109 -107
- package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +134 -132
- package/unstable-preview-types/-private/store-service.d.ts +1503 -1501
- package/unstable-preview-types/-private/utils/coerce-id.d.ts +10 -8
- package/unstable-preview-types/-private/utils/construct-resource.d.ts +10 -8
- package/unstable-preview-types/-private/utils/identifier-debug-consts.d.ts +7 -5
- package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +4 -2
- package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +4 -2
- package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +4 -2
- package/unstable-preview-types/-private.d.ts +4 -2
- package/unstable-preview-types/-types/overview.d.ts +21 -19
- package/unstable-preview-types/-types/q/cache-store-wrapper.d.ts +107 -105
- package/unstable-preview-types/-types/q/cache.d.ts +47 -45
- package/unstable-preview-types/-types/q/ds-model.d.ts +15 -13
- package/unstable-preview-types/-types/q/identifier.d.ts +169 -167
- package/unstable-preview-types/-types/q/promise-proxies.d.ts +4 -2
- package/unstable-preview-types/-types/q/record-data-json-api.d.ts +36 -34
- package/unstable-preview-types/-types/q/record-instance.d.ts +29 -27
- package/unstable-preview-types/-types/q/schema-service.d.ts +214 -212
- package/unstable-preview-types/-types/q/store.d.ts +17 -15
- package/unstable-preview-types/index.d.ts +220 -185
|
@@ -1,212 +1,214 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
1
|
+
declare module '@ember-data/store/-types/q/schema-service' {
|
|
2
|
+
/**
|
|
3
|
+
@module @ember-data/store
|
|
4
|
+
*/
|
|
5
|
+
import type { RecordIdentifier } from '@warp-drive/core-types/identifier';
|
|
6
|
+
import type { AttributesSchema, RelationshipsSchema } from '@warp-drive/core-types/schema';
|
|
7
|
+
export interface FieldSchema {
|
|
8
|
+
type: string | null;
|
|
9
|
+
name: string;
|
|
10
|
+
kind: 'attribute' | 'hasMany' | 'belongsTo' | 'field' | 'resource' | 'collection' | 'derived' | 'object' | 'array' | '@id' | '@local';
|
|
11
|
+
options?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The SchemaService provides the ability to query for information about the structure
|
|
15
|
+
* of any resource type.
|
|
16
|
+
*
|
|
17
|
+
* Applications can provide any implementation of the SchemaService they please so long
|
|
18
|
+
* as it conforms to this interface.
|
|
19
|
+
*
|
|
20
|
+
* The design of the service means that schema information could be lazily populated,
|
|
21
|
+
* derived-on-demand, or progressively enhanced during the course of an application's runtime.
|
|
22
|
+
* The primary requirement is merely that any information the service needs to correctly
|
|
23
|
+
* respond to an inquest is available by the time it is asked.
|
|
24
|
+
*
|
|
25
|
+
* The `@ember-data/model` package provides an implementation of this service which
|
|
26
|
+
* makes use of your model classes as the source of information to respond to queries
|
|
27
|
+
* about resource schema. While this is useful, this may not be ideal for your application.
|
|
28
|
+
* For instance, Schema information could be sideloaded or pre-flighted for API calls,
|
|
29
|
+
* resulting in no need to bundle and ship potentially large and expensive JSON
|
|
30
|
+
* or large Javascript based Models to pull information from.
|
|
31
|
+
*
|
|
32
|
+
* To register a custom schema implementation, extend the store service or
|
|
33
|
+
* lookup and register the schema service first thing on app-boot. Example below
|
|
34
|
+
* shows extending the service.
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* import Store from '@ember-data/store';
|
|
38
|
+
* import CustomSchemas from './custom-schemas';
|
|
39
|
+
*
|
|
40
|
+
* export default class extends Store {
|
|
41
|
+
* constructor(...args) {
|
|
42
|
+
* super(...args);
|
|
43
|
+
* this.registerSchema(new CustomSchemas());
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* At runtime, both the `Store` and the `CacheCapabilitiesManager` provide
|
|
49
|
+
* access to this service via the `schema` property.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* export default class extends Component {
|
|
53
|
+
* @service store;
|
|
54
|
+
*
|
|
55
|
+
* get attributes() {
|
|
56
|
+
* return this.store
|
|
57
|
+
* .schema
|
|
58
|
+
* .attributesDefinitionFor(this.args.dataType);
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* Note: there can only be one schema service registered at a time.
|
|
64
|
+
* If you register a new schema service, the old one will be replaced.
|
|
65
|
+
*
|
|
66
|
+
* If you would like to inherit from another schema service, you can do so by
|
|
67
|
+
* using typical class inheritance patterns OR by accessing the existing
|
|
68
|
+
* schema service at runtime before replacing it with your own, and then
|
|
69
|
+
* having your own delegate to it when needed.
|
|
70
|
+
*
|
|
71
|
+
* @class <Interface> SchemaService
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
export interface SchemaService {
|
|
75
|
+
/**
|
|
76
|
+
* Queries whether the schema-definition-service recognizes `type` as a resource type
|
|
77
|
+
*
|
|
78
|
+
* @method doesTypeExist
|
|
79
|
+
* @public
|
|
80
|
+
* @param {string} type
|
|
81
|
+
* @return {boolean}
|
|
82
|
+
*/
|
|
83
|
+
doesTypeExist(type: string): boolean;
|
|
84
|
+
fields({ type }: {
|
|
85
|
+
type: string;
|
|
86
|
+
}): Map<string, FieldSchema>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns definitions for all properties of the specified resource
|
|
89
|
+
* that are considered "attributes". Generally these are properties
|
|
90
|
+
* that are not related to book-keeping state on the client and do
|
|
91
|
+
* not represent a linkage to another resource.
|
|
92
|
+
*
|
|
93
|
+
* The return value should be a dictionary of key:value pairs
|
|
94
|
+
* where the `key` is the attribute or property's name and `value`
|
|
95
|
+
* is an object with at least the property `name` which should also
|
|
96
|
+
* match `key`.
|
|
97
|
+
*
|
|
98
|
+
* Optionally, this object may also specify `type`, which should
|
|
99
|
+
* be a string reference to a `transform`, and `options` which
|
|
100
|
+
* should be dictionary in which any key:value pairs are permissable.
|
|
101
|
+
*
|
|
102
|
+
* For instance, when using `@ember-data/model`, the following attribute
|
|
103
|
+
* definition:
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* class extends Model {
|
|
107
|
+
* @attr('string', { defaultValue: 'hello' }) greeting;
|
|
108
|
+
* @attr('date') birthday;
|
|
109
|
+
* @attr firstName;
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* Would be returned as:
|
|
114
|
+
*
|
|
115
|
+
* ```js
|
|
116
|
+
* {
|
|
117
|
+
* greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
|
|
118
|
+
* birthday: { name: 'birthday', type: 'date' },
|
|
119
|
+
* firstName: { name: 'firstName' }
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @method attributesDefinitionFor
|
|
124
|
+
* @public
|
|
125
|
+
* @param {RecordIdentifier|{ type: string }} identifier
|
|
126
|
+
* @return {AttributesSchema}
|
|
127
|
+
*/
|
|
128
|
+
attributesDefinitionFor(identifier: RecordIdentifier | {
|
|
129
|
+
type: string;
|
|
130
|
+
}): AttributesSchema;
|
|
131
|
+
/**
|
|
132
|
+
* Returns definitions for all properties of the specified resource
|
|
133
|
+
* that are considered "relationships". Generally these are properties
|
|
134
|
+
* that represent a linkage to another resource.
|
|
135
|
+
*
|
|
136
|
+
* The return value should be a dictionary of key:value pairs
|
|
137
|
+
* where the `key` is the relationship or property's name and `value`
|
|
138
|
+
* is an object with at least the following properties:
|
|
139
|
+
*
|
|
140
|
+
* - `name` which should also match the `key` used in the dictionary.
|
|
141
|
+
* - `kind` which should be either `belongsTo` or `hasMany`
|
|
142
|
+
* - `type` which should be the related resource's string "type"
|
|
143
|
+
* - `options` which should be a dictionary allowing any key but with
|
|
144
|
+
* at least the below keys present.
|
|
145
|
+
*
|
|
146
|
+
* - `options.async` a boolean representing whether data for this relationship is
|
|
147
|
+
* typically loaded on-demand.
|
|
148
|
+
* - `options.inverse` a string or null representing the field name / key of the
|
|
149
|
+
* corresponding relationship on the inverse resource.
|
|
150
|
+
*
|
|
151
|
+
* Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
|
|
152
|
+
*
|
|
153
|
+
* - `options.polymorphic` a boolean representing whether multiple resource types
|
|
154
|
+
* can be used to satisfy this relationship.
|
|
155
|
+
* - `options.as` a string representing the abstract type that the concrete side of
|
|
156
|
+
* a relationship must specify when fulfilling a polymorphic inverse.
|
|
157
|
+
*
|
|
158
|
+
* For example, the following Model using @ember-data/model would generate this relationships
|
|
159
|
+
* definition by default:
|
|
160
|
+
*
|
|
161
|
+
* ```js
|
|
162
|
+
* class User extends Model {
|
|
163
|
+
* @belongsTo('user', { async: false, inverse: null }) bestFriend;
|
|
164
|
+
* @hasMany('user', { async: true, inverse: 'friends' }) friends;
|
|
165
|
+
* @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* Which would be returned as
|
|
170
|
+
*
|
|
171
|
+
* ```js
|
|
172
|
+
* {
|
|
173
|
+
* bestFriend: {
|
|
174
|
+
* name: 'bestFriend',
|
|
175
|
+
* kind: 'belongsTo',
|
|
176
|
+
* type: 'user',
|
|
177
|
+
* options: {
|
|
178
|
+
* async: false,
|
|
179
|
+
* inverse: null
|
|
180
|
+
* }
|
|
181
|
+
* },
|
|
182
|
+
* friends: {
|
|
183
|
+
* name: 'friends',
|
|
184
|
+
* kind: 'hasMany',
|
|
185
|
+
* type: 'user',
|
|
186
|
+
* options: {
|
|
187
|
+
* async: true,
|
|
188
|
+
* inverse: 'friends'
|
|
189
|
+
* }
|
|
190
|
+
* },
|
|
191
|
+
* pets: {
|
|
192
|
+
* name: 'pets',
|
|
193
|
+
* kind: 'hasMany',
|
|
194
|
+
* type: 'pet',
|
|
195
|
+
* options: {
|
|
196
|
+
* async: false,
|
|
197
|
+
* polymorphic: true,
|
|
198
|
+
* inverse: 'owner'
|
|
199
|
+
* }
|
|
200
|
+
* },
|
|
201
|
+
* }
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @method relationshipsDefinitionFor
|
|
205
|
+
* @public
|
|
206
|
+
* @param {RecordIdentifier|{ type: string }} identifier
|
|
207
|
+
* @return {RelationshipsSchema}
|
|
208
|
+
*/
|
|
209
|
+
relationshipsDefinitionFor(identifier: RecordIdentifier | {
|
|
210
|
+
type: string;
|
|
211
|
+
}): RelationshipsSchema;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=schema-service.d.ts.map
|
|
214
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
declare module '@ember-data/store/-types/q/store' {
|
|
2
|
+
import type { Value } from '@warp-drive/core-types/json/raw';
|
|
3
|
+
export interface BaseFinderOptions {
|
|
4
|
+
reload?: boolean;
|
|
5
|
+
backgroundReload?: boolean;
|
|
6
|
+
include?: string | string[];
|
|
7
|
+
adapterOptions?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface FindRecordOptions extends BaseFinderOptions {
|
|
10
|
+
preload?: Record<string, Value>;
|
|
11
|
+
}
|
|
12
|
+
export type QueryOptions = {
|
|
13
|
+
[K in string | 'adapterOptions']?: K extends 'adapterOptions' ? Record<string, unknown> : unknown;
|
|
14
|
+
};
|
|
15
|
+
export type FindAllOptions = BaseFinderOptions;
|
|
16
|
+
//# sourceMappingURL=store.d.ts.map
|
|
17
|
+
}
|