@warp-drive/core 5.6.0-alpha.5 → 5.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/cjs-dist/addon-shim.cjs +1 -0
- package/cjs-dist/cjs-set-config.cjs +1 -0
- package/declarations/build-config/babel-macros.d.ts +1 -0
- package/declarations/build-config/canary-features.d.ts +1 -0
- package/declarations/build-config/debugging.d.ts +1 -0
- package/declarations/build-config/deprecations.d.ts +1 -0
- package/declarations/build-config/env.d.ts +1 -0
- package/declarations/build-config/macros.d.ts +1 -0
- package/declarations/build-config.d.ts +1 -0
- package/declarations/configure.d.ts +7 -0
- package/declarations/graph/-private/-diff.d.ts +32 -0
- package/declarations/graph/-private/-edge-definition.d.ts +148 -0
- package/declarations/graph/-private/-state.d.ts +96 -0
- package/declarations/graph/-private/-utils.d.ts +31 -0
- package/declarations/graph/-private/coerce-id.d.ts +10 -0
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +18 -0
- package/declarations/graph/-private/edges/collection.d.ts +39 -0
- package/declarations/graph/-private/edges/implicit.d.ts +43 -0
- package/declarations/graph/-private/edges/resource.d.ts +24 -0
- package/declarations/graph/-private/graph.d.ts +90 -0
- package/declarations/graph/-private/normalize-link.d.ts +8 -0
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +4 -0
- package/declarations/graph/-private/operations/merge-identifier.d.ts +3 -0
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +4 -0
- package/declarations/graph/-private/operations/replace-related-record.d.ts +3 -0
- package/declarations/graph/-private/operations/replace-related-records.d.ts +62 -0
- package/declarations/graph/-private/operations/update-relationship.d.ts +13 -0
- package/declarations/graph/-private.d.ts +13 -0
- package/declarations/index.d.ts +14 -3
- package/declarations/reactive/-private/document.d.ts +146 -0
- package/declarations/reactive/-private/fields/compute.d.ts +43 -0
- package/declarations/reactive/-private/fields/extension.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +22 -0
- package/declarations/reactive/-private/fields/managed-object.d.ts +21 -0
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +19 -0
- package/declarations/reactive/-private/hooks.d.ts +5 -0
- package/declarations/reactive/-private/record.d.ts +64 -0
- package/declarations/reactive/-private/schema.d.ts +271 -0
- package/declarations/reactive/-private/symbols.d.ts +36 -0
- package/declarations/reactive/-private.d.ts +1 -0
- package/declarations/reactive.d.ts +4 -0
- package/declarations/request/-private/context.d.ts +34 -35
- package/declarations/request/-private/debug.d.ts +2 -3
- package/declarations/request/-private/fetch.d.ts +24 -36
- package/declarations/request/-private/future.d.ts +3 -4
- package/declarations/request/-private/manager.d.ts +159 -132
- package/declarations/request/-private/promise-cache.d.ts +21 -13
- package/declarations/request/-private/types.d.ts +124 -123
- package/declarations/request/-private/utils.d.ts +8 -9
- package/declarations/request.d.ts +5 -433
- package/declarations/store/-private/cache-handler/handler.d.ts +62 -0
- package/declarations/store/-private/cache-handler/types.d.ts +98 -0
- package/declarations/store/-private/cache-handler/utils.d.ts +32 -0
- package/declarations/store/-private/caches/cache-utils.d.ts +12 -0
- package/declarations/store/-private/caches/identifier-cache.d.ts +304 -0
- package/declarations/store/-private/caches/instance-cache.d.ts +65 -0
- package/declarations/store/-private/caches/resource-utils.d.ts +9 -0
- package/declarations/store/-private/debug/utils.d.ts +6 -0
- package/declarations/store/-private/default-cache-policy.d.ts +384 -0
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +159 -0
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +17 -0
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +25 -0
- package/declarations/store/-private/managers/cache-manager.d.ts +443 -0
- package/declarations/store/-private/managers/notification-manager.d.ts +98 -0
- package/declarations/store/-private/managers/record-array-manager.d.ts +97 -0
- package/declarations/store/-private/network/request-cache.d.ts +107 -0
- package/declarations/store/-private/new-core-tmp/promise-state.d.ts +263 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +176 -0
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +169 -0
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +35 -0
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +277 -0
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +261 -0
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +147 -0
- package/declarations/store/-private/record-arrays/many-array.d.ts +197 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +126 -0
- package/declarations/store/-private/store-service.d.ts +1605 -0
- package/declarations/store/-private/utils/coerce-id.d.ts +10 -0
- package/declarations/store/-private/utils/construct-resource.d.ts +6 -0
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +1 -0
- package/declarations/store/-private/utils/normalize-model-name.d.ts +1 -0
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +1 -0
- package/declarations/store/-private.d.ts +31 -0
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +99 -0
- package/declarations/store/-types/q/ds-model.d.ts +21 -0
- package/declarations/store/-types/q/identifier.d.ts +20 -0
- package/declarations/store/-types/q/record-instance.d.ts +23 -0
- package/declarations/store/-types/q/schema-service.d.ts +354 -0
- package/declarations/store/-types/q/store.d.ts +32 -0
- package/declarations/store.d.ts +1 -0
- package/declarations/types/-private.d.ts +16 -8
- package/declarations/types/cache/aliases.d.ts +11 -1
- package/declarations/types/cache/change.d.ts +4 -5
- package/declarations/types/cache/mutations.d.ts +51 -28
- package/declarations/types/cache/operations.d.ts +60 -47
- package/declarations/types/cache/relationship.d.ts +11 -9
- package/declarations/types/cache.d.ts +495 -484
- package/declarations/types/graph.d.ts +31 -40
- package/declarations/types/identifier.d.ts +83 -82
- package/declarations/types/json/raw.d.ts +1 -2
- package/declarations/types/params.d.ts +4 -5
- package/declarations/types/record.d.ts +117 -76
- package/declarations/types/request.d.ts +289 -266
- package/declarations/types/runtime.d.ts +8 -9
- package/declarations/types/schema/concepts.d.ts +19 -13
- package/declarations/types/schema/fields.d.ts +1712 -1741
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/spec/document.d.ts +28 -22
- package/declarations/types/spec/error.d.ts +16 -17
- package/declarations/types/spec/json-api-raw.d.ts +102 -102
- package/declarations/types/symbols.d.ts +74 -75
- package/declarations/types/utils.d.ts +5 -5
- package/declarations/types.d.ts +10 -7
- package/declarations/utils/string.d.ts +48 -0
- package/dist/build-config/babel-macros.js +1 -0
- package/dist/build-config/canary-features.js +1 -0
- package/dist/build-config/debugging.js +1 -0
- package/dist/build-config/deprecations.js +1 -0
- package/dist/build-config/env.js +1 -0
- package/dist/build-config/macros.js +1 -0
- package/dist/build-config.js +1 -0
- package/dist/configure-B48bFHOl.js +181 -0
- package/dist/configure.js +1 -0
- package/dist/{context-DE5sFezZ.js → context-COmAnXUQ.js} +2 -2
- package/dist/graph/-private.js +3372 -0
- package/dist/handler-C2T-IyJK.js +339 -0
- package/dist/index.js +37 -104
- package/dist/reactive/-private.js +1 -0
- package/dist/reactive.js +1988 -0
- package/dist/request-state-CjLph1LP.js +8139 -0
- package/dist/request.js +1 -1
- package/dist/store/-private.js +3 -0
- package/dist/store.js +545 -0
- package/dist/symbols-SIstXMLI.js +44 -0
- package/dist/types/-private.js +3 -3
- package/dist/types/record.js +1 -1
- package/dist/types/request.js +2 -2
- package/dist/types/runtime.js +1 -1
- package/dist/types/schema/fields.js +8 -41
- package/dist/types/symbols.js +3 -3
- package/dist/utils/string.js +92 -0
- package/logos/NCC-1701-a-blue.svg +4 -0
- package/logos/NCC-1701-a-gold.svg +4 -0
- package/logos/NCC-1701-a-gold_100.svg +1 -0
- package/logos/NCC-1701-a-gold_base-64.txt +1 -0
- package/logos/NCC-1701-a.svg +4 -0
- package/logos/README.md +4 -0
- package/logos/docs-badge.svg +2 -0
- package/logos/ember-data-logo-dark.svg +12 -0
- package/logos/ember-data-logo-light.svg +12 -0
- package/logos/github-header.svg +444 -0
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +4 -0
- package/logos/warp-drive-logo-gold.svg +4 -0
- package/package.json +11 -8
- package/declarations/index.d.ts.map +0 -1
- package/declarations/request/-private/context.d.ts.map +0 -1
- package/declarations/request/-private/debug.d.ts.map +0 -1
- package/declarations/request/-private/fetch.d.ts.map +0 -1
- package/declarations/request/-private/future.d.ts.map +0 -1
- package/declarations/request/-private/manager.d.ts.map +0 -1
- package/declarations/request/-private/promise-cache.d.ts.map +0 -1
- package/declarations/request/-private/types.d.ts.map +0 -1
- package/declarations/request/-private/utils.d.ts.map +0 -1
- package/declarations/request.d.ts.map +0 -1
- package/declarations/types/-private.d.ts.map +0 -1
- package/declarations/types/cache/aliases.d.ts.map +0 -1
- package/declarations/types/cache/change.d.ts.map +0 -1
- package/declarations/types/cache/mutations.d.ts.map +0 -1
- package/declarations/types/cache/operations.d.ts.map +0 -1
- package/declarations/types/cache/relationship.d.ts.map +0 -1
- package/declarations/types/cache.d.ts.map +0 -1
- package/declarations/types/graph.d.ts.map +0 -1
- package/declarations/types/identifier.d.ts.map +0 -1
- package/declarations/types/json/raw.d.ts.map +0 -1
- package/declarations/types/params.d.ts.map +0 -1
- package/declarations/types/record.d.ts.map +0 -1
- package/declarations/types/record.type-test.d.ts +0 -2
- package/declarations/types/record.type-test.d.ts.map +0 -1
- package/declarations/types/request.d.ts.map +0 -1
- package/declarations/types/request.type-test.d.ts +0 -2
- package/declarations/types/request.type-test.d.ts.map +0 -1
- package/declarations/types/runtime.d.ts.map +0 -1
- package/declarations/types/schema/concepts.d.ts.map +0 -1
- package/declarations/types/schema/fields.d.ts.map +0 -1
- package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
- package/declarations/types/spec/document.d.ts.map +0 -1
- package/declarations/types/spec/error.d.ts.map +0 -1
- package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
- package/declarations/types/symbols.d.ts.map +0 -1
- package/declarations/types/utils.d.ts.map +0 -1
- package/declarations/types.d.ts.map +0 -1
- package/dist/context-DE5sFezZ.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/request.js.map +0 -1
- package/dist/types/-private.js.map +0 -1
- package/dist/types/cache/aliases.js.map +0 -1
- package/dist/types/cache/change.js.map +0 -1
- package/dist/types/cache/mutations.js.map +0 -1
- package/dist/types/cache/operations.js.map +0 -1
- package/dist/types/cache/relationship.js.map +0 -1
- package/dist/types/cache.js.map +0 -1
- package/dist/types/graph.js.map +0 -1
- package/dist/types/identifier.js.map +0 -1
- package/dist/types/json/raw.js.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/record.js.map +0 -1
- package/dist/types/request.js.map +0 -1
- package/dist/types/runtime.js.map +0 -1
- package/dist/types/schema/concepts.js.map +0 -1
- package/dist/types/schema/fields.js.map +0 -1
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/types/spec/document.js.map +0 -1
- package/dist/types/spec/error.js.map +0 -1
- package/dist/types/spec/json-api-raw.js.map +0 -1
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/utils.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,1828 +1,1799 @@
|
|
|
1
|
-
import type { ObjectValue, PrimitiveValue } from
|
|
1
|
+
import type { ObjectValue, PrimitiveValue, Value } from "../json/raw.js";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
3
|
+
* A generic "field" that can be used to define
|
|
4
|
+
* primitive value fields.
|
|
5
|
+
*
|
|
6
|
+
* Replaces "attribute" for primitive value fields.
|
|
7
|
+
* Can also be used to eject from deep-tracking of
|
|
8
|
+
* objects or arrays.
|
|
9
|
+
*
|
|
10
|
+
* A major difference between "field" and "attribute"
|
|
11
|
+
* is that "type" points to a legacy transform on
|
|
12
|
+
* "attribute" that a serializer *might* use, while
|
|
13
|
+
* "type" points to a new-style transform on "field"
|
|
14
|
+
* that a record implmentation *must* use.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
19
18
|
export interface GenericField {
|
|
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
|
-
* Must comply to the specific transform's options
|
|
48
|
-
* schema.
|
|
49
|
-
*
|
|
50
|
-
* @property options
|
|
51
|
-
* @type {ObjectValue | undefined}
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
options?: ObjectValue;
|
|
19
|
+
/**
|
|
20
|
+
* The kind of field this is.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
kind: "field";
|
|
25
|
+
/**
|
|
26
|
+
* The name of the field.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* the name of the transform to use, if any
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
type?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Options to pass to the transform, if any
|
|
39
|
+
*
|
|
40
|
+
* Must comply to the specific transform's options
|
|
41
|
+
* schema.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
options?: ObjectValue;
|
|
55
46
|
}
|
|
56
47
|
/**
|
|
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
|
-
*/
|
|
48
|
+
* A field that can be used to alias one key to another
|
|
49
|
+
* key present in the cache version of the resource.
|
|
50
|
+
*
|
|
51
|
+
* Unlike DerivedField, an AliasField may write to its
|
|
52
|
+
* source when a record is in an editable mode.
|
|
53
|
+
*
|
|
54
|
+
* ~~AliasFields may utilize a transform, specified by type,
|
|
55
|
+
* to pre/post process the raw data for the field.~~ (not yet implemented)
|
|
56
|
+
*
|
|
57
|
+
* An AliasField may also specify a `kind` via options.
|
|
58
|
+
* `kind` may be any other valid field kind other than
|
|
59
|
+
*
|
|
60
|
+
* - `@hash`
|
|
61
|
+
* - `@id`
|
|
62
|
+
* - `@local`
|
|
63
|
+
* - `derived`
|
|
64
|
+
*
|
|
65
|
+
* This allows an AliasField to rename any field in the cache.
|
|
66
|
+
*
|
|
67
|
+
* Alias fields are generally intended to be used to support migrating
|
|
68
|
+
* between different schemas, though there are times where they are useful
|
|
69
|
+
* as a form of advanced derivation when used with a transform. For instance,
|
|
70
|
+
* an AliasField could be used to expose both a string and a Date version of the
|
|
71
|
+
* same field, with both being capable of being written to.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
85
75
|
export interface LegacyAliasField {
|
|
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
|
-
* The field def for which this is an alias.
|
|
112
|
-
*
|
|
113
|
-
* @property options
|
|
114
|
-
* @type {GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField}
|
|
115
|
-
* @public
|
|
116
|
-
*/
|
|
117
|
-
options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField;
|
|
76
|
+
/**
|
|
77
|
+
* The kind of field this is.
|
|
78
|
+
*
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
kind: "alias";
|
|
82
|
+
/**
|
|
83
|
+
* The name of the field.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
name: string;
|
|
88
|
+
/**
|
|
89
|
+
* Always null (for now)
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
type: null;
|
|
94
|
+
/**
|
|
95
|
+
* The field def for which this is an alias.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField;
|
|
118
100
|
}
|
|
119
101
|
/**
|
|
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
|
-
*/
|
|
102
|
+
* A field that can be used to alias one key to another
|
|
103
|
+
* key present in the cache version of the resource.
|
|
104
|
+
*
|
|
105
|
+
* Unlike DerivedField, an AliasField may write to its
|
|
106
|
+
* source when a record is in an editable mode.
|
|
107
|
+
*
|
|
108
|
+
* ~~AliasFields may utilize a transform, specified by type,
|
|
109
|
+
* to pre/post process the raw data for the field.~~ (not yet implemented)
|
|
110
|
+
*
|
|
111
|
+
* An AliasField may also specify a `kind` via options.
|
|
112
|
+
* `kind` may be any other valid field kind other than
|
|
113
|
+
*
|
|
114
|
+
* - `@hash`
|
|
115
|
+
* - `@id`
|
|
116
|
+
* - `@local`
|
|
117
|
+
* - `derived`
|
|
118
|
+
*
|
|
119
|
+
* This allows an AliasField to rename any field in the cache.
|
|
120
|
+
*
|
|
121
|
+
* Alias fields are generally intended to be used to support migrating
|
|
122
|
+
* between different schemas, though there are times where they are useful
|
|
123
|
+
* as a form of advanced derivation when used with a transform. For instance,
|
|
124
|
+
* an AliasField could be used to expose both a string and a Date version of the
|
|
125
|
+
* same field, with both being capable of being written to.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
148
129
|
export interface PolarisAliasField {
|
|
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
|
-
* The field def for which this is an alias.
|
|
175
|
-
*
|
|
176
|
-
* @property options
|
|
177
|
-
* @type {GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LinksModeBelongsToField | LinksModeHasManyField}
|
|
178
|
-
* @public
|
|
179
|
-
*/
|
|
180
|
-
options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LinksModeBelongsToField | LinksModeHasManyField;
|
|
130
|
+
/**
|
|
131
|
+
* The kind of field this is.
|
|
132
|
+
*
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
kind: "alias";
|
|
136
|
+
/**
|
|
137
|
+
* The name of the field.
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
name: string;
|
|
142
|
+
/**
|
|
143
|
+
* Always null (for now)
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
type: null;
|
|
148
|
+
/**
|
|
149
|
+
* The field def for which this is an alias.
|
|
150
|
+
*
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | LinksModeBelongsToField | LinksModeHasManyField;
|
|
181
154
|
}
|
|
182
155
|
/**
|
|
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
|
-
*/
|
|
156
|
+
* A field that can be used to alias one key to another
|
|
157
|
+
* key present in the cache version of the resource.
|
|
158
|
+
*
|
|
159
|
+
* Unlike DerivedField, an AliasField may write to its
|
|
160
|
+
* source when a record is in an editable mode.
|
|
161
|
+
*
|
|
162
|
+
* AliasFields may utilize a transform, specified by type,
|
|
163
|
+
* to pre/post process the field.
|
|
164
|
+
*
|
|
165
|
+
* An AliasField may also specify a `kind` via options.
|
|
166
|
+
* `kind` may be any other valid field kind other than
|
|
167
|
+
*
|
|
168
|
+
* - `@hash`
|
|
169
|
+
* - `@id`
|
|
170
|
+
* - `@local`
|
|
171
|
+
* - `derived`
|
|
172
|
+
*
|
|
173
|
+
* This allows an AliasField to rename any field in the cache.
|
|
174
|
+
*
|
|
175
|
+
* Alias fields are generally intended to be used to support migrating
|
|
176
|
+
* between different schemas, though there are times where they are useful
|
|
177
|
+
* as a form of advanced derivation when used with a transform. For instance,
|
|
178
|
+
* an AliasField could be used to expose both a string and a Date version of the
|
|
179
|
+
* same field, with both being capable of being written to.
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
211
183
|
export interface ObjectAliasField {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* The field def for which this is an alias.
|
|
238
|
-
*
|
|
239
|
-
* @property options
|
|
240
|
-
* @type {GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField}
|
|
241
|
-
* @public
|
|
242
|
-
*/
|
|
243
|
-
options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField;
|
|
184
|
+
/**
|
|
185
|
+
* The kind of field this is.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
kind: "alias";
|
|
190
|
+
/**
|
|
191
|
+
* The name of the field.
|
|
192
|
+
*
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
name: string;
|
|
196
|
+
/**
|
|
197
|
+
* Always null (for now)
|
|
198
|
+
*
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
type: null;
|
|
202
|
+
/**
|
|
203
|
+
* The field def for which this is an alias.
|
|
204
|
+
*
|
|
205
|
+
* @public
|
|
206
|
+
*/
|
|
207
|
+
options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField;
|
|
244
208
|
}
|
|
245
209
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
*/
|
|
210
|
+
* Represents a field whose value is the primary
|
|
211
|
+
* key of the resource.
|
|
212
|
+
*
|
|
213
|
+
* This allows any field to serve as the primary
|
|
214
|
+
* key while still being able to drive identity
|
|
215
|
+
* needs within the system.
|
|
216
|
+
*
|
|
217
|
+
* This is useful for resources that use for instance
|
|
218
|
+
* 'uuid', 'urn' or 'entityUrn' or 'primaryKey' as their
|
|
219
|
+
* primary key field instead of 'id'.
|
|
220
|
+
*
|
|
221
|
+
* @public
|
|
222
|
+
*/
|
|
260
223
|
export interface IdentityField {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
* @type {String}
|
|
275
|
-
* @public
|
|
276
|
-
*/
|
|
277
|
-
name: string;
|
|
224
|
+
/**
|
|
225
|
+
* The kind of field this is.
|
|
226
|
+
*
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
kind: "@id";
|
|
230
|
+
/**
|
|
231
|
+
* The name of the field that serves as the
|
|
232
|
+
* primary key for the resource.
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
*/
|
|
236
|
+
name: string;
|
|
278
237
|
}
|
|
279
238
|
/**
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
*/
|
|
239
|
+
* Represents a specialized field whose computed value
|
|
240
|
+
* will be used as the primary key of a schema-object
|
|
241
|
+
* for serializability and comparison purposes.
|
|
242
|
+
*
|
|
243
|
+
* This field functions similarly to derived fields in that
|
|
244
|
+
* it is non-settable, derived state but differs in that
|
|
245
|
+
* it is only able to compute off of cache state and is given
|
|
246
|
+
* no access to a record instance.
|
|
247
|
+
*
|
|
248
|
+
* This means that if a hashing function wants to compute its value
|
|
249
|
+
* taking into account transformations and derivations it must
|
|
250
|
+
* perform those itself.
|
|
251
|
+
*
|
|
252
|
+
* A schema-array can declare its "key" value to be `@hash` if
|
|
253
|
+
* a schema-object has such a field.
|
|
254
|
+
*
|
|
255
|
+
* Only one hash field is permittable per schema-object, and
|
|
256
|
+
* it should be placed in the `ResourceSchema`'s `@id` field
|
|
257
|
+
* in place of an `IdentityField`.
|
|
258
|
+
*
|
|
259
|
+
* @public
|
|
260
|
+
*/
|
|
303
261
|
export interface HashField {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
* Any options that should be provided to the hash
|
|
336
|
-
* function.
|
|
337
|
-
*
|
|
338
|
-
* @property options
|
|
339
|
-
* @type {ObjectValue | undefined}
|
|
340
|
-
* @public
|
|
341
|
-
*/
|
|
342
|
-
options?: ObjectValue;
|
|
262
|
+
/**
|
|
263
|
+
* The kind of field this is.
|
|
264
|
+
*
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
kind: "@hash";
|
|
268
|
+
/**
|
|
269
|
+
* The name of the field that serves as the
|
|
270
|
+
* hash for the resource.
|
|
271
|
+
*
|
|
272
|
+
* Only required if access to this value by
|
|
273
|
+
* the UI is desired, it can be `null` otherwise.
|
|
274
|
+
*
|
|
275
|
+
* @public
|
|
276
|
+
*/
|
|
277
|
+
name: string | null;
|
|
278
|
+
/**
|
|
279
|
+
* The name of a function to run to compute the hash.
|
|
280
|
+
* The function will only have access to the cached
|
|
281
|
+
* data for the record.
|
|
282
|
+
*
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
type: string;
|
|
286
|
+
/**
|
|
287
|
+
* Any options that should be provided to the hash
|
|
288
|
+
* function.
|
|
289
|
+
*
|
|
290
|
+
* @public
|
|
291
|
+
*/
|
|
292
|
+
options?: ObjectValue;
|
|
343
293
|
}
|
|
344
294
|
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*/
|
|
295
|
+
* Represents a field whose value is a local
|
|
296
|
+
* value that is not stored in the cache, nor
|
|
297
|
+
* is it sent to the server.
|
|
298
|
+
*
|
|
299
|
+
* Local fields can be written to, and their
|
|
300
|
+
* value is both memoized and reactive (though
|
|
301
|
+
* not deep-tracked).
|
|
302
|
+
*
|
|
303
|
+
* Because their state is not derived from the cache
|
|
304
|
+
* data or the server, they represent a divorced
|
|
305
|
+
* uncanonical source of state.
|
|
306
|
+
*
|
|
307
|
+
* For this reason Local fields should be used sparingly.
|
|
308
|
+
*
|
|
309
|
+
* Currently, while we document this feature here,
|
|
310
|
+
* only allow our own ReactiveResource default fields to
|
|
311
|
+
* utilize them and the feature should be considered private.
|
|
312
|
+
*
|
|
313
|
+
* Example use cases that drove the creation of local
|
|
314
|
+
* fields are states like `isDestroying` and `isDestroyed`
|
|
315
|
+
* which are specific to a record instance but not
|
|
316
|
+
* stored in the cache. We wanted to be able to drive
|
|
317
|
+
* these fields from schema the same as all other fields.
|
|
318
|
+
*
|
|
319
|
+
* Don't make us regret this decision.
|
|
320
|
+
*
|
|
321
|
+
* @public
|
|
322
|
+
*/
|
|
374
323
|
export interface LocalField {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
*
|
|
403
|
-
* @property options
|
|
404
|
-
* @type {ObjectValue | undefined}
|
|
405
|
-
* @public
|
|
406
|
-
*/
|
|
407
|
-
options?: {
|
|
408
|
-
defaultValue?: PrimitiveValue;
|
|
409
|
-
};
|
|
324
|
+
/**
|
|
325
|
+
* The kind of field this is.
|
|
326
|
+
*
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
kind: "@local";
|
|
330
|
+
/**
|
|
331
|
+
* The name of the field.
|
|
332
|
+
*
|
|
333
|
+
* @public
|
|
334
|
+
*/
|
|
335
|
+
name: string;
|
|
336
|
+
/**
|
|
337
|
+
* Not currently utilized, we are considering
|
|
338
|
+
* allowing transforms to operate on local fields
|
|
339
|
+
*
|
|
340
|
+
* @public
|
|
341
|
+
*/
|
|
342
|
+
type?: string;
|
|
343
|
+
/**
|
|
344
|
+
* Options for the field.
|
|
345
|
+
*
|
|
346
|
+
* @public
|
|
347
|
+
*/
|
|
348
|
+
options?: {
|
|
349
|
+
defaultValue?: PrimitiveValue;
|
|
350
|
+
};
|
|
410
351
|
}
|
|
411
352
|
/**
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
*/
|
|
353
|
+
* Represents a field whose value is an object
|
|
354
|
+
* with keys pointing to values that are primitive
|
|
355
|
+
* values.
|
|
356
|
+
*
|
|
357
|
+
* If values of the keys are not primitives, or
|
|
358
|
+
* if the key/value pairs have well-defined shape,
|
|
359
|
+
* use 'schema-object' instead.
|
|
360
|
+
*
|
|
361
|
+
* @public
|
|
362
|
+
*/
|
|
423
363
|
export interface ObjectField {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
364
|
+
/**
|
|
365
|
+
* The kind of field this is.
|
|
366
|
+
*
|
|
367
|
+
* @public
|
|
368
|
+
*/
|
|
369
|
+
kind: "object";
|
|
370
|
+
/**
|
|
371
|
+
* The name of the field.
|
|
372
|
+
*
|
|
373
|
+
* @public
|
|
374
|
+
*/
|
|
375
|
+
name: string;
|
|
376
|
+
/**
|
|
377
|
+
* The name of a transform to pass the entire object
|
|
378
|
+
* through before displaying or serializing it.
|
|
379
|
+
*
|
|
380
|
+
* @public
|
|
381
|
+
*/
|
|
382
|
+
type?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Options to pass to the transform, if any
|
|
385
|
+
*
|
|
386
|
+
* Must comply to the specific transform's options
|
|
387
|
+
* schema.
|
|
388
|
+
*
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
391
|
+
options?: {
|
|
392
|
+
/**
|
|
393
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
394
|
+
* :::
|
|
395
|
+
*
|
|
396
|
+
* Configures which extensions this object should use.
|
|
397
|
+
*
|
|
398
|
+
* Extensions are registered with the store's schema service
|
|
399
|
+
* via {@link SchemaService.registerDangerousObjectExtension}
|
|
400
|
+
*
|
|
401
|
+
* Extensions should only be used for temporary enhancements
|
|
402
|
+
* to objects to support migrating away from deprecated patterns
|
|
403
|
+
* like custom getters, computeds, and methods
|
|
404
|
+
*/
|
|
405
|
+
objectExtensions?: string[];
|
|
406
|
+
[key: string]: Value | undefined;
|
|
407
|
+
};
|
|
460
408
|
}
|
|
461
409
|
/**
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
*/
|
|
410
|
+
* Represents a field whose value is an object
|
|
411
|
+
* with a well-defined structure described by
|
|
412
|
+
* a non-resource schema.
|
|
413
|
+
*
|
|
414
|
+
* If the object's structure is not well-defined,
|
|
415
|
+
* use 'object' instead.
|
|
416
|
+
*
|
|
417
|
+
* @public
|
|
418
|
+
*/
|
|
472
419
|
export interface SchemaObjectField {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
420
|
+
/**
|
|
421
|
+
* The kind of field this is.
|
|
422
|
+
*
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
425
|
+
kind: "schema-object";
|
|
426
|
+
/**
|
|
427
|
+
* The name of the field.
|
|
428
|
+
*
|
|
429
|
+
* @public
|
|
430
|
+
*/
|
|
431
|
+
name: string;
|
|
432
|
+
/**
|
|
433
|
+
* The name of the ObjectSchema that describes the
|
|
434
|
+
* structure of the object.
|
|
435
|
+
*
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
438
|
+
type: string;
|
|
439
|
+
/**
|
|
440
|
+
* Options for configuring the behavior of the
|
|
441
|
+
* SchemaObject.
|
|
442
|
+
*
|
|
443
|
+
* - `polymorphic` : Whether this SchemaObject is Polymorphic.
|
|
444
|
+
* - `type` : If the SchemaObject is Polymorphic, the key on the raw cache data to use as the "resource-type" value for the schema-object.
|
|
445
|
+
*
|
|
446
|
+
* @public
|
|
447
|
+
*/
|
|
448
|
+
options?: {
|
|
449
|
+
/**
|
|
450
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
451
|
+
* :::
|
|
452
|
+
*
|
|
453
|
+
* Configures which extensions this object should use.
|
|
454
|
+
*
|
|
455
|
+
* Extensions are registered with the store's schema service
|
|
456
|
+
* via {@link SchemaService.registerDangerousObjectExtension}
|
|
457
|
+
*
|
|
458
|
+
* Extensions should only be used for temporary enhancements
|
|
459
|
+
* to objects to support migrating away from deprecated patterns
|
|
460
|
+
* like custom getters, computeds, and methods
|
|
461
|
+
*/
|
|
462
|
+
objectExtensions?: string[];
|
|
463
|
+
/**
|
|
464
|
+
* Whether this SchemaObject is Polymorphic.
|
|
465
|
+
*
|
|
466
|
+
* If the SchemaObject is polymorphic, `options.type` must also be supplied.
|
|
467
|
+
*
|
|
468
|
+
* @public
|
|
469
|
+
*/
|
|
470
|
+
polymorphic?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* If the SchemaObject is Polymorphic, the key on the raw cache data to use
|
|
473
|
+
* as the "resource-type" value for the schema-object.
|
|
474
|
+
*
|
|
475
|
+
* Defaults to "type".
|
|
476
|
+
*
|
|
477
|
+
* @public
|
|
478
|
+
*/
|
|
479
|
+
type?: string;
|
|
480
|
+
};
|
|
526
481
|
}
|
|
527
482
|
/**
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
*/
|
|
483
|
+
* Represents a field whose value is an array
|
|
484
|
+
* of primitive values.
|
|
485
|
+
*
|
|
486
|
+
* If the array's elements are not primitive
|
|
487
|
+
* values, use 'schema-array' instead.
|
|
488
|
+
*
|
|
489
|
+
* @public
|
|
490
|
+
*/
|
|
537
491
|
export interface ArrayField {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
492
|
+
/**
|
|
493
|
+
* The kind of field this is.
|
|
494
|
+
*
|
|
495
|
+
* @public
|
|
496
|
+
*/
|
|
497
|
+
kind: "array";
|
|
498
|
+
/**
|
|
499
|
+
* The name of the field.
|
|
500
|
+
*
|
|
501
|
+
* @public
|
|
502
|
+
*/
|
|
503
|
+
name: string;
|
|
504
|
+
/**
|
|
505
|
+
* The name of a transform to pass each item
|
|
506
|
+
* in the array through before displaying or
|
|
507
|
+
* or serializing it.
|
|
508
|
+
*
|
|
509
|
+
* @public
|
|
510
|
+
*/
|
|
511
|
+
type?: string;
|
|
512
|
+
/**
|
|
513
|
+
* Options to pass to the transform, if any
|
|
514
|
+
*
|
|
515
|
+
* Must comply to the specific transform's options
|
|
516
|
+
* schema.
|
|
517
|
+
*
|
|
518
|
+
* @public
|
|
519
|
+
*/
|
|
520
|
+
options?: {
|
|
521
|
+
/**
|
|
522
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
523
|
+
* :::
|
|
524
|
+
*
|
|
525
|
+
* Configures which extensions this array is allowed to use.
|
|
526
|
+
* Extensions are registered with the store's schema service
|
|
527
|
+
* via {@link SchemaService.registerDangerousArrayExtension}
|
|
528
|
+
*
|
|
529
|
+
* Extensions should only be used for temporary enhancements
|
|
530
|
+
* to arrays to support migrating away from deprecated behaviors
|
|
531
|
+
* such as Ember's "ArrayLike" and FragmentArray from ember-data-model-fragments
|
|
532
|
+
*/
|
|
533
|
+
arrayExtensions?: string[];
|
|
534
|
+
[key: string]: Value | undefined;
|
|
535
|
+
};
|
|
575
536
|
}
|
|
576
537
|
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
*/
|
|
538
|
+
* Represents a field whose value is an array
|
|
539
|
+
* of objects with a well-defined structure
|
|
540
|
+
* described by a non-resource schema.
|
|
541
|
+
*
|
|
542
|
+
* If the array's elements are not well-defined,
|
|
543
|
+
* use 'array' instead.
|
|
544
|
+
*
|
|
545
|
+
* @public
|
|
546
|
+
*/
|
|
587
547
|
export interface SchemaArrayField {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
548
|
+
/**
|
|
549
|
+
* The kind of field this is.
|
|
550
|
+
*
|
|
551
|
+
* @public
|
|
552
|
+
*/
|
|
553
|
+
kind: "schema-array";
|
|
554
|
+
/**
|
|
555
|
+
* The name of the field.
|
|
556
|
+
*
|
|
557
|
+
* @public
|
|
558
|
+
*/
|
|
559
|
+
name: string;
|
|
560
|
+
/**
|
|
561
|
+
* The name of the ObjectSchema that describes the
|
|
562
|
+
* structure of the objects in the array.
|
|
563
|
+
*
|
|
564
|
+
* @public
|
|
565
|
+
*/
|
|
566
|
+
type: string;
|
|
567
|
+
/**
|
|
568
|
+
* Options for configuring the behavior of the
|
|
569
|
+
* SchemaArray.
|
|
570
|
+
*
|
|
571
|
+
* - `key`
|
|
572
|
+
*
|
|
573
|
+
* Configures how the SchemaArray determines whether an object in the cache is the same
|
|
574
|
+
* as an object previously used to instantiate one of the schema-objects it contains.
|
|
575
|
+
*
|
|
576
|
+
* The default is `'@identity'`.
|
|
577
|
+
*
|
|
578
|
+
* Valid options are:
|
|
579
|
+
*
|
|
580
|
+
* - `'@identity'` (default) : the cached object's referential identity will be used.
|
|
581
|
+
* This may result in significant instability when resource data is updated from the API
|
|
582
|
+
* - `'@index'` : the cached object's index in the array will be used.
|
|
583
|
+
* This is only a good choice for arrays that rarely if ever change membership
|
|
584
|
+
* - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for
|
|
585
|
+
* The contained schema-object and use the computed result to determine and compare identity.
|
|
586
|
+
* - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
|
|
587
|
+
* Are valid field names for this purpose. The cache state without transforms applied will be
|
|
588
|
+
* used when comparing values. The field value should be unique enough to guarantee two schema-objects
|
|
589
|
+
* of the same type will not collide.
|
|
590
|
+
*
|
|
591
|
+
* - `polymorphic` : Whether this SchemaArray is Polymorphic.
|
|
592
|
+
* - `type` : If the SchemaArray is Polymorphic, the key on the raw cache data to use as the "resource-type" value for the schema-object.
|
|
593
|
+
*
|
|
594
|
+
* @public
|
|
595
|
+
*/
|
|
596
|
+
options?: {
|
|
597
|
+
/**
|
|
598
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
599
|
+
* :::
|
|
600
|
+
*
|
|
601
|
+
* Configures which extensions this array is allowed to use.
|
|
602
|
+
* Extensions are registered with the store's schema service
|
|
603
|
+
* via {@link SchemaService.registerDangerousArrayExtension}
|
|
604
|
+
*
|
|
605
|
+
* Extensions should only be used for temporary enhancements
|
|
606
|
+
* to arrays to support migrating away from deprecated behaviors
|
|
607
|
+
* such as Ember's "ArrayLike" and FragmentArray from ember-data-model-fragments
|
|
608
|
+
*/
|
|
609
|
+
arrayExtensions?: string[];
|
|
610
|
+
/**
|
|
611
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
612
|
+
* :::
|
|
613
|
+
*
|
|
614
|
+
* Configures which extensions this object should use.
|
|
615
|
+
*
|
|
616
|
+
* Extensions are registered with the store's schema service
|
|
617
|
+
* via {@link SchemaService.registerDangerousObjectExtension}
|
|
618
|
+
*
|
|
619
|
+
* Extensions should only be used for temporary enhancements
|
|
620
|
+
* to objects to support migrating away from deprecated patterns
|
|
621
|
+
* like custom getters, computeds, and methods
|
|
622
|
+
*/
|
|
623
|
+
objectExtensions?: string[];
|
|
624
|
+
/**
|
|
625
|
+
* Configures how the SchemaArray determines whether
|
|
626
|
+
* an object in the cache is the same as an object
|
|
627
|
+
* previously used to instantiate one of the schema-objects
|
|
628
|
+
* it contains.
|
|
629
|
+
*
|
|
630
|
+
* The default is `'@identity'`.
|
|
631
|
+
*
|
|
632
|
+
* Valid options are:
|
|
633
|
+
*
|
|
634
|
+
* - `'@identity'` (default) : the cached object's referential identity will be used.
|
|
635
|
+
* This may result in significant instability when resource data is updated from the API
|
|
636
|
+
* - `'@index'` : the cached object's index in the array will be used.
|
|
637
|
+
* This is only a good choice for arrays that rarely if ever change membership
|
|
638
|
+
* - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for
|
|
639
|
+
* The contained schema-object and use the computed result to determine and compare identity.
|
|
640
|
+
* - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
|
|
641
|
+
* Are valid field names for this purpose. The cache state without transforms applied will be
|
|
642
|
+
* used when comparing values. The field value should be unique enough to guarantee two schema-objects
|
|
643
|
+
* of the same type will not collide.
|
|
644
|
+
*
|
|
645
|
+
*/
|
|
646
|
+
key?: "@identity" | "@index" | "@hash" | string;
|
|
647
|
+
/**
|
|
648
|
+
* Whether this SchemaArray is Polymorphic.
|
|
649
|
+
*
|
|
650
|
+
* If the SchemaArray is polymorphic, `options.type` must also be supplied.
|
|
651
|
+
*
|
|
652
|
+
*/
|
|
653
|
+
polymorphic?: boolean;
|
|
654
|
+
/**
|
|
655
|
+
* If the SchemaArray is Polymorphic, the key on the raw cache data to use
|
|
656
|
+
* as the "resource-type" value for the schema-object.
|
|
657
|
+
*
|
|
658
|
+
* Defaults to "type".
|
|
659
|
+
*
|
|
660
|
+
*/
|
|
661
|
+
type?: string;
|
|
662
|
+
};
|
|
684
663
|
}
|
|
685
664
|
/**
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
*/
|
|
665
|
+
* Represents a field whose value is derived
|
|
666
|
+
* from other fields in the schema.
|
|
667
|
+
*
|
|
668
|
+
* The value is read-only, and is not stored
|
|
669
|
+
* in the cache, nor is it sent to the server.
|
|
670
|
+
*
|
|
671
|
+
* Usage of derived fields should be minimized
|
|
672
|
+
* to scenarios where the derivation is known
|
|
673
|
+
* to be safe. For instance, derivations that
|
|
674
|
+
* required fields that are not always loaded
|
|
675
|
+
* or that require access to related resources
|
|
676
|
+
* that may not be loaded should be avoided.
|
|
677
|
+
*
|
|
678
|
+
* @public
|
|
679
|
+
*/
|
|
702
680
|
export interface DerivedField {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
* Must comply to the specific derivation's
|
|
745
|
-
* options schema.
|
|
746
|
-
*
|
|
747
|
-
* @property options
|
|
748
|
-
* @type {ObjectValue | undefined}
|
|
749
|
-
* @public
|
|
750
|
-
*/
|
|
751
|
-
options?: ObjectValue;
|
|
681
|
+
/**
|
|
682
|
+
* The kind of field this is.
|
|
683
|
+
*
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
kind: "derived";
|
|
687
|
+
/**
|
|
688
|
+
* The name of the field.
|
|
689
|
+
*
|
|
690
|
+
* @public
|
|
691
|
+
*/
|
|
692
|
+
name: string;
|
|
693
|
+
/**
|
|
694
|
+
* The name of the derivation to use.
|
|
695
|
+
*
|
|
696
|
+
* Derivations are functions that take the
|
|
697
|
+
* record, options, and the name of the field
|
|
698
|
+
* as arguments, and return the derived value.
|
|
699
|
+
*
|
|
700
|
+
* Derivations are memoized, and are only
|
|
701
|
+
* recomputed when the fields they depend on
|
|
702
|
+
* change.
|
|
703
|
+
*
|
|
704
|
+
* Derivations are not stored in the cache,
|
|
705
|
+
* and are not sent to the server.
|
|
706
|
+
*
|
|
707
|
+
* Derivation functions must be explicitly
|
|
708
|
+
* registered with the schema service.
|
|
709
|
+
*
|
|
710
|
+
* @public
|
|
711
|
+
*/
|
|
712
|
+
type: string;
|
|
713
|
+
/**
|
|
714
|
+
* Options to pass to the derivation, if any
|
|
715
|
+
*
|
|
716
|
+
* Must comply to the specific derivation's
|
|
717
|
+
* options schema.
|
|
718
|
+
*
|
|
719
|
+
* @public
|
|
720
|
+
*/
|
|
721
|
+
options?: ObjectValue;
|
|
752
722
|
}
|
|
753
723
|
/**
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
*/
|
|
724
|
+
* Represents a field that is a reference to
|
|
725
|
+
* another resource.
|
|
726
|
+
*
|
|
727
|
+
* SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
|
|
728
|
+
* BY ReactiveResource
|
|
729
|
+
*
|
|
730
|
+
* @public
|
|
731
|
+
*/
|
|
763
732
|
export interface ResourceField {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
*
|
|
835
|
-
*/
|
|
836
|
-
polymorphic?: boolean;
|
|
837
|
-
};
|
|
733
|
+
/**
|
|
734
|
+
* The kind of field this is.
|
|
735
|
+
*
|
|
736
|
+
* @public
|
|
737
|
+
*/
|
|
738
|
+
kind: "resource";
|
|
739
|
+
/**
|
|
740
|
+
* The name of the field.
|
|
741
|
+
*
|
|
742
|
+
* @public
|
|
743
|
+
*/
|
|
744
|
+
name: string;
|
|
745
|
+
/**
|
|
746
|
+
* The name of the resource that this field
|
|
747
|
+
* refers to. In the case of a polymorphic
|
|
748
|
+
* relationship, this should be the trait
|
|
749
|
+
* or abstract type.
|
|
750
|
+
*
|
|
751
|
+
* @public
|
|
752
|
+
*/
|
|
753
|
+
type: string;
|
|
754
|
+
/**
|
|
755
|
+
* Options for resources are optional. If
|
|
756
|
+
* not present, all options are presumed
|
|
757
|
+
* to be falsey
|
|
758
|
+
*
|
|
759
|
+
* @public
|
|
760
|
+
*/
|
|
761
|
+
options?: {
|
|
762
|
+
/**
|
|
763
|
+
* Whether the relationship is async
|
|
764
|
+
*
|
|
765
|
+
* If true, it is expected that the cache
|
|
766
|
+
* data for this field will contain a link
|
|
767
|
+
* that can be used to fetch the related
|
|
768
|
+
* resource when needed.
|
|
769
|
+
*
|
|
770
|
+
* @public
|
|
771
|
+
*/
|
|
772
|
+
async?: boolean;
|
|
773
|
+
/**
|
|
774
|
+
* The name of the inverse field on the
|
|
775
|
+
* related resource that points back to
|
|
776
|
+
* this field on this resource to form a
|
|
777
|
+
* bidirectional relationship.
|
|
778
|
+
*
|
|
779
|
+
* If null, the relationship is unidirectional.
|
|
780
|
+
*
|
|
781
|
+
* @public
|
|
782
|
+
*/
|
|
783
|
+
inverse?: string | null;
|
|
784
|
+
/**
|
|
785
|
+
* If this field is satisfying a polymorphic
|
|
786
|
+
* relationship on another resource, then this
|
|
787
|
+
* should be set to the trait or abstract type
|
|
788
|
+
* that this resource implements.
|
|
789
|
+
*
|
|
790
|
+
* @public
|
|
791
|
+
*/
|
|
792
|
+
as?: string;
|
|
793
|
+
/**
|
|
794
|
+
* Whether this field is a polymorphic relationship,
|
|
795
|
+
* meaning that it can point to multiple types of
|
|
796
|
+
* resources so long as they implement the trait
|
|
797
|
+
* or abstract type specified in `type`.
|
|
798
|
+
*
|
|
799
|
+
* @public
|
|
800
|
+
*/
|
|
801
|
+
polymorphic?: boolean;
|
|
802
|
+
};
|
|
838
803
|
}
|
|
839
804
|
/**
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
*/
|
|
805
|
+
* Represents a field that is a reference to
|
|
806
|
+
* a collection of other resources, potentially
|
|
807
|
+
* paginate.
|
|
808
|
+
*
|
|
809
|
+
* SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
|
|
810
|
+
* BY ReactiveResource
|
|
811
|
+
*
|
|
812
|
+
* @public
|
|
813
|
+
*/
|
|
850
814
|
export interface CollectionField {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
};
|
|
815
|
+
/**
|
|
816
|
+
* The kind of field this is.
|
|
817
|
+
*
|
|
818
|
+
* @public
|
|
819
|
+
*/
|
|
820
|
+
kind: "collection";
|
|
821
|
+
/**
|
|
822
|
+
* The name of the field.
|
|
823
|
+
*
|
|
824
|
+
* @public
|
|
825
|
+
*/
|
|
826
|
+
name: string;
|
|
827
|
+
/**
|
|
828
|
+
* The name of the resource that this field
|
|
829
|
+
* refers to. In the case of a polymorphic
|
|
830
|
+
* relationship, this should be the trait
|
|
831
|
+
* or abstract type.
|
|
832
|
+
*
|
|
833
|
+
* @public
|
|
834
|
+
*/
|
|
835
|
+
type: string;
|
|
836
|
+
/**
|
|
837
|
+
* Options for resources are optional. If
|
|
838
|
+
* not present, all options are presumed
|
|
839
|
+
* to be falsey
|
|
840
|
+
*
|
|
841
|
+
* @public
|
|
842
|
+
*/
|
|
843
|
+
options?: {
|
|
844
|
+
/**
|
|
845
|
+
* Whether the relationship is async
|
|
846
|
+
*
|
|
847
|
+
* If true, it is expected that the cache
|
|
848
|
+
* data for this field will contain links
|
|
849
|
+
* that can be used to fetch the related
|
|
850
|
+
* resources when needed.
|
|
851
|
+
*
|
|
852
|
+
* When false, it is expected that all related
|
|
853
|
+
* resources are loaded together with this resource,
|
|
854
|
+
* and that the cache data for this field will
|
|
855
|
+
* contain the full list of pointers.
|
|
856
|
+
*
|
|
857
|
+
* When true, it is expected that the relationship
|
|
858
|
+
* is paginated. If the relationship is not paginated,
|
|
859
|
+
* then the cache data for "page 1" would contain the
|
|
860
|
+
* full list of pointers, and loading "page 1" would
|
|
861
|
+
* load all related resources.
|
|
862
|
+
*
|
|
863
|
+
* @public
|
|
864
|
+
*/
|
|
865
|
+
async?: boolean;
|
|
866
|
+
/**
|
|
867
|
+
* The name of the inverse field on the
|
|
868
|
+
* related resource that points back to
|
|
869
|
+
* this field on this resource to form a
|
|
870
|
+
* bidirectional relationship.
|
|
871
|
+
*
|
|
872
|
+
* If null, the relationship is unidirectional.
|
|
873
|
+
*
|
|
874
|
+
* @public
|
|
875
|
+
*/
|
|
876
|
+
inverse?: string | null;
|
|
877
|
+
/**
|
|
878
|
+
* If this field is satisfying a polymorphic
|
|
879
|
+
* relationship on another resource, then this
|
|
880
|
+
* should be set to the trait or abstract type
|
|
881
|
+
* that this resource implements.
|
|
882
|
+
*
|
|
883
|
+
* @public
|
|
884
|
+
*/
|
|
885
|
+
as?: string;
|
|
886
|
+
/**
|
|
887
|
+
* Whether this field is a polymorphic relationship,
|
|
888
|
+
* meaning that it can point to multiple types of
|
|
889
|
+
* resources so long as they implement the trait
|
|
890
|
+
* or abstract type specified in `type`.
|
|
891
|
+
*
|
|
892
|
+
* @public
|
|
893
|
+
*/
|
|
894
|
+
polymorphic?: boolean;
|
|
895
|
+
};
|
|
933
896
|
}
|
|
934
897
|
/**
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
*/
|
|
898
|
+
* > [!CAUTION]
|
|
899
|
+
* > This Field is LEGACY
|
|
900
|
+
* > It cannot be used with PolarisMode
|
|
901
|
+
*
|
|
902
|
+
* A generic "field" that can be used to define
|
|
903
|
+
* primitive value fields.
|
|
904
|
+
*
|
|
905
|
+
* If the field points to an object or array,
|
|
906
|
+
* it will not be deep-tracked.
|
|
907
|
+
*
|
|
908
|
+
* Transforms when defined are legacy transforms
|
|
909
|
+
* that a serializer *might* use, but their usage
|
|
910
|
+
* is not guaranteed.
|
|
911
|
+
*
|
|
912
|
+
* @public
|
|
913
|
+
*/
|
|
952
914
|
export interface LegacyAttributeField {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
*
|
|
980
|
-
* Must comply to the specific transform's options
|
|
981
|
-
* schema.
|
|
982
|
-
*
|
|
983
|
-
*/
|
|
984
|
-
options?: ObjectValue;
|
|
915
|
+
/**
|
|
916
|
+
* The kind of field this is.
|
|
917
|
+
*
|
|
918
|
+
* @public
|
|
919
|
+
*/
|
|
920
|
+
kind: "attribute";
|
|
921
|
+
/**
|
|
922
|
+
* The name of the field.
|
|
923
|
+
*
|
|
924
|
+
* @public
|
|
925
|
+
*/
|
|
926
|
+
name: string;
|
|
927
|
+
/**
|
|
928
|
+
* The name of the transform to use, if any
|
|
929
|
+
*
|
|
930
|
+
* @public
|
|
931
|
+
*/
|
|
932
|
+
type?: string | null;
|
|
933
|
+
/**
|
|
934
|
+
* Options to pass to the transform, if any
|
|
935
|
+
*
|
|
936
|
+
* Must comply to the specific transform's options
|
|
937
|
+
* schema.
|
|
938
|
+
*
|
|
939
|
+
*/
|
|
940
|
+
options?: ObjectValue;
|
|
985
941
|
}
|
|
986
942
|
/**
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
*/
|
|
943
|
+
* > [!CAUTION]
|
|
944
|
+
* > This Field is LEGACY
|
|
945
|
+
*
|
|
946
|
+
* Represents a field that is a reference to
|
|
947
|
+
* another resource.
|
|
948
|
+
*
|
|
949
|
+
* This is the legacy version of the `ResourceField`.
|
|
950
|
+
*
|
|
951
|
+
* @public
|
|
952
|
+
*/
|
|
998
953
|
export interface LegacyBelongsToField {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
954
|
+
/**
|
|
955
|
+
* The kind of field this is.
|
|
956
|
+
*
|
|
957
|
+
* @public
|
|
958
|
+
*/
|
|
959
|
+
kind: "belongsTo";
|
|
960
|
+
/**
|
|
961
|
+
* The name of the field.
|
|
962
|
+
*
|
|
963
|
+
* @public
|
|
964
|
+
*/
|
|
965
|
+
name: string;
|
|
966
|
+
/**
|
|
967
|
+
* The name of the resource that this field
|
|
968
|
+
* refers to. In the case of a polymorphic
|
|
969
|
+
* relationship, this should be the trait
|
|
970
|
+
* or abstract type.
|
|
971
|
+
*
|
|
972
|
+
* @public
|
|
973
|
+
*/
|
|
974
|
+
type: string;
|
|
975
|
+
/**
|
|
976
|
+
* Options for belongsTo are mandatory.
|
|
977
|
+
*
|
|
978
|
+
* @public
|
|
979
|
+
*/
|
|
980
|
+
options: {
|
|
981
|
+
/**
|
|
982
|
+
* Whether the relationship is async
|
|
983
|
+
*
|
|
984
|
+
* If true, it is expected that the cache
|
|
985
|
+
* data for this field will contain a link
|
|
986
|
+
* or a pointer that can be used to fetch
|
|
987
|
+
* the related resource when needed.
|
|
988
|
+
*
|
|
989
|
+
* Pointers are highly discouraged.
|
|
990
|
+
*
|
|
991
|
+
* @public
|
|
992
|
+
*/
|
|
993
|
+
async: boolean;
|
|
994
|
+
/**
|
|
995
|
+
* The name of the inverse field on the
|
|
996
|
+
* related resource that points back to
|
|
997
|
+
* this field on this resource to form a
|
|
998
|
+
* bidirectional relationship.
|
|
999
|
+
*
|
|
1000
|
+
* If null, the relationship is unidirectional.
|
|
1001
|
+
*
|
|
1002
|
+
* @public
|
|
1003
|
+
*/
|
|
1004
|
+
inverse: string | null;
|
|
1005
|
+
/**
|
|
1006
|
+
* If this field is satisfying a polymorphic
|
|
1007
|
+
* relationship on another resource, then this
|
|
1008
|
+
* should be set to the trait or abstract type
|
|
1009
|
+
* that this resource implements.
|
|
1010
|
+
*
|
|
1011
|
+
* @public
|
|
1012
|
+
*/
|
|
1013
|
+
as?: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* Whether this field is a polymorphic relationship,
|
|
1016
|
+
* meaning that it can point to multiple types of
|
|
1017
|
+
* resources so long as they implement the trait
|
|
1018
|
+
* or abstract type specified in `type`.
|
|
1019
|
+
*
|
|
1020
|
+
* @public
|
|
1021
|
+
*/
|
|
1022
|
+
polymorphic?: boolean;
|
|
1023
|
+
/**
|
|
1024
|
+
* Whether this field should ever make use of the legacy support infra
|
|
1025
|
+
* from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
|
|
1026
|
+
*
|
|
1027
|
+
* When true, none of the legacy support will be utilized. Sync relationships
|
|
1028
|
+
* will be expected to already have all their data. When reloading a sync relationship
|
|
1029
|
+
* you would be expected to have a `related link` available from a prior relationship
|
|
1030
|
+
* payload e.g.
|
|
1031
|
+
*
|
|
1032
|
+
* ```ts
|
|
1033
|
+
* {
|
|
1034
|
+
* data: {
|
|
1035
|
+
* type: 'user',
|
|
1036
|
+
* id: '2',
|
|
1037
|
+
* attributes: { name: 'Chris' },
|
|
1038
|
+
* relationships: {
|
|
1039
|
+
* bestFriend: {
|
|
1040
|
+
* links: { related: "/users/1/bestFriend" },
|
|
1041
|
+
* data: { type: 'user', id: '1' },
|
|
1042
|
+
* }
|
|
1043
|
+
* }
|
|
1044
|
+
* },
|
|
1045
|
+
* included: [
|
|
1046
|
+
* { type: 'user', id: '1', attributes: { name: 'Krystan' } }
|
|
1047
|
+
* ]
|
|
1048
|
+
* }
|
|
1049
|
+
* ```
|
|
1050
|
+
*
|
|
1051
|
+
* Async relationships will be loaded via their link if needed.
|
|
1052
|
+
*
|
|
1053
|
+
* @public
|
|
1054
|
+
*/
|
|
1055
|
+
linksMode?: true;
|
|
1056
|
+
/**
|
|
1057
|
+
* When omitted, the cache data for this field will
|
|
1058
|
+
* clear local state of all changes except for the
|
|
1059
|
+
* addition of records still in the "new" state any
|
|
1060
|
+
* time the remote data for this field is updated.
|
|
1061
|
+
*
|
|
1062
|
+
* When set to `false`, the cache data for this field
|
|
1063
|
+
* will instead intelligently commit any changes from
|
|
1064
|
+
* local state that are present in the remote data,
|
|
1065
|
+
* leaving any remaining changes in local state still.
|
|
1066
|
+
*
|
|
1067
|
+
* @public
|
|
1068
|
+
*/
|
|
1069
|
+
resetOnRemoteUpdate?: false;
|
|
1070
|
+
};
|
|
1115
1071
|
}
|
|
1116
1072
|
/**
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
*/
|
|
1073
|
+
* > [!CAUTION]
|
|
1074
|
+
* > This Field is LEGACY
|
|
1075
|
+
*
|
|
1076
|
+
* Represents a field that is a reference to
|
|
1077
|
+
* another resource.
|
|
1078
|
+
*
|
|
1079
|
+
* This is the legacy version of the `ResourceField`.
|
|
1080
|
+
*
|
|
1081
|
+
* @public
|
|
1082
|
+
*/
|
|
1128
1083
|
export interface LinksModeBelongsToField {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1084
|
+
/**
|
|
1085
|
+
* The kind of field this is.
|
|
1086
|
+
*
|
|
1087
|
+
* @public
|
|
1088
|
+
*/
|
|
1089
|
+
kind: "belongsTo";
|
|
1090
|
+
/**
|
|
1091
|
+
* The name of the field.
|
|
1092
|
+
*
|
|
1093
|
+
* @public
|
|
1094
|
+
*/
|
|
1095
|
+
name: string;
|
|
1096
|
+
/**
|
|
1097
|
+
* The name of the resource that this field
|
|
1098
|
+
* refers to. In the case of a polymorphic
|
|
1099
|
+
* relationship, this should be the trait
|
|
1100
|
+
* or abstract type.
|
|
1101
|
+
*
|
|
1102
|
+
* @public
|
|
1103
|
+
*/
|
|
1104
|
+
type: string;
|
|
1105
|
+
/**
|
|
1106
|
+
* Options for belongsTo are mandatory.
|
|
1107
|
+
*
|
|
1108
|
+
* @public
|
|
1109
|
+
*/
|
|
1110
|
+
options: {
|
|
1111
|
+
/**
|
|
1112
|
+
* Whether the relationship is async
|
|
1113
|
+
*
|
|
1114
|
+
* MUST be false for PolarisMode + LinksMode
|
|
1115
|
+
*
|
|
1116
|
+
* @public
|
|
1117
|
+
*/
|
|
1118
|
+
async: false;
|
|
1119
|
+
/**
|
|
1120
|
+
* The name of the inverse field on the
|
|
1121
|
+
* related resource that points back to
|
|
1122
|
+
* this field on this resource to form a
|
|
1123
|
+
* bidirectional relationship.
|
|
1124
|
+
*
|
|
1125
|
+
* If null, the relationship is unidirectional.
|
|
1126
|
+
*
|
|
1127
|
+
* @public
|
|
1128
|
+
*/
|
|
1129
|
+
inverse: string | null;
|
|
1130
|
+
/**
|
|
1131
|
+
* If this field is satisfying a polymorphic
|
|
1132
|
+
* relationship on another resource, then this
|
|
1133
|
+
* should be set to the trait or abstract type
|
|
1134
|
+
* that this resource implements.
|
|
1135
|
+
*
|
|
1136
|
+
* @public
|
|
1137
|
+
*/
|
|
1138
|
+
as?: string;
|
|
1139
|
+
/**
|
|
1140
|
+
* Whether this field is a polymorphic relationship,
|
|
1141
|
+
* meaning that it can point to multiple types of
|
|
1142
|
+
* resources so long as they implement the trait
|
|
1143
|
+
* or abstract type specified in `type`.
|
|
1144
|
+
*
|
|
1145
|
+
* @public
|
|
1146
|
+
*/
|
|
1147
|
+
polymorphic?: boolean;
|
|
1148
|
+
/**
|
|
1149
|
+
* Whether this field should ever make use of the legacy support infra
|
|
1150
|
+
* from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
|
|
1151
|
+
*
|
|
1152
|
+
* MUST be true for PolarisMode + LinksMode
|
|
1153
|
+
*
|
|
1154
|
+
* When true, none of the legacy support will be utilized. Sync relationships
|
|
1155
|
+
* will be expected to already have all their data. When reloading a sync relationship
|
|
1156
|
+
* you would be expected to have a `related link` available from a prior relationship
|
|
1157
|
+
* payload e.g.
|
|
1158
|
+
*
|
|
1159
|
+
* ```ts
|
|
1160
|
+
* {
|
|
1161
|
+
* data: {
|
|
1162
|
+
* type: 'user',
|
|
1163
|
+
* id: '2',
|
|
1164
|
+
* attributes: { name: 'Chris' },
|
|
1165
|
+
* relationships: {
|
|
1166
|
+
* bestFriend: {
|
|
1167
|
+
* links: { related: "/users/1/bestFriend" },
|
|
1168
|
+
* data: { type: 'user', id: '1' },
|
|
1169
|
+
* }
|
|
1170
|
+
* }
|
|
1171
|
+
* },
|
|
1172
|
+
* included: [
|
|
1173
|
+
* { type: 'user', id: '1', attributes: { name: 'Krystan' } }
|
|
1174
|
+
* ]
|
|
1175
|
+
* }
|
|
1176
|
+
* ```
|
|
1177
|
+
*
|
|
1178
|
+
* Async relationships will be loaded via their link if needed.
|
|
1179
|
+
*
|
|
1180
|
+
* Activating LinksMode will *also* deactivate the deprecated
|
|
1181
|
+
* `resetOnRemoteUpdate` behavior for this field.
|
|
1182
|
+
*
|
|
1183
|
+
* This means that when new remote state is received, the cache
|
|
1184
|
+
* will intelligently commit any changes from local state that
|
|
1185
|
+
* are present in the remote data for this field, leaving any remaining
|
|
1186
|
+
* changes in local state still.
|
|
1187
|
+
*
|
|
1188
|
+
* Previously, the cache would clear local state of all changes
|
|
1189
|
+
* except for the addition of records still in the "new" state any
|
|
1190
|
+
* time the remote data for this field was updated.
|
|
1191
|
+
*
|
|
1192
|
+
* @public
|
|
1193
|
+
*/
|
|
1194
|
+
linksMode: true;
|
|
1195
|
+
};
|
|
1241
1196
|
}
|
|
1242
1197
|
/**
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
*/
|
|
1198
|
+
* > [!CAUTION]
|
|
1199
|
+
* > This Field is LEGACY
|
|
1200
|
+
*
|
|
1201
|
+
* Represents a field that is a reference to
|
|
1202
|
+
* a collection of other resources.
|
|
1203
|
+
*
|
|
1204
|
+
* This is the legacy version of the `CollectionField`.
|
|
1205
|
+
*
|
|
1206
|
+
* @public
|
|
1207
|
+
*/
|
|
1254
1208
|
export interface LegacyHasManyField {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1209
|
+
/**
|
|
1210
|
+
* The kind of field this is.
|
|
1211
|
+
*
|
|
1212
|
+
* @public
|
|
1213
|
+
*/
|
|
1214
|
+
kind: "hasMany";
|
|
1215
|
+
/**
|
|
1216
|
+
* The name of the field.
|
|
1217
|
+
*
|
|
1218
|
+
* @public
|
|
1219
|
+
*/
|
|
1220
|
+
name: string;
|
|
1221
|
+
/**
|
|
1222
|
+
* the name of the resource that this field
|
|
1223
|
+
* refers to. In the case of a polymorphic
|
|
1224
|
+
* relationship, this should be the trait
|
|
1225
|
+
* or abstract type.
|
|
1226
|
+
*
|
|
1227
|
+
* @public
|
|
1228
|
+
*/
|
|
1229
|
+
type: string;
|
|
1230
|
+
/**
|
|
1231
|
+
* Options for hasMany are mandatory.
|
|
1232
|
+
*
|
|
1233
|
+
* @public
|
|
1234
|
+
*/
|
|
1235
|
+
options: {
|
|
1236
|
+
/**
|
|
1237
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
1238
|
+
* :::
|
|
1239
|
+
*
|
|
1240
|
+
* Configures which extensions this array is allowed to use.
|
|
1241
|
+
* Extensions are registered with the store's schema service
|
|
1242
|
+
* via {@link SchemaService.registerDangerousArrayExtension}
|
|
1243
|
+
*
|
|
1244
|
+
* Extensions should only be used for temporary enhancements
|
|
1245
|
+
* to arrays to support migrating away from deprecated behaviors
|
|
1246
|
+
* such as Ember's "ArrayLike" and FragmentArray from ember-data-model-fragments
|
|
1247
|
+
*/
|
|
1248
|
+
arrayExtensions?: string[];
|
|
1249
|
+
/**
|
|
1250
|
+
* Whether the relationship is async
|
|
1251
|
+
*
|
|
1252
|
+
* If true, it is expected that the cache
|
|
1253
|
+
* data for this field will contain links
|
|
1254
|
+
* or pointers that can be used to fetch
|
|
1255
|
+
* the related resources when needed.
|
|
1256
|
+
*
|
|
1257
|
+
* When false, it is expected that all related
|
|
1258
|
+
* resources are loaded together with this resource,
|
|
1259
|
+
* and that the cache data for this field will
|
|
1260
|
+
* contain the full list of pointers.
|
|
1261
|
+
*
|
|
1262
|
+
* hasMany relationships do not support pagination.
|
|
1263
|
+
*
|
|
1264
|
+
* @public
|
|
1265
|
+
*/
|
|
1266
|
+
async: boolean;
|
|
1267
|
+
/**
|
|
1268
|
+
* The name of the inverse field on the
|
|
1269
|
+
* related resource that points back to
|
|
1270
|
+
* this field on this resource to form a
|
|
1271
|
+
* bidirectional relationship.
|
|
1272
|
+
*
|
|
1273
|
+
* If null, the relationship is unidirectional.
|
|
1274
|
+
*
|
|
1275
|
+
* @public
|
|
1276
|
+
*/
|
|
1277
|
+
inverse: string | null;
|
|
1278
|
+
/**
|
|
1279
|
+
* If this field is satisfying a polymorphic
|
|
1280
|
+
* relationship on another resource, then this
|
|
1281
|
+
* should be set to the trait or abstract type
|
|
1282
|
+
* that this resource implements.
|
|
1283
|
+
*
|
|
1284
|
+
* @public
|
|
1285
|
+
*/
|
|
1286
|
+
as?: string;
|
|
1287
|
+
/**
|
|
1288
|
+
* Whether this field is a polymorphic relationship,
|
|
1289
|
+
* meaning that it can point to multiple types of
|
|
1290
|
+
* resources so long as they implement the trait
|
|
1291
|
+
* or abstract type specified in `type`.
|
|
1292
|
+
*
|
|
1293
|
+
* @public
|
|
1294
|
+
*/
|
|
1295
|
+
polymorphic?: boolean;
|
|
1296
|
+
/**
|
|
1297
|
+
* Whether this field should ever make use of the legacy support infra
|
|
1298
|
+
* from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
|
|
1299
|
+
*
|
|
1300
|
+
* When true, none of the legacy support will be utilized. Sync relationships
|
|
1301
|
+
* will be expected to already have all their data. When reloading a sync relationship
|
|
1302
|
+
* you would be expected to have a `related link` available from a prior relationship
|
|
1303
|
+
* payload e.g.
|
|
1304
|
+
*
|
|
1305
|
+
* ```ts
|
|
1306
|
+
* {
|
|
1307
|
+
* data: {
|
|
1308
|
+
* type: 'user',
|
|
1309
|
+
* id: '2',
|
|
1310
|
+
* attributes: { name: 'Chris' },
|
|
1311
|
+
* relationships: {
|
|
1312
|
+
* bestFriends: {
|
|
1313
|
+
* links: { related: "/users/1/bestFriends" },
|
|
1314
|
+
* data: [ { type: 'user', id: '1' } ],
|
|
1315
|
+
* }
|
|
1316
|
+
* }
|
|
1317
|
+
* },
|
|
1318
|
+
* included: [
|
|
1319
|
+
* { type: 'user', id: '1', attributes: { name: 'Krystan' } }
|
|
1320
|
+
* ]
|
|
1321
|
+
* }
|
|
1322
|
+
* ```
|
|
1323
|
+
*
|
|
1324
|
+
* Async relationships will be loaded via their link if needed.
|
|
1325
|
+
*
|
|
1326
|
+
* @public
|
|
1327
|
+
*/
|
|
1328
|
+
linksMode?: true;
|
|
1329
|
+
/**
|
|
1330
|
+
* When omitted, the cache data for this field will
|
|
1331
|
+
* clear local state of all changes except for the
|
|
1332
|
+
* addition of records still in the "new" state any
|
|
1333
|
+
* time the remote data for this field is updated.
|
|
1334
|
+
*
|
|
1335
|
+
* When set to `false`, the cache data for this field
|
|
1336
|
+
* will instead intelligently commit any changes from
|
|
1337
|
+
* local state that are present in the remote data,
|
|
1338
|
+
* leaving any remaining changes in local state still.
|
|
1339
|
+
*
|
|
1340
|
+
* @public
|
|
1341
|
+
*/
|
|
1342
|
+
resetOnRemoteUpdate?: false;
|
|
1343
|
+
};
|
|
1376
1344
|
}
|
|
1377
1345
|
/**
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
*/
|
|
1346
|
+
* > [!CAUTION]
|
|
1347
|
+
* > This Field is LEGACY
|
|
1348
|
+
*
|
|
1349
|
+
* Represents a field that is a reference to
|
|
1350
|
+
* a collection of other resources.
|
|
1351
|
+
*
|
|
1352
|
+
* This is the legacy version of the `CollectionField`.
|
|
1353
|
+
*
|
|
1354
|
+
* @public
|
|
1355
|
+
*/
|
|
1389
1356
|
export interface LinksModeHasManyField {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1357
|
+
/**
|
|
1358
|
+
* The kind of field this is.
|
|
1359
|
+
*
|
|
1360
|
+
* @public
|
|
1361
|
+
*/
|
|
1362
|
+
kind: "hasMany";
|
|
1363
|
+
/**
|
|
1364
|
+
* The name of the field.
|
|
1365
|
+
*
|
|
1366
|
+
* @public
|
|
1367
|
+
*/
|
|
1368
|
+
name: string;
|
|
1369
|
+
/**
|
|
1370
|
+
* the name of the resource that this field
|
|
1371
|
+
* refers to. In the case of a polymorphic
|
|
1372
|
+
* relationship, this should be the trait
|
|
1373
|
+
* or abstract type.
|
|
1374
|
+
*
|
|
1375
|
+
* @public
|
|
1376
|
+
*/
|
|
1377
|
+
type: string;
|
|
1378
|
+
/**
|
|
1379
|
+
* Options for hasMany are mandatory.
|
|
1380
|
+
*
|
|
1381
|
+
* @public
|
|
1382
|
+
*/
|
|
1383
|
+
options: {
|
|
1384
|
+
/**
|
|
1385
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
1386
|
+
* :::
|
|
1387
|
+
*
|
|
1388
|
+
* Configures which extensions this array is allowed to use.
|
|
1389
|
+
* Extensions are registered with the store's schema service
|
|
1390
|
+
* via {@link SchemaService.registerDangerousArrayExtension}
|
|
1391
|
+
*
|
|
1392
|
+
* Extensions should only be used for temporary enhancements
|
|
1393
|
+
* to arrays to support migrating away from deprecated behaviors
|
|
1394
|
+
* such as Ember's "ArrayLike" and FragmentArray from ember-data-model-fragments
|
|
1395
|
+
*/
|
|
1396
|
+
arrayExtensions?: string[];
|
|
1397
|
+
/**
|
|
1398
|
+
* Whether the relationship is async
|
|
1399
|
+
*
|
|
1400
|
+
* MUST be false for PolarisMode + LinksMode
|
|
1401
|
+
*
|
|
1402
|
+
* If true, it is expected that the cache
|
|
1403
|
+
* data for this field will contain links
|
|
1404
|
+
* or pointers that can be used to fetch
|
|
1405
|
+
* the related resources when needed.
|
|
1406
|
+
*
|
|
1407
|
+
* When false, it is expected that all related
|
|
1408
|
+
* resources are loaded together with this resource,
|
|
1409
|
+
* and that the cache data for this field will
|
|
1410
|
+
* contain the full list of pointers.
|
|
1411
|
+
*
|
|
1412
|
+
* hasMany relationships do not support pagination.
|
|
1413
|
+
*
|
|
1414
|
+
* @public
|
|
1415
|
+
*/
|
|
1416
|
+
async: false;
|
|
1417
|
+
/**
|
|
1418
|
+
* The name of the inverse field on the
|
|
1419
|
+
* related resource that points back to
|
|
1420
|
+
* this field on this resource to form a
|
|
1421
|
+
* bidirectional relationship.
|
|
1422
|
+
*
|
|
1423
|
+
* If null, the relationship is unidirectional.
|
|
1424
|
+
*
|
|
1425
|
+
* @public
|
|
1426
|
+
*/
|
|
1427
|
+
inverse: string | null;
|
|
1428
|
+
/**
|
|
1429
|
+
* If this field is satisfying a polymorphic
|
|
1430
|
+
* relationship on another resource, then this
|
|
1431
|
+
* should be set to the trait or abstract type
|
|
1432
|
+
* that this resource implements.
|
|
1433
|
+
*
|
|
1434
|
+
* @public
|
|
1435
|
+
*/
|
|
1436
|
+
as?: string;
|
|
1437
|
+
/**
|
|
1438
|
+
* Whether this field is a polymorphic relationship,
|
|
1439
|
+
* meaning that it can point to multiple types of
|
|
1440
|
+
* resources so long as they implement the trait
|
|
1441
|
+
* or abstract type specified in `type`.
|
|
1442
|
+
*
|
|
1443
|
+
* @public
|
|
1444
|
+
*/
|
|
1445
|
+
polymorphic?: boolean;
|
|
1446
|
+
/**
|
|
1447
|
+
* Whether this field should ever make use of the legacy support infra
|
|
1448
|
+
* from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
|
|
1449
|
+
*
|
|
1450
|
+
* MUST be true for PolarisMode + LinksMode
|
|
1451
|
+
*
|
|
1452
|
+
* When true, none of the legacy support will be utilized. Sync relationships
|
|
1453
|
+
* will be expected to already have all their data. When reloading a sync relationship
|
|
1454
|
+
* you would be expected to have a `related link` available from a prior relationship
|
|
1455
|
+
* payload e.g.
|
|
1456
|
+
*
|
|
1457
|
+
* ```ts
|
|
1458
|
+
* {
|
|
1459
|
+
* data: {
|
|
1460
|
+
* type: 'user',
|
|
1461
|
+
* id: '2',
|
|
1462
|
+
* attributes: { name: 'Chris' },
|
|
1463
|
+
* relationships: {
|
|
1464
|
+
* bestFriends: {
|
|
1465
|
+
* links: { related: "/users/1/bestFriends" },
|
|
1466
|
+
* data: [ { type: 'user', id: '1' } ],
|
|
1467
|
+
* }
|
|
1468
|
+
* }
|
|
1469
|
+
* },
|
|
1470
|
+
* included: [
|
|
1471
|
+
* { type: 'user', id: '1', attributes: { name: 'Krystan' } }
|
|
1472
|
+
* ]
|
|
1473
|
+
* }
|
|
1474
|
+
* ```
|
|
1475
|
+
*
|
|
1476
|
+
* Async relationships will be loaded via their link if needed.
|
|
1477
|
+
*
|
|
1478
|
+
* Activating LinksMode will *also* deactivate the deprecated
|
|
1479
|
+
* `resetOnRemoteUpdate` behavior for this field.
|
|
1480
|
+
*
|
|
1481
|
+
* This means that when new remote state is received, the cache
|
|
1482
|
+
* will intelligently commit any changes from local state that
|
|
1483
|
+
* are present in the remote data for this field, leaving any remaining
|
|
1484
|
+
* changes in local state still.
|
|
1485
|
+
*
|
|
1486
|
+
* Previously, the cache would clear local state of all changes
|
|
1487
|
+
* except for the addition of records still in the "new" state any
|
|
1488
|
+
* time the remote data for this field was updated.
|
|
1489
|
+
*
|
|
1490
|
+
* @public
|
|
1491
|
+
*/
|
|
1492
|
+
linksMode: true;
|
|
1493
|
+
};
|
|
1514
1494
|
}
|
|
1515
1495
|
/**
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
*/
|
|
1496
|
+
* A union of all possible LegacyMode field schemas.
|
|
1497
|
+
*
|
|
1498
|
+
* Available field schemas are:
|
|
1499
|
+
*
|
|
1500
|
+
* - {@link GenericField}
|
|
1501
|
+
* - {@link LegacyAliasField}
|
|
1502
|
+
* - {@link LocalField}
|
|
1503
|
+
* - {@link ObjectField}
|
|
1504
|
+
* - {@link SchemaObjectField}
|
|
1505
|
+
* - {@link ArrayField}
|
|
1506
|
+
* - {@link SchemaArrayField}
|
|
1507
|
+
* - {@link DerivedField}
|
|
1508
|
+
* - {@link ResourceField | ResourceField (not yet implemented)}
|
|
1509
|
+
* - {@link CollectionField | CollectionField (not yet implemented)}
|
|
1510
|
+
* - {@link LegacyAttributeField}
|
|
1511
|
+
* - {@link LegacyBelongsToField}
|
|
1512
|
+
* - {@link LegacyHasManyField}
|
|
1513
|
+
*
|
|
1514
|
+
* @public
|
|
1515
|
+
*/
|
|
1537
1516
|
export type LegacyModeFieldSchema = GenericField | LegacyAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField;
|
|
1538
1517
|
/**
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
*/
|
|
1518
|
+
* A union of all possible PolarisMode field schemas.
|
|
1519
|
+
*
|
|
1520
|
+
* Available field schemas are:
|
|
1521
|
+
*
|
|
1522
|
+
* - {@link GenericField}
|
|
1523
|
+
* - {@link PolarisAliasField}
|
|
1524
|
+
* - {@link LocalField}
|
|
1525
|
+
* - {@link ObjectField}
|
|
1526
|
+
* - {@link SchemaObjectField}
|
|
1527
|
+
* - {@link ArrayField}
|
|
1528
|
+
* - {@link SchemaArrayField}
|
|
1529
|
+
* - {@link DerivedField}
|
|
1530
|
+
* - {@link ResourceField | ResourceField (not yet implemented)}
|
|
1531
|
+
* - {@link CollectionField | CollectionField (not yet implemented)}
|
|
1532
|
+
* - {@link LinksModeBelongsToField}
|
|
1533
|
+
* - {@link LinksModeHasManyField}
|
|
1534
|
+
*
|
|
1535
|
+
* @public
|
|
1536
|
+
*/
|
|
1559
1537
|
export type PolarisModeFieldSchema = GenericField | PolarisAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | LinksModeBelongsToField | LinksModeHasManyField;
|
|
1560
1538
|
/**
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
*/
|
|
1539
|
+
* A union of all possible LegacyMode and PolarisMode
|
|
1540
|
+
* field schemas.
|
|
1541
|
+
*
|
|
1542
|
+
* You likely will want to use PolarisModeFieldSchema,
|
|
1543
|
+
* LegacyModeFieldSchema, or ObjectFieldSchema instead
|
|
1544
|
+
* as appropriate as they are more specific and will
|
|
1545
|
+
* provide better guidance around what is valid.
|
|
1546
|
+
*
|
|
1547
|
+
* @public
|
|
1548
|
+
*/
|
|
1572
1549
|
export type FieldSchema = GenericField | LegacyAliasField | PolarisAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | ResourceField | CollectionField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
|
|
1573
1550
|
/**
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
*/
|
|
1551
|
+
* A union of all possible field schemas that can be
|
|
1552
|
+
* used in an ObjectSchema.
|
|
1553
|
+
*
|
|
1554
|
+
* @public
|
|
1555
|
+
*/
|
|
1580
1556
|
export type ObjectFieldSchema = GenericField | ObjectAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField;
|
|
1581
1557
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
*/
|
|
1558
|
+
* Represents a schema for a primary resource in PolarisMode.
|
|
1559
|
+
*
|
|
1560
|
+
* Primary resources are objects with a unique identity of their
|
|
1561
|
+
* own which may allow them to appear in relationships, or in multiple
|
|
1562
|
+
* response documents.
|
|
1563
|
+
*
|
|
1564
|
+
* @public
|
|
1565
|
+
*/
|
|
1591
1566
|
export interface PolarisResourceSchema {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
*
|
|
1643
|
-
* @property traits
|
|
1644
|
-
* @type {String[]}
|
|
1645
|
-
* @public
|
|
1646
|
-
*/
|
|
1647
|
-
traits?: string[];
|
|
1567
|
+
legacy?: false;
|
|
1568
|
+
/**
|
|
1569
|
+
* For primary resources, this should be an IdentityField
|
|
1570
|
+
*
|
|
1571
|
+
* for schema-objects, this should be either a HashField or null
|
|
1572
|
+
*
|
|
1573
|
+
* @property identity
|
|
1574
|
+
* @type {IdentityField}
|
|
1575
|
+
* @public
|
|
1576
|
+
*/
|
|
1577
|
+
identity: IdentityField;
|
|
1578
|
+
/**
|
|
1579
|
+
* The name of the schema
|
|
1580
|
+
*
|
|
1581
|
+
* For cacheable resources, this should be the
|
|
1582
|
+
* primary resource type.
|
|
1583
|
+
*
|
|
1584
|
+
* For object schemas, this should be the name
|
|
1585
|
+
* of the object schema.
|
|
1586
|
+
*
|
|
1587
|
+
* The names of object and resource schemas share
|
|
1588
|
+
* a single namespace and must not conflict.
|
|
1589
|
+
*
|
|
1590
|
+
* We recommend a naming convention for object schemas
|
|
1591
|
+
* such as below for ensuring uniqueness:
|
|
1592
|
+
*
|
|
1593
|
+
* - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`
|
|
1594
|
+
* - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`
|
|
1595
|
+
* - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`
|
|
1596
|
+
*
|
|
1597
|
+
* @public
|
|
1598
|
+
*/
|
|
1599
|
+
type: string;
|
|
1600
|
+
/**
|
|
1601
|
+
* The fields that make up the shape of the resource
|
|
1602
|
+
*
|
|
1603
|
+
* @public
|
|
1604
|
+
*/
|
|
1605
|
+
fields: PolarisModeFieldSchema[];
|
|
1606
|
+
/**
|
|
1607
|
+
* A list of traits that this resource implements. The fields for these
|
|
1608
|
+
* traits should still be defined in the fields array.
|
|
1609
|
+
*
|
|
1610
|
+
* Each trait should be a string that matches the `type` of another
|
|
1611
|
+
* resource schema. The trait can be abstract and reference a resource
|
|
1612
|
+
* type that is never defined as a schema.
|
|
1613
|
+
*
|
|
1614
|
+
* @public
|
|
1615
|
+
*/
|
|
1616
|
+
traits?: string[];
|
|
1648
1617
|
}
|
|
1649
1618
|
/**
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
*/
|
|
1619
|
+
* Represents a schema for a primary resource in LegacyMode
|
|
1620
|
+
*
|
|
1621
|
+
* Primary resources are objects with a unique identity of their
|
|
1622
|
+
* own which may allow them to appear in relationships, or in multiple
|
|
1623
|
+
* response documents.
|
|
1624
|
+
*
|
|
1625
|
+
* @public
|
|
1626
|
+
*/
|
|
1659
1627
|
export interface LegacyResourceSchema {
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1628
|
+
/**
|
|
1629
|
+
* A flag indicating that this is a legacy resource schema
|
|
1630
|
+
*
|
|
1631
|
+
* @public
|
|
1632
|
+
*/
|
|
1633
|
+
legacy: true;
|
|
1634
|
+
/**
|
|
1635
|
+
* This should be an IdentityField.
|
|
1636
|
+
*
|
|
1637
|
+
* To maximize compatibility with Model where `id` was the
|
|
1638
|
+
* name of the identity field, we recommend using `{ kind: '@id', name: 'id' }`
|
|
1639
|
+
* for records in legacy mode, but this is not required.
|
|
1640
|
+
*
|
|
1641
|
+
* @public
|
|
1642
|
+
*/
|
|
1643
|
+
identity: IdentityField;
|
|
1644
|
+
/**
|
|
1645
|
+
* The name of the schema
|
|
1646
|
+
*
|
|
1647
|
+
* For cacheable resources, this should be the
|
|
1648
|
+
* primary resource type.
|
|
1649
|
+
*
|
|
1650
|
+
* The names of object and resource schemas share
|
|
1651
|
+
* a single namespace and must not conflict.
|
|
1652
|
+
*
|
|
1653
|
+
* We recommend a naming convention for object schemas
|
|
1654
|
+
* such as below for ensuring uniqueness:
|
|
1655
|
+
*
|
|
1656
|
+
* - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`
|
|
1657
|
+
* - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`
|
|
1658
|
+
* - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`
|
|
1659
|
+
*
|
|
1660
|
+
* @public
|
|
1661
|
+
*/
|
|
1662
|
+
type: string;
|
|
1663
|
+
/**
|
|
1664
|
+
* The fields that make up the shape of the resource
|
|
1665
|
+
*
|
|
1666
|
+
* @public
|
|
1667
|
+
*/
|
|
1668
|
+
fields: LegacyModeFieldSchema[];
|
|
1669
|
+
/**
|
|
1670
|
+
* A list of traits that this resource implements. The fields for these
|
|
1671
|
+
* traits should still be defined in the fields array.
|
|
1672
|
+
*
|
|
1673
|
+
* Each trait should be a string that matches the `type` of another
|
|
1674
|
+
* resource schema. The trait can be abstract and reference a resource
|
|
1675
|
+
* type that is never defined as a schema.
|
|
1676
|
+
*
|
|
1677
|
+
* @public
|
|
1678
|
+
*/
|
|
1679
|
+
traits?: string[];
|
|
1680
|
+
/**
|
|
1681
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
1682
|
+
* :::
|
|
1683
|
+
*
|
|
1684
|
+
* Configures which extensions this resource should use.
|
|
1685
|
+
*
|
|
1686
|
+
* Extensions are registered with the store's schema service
|
|
1687
|
+
* via {@link SchemaService.registerDangerousObjectExtension}
|
|
1688
|
+
*
|
|
1689
|
+
* Extensions should only be used for temporary enhancements
|
|
1690
|
+
* to objects to support migrating away from deprecated patterns
|
|
1691
|
+
* like custom getters, computeds, and methods
|
|
1692
|
+
*/
|
|
1693
|
+
objectExtensions?: string[];
|
|
1722
1694
|
}
|
|
1723
1695
|
/**
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1696
|
+
* A type which represents a valid JSON schema
|
|
1697
|
+
* definition for either a PolarisMode or a
|
|
1698
|
+
* LegacyMode resource.
|
|
1699
|
+
*
|
|
1700
|
+
* Note, this is separate from the type returned
|
|
1701
|
+
* by the SchemaService which provides fields as a Map
|
|
1702
|
+
* instead of as an Array.
|
|
1703
|
+
*
|
|
1704
|
+
* @public
|
|
1705
|
+
*/
|
|
1733
1706
|
export type ResourceSchema = PolarisResourceSchema | LegacyResourceSchema;
|
|
1734
1707
|
/**
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
*/
|
|
1708
|
+
* Represents a schema for an object that is not
|
|
1709
|
+
* a primary resource (has no unique identity of its own).
|
|
1710
|
+
*
|
|
1711
|
+
* ObjectSchemas may not currently contain relationships.
|
|
1712
|
+
*
|
|
1713
|
+
* @public
|
|
1714
|
+
*/
|
|
1743
1715
|
export interface ObjectSchema {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1716
|
+
/**
|
|
1717
|
+
* Either a HashField from which to calculate an identity or null
|
|
1718
|
+
*
|
|
1719
|
+
* In the case of `null`, the object's identity will be based
|
|
1720
|
+
* on the referential identity of the object in the cache itself
|
|
1721
|
+
* when an identity is needed.
|
|
1722
|
+
*
|
|
1723
|
+
* @public
|
|
1724
|
+
*/
|
|
1725
|
+
identity: HashField | null;
|
|
1726
|
+
/**
|
|
1727
|
+
* The name of the schema
|
|
1728
|
+
*
|
|
1729
|
+
* The names of object and resource schemas share
|
|
1730
|
+
* a single namespace and must not conflict.
|
|
1731
|
+
*
|
|
1732
|
+
* We recommend a naming convention for object schemas
|
|
1733
|
+
* such as below for ensuring uniqueness:
|
|
1734
|
+
*
|
|
1735
|
+
* - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`
|
|
1736
|
+
* - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`
|
|
1737
|
+
* - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`
|
|
1738
|
+
*
|
|
1739
|
+
* @public
|
|
1740
|
+
*/
|
|
1741
|
+
type: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* The fields that make up the shape of the object
|
|
1744
|
+
*
|
|
1745
|
+
* @public
|
|
1746
|
+
*/
|
|
1747
|
+
fields: ObjectFieldSchema[];
|
|
1748
|
+
/**
|
|
1749
|
+
* ::: warning ⚠️ Dangerous Feature Ahead
|
|
1750
|
+
* :::
|
|
1751
|
+
*
|
|
1752
|
+
* Configures which extensions this object should use.
|
|
1753
|
+
*
|
|
1754
|
+
* Extensions are registered with the store's schema service
|
|
1755
|
+
* via {@link SchemaService.registerDangerousObjectExtension}
|
|
1756
|
+
*
|
|
1757
|
+
* Extensions should only be used for temporary enhancements
|
|
1758
|
+
* to objects to support migrating away from deprecated patterns
|
|
1759
|
+
* like custom getters, computeds, and methods
|
|
1760
|
+
*/
|
|
1761
|
+
objectExtensions?: string[];
|
|
1782
1762
|
}
|
|
1783
1763
|
export type Schema = ResourceSchema | ObjectSchema;
|
|
1784
1764
|
/**
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
* @public
|
|
1797
|
-
*/
|
|
1765
|
+
* A no-op type utility that enables type-checking resource schema
|
|
1766
|
+
* definitions.
|
|
1767
|
+
*
|
|
1768
|
+
* Will return the passed in schema.
|
|
1769
|
+
*
|
|
1770
|
+
* This will not validate relationship inverses or related types,
|
|
1771
|
+
* as doing so would require a full schema graph to be passed in
|
|
1772
|
+
* and no cycles in the graph to be present.
|
|
1773
|
+
*
|
|
1774
|
+
* @public
|
|
1775
|
+
*/
|
|
1798
1776
|
export declare function resourceSchema<T extends LegacyResourceSchema | PolarisResourceSchema>(schema: LegacyResourceSchema | PolarisResourceSchema): T;
|
|
1799
1777
|
/**
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
* @public
|
|
1808
|
-
*/
|
|
1778
|
+
* A no-op type utility that enables type-checking object schema
|
|
1779
|
+
* definitions.
|
|
1780
|
+
*
|
|
1781
|
+
* Will return the passed in schema.
|
|
1782
|
+
*
|
|
1783
|
+
* @public
|
|
1784
|
+
*/
|
|
1809
1785
|
export declare function objectSchema<T extends ObjectSchema>(schema: T): T;
|
|
1810
1786
|
/**
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
* @public
|
|
1816
|
-
*/
|
|
1787
|
+
* A type utility to narrow a schema to a ResourceSchema
|
|
1788
|
+
*
|
|
1789
|
+
* @public
|
|
1790
|
+
*/
|
|
1817
1791
|
export declare function isResourceSchema(schema: ResourceSchema | ObjectSchema): schema is ResourceSchema;
|
|
1818
1792
|
/**
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
* @public
|
|
1824
|
-
*/
|
|
1793
|
+
* A type utility to narrow a schema to LegacyResourceSchema
|
|
1794
|
+
*
|
|
1795
|
+
* @public
|
|
1796
|
+
*/
|
|
1825
1797
|
export declare function isLegacyResourceSchema(schema: ResourceSchema | ObjectSchema): schema is LegacyResourceSchema;
|
|
1826
1798
|
export type LegacyField = LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
|
|
1827
1799
|
export type LegacyRelationshipField = LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
|
|
1828
|
-
//# sourceMappingURL=fields.d.ts.map
|