@warp-drive/core 5.6.0-alpha.18 → 5.6.0-alpha.5
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/README.md +7 -8
- package/declarations/index.d.ts +3 -14
- package/declarations/index.d.ts.map +1 -0
- package/declarations/request/-private/context.d.ts +35 -34
- package/declarations/request/-private/context.d.ts.map +1 -0
- package/declarations/request/-private/debug.d.ts +3 -2
- package/declarations/request/-private/debug.d.ts.map +1 -0
- package/declarations/request/-private/fetch.d.ts +36 -24
- package/declarations/request/-private/fetch.d.ts.map +1 -0
- package/declarations/request/-private/future.d.ts +4 -3
- package/declarations/request/-private/future.d.ts.map +1 -0
- package/declarations/request/-private/manager.d.ts +132 -159
- package/declarations/request/-private/manager.d.ts.map +1 -0
- package/declarations/request/-private/promise-cache.d.ts +13 -21
- package/declarations/request/-private/promise-cache.d.ts.map +1 -0
- package/declarations/request/-private/types.d.ts +123 -124
- package/declarations/request/-private/types.d.ts.map +1 -0
- package/declarations/request/-private/utils.d.ts +9 -8
- package/declarations/request/-private/utils.d.ts.map +1 -0
- package/declarations/request.d.ts +433 -5
- package/declarations/request.d.ts.map +1 -0
- package/declarations/types/-private.d.ts +8 -16
- package/declarations/types/-private.d.ts.map +1 -0
- package/declarations/types/cache/aliases.d.ts +1 -11
- package/declarations/types/cache/aliases.d.ts.map +1 -0
- package/declarations/types/cache/change.d.ts +5 -4
- package/declarations/types/cache/change.d.ts.map +1 -0
- package/declarations/types/cache/mutations.d.ts +28 -51
- package/declarations/types/cache/mutations.d.ts.map +1 -0
- package/declarations/types/cache/operations.d.ts +47 -60
- package/declarations/types/cache/operations.d.ts.map +1 -0
- package/declarations/types/cache/relationship.d.ts +9 -11
- package/declarations/types/cache/relationship.d.ts.map +1 -0
- package/declarations/types/cache.d.ts +484 -495
- package/declarations/types/cache.d.ts.map +1 -0
- package/declarations/types/graph.d.ts +40 -31
- package/declarations/types/graph.d.ts.map +1 -0
- package/declarations/types/identifier.d.ts +82 -83
- package/declarations/types/identifier.d.ts.map +1 -0
- package/declarations/types/json/raw.d.ts +2 -1
- package/declarations/types/json/raw.d.ts.map +1 -0
- package/declarations/types/params.d.ts +5 -4
- package/declarations/types/params.d.ts.map +1 -0
- package/declarations/types/record.d.ts +76 -117
- package/declarations/types/record.d.ts.map +1 -0
- package/declarations/types/record.type-test.d.ts +2 -0
- package/declarations/types/record.type-test.d.ts.map +1 -0
- package/declarations/types/request.d.ts +266 -289
- package/declarations/types/request.d.ts.map +1 -0
- package/declarations/types/request.type-test.d.ts +2 -0
- package/declarations/types/request.type-test.d.ts.map +1 -0
- package/declarations/types/runtime.d.ts +9 -8
- package/declarations/types/runtime.d.ts.map +1 -0
- package/declarations/types/schema/concepts.d.ts +13 -19
- package/declarations/types/schema/concepts.d.ts.map +1 -0
- package/declarations/types/schema/fields.d.ts +1741 -1712
- package/declarations/types/schema/fields.d.ts.map +1 -0
- package/declarations/types/schema/fields.type-test.d.ts +1 -0
- package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
- package/declarations/types/spec/document.d.ts +22 -28
- package/declarations/types/spec/document.d.ts.map +1 -0
- package/declarations/types/spec/error.d.ts +17 -16
- package/declarations/types/spec/error.d.ts.map +1 -0
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
- package/declarations/types/symbols.d.ts +75 -74
- package/declarations/types/symbols.d.ts.map +1 -0
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types/utils.d.ts.map +1 -0
- package/declarations/types.d.ts +7 -10
- package/declarations/types.d.ts.map +1 -0
- package/dist/{context-COmAnXUQ.js → context-DE5sFezZ.js} +2 -2
- package/dist/context-DE5sFezZ.js.map +1 -0
- package/dist/index.js +104 -37
- package/dist/index.js.map +1 -0
- package/dist/request.js +1 -1
- package/dist/request.js.map +1 -0
- package/dist/types/-private.js +3 -3
- package/dist/types/-private.js.map +1 -0
- package/dist/types/cache/aliases.js.map +1 -0
- package/dist/types/cache/change.js.map +1 -0
- package/dist/types/cache/mutations.js.map +1 -0
- package/dist/types/cache/operations.js.map +1 -0
- package/dist/types/cache/relationship.js.map +1 -0
- package/dist/types/cache.js.map +1 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/identifier.js.map +1 -0
- package/dist/types/json/raw.js.map +1 -0
- package/dist/types/params.js.map +1 -0
- package/dist/types/record.js +1 -1
- package/dist/types/record.js.map +1 -0
- package/dist/types/request.js +2 -2
- package/dist/types/request.js.map +1 -0
- package/dist/types/runtime.js +1 -1
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/schema/concepts.js.map +1 -0
- package/dist/types/schema/fields.js +41 -8
- package/dist/types/schema/fields.js.map +1 -0
- package/dist/types/schema/fields.type-test.js.map +1 -0
- package/dist/types/spec/document.js.map +1 -0
- package/dist/types/spec/error.js.map +1 -0
- package/dist/types/spec/json-api-raw.js.map +1 -0
- package/dist/types/symbols.js +3 -3
- package/dist/types/symbols.js.map +1 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +8 -11
- package/cjs-dist/addon-shim.cjs +0 -1
- package/cjs-dist/cjs-set-config.cjs +0 -1
- package/declarations/build-config/babel-macros.d.ts +0 -1
- package/declarations/build-config/canary-features.d.ts +0 -1
- package/declarations/build-config/debugging.d.ts +0 -1
- package/declarations/build-config/deprecations.d.ts +0 -1
- package/declarations/build-config/env.d.ts +0 -1
- package/declarations/build-config/macros.d.ts +0 -1
- package/declarations/build-config.d.ts +0 -1
- package/declarations/configure.d.ts +0 -7
- package/declarations/graph/-private/-diff.d.ts +0 -32
- package/declarations/graph/-private/-edge-definition.d.ts +0 -148
- package/declarations/graph/-private/-state.d.ts +0 -96
- package/declarations/graph/-private/-utils.d.ts +0 -31
- package/declarations/graph/-private/coerce-id.d.ts +0 -10
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -18
- package/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/declarations/graph/-private/edges/resource.d.ts +0 -24
- package/declarations/graph/-private/graph.d.ts +0 -90
- package/declarations/graph/-private/normalize-link.d.ts +0 -8
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -62
- package/declarations/graph/-private/operations/update-relationship.d.ts +0 -13
- package/declarations/graph/-private.d.ts +0 -13
- package/declarations/reactive/-private/document.d.ts +0 -146
- package/declarations/reactive/-private/fields/compute.d.ts +0 -43
- package/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/declarations/reactive/-private/fields/managed-array.d.ts +0 -22
- package/declarations/reactive/-private/fields/managed-object.d.ts +0 -21
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/declarations/reactive/-private/hooks.d.ts +0 -5
- package/declarations/reactive/-private/record.d.ts +0 -64
- package/declarations/reactive/-private/schema.d.ts +0 -271
- package/declarations/reactive/-private/symbols.d.ts +0 -36
- package/declarations/reactive/-private.d.ts +0 -1
- package/declarations/reactive.d.ts +0 -4
- package/declarations/store/-private/cache-handler/handler.d.ts +0 -62
- package/declarations/store/-private/cache-handler/types.d.ts +0 -98
- package/declarations/store/-private/cache-handler/utils.d.ts +0 -32
- package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
- package/declarations/store/-private/caches/identifier-cache.d.ts +0 -304
- package/declarations/store/-private/caches/instance-cache.d.ts +0 -65
- package/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/declarations/store/-private/debug/utils.d.ts +0 -6
- package/declarations/store/-private/default-cache-policy.d.ts +0 -384
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -25
- package/declarations/store/-private/managers/cache-manager.d.ts +0 -443
- package/declarations/store/-private/managers/notification-manager.d.ts +0 -98
- package/declarations/store/-private/managers/record-array-manager.d.ts +0 -97
- package/declarations/store/-private/network/request-cache.d.ts +0 -107
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -263
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -176
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -169
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -35
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -277
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -261
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
- package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -126
- package/declarations/store/-private/store-service.d.ts +0 -1605
- package/declarations/store/-private/utils/coerce-id.d.ts +0 -10
- package/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +0 -31
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -99
- package/declarations/store/-types/q/ds-model.d.ts +0 -21
- package/declarations/store/-types/q/identifier.d.ts +0 -20
- package/declarations/store/-types/q/record-instance.d.ts +0 -23
- package/declarations/store/-types/q/schema-service.d.ts +0 -354
- package/declarations/store/-types/q/store.d.ts +0 -32
- package/declarations/store.d.ts +0 -1
- package/declarations/utils/string.d.ts +0 -48
- package/dist/build-config/babel-macros.js +0 -1
- package/dist/build-config/canary-features.js +0 -1
- package/dist/build-config/debugging.js +0 -1
- package/dist/build-config/deprecations.js +0 -1
- package/dist/build-config/env.js +0 -1
- package/dist/build-config/macros.js +0 -1
- package/dist/build-config.js +0 -1
- package/dist/configure-B48bFHOl.js +0 -181
- package/dist/configure.js +0 -1
- package/dist/graph/-private.js +0 -3372
- package/dist/handler-C2T-IyJK.js +0 -339
- package/dist/reactive/-private.js +0 -1
- package/dist/reactive.js +0 -1988
- package/dist/request-state-CjLph1LP.js +0 -8139
- package/dist/store/-private.js +0 -3
- package/dist/store.js +0 -545
- package/dist/symbols-SIstXMLI.js +0 -44
- package/dist/utils/string.js +0 -92
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/README.md +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/github-header.svg +0 -444
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../../src/types/runtime.ts"],"sourcesContent":["import type { LOG_CONFIG } from '@warp-drive/build-config/-private/utils/logging';\n\nimport { getOrSetUniversal } from './-private.ts';\n\nconst RuntimeConfig: { debug: Partial<LOG_CONFIG> } = getOrSetUniversal('WarpDriveRuntimeConfig', {\n debug: {},\n});\n\nfunction trySessionStorage() {\n // This works even when sessionStorage is not available.\n // See https://github.com/emberjs/data/issues/9784\n try {\n return globalThis.sessionStorage;\n } catch {\n return undefined;\n }\n}\n\nconst storage = trySessionStorage();\nconst settings = storage?.getItem('WarpDriveRuntimeConfig');\nif (settings) {\n Object.assign(RuntimeConfig, JSON.parse(settings));\n}\n\nexport function getRuntimeConfig(): typeof RuntimeConfig {\n return RuntimeConfig;\n}\n\n/**\n * Upserts the specified logging configuration into the runtime\n * config.\n *\n * globalThis.setWarpDriveLogging({ LOG_CACHE: true } });\n *\n */\nexport function setLogging(config: Partial<LOG_CONFIG>): void {\n Object.assign(RuntimeConfig.debug, config);\n storage?.setItem('WarpDriveRuntimeConfig', JSON.stringify(RuntimeConfig));\n}\n"],"names":["RuntimeConfig","getOrSetUniversal","debug","trySessionStorage","globalThis","sessionStorage","undefined","storage","settings","getItem","Object","assign","JSON","parse","getRuntimeConfig","setLogging","config","setItem","stringify"],"mappings":";;AAIA,MAAMA,aAA6C,GAAGC,iBAAiB,CAAC,wBAAwB,EAAE;AAChGC,EAAAA,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,SAASC,iBAAiBA,GAAG;AAC3B;AACA;EACA,IAAI;IACF,OAAOC,UAAU,CAACC,cAAc;AAClC,GAAC,CAAC,MAAM;AACN,IAAA,OAAOC,SAAS;AAClB;AACF;AAEA,MAAMC,OAAO,GAAGJ,iBAAiB,EAAE;AACnC,MAAMK,QAAQ,GAAGD,OAAO,EAAEE,OAAO,CAAC,wBAAwB,CAAC;AAC3D,IAAID,QAAQ,EAAE;EACZE,MAAM,CAACC,MAAM,CAACX,aAAa,EAAEY,IAAI,CAACC,KAAK,CAACL,QAAQ,CAAC,CAAC;AACpD;AAEO,SAASM,gBAAgBA,GAAyB;AACvD,EAAA,OAAOd,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASe,UAAUA,CAACC,MAA2B,EAAQ;EAC5DN,MAAM,CAACC,MAAM,CAACX,aAAa,CAACE,KAAK,EAAEc,MAAM,CAAC;EAC1CT,OAAO,EAAEU,OAAO,CAAC,wBAAwB,EAAEL,IAAI,CAACM,SAAS,CAAClB,aAAa,CAAC,CAAC;AAC3E;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concepts.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* "type" points to a new-style transform on "field"
|
|
13
13
|
* that a record implmentation *must* use.
|
|
14
14
|
*
|
|
15
|
+
* @class (Type) GenericField
|
|
15
16
|
* @public
|
|
16
17
|
*/
|
|
17
18
|
|
|
@@ -22,8 +23,8 @@
|
|
|
22
23
|
* Unlike DerivedField, an AliasField may write to its
|
|
23
24
|
* source when a record is in an editable mode.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
-
* to pre/post process the
|
|
26
|
+
* AliasFields may utilize a transform, specified by type,
|
|
27
|
+
* to pre/post process the field.
|
|
27
28
|
*
|
|
28
29
|
* An AliasField may also specify a `kind` via options.
|
|
29
30
|
* `kind` may be any other valid field kind other than
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
* an AliasField could be used to expose both a string and a Date version of the
|
|
42
43
|
* same field, with both being capable of being written to.
|
|
43
44
|
*
|
|
45
|
+
* @class (Type) LegacyAliasField
|
|
44
46
|
* @public
|
|
45
47
|
*/
|
|
46
48
|
|
|
@@ -51,8 +53,8 @@
|
|
|
51
53
|
* Unlike DerivedField, an AliasField may write to its
|
|
52
54
|
* source when a record is in an editable mode.
|
|
53
55
|
*
|
|
54
|
-
*
|
|
55
|
-
* to pre/post process the
|
|
56
|
+
* AliasFields may utilize a transform, specified by type,
|
|
57
|
+
* to pre/post process the field.
|
|
56
58
|
*
|
|
57
59
|
* An AliasField may also specify a `kind` via options.
|
|
58
60
|
* `kind` may be any other valid field kind other than
|
|
@@ -70,6 +72,7 @@
|
|
|
70
72
|
* an AliasField could be used to expose both a string and a Date version of the
|
|
71
73
|
* same field, with both being capable of being written to.
|
|
72
74
|
*
|
|
75
|
+
* @class (Type) PolarisAliasField
|
|
73
76
|
* @public
|
|
74
77
|
*/
|
|
75
78
|
|
|
@@ -99,6 +102,7 @@
|
|
|
99
102
|
* an AliasField could be used to expose both a string and a Date version of the
|
|
100
103
|
* same field, with both being capable of being written to.
|
|
101
104
|
*
|
|
105
|
+
* @class (Type) ObjectAliasField
|
|
102
106
|
* @public
|
|
103
107
|
*/
|
|
104
108
|
|
|
@@ -114,6 +118,7 @@
|
|
|
114
118
|
* 'uuid', 'urn' or 'entityUrn' or 'primaryKey' as their
|
|
115
119
|
* primary key field instead of 'id'.
|
|
116
120
|
*
|
|
121
|
+
* @class (Type) IdentityField
|
|
117
122
|
* @public
|
|
118
123
|
*/
|
|
119
124
|
|
|
@@ -138,6 +143,7 @@
|
|
|
138
143
|
* it should be placed in the `ResourceSchema`'s `@id` field
|
|
139
144
|
* in place of an `IdentityField`.
|
|
140
145
|
*
|
|
146
|
+
* @class (Type) HashField
|
|
141
147
|
* @public
|
|
142
148
|
*/
|
|
143
149
|
|
|
@@ -157,7 +163,7 @@
|
|
|
157
163
|
* For this reason Local fields should be used sparingly.
|
|
158
164
|
*
|
|
159
165
|
* Currently, while we document this feature here,
|
|
160
|
-
* only allow our own
|
|
166
|
+
* only allow our own SchemaRecord default fields to
|
|
161
167
|
* utilize them and the feature should be considered private.
|
|
162
168
|
*
|
|
163
169
|
* Example use cases that drove the creation of local
|
|
@@ -168,6 +174,7 @@
|
|
|
168
174
|
*
|
|
169
175
|
* Don't make us regret this decision.
|
|
170
176
|
*
|
|
177
|
+
* @class (Type) LocalField
|
|
171
178
|
* @public
|
|
172
179
|
*/
|
|
173
180
|
|
|
@@ -180,6 +187,7 @@
|
|
|
180
187
|
* if the key/value pairs have well-defined shape,
|
|
181
188
|
* use 'schema-object' instead.
|
|
182
189
|
*
|
|
190
|
+
* @class (Type) ObjectField
|
|
183
191
|
* @public
|
|
184
192
|
*/
|
|
185
193
|
|
|
@@ -191,6 +199,7 @@
|
|
|
191
199
|
* If the object's structure is not well-defined,
|
|
192
200
|
* use 'object' instead.
|
|
193
201
|
*
|
|
202
|
+
* @class (Type) SchemaObjectField
|
|
194
203
|
* @public
|
|
195
204
|
*/
|
|
196
205
|
|
|
@@ -201,6 +210,7 @@
|
|
|
201
210
|
* If the array's elements are not primitive
|
|
202
211
|
* values, use 'schema-array' instead.
|
|
203
212
|
*
|
|
213
|
+
* @class (Type) ArrayField
|
|
204
214
|
* @public
|
|
205
215
|
*/
|
|
206
216
|
|
|
@@ -212,6 +222,7 @@
|
|
|
212
222
|
* If the array's elements are not well-defined,
|
|
213
223
|
* use 'array' instead.
|
|
214
224
|
*
|
|
225
|
+
* @class (Type) SchemaArrayField
|
|
215
226
|
* @public
|
|
216
227
|
*/
|
|
217
228
|
|
|
@@ -229,6 +240,7 @@
|
|
|
229
240
|
* or that require access to related resources
|
|
230
241
|
* that may not be loaded should be avoided.
|
|
231
242
|
*
|
|
243
|
+
* @class (Type) DerivedField
|
|
232
244
|
* @public
|
|
233
245
|
*/
|
|
234
246
|
|
|
@@ -237,8 +249,9 @@
|
|
|
237
249
|
* another resource.
|
|
238
250
|
*
|
|
239
251
|
* SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
|
|
240
|
-
* BY
|
|
252
|
+
* BY SchemaRecord
|
|
241
253
|
*
|
|
254
|
+
* @class (Type) ResourceField
|
|
242
255
|
* @public
|
|
243
256
|
*/
|
|
244
257
|
|
|
@@ -248,8 +261,9 @@
|
|
|
248
261
|
* paginate.
|
|
249
262
|
*
|
|
250
263
|
* SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
|
|
251
|
-
* BY
|
|
264
|
+
* BY SchemaRecord
|
|
252
265
|
*
|
|
266
|
+
* @class (Type) CollectionField
|
|
253
267
|
* @public
|
|
254
268
|
*/
|
|
255
269
|
|
|
@@ -268,6 +282,7 @@
|
|
|
268
282
|
* that a serializer *might* use, but their usage
|
|
269
283
|
* is not guaranteed.
|
|
270
284
|
*
|
|
285
|
+
* @class (Type) LegacyAttributeField
|
|
271
286
|
* @public
|
|
272
287
|
*/
|
|
273
288
|
|
|
@@ -280,6 +295,7 @@
|
|
|
280
295
|
*
|
|
281
296
|
* This is the legacy version of the `ResourceField`.
|
|
282
297
|
*
|
|
298
|
+
* @class (Type) LegacyBelongsToField
|
|
283
299
|
* @public
|
|
284
300
|
*/
|
|
285
301
|
|
|
@@ -292,6 +308,7 @@
|
|
|
292
308
|
*
|
|
293
309
|
* This is the legacy version of the `ResourceField`.
|
|
294
310
|
*
|
|
311
|
+
* @class (Type) LinksModeBelongsToField
|
|
295
312
|
* @public
|
|
296
313
|
*/
|
|
297
314
|
|
|
@@ -304,6 +321,7 @@
|
|
|
304
321
|
*
|
|
305
322
|
* This is the legacy version of the `CollectionField`.
|
|
306
323
|
*
|
|
324
|
+
* @class (Type) LegacyHasManyField
|
|
307
325
|
* @public
|
|
308
326
|
*/
|
|
309
327
|
|
|
@@ -316,6 +334,7 @@
|
|
|
316
334
|
*
|
|
317
335
|
* This is the legacy version of the `CollectionField`.
|
|
318
336
|
*
|
|
337
|
+
* @class (Type) LinksModeHasManyField
|
|
319
338
|
* @public
|
|
320
339
|
*/
|
|
321
340
|
|
|
@@ -338,6 +357,7 @@
|
|
|
338
357
|
* - {@link LegacyBelongsToField}
|
|
339
358
|
* - {@link LegacyHasManyField}
|
|
340
359
|
*
|
|
360
|
+
* @class (Type) LegacyModeFieldSchema
|
|
341
361
|
* @public
|
|
342
362
|
*/
|
|
343
363
|
|
|
@@ -359,6 +379,7 @@
|
|
|
359
379
|
* - {@link LinksModeBelongsToField}
|
|
360
380
|
* - {@link LinksModeHasManyField}
|
|
361
381
|
*
|
|
382
|
+
* @class (Type) PolarisModeFieldSchema
|
|
362
383
|
* @public
|
|
363
384
|
*/
|
|
364
385
|
|
|
@@ -371,6 +392,7 @@
|
|
|
371
392
|
* as appropriate as they are more specific and will
|
|
372
393
|
* provide better guidance around what is valid.
|
|
373
394
|
*
|
|
395
|
+
* @class (Type) FieldSchema
|
|
374
396
|
* @public
|
|
375
397
|
*/
|
|
376
398
|
|
|
@@ -378,6 +400,7 @@
|
|
|
378
400
|
* A union of all possible field schemas that can be
|
|
379
401
|
* used in an ObjectSchema.
|
|
380
402
|
*
|
|
403
|
+
* @class (Type) ObjectFieldSchema
|
|
381
404
|
* @public
|
|
382
405
|
*/
|
|
383
406
|
|
|
@@ -388,6 +411,7 @@
|
|
|
388
411
|
* own which may allow them to appear in relationships, or in multiple
|
|
389
412
|
* response documents.
|
|
390
413
|
*
|
|
414
|
+
* @class (Type) PolarisResourceSchema
|
|
391
415
|
* @public
|
|
392
416
|
*/
|
|
393
417
|
|
|
@@ -398,6 +422,7 @@
|
|
|
398
422
|
* own which may allow them to appear in relationships, or in multiple
|
|
399
423
|
* response documents.
|
|
400
424
|
*
|
|
425
|
+
* @class (Type) LegacyResourceSchema
|
|
401
426
|
* @public
|
|
402
427
|
*/
|
|
403
428
|
|
|
@@ -410,7 +435,6 @@
|
|
|
410
435
|
* by the SchemaService which provides fields as a Map
|
|
411
436
|
* instead of as an Array.
|
|
412
437
|
*
|
|
413
|
-
* @public
|
|
414
438
|
*/
|
|
415
439
|
|
|
416
440
|
/**
|
|
@@ -419,6 +443,7 @@
|
|
|
419
443
|
*
|
|
420
444
|
* ObjectSchemas may not currently contain relationships.
|
|
421
445
|
*
|
|
446
|
+
* @class (Type) ObjectSchema
|
|
422
447
|
* @public
|
|
423
448
|
*/
|
|
424
449
|
|
|
@@ -432,6 +457,8 @@
|
|
|
432
457
|
* as doing so would require a full schema graph to be passed in
|
|
433
458
|
* and no cycles in the graph to be present.
|
|
434
459
|
*
|
|
460
|
+
* @param {ResourceSchema} schema
|
|
461
|
+
* @return {ResourceSchema} the passed in schema
|
|
435
462
|
* @public
|
|
436
463
|
*/
|
|
437
464
|
function resourceSchema(schema) {
|
|
@@ -444,6 +471,8 @@ function resourceSchema(schema) {
|
|
|
444
471
|
*
|
|
445
472
|
* Will return the passed in schema.
|
|
446
473
|
*
|
|
474
|
+
* @param {ObjectSchema} schema
|
|
475
|
+
* @return {ObjectSchema} the passed in schema
|
|
447
476
|
* @public
|
|
448
477
|
*/
|
|
449
478
|
function objectSchema(schema) {
|
|
@@ -453,6 +482,8 @@ function objectSchema(schema) {
|
|
|
453
482
|
/**
|
|
454
483
|
* A type utility to narrow a schema to a ResourceSchema
|
|
455
484
|
*
|
|
485
|
+
* @param schema
|
|
486
|
+
* @return {Boolean}
|
|
456
487
|
* @public
|
|
457
488
|
*/
|
|
458
489
|
function isResourceSchema(schema) {
|
|
@@ -462,6 +493,8 @@ function isResourceSchema(schema) {
|
|
|
462
493
|
/**
|
|
463
494
|
* A type utility to narrow a schema to LegacyResourceSchema
|
|
464
495
|
*
|
|
496
|
+
* @param schema
|
|
497
|
+
* @return {Boolean}
|
|
465
498
|
* @public
|
|
466
499
|
*/
|
|
467
500
|
function isLegacyResourceSchema(schema) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sources":["../../../src/types/schema/fields.ts"],"sourcesContent":["import type { ObjectValue, PrimitiveValue } from '../json/raw.ts';\n\n/**\n * A generic \"field\" that can be used to define\n * primitive value fields.\n *\n * Replaces \"attribute\" for primitive value fields.\n * Can also be used to eject from deep-tracking of\n * objects or arrays.\n *\n * A major difference between \"field\" and \"attribute\"\n * is that \"type\" points to a legacy transform on\n * \"attribute\" that a serializer *might* use, while\n * \"type\" points to a new-style transform on \"field\"\n * that a record implmentation *must* use.\n *\n * @class (Type) GenericField\n * @public\n */\nexport interface GenericField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'field'}\n * @public\n */\n kind: 'field';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * the name of the transform to use, if any\n *\n * @property type\n * @type {String | undefined}\n * @public\n */\n type?: string;\n\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * A field that can be used to alias one key to another\n * key present in the cache version of the resource.\n *\n * Unlike DerivedField, an AliasField may write to its\n * source when a record is in an editable mode.\n *\n * AliasFields may utilize a transform, specified by type,\n * to pre/post process the field.\n *\n * An AliasField may also specify a `kind` via options.\n * `kind` may be any other valid field kind other than\n *\n * - `@hash`\n * - `@id`\n * - `@local`\n * - `derived`\n *\n * This allows an AliasField to rename any field in the cache.\n *\n * Alias fields are generally intended to be used to support migrating\n * between different schemas, though there are times where they are useful\n * as a form of advanced derivation when used with a transform. For instance,\n * an AliasField could be used to expose both a string and a Date version of the\n * same field, with both being capable of being written to.\n *\n * @class (Type) LegacyAliasField\n * @public\n */\nexport interface LegacyAliasField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'alias'}\n * @public\n */\n kind: 'alias';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * Always null (for now)\n *\n * @property type\n * @type {null}\n * @public\n */\n type: null; // should always be null\n\n /**\n * The field def for which this is an alias.\n *\n * @property options\n * @type {GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField}\n * @public\n */\n options:\n | GenericField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n // | ResourceField\n // | CollectionField\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField;\n}\n\n/**\n * A field that can be used to alias one key to another\n * key present in the cache version of the resource.\n *\n * Unlike DerivedField, an AliasField may write to its\n * source when a record is in an editable mode.\n *\n * AliasFields may utilize a transform, specified by type,\n * to pre/post process the field.\n *\n * An AliasField may also specify a `kind` via options.\n * `kind` may be any other valid field kind other than\n *\n * - `@hash`\n * - `@id`\n * - `@local`\n * - `derived`\n *\n * This allows an AliasField to rename any field in the cache.\n *\n * Alias fields are generally intended to be used to support migrating\n * between different schemas, though there are times where they are useful\n * as a form of advanced derivation when used with a transform. For instance,\n * an AliasField could be used to expose both a string and a Date version of the\n * same field, with both being capable of being written to.\n *\n * @class (Type) PolarisAliasField\n * @public\n */\nexport interface PolarisAliasField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'alias'}\n * @public\n */\n kind: 'alias';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * Always null (for now)\n *\n * @property type\n * @type {null}\n * @public\n */\n type: null; // should always be null\n\n /**\n * The field def for which this is an alias.\n *\n * @property options\n * @type {GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LinksModeBelongsToField | LinksModeHasManyField}\n * @public\n */\n options:\n | GenericField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n // | ResourceField\n // | CollectionField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n}\n\n/**\n * A field that can be used to alias one key to another\n * key present in the cache version of the resource.\n *\n * Unlike DerivedField, an AliasField may write to its\n * source when a record is in an editable mode.\n *\n * AliasFields may utilize a transform, specified by type,\n * to pre/post process the field.\n *\n * An AliasField may also specify a `kind` via options.\n * `kind` may be any other valid field kind other than\n *\n * - `@hash`\n * - `@id`\n * - `@local`\n * - `derived`\n *\n * This allows an AliasField to rename any field in the cache.\n *\n * Alias fields are generally intended to be used to support migrating\n * between different schemas, though there are times where they are useful\n * as a form of advanced derivation when used with a transform. For instance,\n * an AliasField could be used to expose both a string and a Date version of the\n * same field, with both being capable of being written to.\n *\n * @class (Type) ObjectAliasField\n * @public\n */\nexport interface ObjectAliasField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'alias'}\n * @public\n */\n kind: 'alias';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * Always null (for now)\n *\n * @property type\n * @type {null}\n * @public\n */\n type: null; // should always be null\n\n /**\n * The field def for which this is an alias.\n *\n * @property options\n * @type {GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField}\n * @public\n */\n options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField;\n}\n\n/**\n * Represents a field whose value is the primary\n * key of the resource.\n *\n * This allows any field to serve as the primary\n * key while still being able to drive identity\n * needs within the system.\n *\n * This is useful for resources that use for instance\n * 'uuid', 'urn' or 'entityUrn' or 'primaryKey' as their\n * primary key field instead of 'id'.\n *\n * @class (Type) IdentityField\n * @public\n */\nexport interface IdentityField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'@id'}\n * @public\n */\n kind: '@id';\n\n /**\n * The name of the field that serves as the\n * primary key for the resource.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n}\n\n/**\n * Represents a specialized field whose computed value\n * will be used as the primary key of a schema-object\n * for serializability and comparison purposes.\n *\n * This field functions similarly to derived fields in that\n * it is non-settable, derived state but differs in that\n * it is only able to compute off of cache state and is given\n * no access to a record instance.\n *\n * This means that if a hashing function wants to compute its value\n * taking into account transformations and derivations it must\n * perform those itself.\n *\n * A schema-array can declare its \"key\" value to be `@hash` if\n * a schema-object has such a field.\n *\n * Only one hash field is permittable per schema-object, and\n * it should be placed in the `ResourceSchema`'s `@id` field\n * in place of an `IdentityField`.\n *\n * @class (Type) HashField\n * @public\n */\nexport interface HashField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'@hash'}\n * @public\n */\n kind: '@hash';\n\n /**\n * The name of the field that serves as the\n * hash for the resource.\n *\n * Only required if access to this value by\n * the UI is desired, it can be `null` otherwise.\n *\n * @property name\n * @type {String | null}\n * @public\n */\n name: string | null;\n\n /**\n * The name of a function to run to compute the hash.\n * The function will only have access to the cached\n * data for the record.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Any options that should be provided to the hash\n * function.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field whose value is a local\n * value that is not stored in the cache, nor\n * is it sent to the server.\n *\n * Local fields can be written to, and their\n * value is both memoized and reactive (though\n * not deep-tracked).\n *\n * Because their state is not derived from the cache\n * data or the server, they represent a divorced\n * uncanonical source of state.\n *\n * For this reason Local fields should be used sparingly.\n *\n * Currently, while we document this feature here,\n * only allow our own SchemaRecord default fields to\n * utilize them and the feature should be considered private.\n *\n * Example use cases that drove the creation of local\n * fields are states like `isDestroying` and `isDestroyed`\n * which are specific to a record instance but not\n * stored in the cache. We wanted to be able to drive\n * these fields from schema the same as all other fields.\n *\n * Don't make us regret this decision.\n *\n * @class (Type) LocalField\n * @public\n */\nexport interface LocalField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'@local'}\n * @public\n */\n kind: '@local';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n /**\n * Not currently utilized, we are considering\n * allowing transforms to operate on local fields\n *\n * @property type\n * @type {String | undefined}\n * @public\n */\n type?: string;\n\n /**\n * Options for the field.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: { defaultValue?: PrimitiveValue };\n}\n\n/**\n * Represents a field whose value is an object\n * with keys pointing to values that are primitive\n * values.\n *\n * If values of the keys are not primitives, or\n * if the key/value pairs have well-defined shape,\n * use 'schema-object' instead.\n *\n * @class (Type) ObjectField\n * @public\n */\nexport interface ObjectField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'object'}\n * @public\n */\n kind: 'object';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of a transform to pass the entire object\n * through before displaying or serializing it.\n *\n * @property type\n * @type {String | undefined}\n * @public\n */\n type?: string;\n\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field whose value is an object\n * with a well-defined structure described by\n * a non-resource schema.\n *\n * If the object's structure is not well-defined,\n * use 'object' instead.\n *\n * @class (Type) SchemaObjectField\n * @public\n */\nexport interface SchemaObjectField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'schema-object'}\n * @public\n */\n kind: 'schema-object';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the ObjectSchema that describes the\n * structure of the object.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for configuring the behavior of the\n * SchemaObject.\n *\n * - `polymorphic` : Whether this SchemaObject is Polymorphic.\n * - `type` : If the SchemaObject is Polymorphic, the key on the raw cache data to use as the \"resource-type\" value for the schema-object.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: {\n /**\n * Whether this SchemaObject is Polymorphic.\n *\n * If the SchemaObject is polymorphic, `options.type` must also be supplied.\n *\n */\n polymorphic?: boolean;\n\n /**\n * If the SchemaObject is Polymorphic, the key on the raw cache data to use\n * as the \"resource-type\" value for the schema-object.\n *\n * Defaults to \"type\".\n *\n */\n type?: string;\n };\n}\n\n/**\n * Represents a field whose value is an array\n * of primitive values.\n *\n * If the array's elements are not primitive\n * values, use 'schema-array' instead.\n *\n * @class (Type) ArrayField\n * @public\n */\nexport interface ArrayField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'array'}\n * @public\n */\n kind: 'array';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of a transform to pass each item\n * in the array through before displaying or\n * or serializing it.\n *\n * @property type\n * @type {String | undefined}\n * @public\n */\n type?: string;\n\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field whose value is an array\n * of objects with a well-defined structure\n * described by a non-resource schema.\n *\n * If the array's elements are not well-defined,\n * use 'array' instead.\n *\n * @class (Type) SchemaArrayField\n * @public\n */\nexport interface SchemaArrayField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'schema-array'}\n * @public\n */\n kind: 'schema-array';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the ObjectSchema that describes the\n * structure of the objects in the array.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for configuring the behavior of the\n * SchemaArray.\n *\n * - `key`\n *\n * Configures how the SchemaArray determines whether an object in the cache is the same\n * as an object previously used to instantiate one of the schema-objects it contains.\n *\n * The default is `'@identity'`.\n *\n * Valid options are:\n *\n * - `'@identity'` (default) : the cached object's referential identity will be used.\n * This may result in significant instability when resource data is updated from the API\n * - `'@index'` : the cached object's index in the array will be used.\n * This is only a good choice for arrays that rarely if ever change membership\n * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for\n * The contained schema-object and use the computed result to determine and compare identity.\n * - \\<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)\n * Are valid field names for this purpose. The cache state without transforms applied will be\n * used when comparing values. The field value should be unique enough to guarantee two schema-objects\n * of the same type will not collide.\n *\n * - `polymorphic` : Whether this SchemaArray is Polymorphic.\n * - `type` : If the SchemaArray is Polymorphic, the key on the raw cache data to use as the \"resource-type\" value for the schema-object.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: {\n /**\n * Configures how the SchemaArray determines whether\n * an object in the cache is the same as an object\n * previously used to instantiate one of the schema-objects\n * it contains.\n *\n * The default is `'@identity'`.\n *\n * Valid options are:\n *\n * - `'@identity'` (default) : the cached object's referential identity will be used.\n * This may result in significant instability when resource data is updated from the API\n * - `'@index'` : the cached object's index in the array will be used.\n * This is only a good choice for arrays that rarely if ever change membership\n * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for\n * The contained schema-object and use the computed result to determine and compare identity.\n * - \\<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)\n * Are valid field names for this purpose. The cache state without transforms applied will be\n * used when comparing values. The field value should be unique enough to guarantee two schema-objects\n * of the same type will not collide.\n *\n */\n key?: '@identity' | '@index' | '@hash' | string;\n\n /**\n * Whether this SchemaArray is Polymorphic.\n *\n * If the SchemaArray is polymorphic, `options.type` must also be supplied.\n *\n */\n polymorphic?: boolean;\n\n /**\n * If the SchemaArray is Polymorphic, the key on the raw cache data to use\n * as the \"resource-type\" value for the schema-object.\n *\n * Defaults to \"type\".\n *\n */\n type?: string;\n };\n}\n\n/**\n * Represents a field whose value is derived\n * from other fields in the schema.\n *\n * The value is read-only, and is not stored\n * in the cache, nor is it sent to the server.\n *\n * Usage of derived fields should be minimized\n * to scenarios where the derivation is known\n * to be safe. For instance, derivations that\n * required fields that are not always loaded\n * or that require access to related resources\n * that may not be loaded should be avoided.\n *\n * @class (Type) DerivedField\n * @public\n */\nexport interface DerivedField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'derived'}\n * @public\n */\n kind: 'derived';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the derivation to use.\n *\n * Derivations are functions that take the\n * record, options, and the name of the field\n * as arguments, and return the derived value.\n *\n * Derivations are memoized, and are only\n * recomputed when the fields they depend on\n * change.\n *\n * Derivations are not stored in the cache,\n * and are not sent to the server.\n *\n * Derivation functions must be explicitly\n * registered with the schema service.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options to pass to the derivation, if any\n *\n * Must comply to the specific derivation's\n * options schema.\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field that is a reference to\n * another resource.\n *\n * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED\n * BY SchemaRecord\n *\n * @class (Type) ResourceField\n * @public\n */\nexport interface ResourceField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'resource'}\n * @public\n */\n kind: 'resource';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for resources are optional. If\n * not present, all options are presumed\n * to be falsey\n *\n * @property options\n * @type {ObjectValue | undefined}\n * @public\n */\n options?: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain a link\n * that can be used to fetch the related\n * resource when needed.\n *\n */\n async?: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n */\n inverse?: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n */\n polymorphic?: boolean;\n };\n}\n\n/**\n * Represents a field that is a reference to\n * a collection of other resources, potentially\n * paginate.\n *\n * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED\n * BY SchemaRecord\n *\n * @class (Type) CollectionField\n * @public\n */\nexport interface CollectionField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'collection'}\n * @public\n */\n kind: 'collection';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for resources are optional. If\n * not present, all options are presumed\n * to be falsey\n *\n */\n options?: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain links\n * that can be used to fetch the related\n * resources when needed.\n *\n * When false, it is expected that all related\n * resources are loaded together with this resource,\n * and that the cache data for this field will\n * contain the full list of pointers.\n *\n * When true, it is expected that the relationship\n * is paginated. If the relationship is not paginated,\n * then the cache data for \"page 1\" would contain the\n * full list of pointers, and loading \"page 1\" would\n * load all related resources.\n *\n */\n async?: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n */\n inverse?: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n */\n polymorphic?: boolean;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n * > It cannot be used with PolarisMode\n *\n * A generic \"field\" that can be used to define\n * primitive value fields.\n *\n * If the field points to an object or array,\n * it will not be deep-tracked.\n *\n * Transforms when defined are legacy transforms\n * that a serializer *might* use, but their usage\n * is not guaranteed.\n *\n * @class (Type) LegacyAttributeField\n * @public\n */\nexport interface LegacyAttributeField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'attribute'}\n * @public\n */\n kind: 'attribute';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n /**\n * The name of the transform to use, if any\n *\n * @property type\n * @type {String | undefined | null}\n * @public\n */\n type?: string | null;\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n */\n options?: ObjectValue;\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * another resource.\n *\n * This is the legacy version of the `ResourceField`.\n *\n * @class (Type) LegacyBelongsToField\n * @public\n */\nexport interface LegacyBelongsToField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'belongsTo'}\n * @public\n */\n kind: 'belongsTo';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for belongsTo are mandatory.\n *\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain a link\n * or a pointer that can be used to fetch\n * the related resource when needed.\n *\n * Pointers are highly discouraged.\n *\n */\n async: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriend: {\n * links: { related: \"/users/1/bestFriend\" },\n * data: { type: 'user', id: '1' },\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n */\n linksMode?: true;\n\n /**\n * When omitted, the cache data for this field will\n * clear local state of all changes except for the\n * addition of records still in the \"new\" state any\n * time the remote data for this field is updated.\n *\n * When set to `false`, the cache data for this field\n * will instead intelligently commit any changes from\n * local state that are present in the remote data,\n * leaving any remaining changes in local state still.\n *\n */\n resetOnRemoteUpdate?: false;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * another resource.\n *\n * This is the legacy version of the `ResourceField`.\n *\n * @class (Type) LinksModeBelongsToField\n * @public\n */\nexport interface LinksModeBelongsToField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'belongsTo'}\n * @public\n */\n kind: 'belongsTo';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for belongsTo are mandatory.\n *\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * MUST be false for PolarisMode + LinksMode\n *\n */\n async: false;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * MUST be true for PolarisMode + LinksMode\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriend: {\n * links: { related: \"/users/1/bestFriend\" },\n * data: { type: 'user', id: '1' },\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n * Activating LinksMode will *also* deactivate the deprecated\n * `resetOnRemoteUpdate` behavior for this field.\n *\n * This means that when new remote state is received, the cache\n * will intelligently commit any changes from local state that\n * are present in the remote data for this field, leaving any remaining\n * changes in local state still.\n *\n * Previously, the cache would clear local state of all changes\n * except for the addition of records still in the \"new\" state any\n * time the remote data for this field was updated.\n *\n */\n linksMode: true;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * a collection of other resources.\n *\n * This is the legacy version of the `CollectionField`.\n *\n * @class (Type) LegacyHasManyField\n * @public\n */\nexport interface LegacyHasManyField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'hasMany'}\n * @public\n */\n kind: 'hasMany';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * the name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for hasMany are mandatory.\n *\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain links\n * or pointers that can be used to fetch\n * the related resources when needed.\n *\n * When false, it is expected that all related\n * resources are loaded together with this resource,\n * and that the cache data for this field will\n * contain the full list of pointers.\n *\n * hasMany relationships do not support pagination.\n *\n */\n async: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriends: {\n * links: { related: \"/users/1/bestFriends\" },\n * data: [ { type: 'user', id: '1' } ],\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n */\n linksMode?: true;\n\n /**\n * When omitted, the cache data for this field will\n * clear local state of all changes except for the\n * addition of records still in the \"new\" state any\n * time the remote data for this field is updated.\n *\n * When set to `false`, the cache data for this field\n * will instead intelligently commit any changes from\n * local state that are present in the remote data,\n * leaving any remaining changes in local state still.\n *\n */\n resetOnRemoteUpdate?: false;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * a collection of other resources.\n *\n * This is the legacy version of the `CollectionField`.\n *\n * @class (Type) LinksModeHasManyField\n * @public\n */\nexport interface LinksModeHasManyField {\n /**\n * The kind of field this is.\n *\n * @property kind\n * @type {'hasMany'}\n * @public\n */\n kind: 'hasMany';\n\n /**\n * The name of the field.\n *\n * @property name\n * @type {String}\n * @public\n */\n name: string;\n\n /**\n * the name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * Options for hasMany are mandatory.\n *\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * MUST be false for PolarisMode + LinksMode\n *\n * If true, it is expected that the cache\n * data for this field will contain links\n * or pointers that can be used to fetch\n * the related resources when needed.\n *\n * When false, it is expected that all related\n * resources are loaded together with this resource,\n * and that the cache data for this field will\n * contain the full list of pointers.\n *\n * hasMany relationships do not support pagination.\n *\n */\n async: false;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * MUST be true for PolarisMode + LinksMode\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriends: {\n * links: { related: \"/users/1/bestFriends\" },\n * data: [ { type: 'user', id: '1' } ],\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n * Activating LinksMode will *also* deactivate the deprecated\n * `resetOnRemoteUpdate` behavior for this field.\n *\n * This means that when new remote state is received, the cache\n * will intelligently commit any changes from local state that\n * are present in the remote data for this field, leaving any remaining\n * changes in local state still.\n *\n * Previously, the cache would clear local state of all changes\n * except for the addition of records still in the \"new\" state any\n * time the remote data for this field was updated.\n *\n */\n linksMode: true;\n };\n}\n\n/**\n * A union of all possible LegacyMode field schemas.\n *\n * Available field schemas are:\n *\n * - {@link GenericField}\n * - {@link LegacyAliasField}\n * - {@link LocalField}\n * - {@link ObjectField}\n * - {@link SchemaObjectField}\n * - {@link ArrayField}\n * - {@link SchemaArrayField}\n * - {@link DerivedField}\n * - {@link ResourceField | ResourceField (not yet implemented)}\n * - {@link CollectionField | CollectionField (not yet implemented)}\n * - {@link LegacyAttributeField}\n * - {@link LegacyBelongsToField}\n * - {@link LegacyHasManyField}\n *\n * @class (Type) LegacyModeFieldSchema\n * @public\n */\nexport type LegacyModeFieldSchema =\n | GenericField\n | LegacyAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField\n // | ResourceField // not yet implemented\n // | CollectionField // not yet implemented\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField;\n\n/**\n * A union of all possible PolarisMode field schemas.\n *\n * Available field schemas are:\n *\n * - {@link GenericField}\n * - {@link PolarisAliasField}\n * - {@link LocalField}\n * - {@link ObjectField}\n * - {@link SchemaObjectField}\n * - {@link ArrayField}\n * - {@link SchemaArrayField}\n * - {@link DerivedField}\n * - {@link ResourceField | ResourceField (not yet implemented)}\n * - {@link CollectionField | CollectionField (not yet implemented)}\n * - {@link LinksModeBelongsToField}\n * - {@link LinksModeHasManyField}\n *\n * @class (Type) PolarisModeFieldSchema\n * @public\n */\nexport type PolarisModeFieldSchema =\n | GenericField\n | PolarisAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField\n // | ResourceField\n // | CollectionField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n\n/**\n * A union of all possible LegacyMode and PolarisMode\n * field schemas.\n *\n * You likely will want to use PolarisModeFieldSchema,\n * LegacyModeFieldSchema, or ObjectFieldSchema instead\n * as appropriate as they are more specific and will\n * provide better guidance around what is valid.\n *\n * @class (Type) FieldSchema\n * @public\n */\nexport type FieldSchema =\n | GenericField\n | LegacyAliasField\n | PolarisAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField\n | ResourceField\n | CollectionField\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n\n/**\n * A union of all possible field schemas that can be\n * used in an ObjectSchema.\n *\n * @class (Type) ObjectFieldSchema\n * @public\n */\nexport type ObjectFieldSchema =\n | GenericField\n | ObjectAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField;\n\n/**\n * Represents a schema for a primary resource in PolarisMode.\n *\n * Primary resources are objects with a unique identity of their\n * own which may allow them to appear in relationships, or in multiple\n * response documents.\n *\n * @class (Type) PolarisResourceSchema\n * @public\n */\nexport interface PolarisResourceSchema {\n legacy?: false;\n\n /**\n * For primary resources, this should be an IdentityField\n *\n * for schema-objects, this should be either a HashField or null\n *\n * @property identity\n * @type {IdentityField}\n * @public\n */\n identity: IdentityField;\n\n /**\n * The name of the schema\n *\n * For cacheable resources, this should be the\n * primary resource type.\n *\n * For object schemas, this should be the name\n * of the object schema.\n *\n * The names of object and resource schemas share\n * a single namespace and must not conflict.\n *\n * We recommend a naming convention for object schemas\n * such as below for ensuring uniqueness:\n *\n * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`\n * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`\n * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * The fields that make up the shape of the resource\n *\n * @property fields\n * @type {PolarisModeFieldSchema[]}\n * @public\n */\n fields: PolarisModeFieldSchema[];\n\n /**\n * A list of traits that this resource implements. The fields for these\n * traits should still be defined in the fields array.\n *\n * Each trait should be a string that matches the `type` of another\n * resource schema. The trait can be abstract and reference a resource\n * type that is never defined as a schema.\n *\n * @property traits\n * @type {String[]}\n * @public\n */\n traits?: string[];\n}\n\n/**\n * Represents a schema for a primary resource in LegacyMode\n *\n * Primary resources are objects with a unique identity of their\n * own which may allow them to appear in relationships, or in multiple\n * response documents.\n *\n * @class (Type) LegacyResourceSchema\n * @public\n */\nexport interface LegacyResourceSchema {\n /**\n * A flag indicating that this is a legacy resource schema\n *\n * @property legacy\n * @type {true}\n * @public\n */\n legacy: true;\n\n /**\n * This should be an IdentityField.\n *\n * To maximize compatibility with Model where `id` was the\n * name of the identity field, we recommend using `{ kind: '@id', name: 'id' }`\n * for records in legacy mode, but this is not required.\n *\n * @property identity\n * @type {IdentityField}\n * @public\n */\n identity: IdentityField;\n\n /**\n * The name of the schema\n *\n * For cacheable resources, this should be the\n * primary resource type.\n *\n * The names of object and resource schemas share\n * a single namespace and must not conflict.\n *\n * We recommend a naming convention for object schemas\n * such as below for ensuring uniqueness:\n *\n * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`\n * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`\n * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * The fields that make up the shape of the resource\n *\n * @property fields\n * @type {LegacyModeFieldSchema[]}\n * @public\n */\n fields: LegacyModeFieldSchema[];\n\n /**\n * A list of traits that this resource implements. The fields for these\n * traits should still be defined in the fields array.\n *\n * Each trait should be a string that matches the `type` of another\n * resource schema. The trait can be abstract and reference a resource\n * type that is never defined as a schema.\n *\n * @property traits\n * @type {String[]}\n * @public\n */\n traits?: string[];\n}\n\n/**\n * A type which represents a valid JSON schema\n * definition for either a PolarisMode or a\n * LegacyMode resource.\n *\n * Note, this is separate from the type returned\n * by the SchemaService which provides fields as a Map\n * instead of as an Array.\n *\n */\nexport type ResourceSchema = PolarisResourceSchema | LegacyResourceSchema;\n\n/**\n * Represents a schema for an object that is not\n * a primary resource (has no unique identity of its own).\n *\n * ObjectSchemas may not currently contain relationships.\n *\n * @class (Type) ObjectSchema\n * @public\n */\nexport interface ObjectSchema {\n /**\n * Either a HashField from which to calculate an identity or null\n *\n * In the case of `null`, the object's identity will be based\n * on the referential identity of the object in the cache itself\n * when an identity is needed.\n *\n * @property identity\n * @type {HashField | null}\n * @public\n */\n identity: HashField | null;\n\n /**\n * The name of the schema\n *\n * The names of object and resource schemas share\n * a single namespace and must not conflict.\n *\n * We recommend a naming convention for object schemas\n * such as below for ensuring uniqueness:\n *\n * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`\n * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`\n * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`\n *\n * @property type\n * @type {String}\n * @public\n */\n type: string;\n\n /**\n * The fields that make up the shape of the object\n *\n * @property fields\n * @type {ObjectFieldSchema[]}\n * @public\n */\n fields: ObjectFieldSchema[];\n}\n\nexport type Schema = ResourceSchema | ObjectSchema;\n\n/**\n * A no-op type utility that enables type-checking resource schema\n * definitions.\n *\n * Will return the passed in schema.\n *\n * This will not validate relationship inverses or related types,\n * as doing so would require a full schema graph to be passed in\n * and no cycles in the graph to be present.\n *\n * @param {ResourceSchema} schema\n * @return {ResourceSchema} the passed in schema\n * @public\n */\nexport function resourceSchema<T extends LegacyResourceSchema | PolarisResourceSchema>(\n schema: LegacyResourceSchema | PolarisResourceSchema\n): T {\n return schema as T;\n}\n\n/**\n * A no-op type utility that enables type-checking object schema\n * definitions.\n *\n * Will return the passed in schema.\n *\n * @param {ObjectSchema} schema\n * @return {ObjectSchema} the passed in schema\n * @public\n */\nexport function objectSchema<T extends ObjectSchema>(schema: T): T {\n return schema;\n}\n\n/**\n * A type utility to narrow a schema to a ResourceSchema\n *\n * @param schema\n * @return {Boolean}\n * @public\n */\nexport function isResourceSchema(schema: ResourceSchema | ObjectSchema): schema is ResourceSchema {\n return schema?.identity?.kind === '@id';\n}\n\n/**\n * A type utility to narrow a schema to LegacyResourceSchema\n *\n * @param schema\n * @return {Boolean}\n * @public\n */\nexport function isLegacyResourceSchema(schema: ResourceSchema | ObjectSchema): schema is LegacyResourceSchema {\n return isResourceSchema(schema) && schema.legacy === true;\n}\n\nexport type LegacyField =\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\nexport type LegacyRelationshipField =\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n"],"names":["resourceSchema","schema","objectSchema","isResourceSchema","identity","kind","isLegacyResourceSchema","legacy"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,MAAoD,EACjD;AACH,EAAA,OAAOA,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAyBD,MAAS,EAAK;AACjE,EAAA,OAAOA,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAACF,MAAqC,EAA4B;AAChG,EAAA,OAAOA,MAAM,EAAEG,QAAQ,EAAEC,IAAI,KAAK,KAAK;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CAACL,MAAqC,EAAkC;EAC5G,OAAOE,gBAAgB,CAACF,MAAM,CAAC,IAAIA,MAAM,CAACM,MAAM,KAAK,IAAI;AAC3D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.type-test.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-api-raw.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/types/symbols.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getOrSetGlobal } from
|
|
1
|
+
import { getOrSetGlobal } from "./-private.js";
|
|
2
2
|
const RecordStore = getOrSetGlobal('Store', Symbol('Store'));
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -11,7 +11,7 @@ const RecordStore = getOrSetGlobal('Store', Symbol('Store'));
|
|
|
11
11
|
* record implementations to provide a typescript
|
|
12
12
|
* hint for the type of the resource.
|
|
13
13
|
*
|
|
14
|
-
* When used, EmberData
|
|
14
|
+
* When used, EmberData and WarpDrive APIs can
|
|
15
15
|
* take advantage of this to provide better type
|
|
16
16
|
* safety and intellisense.
|
|
17
17
|
*
|
|
@@ -48,7 +48,7 @@ const Type = getOrSetGlobal('$type', Symbol('$type'));
|
|
|
48
48
|
* record implementations to provide a typescript
|
|
49
49
|
* hint for the type of the resource.
|
|
50
50
|
*
|
|
51
|
-
* When used, EmberData
|
|
51
|
+
* When used, EmberData and WarpDrive APIs can
|
|
52
52
|
* take advantage of this to provide better type
|
|
53
53
|
* safety and intellisense.
|
|
54
54
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.js","sources":["../../src/types/symbols.ts"],"sourcesContent":["import { getOrSetGlobal } from './-private.ts';\n\nexport const RecordStore: '___(unique) Symbol(Store)' = getOrSetGlobal('Store', Symbol('Store'));\n\n/**\n * Symbol for the name of a resource, transformation\n * or derivation.\n *\n * ### With Resources\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, EmberData and WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * ### With Derivations\n *\n * Required for derivations registered with\n * `store.registerDerivation(derivation)`.\n *\n * ```ts\n * function concat(record: object, options: ObjectValue | null, prop: string): string {}\n * concat[Name] = 'concat';\n * ```\n *\n * ### With Transforms\n *\n * Required for new-style transformations registered\n * with `store.registerTransform(transform)`.\n *\n * For legacy transforms, if not used,\n * `attr<Transform>('name')` will allow any string name.\n * `attr('name')` will always allow any string name.\n *\n * If used, `attr<Transform>('name')` will enforce\n * that the name is the same as the transform name.\n *\n * @type {Symbol}\n */\nexport const Type: '___(unique) Symbol($type)' = getOrSetGlobal('$type', Symbol('$type'));\n\n/**\n * Symbol for the type of a resource.\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, EmberData and WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * @type {Symbol}\n */\nexport const ResourceType: '___(unique) Symbol($type)' = Type;\n\n/**\n * Symbol for the name of a transform.\n *\n * This is an optional feature that can be used by\n * transform implementations to provide a typescript\n * hint for the name of the transform.\n *\n * If not used, `attr<Transform>('name')` will\n * allow any string name. `attr('name')` will always\n * allow any string name.\n *\n * If used, `attr<Transform>('name')` will enforce\n * that the name is the same as the transform name.\n *\n * @type {Symbol}\n */\nexport const TransformName: '___(unique) Symbol($type)' = Type;\n\n/**\n * Symbol for use by builders to indicate the return type\n * generic to use for store.request()\n *\n * @type {Symbol}\n */\nexport const RequestSignature: '___(unique) Symbol(RequestSignature)' = getOrSetGlobal(\n 'RequestSignature',\n Symbol('RequestSignature')\n);\n"],"names":["RecordStore","getOrSetGlobal","Symbol","Type","ResourceType","TransformName","RequestSignature"],"mappings":";;AAEO,MAAMA,WAAwC,GAAGC,cAAc,CAAC,OAAO,EAAEC,MAAM,CAAC,OAAO,CAAC;;AAE/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,IAAiC,GAAGF,cAAc,CAAC,OAAO,EAAEC,MAAM,CAAC,OAAO,CAAC;;AAExF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,YAAyC,GAAGD;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,aAA0C,GAAGF;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,gBAAwD,GAAGL,cAAc,CACpF,kBAAkB,EAClBC,MAAM,CAAC,kBAAkB,CAC3B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/core",
|
|
3
|
-
"version": "5.6.0-alpha.
|
|
3
|
+
"version": "5.6.0-alpha.5",
|
|
4
4
|
"description": "Core package for WarpDrive | All the Universal Basics",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"cjs-dist",
|
|
18
17
|
"declarations",
|
|
19
18
|
"addon-main.cjs",
|
|
20
19
|
"CHANGELOG.md",
|
|
@@ -27,28 +26,26 @@
|
|
|
27
26
|
"types": "./declarations/index.d.ts",
|
|
28
27
|
"default": "./dist/index.js"
|
|
29
28
|
},
|
|
30
|
-
"./*.cjs": {
|
|
31
|
-
"default": "./cjs-dist/*.cjs"
|
|
32
|
-
},
|
|
33
29
|
"./*": {
|
|
34
30
|
"types": "./declarations/*.d.ts",
|
|
35
31
|
"default": "./dist/*.js"
|
|
36
32
|
}
|
|
37
33
|
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@ember/test-waiters": "^3.1.0 || ^4.0.0"
|
|
36
|
+
},
|
|
38
37
|
"dependencies": {
|
|
39
38
|
"@embroider/macros": "^1.16.12",
|
|
40
|
-
"@warp-drive/build-config": "5.6.0-alpha.
|
|
39
|
+
"@warp-drive/build-config": "5.6.0-alpha.5"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@babel/core": "^7.26.10",
|
|
44
43
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
45
44
|
"@babel/preset-typescript": "^7.27.0",
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"ember-source": "~6.3.0",
|
|
49
|
-
"expect-type": "^1.2.1",
|
|
45
|
+
"@ember/test-waiters": "^4.1.0",
|
|
46
|
+
"@warp-drive/internal-config": "5.6.0-alpha.5",
|
|
50
47
|
"typescript": "^5.8.3",
|
|
51
|
-
"vite": "^
|
|
48
|
+
"vite": "^5.4.15"
|
|
52
49
|
},
|
|
53
50
|
"volta": {
|
|
54
51
|
"extends": "../../package.json"
|
package/cjs-dist/addon-shim.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@warp-drive/build-config/addon-shim.cjs');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@warp-drive/build-config/cjs-set-config.cjs');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { macros } from "@warp-drive/build-config/babel-macros";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@warp-drive/build-config/canary-features";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@warp-drive/build-config/debugging";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@warp-drive/build-config/deprecations";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DEBUG, PRODUCTION, IS_CI, IS_RECORDING, SHOULD_RECORD, TESTING } from "@warp-drive/build-config/env";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { assert } from "@warp-drive/build-config/macros";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { setConfig } from "@warp-drive/build-config";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { StableRecordIdentifier } from "../../types/identifier.js";
|
|
2
|
-
import type { CollectionEdge } from "./edges/collection.js";
|
|
3
|
-
import type { ResourceEdge } from "./edges/resource.js";
|
|
4
|
-
import type { Graph } from "./graph.js";
|
|
5
|
-
type Diff<T> = {
|
|
6
|
-
add: Set<T>;
|
|
7
|
-
del: Set<T>;
|
|
8
|
-
finalState: T[];
|
|
9
|
-
finalSet: Set<T>;
|
|
10
|
-
changed: boolean;
|
|
11
|
-
remoteOrderChanged: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare function diffCollection(finalState: StableRecordIdentifier[], relationship: CollectionEdge, onAdd: (v: StableRecordIdentifier) => void, onDel: (v: StableRecordIdentifier) => void): Diff<StableRecordIdentifier>;
|
|
14
|
-
export declare function computeLocalState(storage: CollectionEdge): StableRecordIdentifier[];
|
|
15
|
-
/**
|
|
16
|
-
* A function which attempts to add a value to the local state of a collection
|
|
17
|
-
* relationship, and returns true if the value was added, or false if it was
|
|
18
|
-
* already present.
|
|
19
|
-
*
|
|
20
|
-
* It will not generate a notification, will not update the relationships to dirty,
|
|
21
|
-
* and will not update the inverse relationships, making it suitable for use as
|
|
22
|
-
* an internal util to perform the just the addition to a specific side of a
|
|
23
|
-
* relationship.
|
|
24
|
-
*
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
export declare function _add(graph: Graph, record: StableRecordIdentifier, relationship: CollectionEdge, value: StableRecordIdentifier, index: number | null, isRemote: boolean): boolean;
|
|
28
|
-
export declare function _remove(graph: Graph, record: StableRecordIdentifier, relationship: CollectionEdge, value: StableRecordIdentifier, index: number | null, isRemote: boolean): boolean;
|
|
29
|
-
export declare function _removeLocal(relationship: CollectionEdge, value: StableRecordIdentifier): boolean;
|
|
30
|
-
export declare function _removeRemote(relationship: CollectionEdge, value: StableRecordIdentifier): boolean;
|
|
31
|
-
export declare function rollbackRelationship(graph: Graph, identifier: StableRecordIdentifier, field: string, relationship: CollectionEdge | ResourceEdge): void;
|
|
32
|
-
export {};
|