@warp-drive/core 5.6.0-alpha.15 → 5.6.0-alpha.18

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