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