@warp-drive/core 5.6.0-alpha.11

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 (337) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE.md +23 -0
  3. package/README.md +70 -0
  4. package/addon-main.cjs +5 -0
  5. package/cjs-dist/addon-shim.cjs +1 -0
  6. package/cjs-dist/cjs-set-config.cjs +1 -0
  7. package/declarations/build-config/babel-macros.d.ts +2 -0
  8. package/declarations/build-config/babel-macros.d.ts.map +1 -0
  9. package/declarations/build-config/canary-features.d.ts +2 -0
  10. package/declarations/build-config/canary-features.d.ts.map +1 -0
  11. package/declarations/build-config/debugging.d.ts +2 -0
  12. package/declarations/build-config/debugging.d.ts.map +1 -0
  13. package/declarations/build-config/deprecations.d.ts +2 -0
  14. package/declarations/build-config/deprecations.d.ts.map +1 -0
  15. package/declarations/build-config/env.d.ts +2 -0
  16. package/declarations/build-config/env.d.ts.map +1 -0
  17. package/declarations/build-config/macros.d.ts +2 -0
  18. package/declarations/build-config/macros.d.ts.map +1 -0
  19. package/declarations/build-config.d.ts +2 -0
  20. package/declarations/build-config.d.ts.map +1 -0
  21. package/declarations/configure.d.ts +8 -0
  22. package/declarations/configure.d.ts.map +1 -0
  23. package/declarations/graph/-private/-diff.d.ts +33 -0
  24. package/declarations/graph/-private/-diff.d.ts.map +1 -0
  25. package/declarations/graph/-private/-edge-definition.d.ts +149 -0
  26. package/declarations/graph/-private/-edge-definition.d.ts.map +1 -0
  27. package/declarations/graph/-private/-state.d.ts +10 -0
  28. package/declarations/graph/-private/-state.d.ts.map +1 -0
  29. package/declarations/graph/-private/-utils.d.ts +26 -0
  30. package/declarations/graph/-private/-utils.d.ts.map +1 -0
  31. package/declarations/graph/-private/coerce-id.d.ts +5 -0
  32. package/declarations/graph/-private/coerce-id.d.ts.map +1 -0
  33. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +7 -0
  34. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  35. package/declarations/graph/-private/edges/collection.d.ts +40 -0
  36. package/declarations/graph/-private/edges/collection.d.ts.map +1 -0
  37. package/declarations/graph/-private/edges/implicit.d.ts +14 -0
  38. package/declarations/graph/-private/edges/implicit.d.ts.map +1 -0
  39. package/declarations/graph/-private/edges/resource.d.ts +25 -0
  40. package/declarations/graph/-private/edges/resource.d.ts.map +1 -0
  41. package/declarations/graph/-private/graph.d.ts +55 -0
  42. package/declarations/graph/-private/graph.d.ts.map +1 -0
  43. package/declarations/graph/-private/normalize-link.d.ts +3 -0
  44. package/declarations/graph/-private/normalize-link.d.ts.map +1 -0
  45. package/declarations/graph/-private/operations/add-to-related-records.d.ts +5 -0
  46. package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +1 -0
  47. package/declarations/graph/-private/operations/merge-identifier.d.ts +4 -0
  48. package/declarations/graph/-private/operations/merge-identifier.d.ts.map +1 -0
  49. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +5 -0
  50. package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +1 -0
  51. package/declarations/graph/-private/operations/replace-related-record.d.ts +4 -0
  52. package/declarations/graph/-private/operations/replace-related-record.d.ts.map +1 -0
  53. package/declarations/graph/-private/operations/replace-related-records.d.ts +8 -0
  54. package/declarations/graph/-private/operations/replace-related-records.d.ts.map +1 -0
  55. package/declarations/graph/-private/operations/update-relationship.d.ts +11 -0
  56. package/declarations/graph/-private/operations/update-relationship.d.ts.map +1 -0
  57. package/declarations/graph/-private.d.ts +14 -0
  58. package/declarations/graph/-private.d.ts.map +1 -0
  59. package/declarations/index.d.ts +15 -0
  60. package/declarations/index.d.ts.map +1 -0
  61. package/declarations/reactive/-private/document.d.ts +147 -0
  62. package/declarations/reactive/-private/document.d.ts.map +1 -0
  63. package/declarations/reactive/-private/fields/compute.d.ts +40 -0
  64. package/declarations/reactive/-private/fields/compute.d.ts.map +1 -0
  65. package/declarations/reactive/-private/fields/managed-array.d.ts +23 -0
  66. package/declarations/reactive/-private/fields/managed-array.d.ts.map +1 -0
  67. package/declarations/reactive/-private/fields/managed-object.d.ts +21 -0
  68. package/declarations/reactive/-private/fields/managed-object.d.ts.map +1 -0
  69. package/declarations/reactive/-private/fields/many-array-manager.d.ts +20 -0
  70. package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +1 -0
  71. package/declarations/reactive/-private/hooks.d.ts +6 -0
  72. package/declarations/reactive/-private/hooks.d.ts.map +1 -0
  73. package/declarations/reactive/-private/record.d.ts +61 -0
  74. package/declarations/reactive/-private/record.d.ts.map +1 -0
  75. package/declarations/reactive/-private/schema.d.ts +180 -0
  76. package/declarations/reactive/-private/schema.d.ts.map +1 -0
  77. package/declarations/reactive/-private/symbols.d.ts +11 -0
  78. package/declarations/reactive/-private/symbols.d.ts.map +1 -0
  79. package/declarations/reactive/-private.d.ts +2 -0
  80. package/declarations/reactive/-private.d.ts.map +1 -0
  81. package/declarations/reactive.d.ts +5 -0
  82. package/declarations/reactive.d.ts.map +1 -0
  83. package/declarations/request/-private/context.d.ts +42 -0
  84. package/declarations/request/-private/context.d.ts.map +1 -0
  85. package/declarations/request/-private/debug.d.ts +5 -0
  86. package/declarations/request/-private/debug.d.ts.map +1 -0
  87. package/declarations/request/-private/fetch.d.ts +40 -0
  88. package/declarations/request/-private/fetch.d.ts.map +1 -0
  89. package/declarations/request/-private/future.d.ts +8 -0
  90. package/declarations/request/-private/future.d.ts.map +1 -0
  91. package/declarations/request/-private/manager.d.ts +160 -0
  92. package/declarations/request/-private/manager.d.ts.map +1 -0
  93. package/declarations/request/-private/promise-cache.d.ts +20 -0
  94. package/declarations/request/-private/promise-cache.d.ts.map +1 -0
  95. package/declarations/request/-private/types.d.ts +236 -0
  96. package/declarations/request/-private/types.d.ts.map +1 -0
  97. package/declarations/request/-private/utils.d.ts +16 -0
  98. package/declarations/request/-private/utils.d.ts.map +1 -0
  99. package/declarations/request.d.ts +6 -0
  100. package/declarations/request.d.ts.map +1 -0
  101. package/declarations/store/-private/cache-handler/handler.d.ts +57 -0
  102. package/declarations/store/-private/cache-handler/handler.d.ts.map +1 -0
  103. package/declarations/store/-private/cache-handler/types.d.ts +99 -0
  104. package/declarations/store/-private/cache-handler/types.d.ts.map +1 -0
  105. package/declarations/store/-private/cache-handler/utils.d.ts +32 -0
  106. package/declarations/store/-private/cache-handler/utils.d.ts.map +1 -0
  107. package/declarations/store/-private/caches/cache-utils.d.ts +9 -0
  108. package/declarations/store/-private/caches/cache-utils.d.ts.map +1 -0
  109. package/declarations/store/-private/caches/identifier-cache.d.ts +316 -0
  110. package/declarations/store/-private/caches/identifier-cache.d.ts.map +1 -0
  111. package/declarations/store/-private/caches/instance-cache.d.ts +65 -0
  112. package/declarations/store/-private/caches/instance-cache.d.ts.map +1 -0
  113. package/declarations/store/-private/caches/resource-utils.d.ts +10 -0
  114. package/declarations/store/-private/caches/resource-utils.d.ts.map +1 -0
  115. package/declarations/store/-private/debug/utils.d.ts +7 -0
  116. package/declarations/store/-private/debug/utils.d.ts.map +1 -0
  117. package/declarations/store/-private/default-cache-policy.d.ts +383 -0
  118. package/declarations/store/-private/default-cache-policy.d.ts.map +1 -0
  119. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +164 -0
  120. package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +1 -0
  121. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +17 -0
  122. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
  123. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +26 -0
  124. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
  125. package/declarations/store/-private/managers/cache-manager.d.ts +428 -0
  126. package/declarations/store/-private/managers/cache-manager.d.ts.map +1 -0
  127. package/declarations/store/-private/managers/notification-manager.d.ts +93 -0
  128. package/declarations/store/-private/managers/notification-manager.d.ts.map +1 -0
  129. package/declarations/store/-private/managers/record-array-manager.d.ts +98 -0
  130. package/declarations/store/-private/managers/record-array-manager.d.ts.map +1 -0
  131. package/declarations/store/-private/network/request-cache.d.ts +104 -0
  132. package/declarations/store/-private/network/request-cache.d.ts.map +1 -0
  133. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +255 -0
  134. package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +1 -0
  135. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +93 -0
  136. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +1 -0
  137. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +170 -0
  138. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +1 -0
  139. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +30 -0
  140. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +1 -0
  141. package/declarations/store/-private/new-core-tmp/request-state.d.ts +255 -0
  142. package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +1 -0
  143. package/declarations/store/-private/record-arrays/identifier-array.d.ts +141 -0
  144. package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +1 -0
  145. package/declarations/store/-private/record-arrays/many-array.d.ts +199 -0
  146. package/declarations/store/-private/record-arrays/many-array.d.ts.map +1 -0
  147. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +116 -0
  148. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +1 -0
  149. package/declarations/store/-private/store-service.d.ts +1597 -0
  150. package/declarations/store/-private/store-service.d.ts.map +1 -0
  151. package/declarations/store/-private/store-service.type-test.d.ts +2 -0
  152. package/declarations/store/-private/store-service.type-test.d.ts.map +1 -0
  153. package/declarations/store/-private/utils/coerce-id.d.ts +5 -0
  154. package/declarations/store/-private/utils/coerce-id.d.ts.map +1 -0
  155. package/declarations/store/-private/utils/construct-resource.d.ts +7 -0
  156. package/declarations/store/-private/utils/construct-resource.d.ts.map +1 -0
  157. package/declarations/store/-private/utils/is-non-empty-string.d.ts +2 -0
  158. package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +1 -0
  159. package/declarations/store/-private/utils/normalize-model-name.d.ts +2 -0
  160. package/declarations/store/-private/utils/normalize-model-name.d.ts.map +1 -0
  161. package/declarations/store/-private/utils/uuid-polyfill.d.ts +2 -0
  162. package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +1 -0
  163. package/declarations/store/-private.d.ts +27 -0
  164. package/declarations/store/-private.d.ts.map +1 -0
  165. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +100 -0
  166. package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +1 -0
  167. package/declarations/store/-types/q/ds-model.d.ts +22 -0
  168. package/declarations/store/-types/q/ds-model.d.ts.map +1 -0
  169. package/declarations/store/-types/q/identifier.d.ts +21 -0
  170. package/declarations/store/-types/q/identifier.d.ts.map +1 -0
  171. package/declarations/store/-types/q/promise-proxies.d.ts +2 -0
  172. package/declarations/store/-types/q/promise-proxies.d.ts.map +1 -0
  173. package/declarations/store/-types/q/record-data-json-api.d.ts +31 -0
  174. package/declarations/store/-types/q/record-data-json-api.d.ts.map +1 -0
  175. package/declarations/store/-types/q/record-instance.d.ts +24 -0
  176. package/declarations/store/-types/q/record-instance.d.ts.map +1 -0
  177. package/declarations/store/-types/q/schema-service.d.ts +331 -0
  178. package/declarations/store/-types/q/schema-service.d.ts.map +1 -0
  179. package/declarations/store/-types/q/store.d.ts +35 -0
  180. package/declarations/store/-types/q/store.d.ts.map +1 -0
  181. package/declarations/store.d.ts +2 -0
  182. package/declarations/store.d.ts.map +1 -0
  183. package/declarations/types/-private.d.ts +14 -0
  184. package/declarations/types/-private.d.ts.map +1 -0
  185. package/declarations/types/cache/aliases.d.ts +2 -0
  186. package/declarations/types/cache/aliases.d.ts.map +1 -0
  187. package/declarations/types/cache/change.d.ts +7 -0
  188. package/declarations/types/cache/change.d.ts.map +1 -0
  189. package/declarations/types/cache/mutations.d.ts +39 -0
  190. package/declarations/types/cache/mutations.d.ts.map +1 -0
  191. package/declarations/types/cache/operations.d.ts +72 -0
  192. package/declarations/types/cache/operations.d.ts.map +1 -0
  193. package/declarations/types/cache/relationship.d.ts +14 -0
  194. package/declarations/types/cache/relationship.d.ts.map +1 -0
  195. package/declarations/types/cache.d.ts +492 -0
  196. package/declarations/types/cache.d.ts.map +1 -0
  197. package/declarations/types/graph.d.ts +48 -0
  198. package/declarations/types/graph.d.ts.map +1 -0
  199. package/declarations/types/identifier.d.ts +111 -0
  200. package/declarations/types/identifier.d.ts.map +1 -0
  201. package/declarations/types/json/raw.d.ts +7 -0
  202. package/declarations/types/json/raw.d.ts.map +1 -0
  203. package/declarations/types/params.d.ts +10 -0
  204. package/declarations/types/params.d.ts.map +1 -0
  205. package/declarations/types/record.d.ts +96 -0
  206. package/declarations/types/record.d.ts.map +1 -0
  207. package/declarations/types/record.type-test.d.ts +2 -0
  208. package/declarations/types/record.type-test.d.ts.map +1 -0
  209. package/declarations/types/request.d.ts +308 -0
  210. package/declarations/types/request.d.ts.map +1 -0
  211. package/declarations/types/request.type-test.d.ts +2 -0
  212. package/declarations/types/request.type-test.d.ts.map +1 -0
  213. package/declarations/types/runtime.d.ts +15 -0
  214. package/declarations/types/runtime.d.ts.map +1 -0
  215. package/declarations/types/schema/concepts.d.ts +17 -0
  216. package/declarations/types/schema/concepts.d.ts.map +1 -0
  217. package/declarations/types/schema/fields.d.ts +1674 -0
  218. package/declarations/types/schema/fields.d.ts.map +1 -0
  219. package/declarations/types/schema/fields.type-test.d.ts +2 -0
  220. package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
  221. package/declarations/types/spec/document.d.ts +31 -0
  222. package/declarations/types/spec/document.d.ts.map +1 -0
  223. package/declarations/types/spec/error.d.ts +19 -0
  224. package/declarations/types/spec/error.d.ts.map +1 -0
  225. package/declarations/types/spec/json-api-raw.d.ts +142 -0
  226. package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
  227. package/declarations/types/symbols.d.ts +79 -0
  228. package/declarations/types/symbols.d.ts.map +1 -0
  229. package/declarations/types/utils.d.ts +5 -0
  230. package/declarations/types/utils.d.ts.map +1 -0
  231. package/declarations/types.d.ts +12 -0
  232. package/declarations/types.d.ts.map +1 -0
  233. package/declarations/utils/string.d.ts +45 -0
  234. package/declarations/utils/string.d.ts.map +1 -0
  235. package/dist/build-config/babel-macros.js +1 -0
  236. package/dist/build-config/babel-macros.js.map +1 -0
  237. package/dist/build-config/canary-features.js +1 -0
  238. package/dist/build-config/canary-features.js.map +1 -0
  239. package/dist/build-config/debugging.js +1 -0
  240. package/dist/build-config/debugging.js.map +1 -0
  241. package/dist/build-config/deprecations.js +1 -0
  242. package/dist/build-config/deprecations.js.map +1 -0
  243. package/dist/build-config/env.js +1 -0
  244. package/dist/build-config/env.js.map +1 -0
  245. package/dist/build-config/macros.js +1 -0
  246. package/dist/build-config/macros.js.map +1 -0
  247. package/dist/build-config.js +1 -0
  248. package/dist/build-config.js.map +1 -0
  249. package/dist/configure-Bz49BEZQ.js +145 -0
  250. package/dist/configure-Bz49BEZQ.js.map +1 -0
  251. package/dist/configure.js +1 -0
  252. package/dist/configure.js.map +1 -0
  253. package/dist/context-DE5sFezZ.js +636 -0
  254. package/dist/context-DE5sFezZ.js.map +1 -0
  255. package/dist/graph/-private.js +3364 -0
  256. package/dist/graph/-private.js.map +1 -0
  257. package/dist/handler-DYUefHNU.js +339 -0
  258. package/dist/handler-DYUefHNU.js.map +1 -0
  259. package/dist/index.js +382 -0
  260. package/dist/index.js.map +1 -0
  261. package/dist/reactive/-private.js +1 -0
  262. package/dist/reactive/-private.js.map +1 -0
  263. package/dist/reactive.js +1802 -0
  264. package/dist/reactive.js.map +1 -0
  265. package/dist/request-state-Bv5CY_H0.js +7358 -0
  266. package/dist/request-state-Bv5CY_H0.js.map +1 -0
  267. package/dist/request.js +1 -0
  268. package/dist/request.js.map +1 -0
  269. package/dist/store/-private.js +3 -0
  270. package/dist/store/-private.js.map +1 -0
  271. package/dist/store.js +545 -0
  272. package/dist/store.js.map +1 -0
  273. package/dist/symbols-DyqeYQTe.js +44 -0
  274. package/dist/symbols-DyqeYQTe.js.map +1 -0
  275. package/dist/types/-private.js +79 -0
  276. package/dist/types/-private.js.map +1 -0
  277. package/dist/types/cache/aliases.js +0 -0
  278. package/dist/types/cache/aliases.js.map +1 -0
  279. package/dist/types/cache/change.js +0 -0
  280. package/dist/types/cache/change.js.map +1 -0
  281. package/dist/types/cache/mutations.js +0 -0
  282. package/dist/types/cache/mutations.js.map +1 -0
  283. package/dist/types/cache/operations.js +0 -0
  284. package/dist/types/cache/operations.js.map +1 -0
  285. package/dist/types/cache/relationship.js +0 -0
  286. package/dist/types/cache/relationship.js.map +1 -0
  287. package/dist/types/cache.js +0 -0
  288. package/dist/types/cache.js.map +1 -0
  289. package/dist/types/graph.js +0 -0
  290. package/dist/types/graph.js.map +1 -0
  291. package/dist/types/identifier.js +89 -0
  292. package/dist/types/identifier.js.map +1 -0
  293. package/dist/types/json/raw.js +0 -0
  294. package/dist/types/json/raw.js.map +1 -0
  295. package/dist/types/params.js +0 -0
  296. package/dist/types/params.js.map +1 -0
  297. package/dist/types/record.js +64 -0
  298. package/dist/types/record.js.map +1 -0
  299. package/dist/types/request.js +33 -0
  300. package/dist/types/request.js.map +1 -0
  301. package/dist/types/runtime.js +34 -0
  302. package/dist/types/runtime.js.map +1 -0
  303. package/dist/types/schema/concepts.js +0 -0
  304. package/dist/types/schema/concepts.js.map +1 -0
  305. package/dist/types/schema/fields.js +470 -0
  306. package/dist/types/schema/fields.js.map +1 -0
  307. package/dist/types/schema/fields.type-test.js +0 -0
  308. package/dist/types/schema/fields.type-test.js.map +1 -0
  309. package/dist/types/spec/document.js +0 -0
  310. package/dist/types/spec/document.js.map +1 -0
  311. package/dist/types/spec/error.js +0 -0
  312. package/dist/types/spec/error.js.map +1 -0
  313. package/dist/types/spec/json-api-raw.js +0 -0
  314. package/dist/types/spec/json-api-raw.js.map +1 -0
  315. package/dist/types/symbols.js +84 -0
  316. package/dist/types/symbols.js.map +1 -0
  317. package/dist/types/utils.js +0 -0
  318. package/dist/types/utils.js.map +1 -0
  319. package/dist/types.js +0 -0
  320. package/dist/types.js.map +1 -0
  321. package/dist/utils/string.js +92 -0
  322. package/dist/utils/string.js.map +1 -0
  323. package/logos/NCC-1701-a-blue.svg +4 -0
  324. package/logos/NCC-1701-a-gold.svg +4 -0
  325. package/logos/NCC-1701-a-gold_100.svg +1 -0
  326. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  327. package/logos/NCC-1701-a.svg +4 -0
  328. package/logos/README.md +4 -0
  329. package/logos/docs-badge.svg +2 -0
  330. package/logos/ember-data-logo-dark.svg +12 -0
  331. package/logos/ember-data-logo-light.svg +12 -0
  332. package/logos/github-header.svg +444 -0
  333. package/logos/social1.png +0 -0
  334. package/logos/social2.png +0 -0
  335. package/logos/warp-drive-logo-dark.svg +4 -0
  336. package/logos/warp-drive-logo-gold.svg +4 -0
  337. package/package.json +70 -0
@@ -0,0 +1,470 @@
1
+ /**
2
+ * A generic "field" that can be used to define
3
+ * primitive value fields.
4
+ *
5
+ * Replaces "attribute" for primitive value fields.
6
+ * Can also be used to eject from deep-tracking of
7
+ * objects or arrays.
8
+ *
9
+ * A major difference between "field" and "attribute"
10
+ * is that "type" points to a legacy transform on
11
+ * "attribute" that a serializer *might* use, while
12
+ * "type" points to a new-style transform on "field"
13
+ * that a record implmentation *must* use.
14
+ *
15
+ * @public
16
+ */
17
+
18
+ /**
19
+ * A field that can be used to alias one key to another
20
+ * key present in the cache version of the resource.
21
+ *
22
+ * Unlike DerivedField, an AliasField may write to its
23
+ * source when a record is in an editable mode.
24
+ *
25
+ * AliasFields may utilize a transform, specified by type,
26
+ * to pre/post process the field.
27
+ *
28
+ * An AliasField may also specify a `kind` via options.
29
+ * `kind` may be any other valid field kind other than
30
+ *
31
+ * - `@hash`
32
+ * - `@id`
33
+ * - `@local`
34
+ * - `derived`
35
+ *
36
+ * This allows an AliasField to rename any field in the cache.
37
+ *
38
+ * Alias fields are generally intended to be used to support migrating
39
+ * between different schemas, though there are times where they are useful
40
+ * as a form of advanced derivation when used with a transform. For instance,
41
+ * an AliasField could be used to expose both a string and a Date version of the
42
+ * same field, with both being capable of being written to.
43
+ *
44
+ * @public
45
+ */
46
+
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 field.
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
+
76
+ /**
77
+ * A field that can be used to alias one key to another
78
+ * key present in the cache version of the resource.
79
+ *
80
+ * Unlike DerivedField, an AliasField may write to its
81
+ * source when a record is in an editable mode.
82
+ *
83
+ * AliasFields may utilize a transform, specified by type,
84
+ * to pre/post process the field.
85
+ *
86
+ * An AliasField may also specify a `kind` via options.
87
+ * `kind` may be any other valid field kind other than
88
+ *
89
+ * - `@hash`
90
+ * - `@id`
91
+ * - `@local`
92
+ * - `derived`
93
+ *
94
+ * This allows an AliasField to rename any field in the cache.
95
+ *
96
+ * Alias fields are generally intended to be used to support migrating
97
+ * between different schemas, though there are times where they are useful
98
+ * as a form of advanced derivation when used with a transform. For instance,
99
+ * an AliasField could be used to expose both a string and a Date version of the
100
+ * same field, with both being capable of being written to.
101
+ *
102
+ * @public
103
+ */
104
+
105
+ /**
106
+ * Represents a field whose value is the primary
107
+ * key of the resource.
108
+ *
109
+ * This allows any field to serve as the primary
110
+ * key while still being able to drive identity
111
+ * needs within the system.
112
+ *
113
+ * This is useful for resources that use for instance
114
+ * 'uuid', 'urn' or 'entityUrn' or 'primaryKey' as their
115
+ * primary key field instead of 'id'.
116
+ *
117
+ * @public
118
+ */
119
+
120
+ /**
121
+ * Represents a specialized field whose computed value
122
+ * will be used as the primary key of a schema-object
123
+ * for serializability and comparison purposes.
124
+ *
125
+ * This field functions similarly to derived fields in that
126
+ * it is non-settable, derived state but differs in that
127
+ * it is only able to compute off of cache state and is given
128
+ * no access to a record instance.
129
+ *
130
+ * This means that if a hashing function wants to compute its value
131
+ * taking into account transformations and derivations it must
132
+ * perform those itself.
133
+ *
134
+ * A schema-array can declare its "key" value to be `@hash` if
135
+ * a schema-object has such a field.
136
+ *
137
+ * Only one hash field is permittable per schema-object, and
138
+ * it should be placed in the `ResourceSchema`'s `@id` field
139
+ * in place of an `IdentityField`.
140
+ *
141
+ * @public
142
+ */
143
+
144
+ /**
145
+ * Represents a field whose value is a local
146
+ * value that is not stored in the cache, nor
147
+ * is it sent to the server.
148
+ *
149
+ * Local fields can be written to, and their
150
+ * value is both memoized and reactive (though
151
+ * not deep-tracked).
152
+ *
153
+ * Because their state is not derived from the cache
154
+ * data or the server, they represent a divorced
155
+ * uncanonical source of state.
156
+ *
157
+ * For this reason Local fields should be used sparingly.
158
+ *
159
+ * Currently, while we document this feature here,
160
+ * only allow our own ReactiveResource default fields to
161
+ * utilize them and the feature should be considered private.
162
+ *
163
+ * Example use cases that drove the creation of local
164
+ * fields are states like `isDestroying` and `isDestroyed`
165
+ * which are specific to a record instance but not
166
+ * stored in the cache. We wanted to be able to drive
167
+ * these fields from schema the same as all other fields.
168
+ *
169
+ * Don't make us regret this decision.
170
+ *
171
+ * @public
172
+ */
173
+
174
+ /**
175
+ * Represents a field whose value is an object
176
+ * with keys pointing to values that are primitive
177
+ * values.
178
+ *
179
+ * If values of the keys are not primitives, or
180
+ * if the key/value pairs have well-defined shape,
181
+ * use 'schema-object' instead.
182
+ *
183
+ * @public
184
+ */
185
+
186
+ /**
187
+ * Represents a field whose value is an object
188
+ * with a well-defined structure described by
189
+ * a non-resource schema.
190
+ *
191
+ * If the object's structure is not well-defined,
192
+ * use 'object' instead.
193
+ *
194
+ * @public
195
+ */
196
+
197
+ /**
198
+ * Represents a field whose value is an array
199
+ * of primitive values.
200
+ *
201
+ * If the array's elements are not primitive
202
+ * values, use 'schema-array' instead.
203
+ *
204
+ * @public
205
+ */
206
+
207
+ /**
208
+ * Represents a field whose value is an array
209
+ * of objects with a well-defined structure
210
+ * described by a non-resource schema.
211
+ *
212
+ * If the array's elements are not well-defined,
213
+ * use 'array' instead.
214
+ *
215
+ * @public
216
+ */
217
+
218
+ /**
219
+ * Represents a field whose value is derived
220
+ * from other fields in the schema.
221
+ *
222
+ * The value is read-only, and is not stored
223
+ * in the cache, nor is it sent to the server.
224
+ *
225
+ * Usage of derived fields should be minimized
226
+ * to scenarios where the derivation is known
227
+ * to be safe. For instance, derivations that
228
+ * required fields that are not always loaded
229
+ * or that require access to related resources
230
+ * that may not be loaded should be avoided.
231
+ *
232
+ * @public
233
+ */
234
+
235
+ /**
236
+ * Represents a field that is a reference to
237
+ * another resource.
238
+ *
239
+ * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
240
+ * BY ReactiveResource
241
+ *
242
+ * @public
243
+ */
244
+
245
+ /**
246
+ * Represents a field that is a reference to
247
+ * a collection of other resources, potentially
248
+ * paginate.
249
+ *
250
+ * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
251
+ * BY ReactiveResource
252
+ *
253
+ * @public
254
+ */
255
+
256
+ /**
257
+ * > [!CAUTION]
258
+ * > This Field is LEGACY
259
+ * > It cannot be used with PolarisMode
260
+ *
261
+ * A generic "field" that can be used to define
262
+ * primitive value fields.
263
+ *
264
+ * If the field points to an object or array,
265
+ * it will not be deep-tracked.
266
+ *
267
+ * Transforms when defined are legacy transforms
268
+ * that a serializer *might* use, but their usage
269
+ * is not guaranteed.
270
+ *
271
+ * @public
272
+ */
273
+
274
+ /**
275
+ * > [!CAUTION]
276
+ * > This Field is LEGACY
277
+ *
278
+ * Represents a field that is a reference to
279
+ * another resource.
280
+ *
281
+ * This is the legacy version of the `ResourceField`.
282
+ *
283
+ * @public
284
+ */
285
+
286
+ /**
287
+ * > [!CAUTION]
288
+ * > This Field is LEGACY
289
+ *
290
+ * Represents a field that is a reference to
291
+ * another resource.
292
+ *
293
+ * This is the legacy version of the `ResourceField`.
294
+ *
295
+ * @public
296
+ */
297
+
298
+ /**
299
+ * > [!CAUTION]
300
+ * > This Field is LEGACY
301
+ *
302
+ * Represents a field that is a reference to
303
+ * a collection of other resources.
304
+ *
305
+ * This is the legacy version of the `CollectionField`.
306
+ *
307
+ * @public
308
+ */
309
+
310
+ /**
311
+ * > [!CAUTION]
312
+ * > This Field is LEGACY
313
+ *
314
+ * Represents a field that is a reference to
315
+ * a collection of other resources.
316
+ *
317
+ * This is the legacy version of the `CollectionField`.
318
+ *
319
+ * @public
320
+ */
321
+
322
+ /**
323
+ * A union of all possible LegacyMode field schemas.
324
+ *
325
+ * Available field schemas are:
326
+ *
327
+ * - {@link GenericField}
328
+ * - {@link LegacyAliasField}
329
+ * - {@link LocalField}
330
+ * - {@link ObjectField}
331
+ * - {@link SchemaObjectField}
332
+ * - {@link ArrayField}
333
+ * - {@link SchemaArrayField}
334
+ * - {@link DerivedField}
335
+ * - {@link ResourceField | ResourceField (not yet implemented)}
336
+ * - {@link CollectionField | CollectionField (not yet implemented)}
337
+ * - {@link LegacyAttributeField}
338
+ * - {@link LegacyBelongsToField}
339
+ * - {@link LegacyHasManyField}
340
+ *
341
+ * @public
342
+ */
343
+
344
+ /**
345
+ * A union of all possible PolarisMode field schemas.
346
+ *
347
+ * Available field schemas are:
348
+ *
349
+ * - {@link GenericField}
350
+ * - {@link PolarisAliasField}
351
+ * - {@link LocalField}
352
+ * - {@link ObjectField}
353
+ * - {@link SchemaObjectField}
354
+ * - {@link ArrayField}
355
+ * - {@link SchemaArrayField}
356
+ * - {@link DerivedField}
357
+ * - {@link ResourceField | ResourceField (not yet implemented)}
358
+ * - {@link CollectionField | CollectionField (not yet implemented)}
359
+ * - {@link LinksModeBelongsToField}
360
+ * - {@link LinksModeHasManyField}
361
+ *
362
+ * @public
363
+ */
364
+
365
+ /**
366
+ * A union of all possible LegacyMode and PolarisMode
367
+ * field schemas.
368
+ *
369
+ * You likely will want to use PolarisModeFieldSchema,
370
+ * LegacyModeFieldSchema, or ObjectFieldSchema instead
371
+ * as appropriate as they are more specific and will
372
+ * provide better guidance around what is valid.
373
+ *
374
+ * @public
375
+ */
376
+
377
+ /**
378
+ * A union of all possible field schemas that can be
379
+ * used in an ObjectSchema.
380
+ *
381
+ * @public
382
+ */
383
+
384
+ /**
385
+ * Represents a schema for a primary resource in PolarisMode.
386
+ *
387
+ * Primary resources are objects with a unique identity of their
388
+ * own which may allow them to appear in relationships, or in multiple
389
+ * response documents.
390
+ *
391
+ * @public
392
+ */
393
+
394
+ /**
395
+ * Represents a schema for a primary resource in LegacyMode
396
+ *
397
+ * Primary resources are objects with a unique identity of their
398
+ * own which may allow them to appear in relationships, or in multiple
399
+ * response documents.
400
+ *
401
+ * @public
402
+ */
403
+
404
+ /**
405
+ * A type which represents a valid JSON schema
406
+ * definition for either a PolarisMode or a
407
+ * LegacyMode resource.
408
+ *
409
+ * Note, this is separate from the type returned
410
+ * by the SchemaService which provides fields as a Map
411
+ * instead of as an Array.
412
+ *
413
+ * @public
414
+ */
415
+
416
+ /**
417
+ * Represents a schema for an object that is not
418
+ * a primary resource (has no unique identity of its own).
419
+ *
420
+ * ObjectSchemas may not currently contain relationships.
421
+ *
422
+ * @public
423
+ */
424
+
425
+ /**
426
+ * A no-op type utility that enables type-checking resource schema
427
+ * definitions.
428
+ *
429
+ * Will return the passed in schema.
430
+ *
431
+ * This will not validate relationship inverses or related types,
432
+ * as doing so would require a full schema graph to be passed in
433
+ * and no cycles in the graph to be present.
434
+ *
435
+ * @public
436
+ */
437
+ function resourceSchema(schema) {
438
+ return schema;
439
+ }
440
+
441
+ /**
442
+ * A no-op type utility that enables type-checking object schema
443
+ * definitions.
444
+ *
445
+ * Will return the passed in schema.
446
+ *
447
+ * @public
448
+ */
449
+ function objectSchema(schema) {
450
+ return schema;
451
+ }
452
+
453
+ /**
454
+ * A type utility to narrow a schema to a ResourceSchema
455
+ *
456
+ * @public
457
+ */
458
+ function isResourceSchema(schema) {
459
+ return schema?.identity?.kind === '@id';
460
+ }
461
+
462
+ /**
463
+ * A type utility to narrow a schema to LegacyResourceSchema
464
+ *
465
+ * @public
466
+ */
467
+ function isLegacyResourceSchema(schema) {
468
+ return isResourceSchema(schema) && schema.legacy === true;
469
+ }
470
+ export { isLegacyResourceSchema, isResourceSchema, objectSchema, resourceSchema };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sources":["../../../src/types/schema/fields.ts"],"sourcesContent":["import type { ObjectValue, PrimitiveValue } from '../json/raw.ts';\n\n/**\n * A generic \"field\" that can be used to define\n * primitive value fields.\n *\n * Replaces \"attribute\" for primitive value fields.\n * Can also be used to eject from deep-tracking of\n * objects or arrays.\n *\n * A major difference between \"field\" and \"attribute\"\n * is that \"type\" points to a legacy transform on\n * \"attribute\" that a serializer *might* use, while\n * \"type\" points to a new-style transform on \"field\"\n * that a record implmentation *must* use.\n *\n * @public\n */\nexport interface GenericField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'field';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * the name of the transform to use, if any\n *\n * @public\n */\n type?: string;\n\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * A field that can be used to alias one key to another\n * key present in the cache version of the resource.\n *\n * Unlike DerivedField, an AliasField may write to its\n * source when a record is in an editable mode.\n *\n * AliasFields may utilize a transform, specified by type,\n * to pre/post process the field.\n *\n * An AliasField may also specify a `kind` via options.\n * `kind` may be any other valid field kind other than\n *\n * - `@hash`\n * - `@id`\n * - `@local`\n * - `derived`\n *\n * This allows an AliasField to rename any field in the cache.\n *\n * Alias fields are generally intended to be used to support migrating\n * between different schemas, though there are times where they are useful\n * as a form of advanced derivation when used with a transform. For instance,\n * an AliasField could be used to expose both a string and a Date version of the\n * same field, with both being capable of being written to.\n *\n * @public\n */\nexport interface LegacyAliasField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'alias';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * Always null (for now)\n *\n * @public\n */\n type: null; // should always be null\n\n /**\n * The field def for which this is an alias.\n *\n * @public\n */\n options:\n | GenericField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n // | ResourceField\n // | CollectionField\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField;\n}\n\n/**\n * A field that can be used to alias one key to another\n * key present in the cache version of the resource.\n *\n * Unlike DerivedField, an AliasField may write to its\n * source when a record is in an editable mode.\n *\n * AliasFields may utilize a transform, specified by type,\n * to pre/post process the field.\n *\n * An AliasField may also specify a `kind` via options.\n * `kind` may be any other valid field kind other than\n *\n * - `@hash`\n * - `@id`\n * - `@local`\n * - `derived`\n *\n * This allows an AliasField to rename any field in the cache.\n *\n * Alias fields are generally intended to be used to support migrating\n * between different schemas, though there are times where they are useful\n * as a form of advanced derivation when used with a transform. For instance,\n * an AliasField could be used to expose both a string and a Date version of the\n * same field, with both being capable of being written to.\n *\n * @public\n */\nexport interface PolarisAliasField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'alias';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * Always null (for now)\n *\n * @public\n */\n type: null; // should always be null\n\n /**\n * The field def for which this is an alias.\n *\n * @public\n */\n options:\n | GenericField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n // | ResourceField\n // | CollectionField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n}\n\n/**\n * A field that can be used to alias one key to another\n * key present in the cache version of the resource.\n *\n * Unlike DerivedField, an AliasField may write to its\n * source when a record is in an editable mode.\n *\n * AliasFields may utilize a transform, specified by type,\n * to pre/post process the field.\n *\n * An AliasField may also specify a `kind` via options.\n * `kind` may be any other valid field kind other than\n *\n * - `@hash`\n * - `@id`\n * - `@local`\n * - `derived`\n *\n * This allows an AliasField to rename any field in the cache.\n *\n * Alias fields are generally intended to be used to support migrating\n * between different schemas, though there are times where they are useful\n * as a form of advanced derivation when used with a transform. For instance,\n * an AliasField could be used to expose both a string and a Date version of the\n * same field, with both being capable of being written to.\n *\n * @public\n */\nexport interface ObjectAliasField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'alias';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * Always null (for now)\n *\n * @public\n */\n type: null; // should always be null\n\n /**\n * The field def for which this is an alias.\n *\n * @public\n */\n options: GenericField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField;\n}\n\n/**\n * Represents a field whose value is the primary\n * key of the resource.\n *\n * This allows any field to serve as the primary\n * key while still being able to drive identity\n * needs within the system.\n *\n * This is useful for resources that use for instance\n * 'uuid', 'urn' or 'entityUrn' or 'primaryKey' as their\n * primary key field instead of 'id'.\n *\n * @public\n */\nexport interface IdentityField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: '@id';\n\n /**\n * The name of the field that serves as the\n * primary key for the resource.\n *\n * @public\n */\n name: string;\n}\n\n/**\n * Represents a specialized field whose computed value\n * will be used as the primary key of a schema-object\n * for serializability and comparison purposes.\n *\n * This field functions similarly to derived fields in that\n * it is non-settable, derived state but differs in that\n * it is only able to compute off of cache state and is given\n * no access to a record instance.\n *\n * This means that if a hashing function wants to compute its value\n * taking into account transformations and derivations it must\n * perform those itself.\n *\n * A schema-array can declare its \"key\" value to be `@hash` if\n * a schema-object has such a field.\n *\n * Only one hash field is permittable per schema-object, and\n * it should be placed in the `ResourceSchema`'s `@id` field\n * in place of an `IdentityField`.\n *\n * @public\n */\nexport interface HashField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: '@hash';\n\n /**\n * The name of the field that serves as the\n * hash for the resource.\n *\n * Only required if access to this value by\n * the UI is desired, it can be `null` otherwise.\n *\n * @public\n */\n name: string | null;\n\n /**\n * The name of a function to run to compute the hash.\n * The function will only have access to the cached\n * data for the record.\n *\n * @public\n */\n type: string;\n\n /**\n * Any options that should be provided to the hash\n * function.\n *\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field whose value is a local\n * value that is not stored in the cache, nor\n * is it sent to the server.\n *\n * Local fields can be written to, and their\n * value is both memoized and reactive (though\n * not deep-tracked).\n *\n * Because their state is not derived from the cache\n * data or the server, they represent a divorced\n * uncanonical source of state.\n *\n * For this reason Local fields should be used sparingly.\n *\n * Currently, while we document this feature here,\n * only allow our own ReactiveResource default fields to\n * utilize them and the feature should be considered private.\n *\n * Example use cases that drove the creation of local\n * fields are states like `isDestroying` and `isDestroyed`\n * which are specific to a record instance but not\n * stored in the cache. We wanted to be able to drive\n * these fields from schema the same as all other fields.\n *\n * Don't make us regret this decision.\n *\n * @public\n */\nexport interface LocalField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: '@local';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n /**\n * Not currently utilized, we are considering\n * allowing transforms to operate on local fields\n *\n * @public\n */\n type?: string;\n\n /**\n * Options for the field.\n *\n * @public\n */\n options?: { defaultValue?: PrimitiveValue };\n}\n\n/**\n * Represents a field whose value is an object\n * with keys pointing to values that are primitive\n * values.\n *\n * If values of the keys are not primitives, or\n * if the key/value pairs have well-defined shape,\n * use 'schema-object' instead.\n *\n * @public\n */\nexport interface ObjectField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'object';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of a transform to pass the entire object\n * through before displaying or serializing it.\n *\n * @public\n */\n type?: string;\n\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field whose value is an object\n * with a well-defined structure described by\n * a non-resource schema.\n *\n * If the object's structure is not well-defined,\n * use 'object' instead.\n *\n * @public\n */\nexport interface SchemaObjectField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'schema-object';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the ObjectSchema that describes the\n * structure of the object.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for configuring the behavior of the\n * SchemaObject.\n *\n * - `polymorphic` : Whether this SchemaObject is Polymorphic.\n * - `type` : If the SchemaObject is Polymorphic, the key on the raw cache data to use as the \"resource-type\" value for the schema-object.\n *\n * @public\n */\n options?: {\n /**\n * Whether this SchemaObject is Polymorphic.\n *\n * If the SchemaObject is polymorphic, `options.type` must also be supplied.\n *\n * @public\n */\n polymorphic?: boolean;\n\n /**\n * If the SchemaObject is Polymorphic, the key on the raw cache data to use\n * as the \"resource-type\" value for the schema-object.\n *\n * Defaults to \"type\".\n *\n * @public\n */\n type?: string;\n };\n}\n\n/**\n * Represents a field whose value is an array\n * of primitive values.\n *\n * If the array's elements are not primitive\n * values, use 'schema-array' instead.\n *\n * @public\n */\nexport interface ArrayField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'array';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of a transform to pass each item\n * in the array through before displaying or\n * or serializing it.\n *\n * @public\n */\n type?: string;\n\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field whose value is an array\n * of objects with a well-defined structure\n * described by a non-resource schema.\n *\n * If the array's elements are not well-defined,\n * use 'array' instead.\n *\n * @public\n */\nexport interface SchemaArrayField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'schema-array';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the ObjectSchema that describes the\n * structure of the objects in the array.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for configuring the behavior of the\n * SchemaArray.\n *\n * - `key`\n *\n * Configures how the SchemaArray determines whether an object in the cache is the same\n * as an object previously used to instantiate one of the schema-objects it contains.\n *\n * The default is `'@identity'`.\n *\n * Valid options are:\n *\n * - `'@identity'` (default) : the cached object's referential identity will be used.\n * This may result in significant instability when resource data is updated from the API\n * - `'@index'` : the cached object's index in the array will be used.\n * This is only a good choice for arrays that rarely if ever change membership\n * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for\n * The contained schema-object and use the computed result to determine and compare identity.\n * - \\<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)\n * Are valid field names for this purpose. The cache state without transforms applied will be\n * used when comparing values. The field value should be unique enough to guarantee two schema-objects\n * of the same type will not collide.\n *\n * - `polymorphic` : Whether this SchemaArray is Polymorphic.\n * - `type` : If the SchemaArray is Polymorphic, the key on the raw cache data to use as the \"resource-type\" value for the schema-object.\n *\n * @public\n */\n options?: {\n /**\n * Configures how the SchemaArray determines whether\n * an object in the cache is the same as an object\n * previously used to instantiate one of the schema-objects\n * it contains.\n *\n * The default is `'@identity'`.\n *\n * Valid options are:\n *\n * - `'@identity'` (default) : the cached object's referential identity will be used.\n * This may result in significant instability when resource data is updated from the API\n * - `'@index'` : the cached object's index in the array will be used.\n * This is only a good choice for arrays that rarely if ever change membership\n * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for\n * The contained schema-object and use the computed result to determine and compare identity.\n * - \\<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)\n * Are valid field names for this purpose. The cache state without transforms applied will be\n * used when comparing values. The field value should be unique enough to guarantee two schema-objects\n * of the same type will not collide.\n *\n */\n key?: '@identity' | '@index' | '@hash' | string;\n\n /**\n * Whether this SchemaArray is Polymorphic.\n *\n * If the SchemaArray is polymorphic, `options.type` must also be supplied.\n *\n */\n polymorphic?: boolean;\n\n /**\n * If the SchemaArray is Polymorphic, the key on the raw cache data to use\n * as the \"resource-type\" value for the schema-object.\n *\n * Defaults to \"type\".\n *\n */\n type?: string;\n };\n}\n\n/**\n * Represents a field whose value is derived\n * from other fields in the schema.\n *\n * The value is read-only, and is not stored\n * in the cache, nor is it sent to the server.\n *\n * Usage of derived fields should be minimized\n * to scenarios where the derivation is known\n * to be safe. For instance, derivations that\n * required fields that are not always loaded\n * or that require access to related resources\n * that may not be loaded should be avoided.\n *\n * @public\n */\nexport interface DerivedField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'derived';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the derivation to use.\n *\n * Derivations are functions that take the\n * record, options, and the name of the field\n * as arguments, and return the derived value.\n *\n * Derivations are memoized, and are only\n * recomputed when the fields they depend on\n * change.\n *\n * Derivations are not stored in the cache,\n * and are not sent to the server.\n *\n * Derivation functions must be explicitly\n * registered with the schema service.\n *\n * @public\n */\n type: string;\n\n /**\n * Options to pass to the derivation, if any\n *\n * Must comply to the specific derivation's\n * options schema.\n *\n * @public\n */\n options?: ObjectValue;\n}\n\n/**\n * Represents a field that is a reference to\n * another resource.\n *\n * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED\n * BY ReactiveResource\n *\n * @public\n */\nexport interface ResourceField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'resource';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for resources are optional. If\n * not present, all options are presumed\n * to be falsey\n *\n * @public\n */\n options?: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain a link\n * that can be used to fetch the related\n * resource when needed.\n *\n * @public\n */\n async?: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n * @public\n */\n inverse?: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n * @public\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n * @public\n */\n polymorphic?: boolean;\n };\n}\n\n/**\n * Represents a field that is a reference to\n * a collection of other resources, potentially\n * paginate.\n *\n * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED\n * BY ReactiveResource\n *\n * @public\n */\nexport interface CollectionField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'collection';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for resources are optional. If\n * not present, all options are presumed\n * to be falsey\n *\n * @public\n */\n options?: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain links\n * that can be used to fetch the related\n * resources when needed.\n *\n * When false, it is expected that all related\n * resources are loaded together with this resource,\n * and that the cache data for this field will\n * contain the full list of pointers.\n *\n * When true, it is expected that the relationship\n * is paginated. If the relationship is not paginated,\n * then the cache data for \"page 1\" would contain the\n * full list of pointers, and loading \"page 1\" would\n * load all related resources.\n *\n * @public\n */\n async?: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n * @public\n */\n inverse?: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n * @public\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n * @public\n */\n polymorphic?: boolean;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n * > It cannot be used with PolarisMode\n *\n * A generic \"field\" that can be used to define\n * primitive value fields.\n *\n * If the field points to an object or array,\n * it will not be deep-tracked.\n *\n * Transforms when defined are legacy transforms\n * that a serializer *might* use, but their usage\n * is not guaranteed.\n *\n * @public\n */\nexport interface LegacyAttributeField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'attribute';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n /**\n * The name of the transform to use, if any\n *\n * @public\n */\n type?: string | null;\n /**\n * Options to pass to the transform, if any\n *\n * Must comply to the specific transform's options\n * schema.\n *\n */\n options?: ObjectValue;\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * another resource.\n *\n * This is the legacy version of the `ResourceField`.\n *\n * @public\n */\nexport interface LegacyBelongsToField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'belongsTo';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for belongsTo are mandatory.\n *\n * @public\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain a link\n * or a pointer that can be used to fetch\n * the related resource when needed.\n *\n * Pointers are highly discouraged.\n *\n * @public\n */\n async: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n * @public\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n * @public\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n * @public\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriend: {\n * links: { related: \"/users/1/bestFriend\" },\n * data: { type: 'user', id: '1' },\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n * @public\n */\n linksMode?: true;\n\n /**\n * When omitted, the cache data for this field will\n * clear local state of all changes except for the\n * addition of records still in the \"new\" state any\n * time the remote data for this field is updated.\n *\n * When set to `false`, the cache data for this field\n * will instead intelligently commit any changes from\n * local state that are present in the remote data,\n * leaving any remaining changes in local state still.\n *\n * @public\n */\n resetOnRemoteUpdate?: false;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * another resource.\n *\n * This is the legacy version of the `ResourceField`.\n *\n * @public\n */\nexport interface LinksModeBelongsToField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'belongsTo';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * The name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for belongsTo are mandatory.\n *\n * @public\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * MUST be false for PolarisMode + LinksMode\n *\n * @public\n */\n async: false;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n * @public\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n * @public\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n * @public\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * MUST be true for PolarisMode + LinksMode\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriend: {\n * links: { related: \"/users/1/bestFriend\" },\n * data: { type: 'user', id: '1' },\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n * Activating LinksMode will *also* deactivate the deprecated\n * `resetOnRemoteUpdate` behavior for this field.\n *\n * This means that when new remote state is received, the cache\n * will intelligently commit any changes from local state that\n * are present in the remote data for this field, leaving any remaining\n * changes in local state still.\n *\n * Previously, the cache would clear local state of all changes\n * except for the addition of records still in the \"new\" state any\n * time the remote data for this field was updated.\n *\n * @public\n */\n linksMode: true;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * a collection of other resources.\n *\n * This is the legacy version of the `CollectionField`.\n *\n * @public\n */\nexport interface LegacyHasManyField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'hasMany';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * the name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for hasMany are mandatory.\n *\n * @public\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * If true, it is expected that the cache\n * data for this field will contain links\n * or pointers that can be used to fetch\n * the related resources when needed.\n *\n * When false, it is expected that all related\n * resources are loaded together with this resource,\n * and that the cache data for this field will\n * contain the full list of pointers.\n *\n * hasMany relationships do not support pagination.\n *\n * @public\n */\n async: boolean;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n * @public\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n * @public\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n * @public\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriends: {\n * links: { related: \"/users/1/bestFriends\" },\n * data: [ { type: 'user', id: '1' } ],\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n * @public\n */\n linksMode?: true;\n\n /**\n * When omitted, the cache data for this field will\n * clear local state of all changes except for the\n * addition of records still in the \"new\" state any\n * time the remote data for this field is updated.\n *\n * When set to `false`, the cache data for this field\n * will instead intelligently commit any changes from\n * local state that are present in the remote data,\n * leaving any remaining changes in local state still.\n *\n * @public\n */\n resetOnRemoteUpdate?: false;\n };\n}\n\n/**\n * > [!CAUTION]\n * > This Field is LEGACY\n *\n * Represents a field that is a reference to\n * a collection of other resources.\n *\n * This is the legacy version of the `CollectionField`.\n *\n * @public\n */\nexport interface LinksModeHasManyField {\n /**\n * The kind of field this is.\n *\n * @public\n */\n kind: 'hasMany';\n\n /**\n * The name of the field.\n *\n * @public\n */\n name: string;\n\n /**\n * the name of the resource that this field\n * refers to. In the case of a polymorphic\n * relationship, this should be the trait\n * or abstract type.\n *\n * @public\n */\n type: string;\n\n /**\n * Options for hasMany are mandatory.\n *\n * @public\n */\n options: {\n /**\n * Whether the relationship is async\n *\n * MUST be false for PolarisMode + LinksMode\n *\n * If true, it is expected that the cache\n * data for this field will contain links\n * or pointers that can be used to fetch\n * the related resources when needed.\n *\n * When false, it is expected that all related\n * resources are loaded together with this resource,\n * and that the cache data for this field will\n * contain the full list of pointers.\n *\n * hasMany relationships do not support pagination.\n *\n * @public\n */\n async: false;\n\n /**\n * The name of the inverse field on the\n * related resource that points back to\n * this field on this resource to form a\n * bidirectional relationship.\n *\n * If null, the relationship is unidirectional.\n *\n * @public\n */\n inverse: string | null;\n\n /**\n * If this field is satisfying a polymorphic\n * relationship on another resource, then this\n * should be set to the trait or abstract type\n * that this resource implements.\n *\n * @public\n */\n as?: string;\n\n /**\n * Whether this field is a polymorphic relationship,\n * meaning that it can point to multiple types of\n * resources so long as they implement the trait\n * or abstract type specified in `type`.\n *\n * @public\n */\n polymorphic?: boolean;\n\n /**\n * Whether this field should ever make use of the legacy support infra\n * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * MUST be true for PolarisMode + LinksMode\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * will be expected to already have all their data. When reloading a sync relationship\n * you would be expected to have a `related link` available from a prior relationship\n * payload e.g.\n *\n * ```ts\n * {\n * data: {\n * type: 'user',\n * id: '2',\n * attributes: { name: 'Chris' },\n * relationships: {\n * bestFriends: {\n * links: { related: \"/users/1/bestFriends\" },\n * data: [ { type: 'user', id: '1' } ],\n * }\n * }\n * },\n * included: [\n * { type: 'user', id: '1', attributes: { name: 'Krystan' } }\n * ]\n * }\n * ```\n *\n * Async relationships will be loaded via their link if needed.\n *\n * Activating LinksMode will *also* deactivate the deprecated\n * `resetOnRemoteUpdate` behavior for this field.\n *\n * This means that when new remote state is received, the cache\n * will intelligently commit any changes from local state that\n * are present in the remote data for this field, leaving any remaining\n * changes in local state still.\n *\n * Previously, the cache would clear local state of all changes\n * except for the addition of records still in the \"new\" state any\n * time the remote data for this field was updated.\n *\n * @public\n */\n linksMode: true;\n };\n}\n\n/**\n * A union of all possible LegacyMode field schemas.\n *\n * Available field schemas are:\n *\n * - {@link GenericField}\n * - {@link LegacyAliasField}\n * - {@link LocalField}\n * - {@link ObjectField}\n * - {@link SchemaObjectField}\n * - {@link ArrayField}\n * - {@link SchemaArrayField}\n * - {@link DerivedField}\n * - {@link ResourceField | ResourceField (not yet implemented)}\n * - {@link CollectionField | CollectionField (not yet implemented)}\n * - {@link LegacyAttributeField}\n * - {@link LegacyBelongsToField}\n * - {@link LegacyHasManyField}\n *\n * @public\n */\nexport type LegacyModeFieldSchema =\n | GenericField\n | LegacyAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField\n // | ResourceField // not yet implemented\n // | CollectionField // not yet implemented\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField;\n\n/**\n * A union of all possible PolarisMode field schemas.\n *\n * Available field schemas are:\n *\n * - {@link GenericField}\n * - {@link PolarisAliasField}\n * - {@link LocalField}\n * - {@link ObjectField}\n * - {@link SchemaObjectField}\n * - {@link ArrayField}\n * - {@link SchemaArrayField}\n * - {@link DerivedField}\n * - {@link ResourceField | ResourceField (not yet implemented)}\n * - {@link CollectionField | CollectionField (not yet implemented)}\n * - {@link LinksModeBelongsToField}\n * - {@link LinksModeHasManyField}\n *\n * @public\n */\nexport type PolarisModeFieldSchema =\n | GenericField\n | PolarisAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField\n // | ResourceField\n // | CollectionField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n\n/**\n * A union of all possible LegacyMode and PolarisMode\n * field schemas.\n *\n * You likely will want to use PolarisModeFieldSchema,\n * LegacyModeFieldSchema, or ObjectFieldSchema instead\n * as appropriate as they are more specific and will\n * provide better guidance around what is valid.\n *\n * @public\n */\nexport type FieldSchema =\n | GenericField\n | LegacyAliasField\n | PolarisAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField\n | ResourceField\n | CollectionField\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n\n/**\n * A union of all possible field schemas that can be\n * used in an ObjectSchema.\n *\n * @public\n */\nexport type ObjectFieldSchema =\n | GenericField\n | ObjectAliasField\n | LocalField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\n | DerivedField;\n\n/**\n * Represents a schema for a primary resource in PolarisMode.\n *\n * Primary resources are objects with a unique identity of their\n * own which may allow them to appear in relationships, or in multiple\n * response documents.\n *\n * @public\n */\nexport interface PolarisResourceSchema {\n legacy?: false;\n\n /**\n * For primary resources, this should be an IdentityField\n *\n * for schema-objects, this should be either a HashField or null\n *\n * @property identity\n * @type {IdentityField}\n * @public\n */\n identity: IdentityField;\n\n /**\n * The name of the schema\n *\n * For cacheable resources, this should be the\n * primary resource type.\n *\n * For object schemas, this should be the name\n * of the object schema.\n *\n * The names of object and resource schemas share\n * a single namespace and must not conflict.\n *\n * We recommend a naming convention for object schemas\n * such as below for ensuring uniqueness:\n *\n * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`\n * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`\n * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`\n *\n * @public\n */\n type: string;\n\n /**\n * The fields that make up the shape of the resource\n *\n * @public\n */\n fields: PolarisModeFieldSchema[];\n\n /**\n * A list of traits that this resource implements. The fields for these\n * traits should still be defined in the fields array.\n *\n * Each trait should be a string that matches the `type` of another\n * resource schema. The trait can be abstract and reference a resource\n * type that is never defined as a schema.\n *\n * @public\n */\n traits?: string[];\n}\n\n/**\n * Represents a schema for a primary resource in LegacyMode\n *\n * Primary resources are objects with a unique identity of their\n * own which may allow them to appear in relationships, or in multiple\n * response documents.\n *\n * @public\n */\nexport interface LegacyResourceSchema {\n /**\n * A flag indicating that this is a legacy resource schema\n *\n * @public\n */\n legacy: true;\n\n /**\n * This should be an IdentityField.\n *\n * To maximize compatibility with Model where `id` was the\n * name of the identity field, we recommend using `{ kind: '@id', name: 'id' }`\n * for records in legacy mode, but this is not required.\n *\n * @public\n */\n identity: IdentityField;\n\n /**\n * The name of the schema\n *\n * For cacheable resources, this should be the\n * primary resource type.\n *\n * The names of object and resource schemas share\n * a single namespace and must not conflict.\n *\n * We recommend a naming convention for object schemas\n * such as below for ensuring uniqueness:\n *\n * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`\n * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`\n * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`\n *\n * @public\n */\n type: string;\n\n /**\n * The fields that make up the shape of the resource\n *\n * @public\n */\n fields: LegacyModeFieldSchema[];\n\n /**\n * A list of traits that this resource implements. The fields for these\n * traits should still be defined in the fields array.\n *\n * Each trait should be a string that matches the `type` of another\n * resource schema. The trait can be abstract and reference a resource\n * type that is never defined as a schema.\n *\n * @public\n */\n traits?: string[];\n}\n\n/**\n * A type which represents a valid JSON schema\n * definition for either a PolarisMode or a\n * LegacyMode resource.\n *\n * Note, this is separate from the type returned\n * by the SchemaService which provides fields as a Map\n * instead of as an Array.\n *\n * @public\n */\nexport type ResourceSchema = PolarisResourceSchema | LegacyResourceSchema;\n\n/**\n * Represents a schema for an object that is not\n * a primary resource (has no unique identity of its own).\n *\n * ObjectSchemas may not currently contain relationships.\n *\n * @public\n */\nexport interface ObjectSchema {\n /**\n * Either a HashField from which to calculate an identity or null\n *\n * In the case of `null`, the object's identity will be based\n * on the referential identity of the object in the cache itself\n * when an identity is needed.\n *\n * @public\n */\n identity: HashField | null;\n\n /**\n * The name of the schema\n *\n * The names of object and resource schemas share\n * a single namespace and must not conflict.\n *\n * We recommend a naming convention for object schemas\n * such as below for ensuring uniqueness:\n *\n * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`\n * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`\n * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`\n *\n * @public\n */\n type: string;\n\n /**\n * The fields that make up the shape of the object\n *\n * @public\n */\n fields: ObjectFieldSchema[];\n}\n\nexport type Schema = ResourceSchema | ObjectSchema;\n\n/**\n * A no-op type utility that enables type-checking resource schema\n * definitions.\n *\n * Will return the passed in schema.\n *\n * This will not validate relationship inverses or related types,\n * as doing so would require a full schema graph to be passed in\n * and no cycles in the graph to be present.\n *\n * @public\n */\nexport function resourceSchema<T extends LegacyResourceSchema | PolarisResourceSchema>(\n schema: LegacyResourceSchema | PolarisResourceSchema\n): T {\n return schema as T;\n}\n\n/**\n * A no-op type utility that enables type-checking object schema\n * definitions.\n *\n * Will return the passed in schema.\n *\n * @public\n */\nexport function objectSchema<T extends ObjectSchema>(schema: T): T {\n return schema;\n}\n\n/**\n * A type utility to narrow a schema to a ResourceSchema\n *\n * @public\n */\nexport function isResourceSchema(schema: ResourceSchema | ObjectSchema): schema is ResourceSchema {\n return schema?.identity?.kind === '@id';\n}\n\n/**\n * A type utility to narrow a schema to LegacyResourceSchema\n *\n * @public\n */\nexport function isLegacyResourceSchema(schema: ResourceSchema | ObjectSchema): schema is LegacyResourceSchema {\n return isResourceSchema(schema) && schema.legacy === true;\n}\n\nexport type LegacyField =\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\nexport type LegacyRelationshipField =\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n"],"names":["resourceSchema","schema","objectSchema","isResourceSchema","identity","kind","isLegacyResourceSchema","legacy"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC5BC,MAAoD,EACjD;AACH,EAAA,OAAOA,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAyBD,MAAS,EAAK;AACjE,EAAA,OAAOA,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAACF,MAAqC,EAA4B;AAChG,EAAA,OAAOA,MAAM,EAAEG,QAAQ,EAAEC,IAAI,KAAK,KAAK;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CAACL,MAAqC,EAAkC;EAC5G,OAAOE,gBAAgB,CAACF,MAAM,CAAC,IAAIA,MAAM,CAACM,MAAM,KAAK,IAAI;AAC3D;;;;"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.type-test.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-api-raw.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}