@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,1674 @@
1
+ import type { ObjectValue, PrimitiveValue } from '../json/raw.ts';
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
+ */
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;
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
+ 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;
100
+ }
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 field.
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
+ 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;
154
+ }
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
+ */
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;
208
+ }
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
+ */
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;
237
+ }
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
+ */
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;
293
+ }
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
+ */
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
+ };
351
+ }
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
+ */
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?: ObjectValue;
392
+ }
393
+ /**
394
+ * Represents a field whose value is an object
395
+ * with a well-defined structure described by
396
+ * a non-resource schema.
397
+ *
398
+ * If the object's structure is not well-defined,
399
+ * use 'object' instead.
400
+ *
401
+ * @public
402
+ */
403
+ export interface SchemaObjectField {
404
+ /**
405
+ * The kind of field this is.
406
+ *
407
+ * @public
408
+ */
409
+ kind: 'schema-object';
410
+ /**
411
+ * The name of the field.
412
+ *
413
+ * @public
414
+ */
415
+ name: string;
416
+ /**
417
+ * The name of the ObjectSchema that describes the
418
+ * structure of the object.
419
+ *
420
+ * @public
421
+ */
422
+ type: string;
423
+ /**
424
+ * Options for configuring the behavior of the
425
+ * SchemaObject.
426
+ *
427
+ * - `polymorphic` : Whether this SchemaObject is Polymorphic.
428
+ * - `type` : If the SchemaObject is Polymorphic, the key on the raw cache data to use as the "resource-type" value for the schema-object.
429
+ *
430
+ * @public
431
+ */
432
+ options?: {
433
+ /**
434
+ * Whether this SchemaObject is Polymorphic.
435
+ *
436
+ * If the SchemaObject is polymorphic, `options.type` must also be supplied.
437
+ *
438
+ * @public
439
+ */
440
+ polymorphic?: boolean;
441
+ /**
442
+ * If the SchemaObject is Polymorphic, the key on the raw cache data to use
443
+ * as the "resource-type" value for the schema-object.
444
+ *
445
+ * Defaults to "type".
446
+ *
447
+ * @public
448
+ */
449
+ type?: string;
450
+ };
451
+ }
452
+ /**
453
+ * Represents a field whose value is an array
454
+ * of primitive values.
455
+ *
456
+ * If the array's elements are not primitive
457
+ * values, use 'schema-array' instead.
458
+ *
459
+ * @public
460
+ */
461
+ export interface ArrayField {
462
+ /**
463
+ * The kind of field this is.
464
+ *
465
+ * @public
466
+ */
467
+ kind: 'array';
468
+ /**
469
+ * The name of the field.
470
+ *
471
+ * @public
472
+ */
473
+ name: string;
474
+ /**
475
+ * The name of a transform to pass each item
476
+ * in the array through before displaying or
477
+ * or serializing it.
478
+ *
479
+ * @public
480
+ */
481
+ type?: string;
482
+ /**
483
+ * Options to pass to the transform, if any
484
+ *
485
+ * Must comply to the specific transform's options
486
+ * schema.
487
+ *
488
+ * @public
489
+ */
490
+ options?: ObjectValue;
491
+ }
492
+ /**
493
+ * Represents a field whose value is an array
494
+ * of objects with a well-defined structure
495
+ * described by a non-resource schema.
496
+ *
497
+ * If the array's elements are not well-defined,
498
+ * use 'array' instead.
499
+ *
500
+ * @public
501
+ */
502
+ export interface SchemaArrayField {
503
+ /**
504
+ * The kind of field this is.
505
+ *
506
+ * @public
507
+ */
508
+ kind: 'schema-array';
509
+ /**
510
+ * The name of the field.
511
+ *
512
+ * @public
513
+ */
514
+ name: string;
515
+ /**
516
+ * The name of the ObjectSchema that describes the
517
+ * structure of the objects in the array.
518
+ *
519
+ * @public
520
+ */
521
+ type: string;
522
+ /**
523
+ * Options for configuring the behavior of the
524
+ * SchemaArray.
525
+ *
526
+ * - `key`
527
+ *
528
+ * Configures how the SchemaArray determines whether an object in the cache is the same
529
+ * as an object previously used to instantiate one of the schema-objects it contains.
530
+ *
531
+ * The default is `'@identity'`.
532
+ *
533
+ * Valid options are:
534
+ *
535
+ * - `'@identity'` (default) : the cached object's referential identity will be used.
536
+ * This may result in significant instability when resource data is updated from the API
537
+ * - `'@index'` : the cached object's index in the array will be used.
538
+ * This is only a good choice for arrays that rarely if ever change membership
539
+ * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for
540
+ * The contained schema-object and use the computed result to determine and compare identity.
541
+ * - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
542
+ * Are valid field names for this purpose. The cache state without transforms applied will be
543
+ * used when comparing values. The field value should be unique enough to guarantee two schema-objects
544
+ * of the same type will not collide.
545
+ *
546
+ * - `polymorphic` : Whether this SchemaArray is Polymorphic.
547
+ * - `type` : If the SchemaArray is Polymorphic, the key on the raw cache data to use as the "resource-type" value for the schema-object.
548
+ *
549
+ * @public
550
+ */
551
+ options?: {
552
+ /**
553
+ * Configures how the SchemaArray determines whether
554
+ * an object in the cache is the same as an object
555
+ * previously used to instantiate one of the schema-objects
556
+ * it contains.
557
+ *
558
+ * The default is `'@identity'`.
559
+ *
560
+ * Valid options are:
561
+ *
562
+ * - `'@identity'` (default) : the cached object's referential identity will be used.
563
+ * This may result in significant instability when resource data is updated from the API
564
+ * - `'@index'` : the cached object's index in the array will be used.
565
+ * This is only a good choice for arrays that rarely if ever change membership
566
+ * - `'@hash'` : will lookup the `@hash` function supplied in the ResourceSchema for
567
+ * The contained schema-object and use the computed result to determine and compare identity.
568
+ * - \<field-name> (string) : the name of a field to use as the key, only GenericFields (kind `field`)
569
+ * Are valid field names for this purpose. The cache state without transforms applied will be
570
+ * used when comparing values. The field value should be unique enough to guarantee two schema-objects
571
+ * of the same type will not collide.
572
+ *
573
+ */
574
+ key?: '@identity' | '@index' | '@hash' | string;
575
+ /**
576
+ * Whether this SchemaArray is Polymorphic.
577
+ *
578
+ * If the SchemaArray is polymorphic, `options.type` must also be supplied.
579
+ *
580
+ */
581
+ polymorphic?: boolean;
582
+ /**
583
+ * If the SchemaArray is Polymorphic, the key on the raw cache data to use
584
+ * as the "resource-type" value for the schema-object.
585
+ *
586
+ * Defaults to "type".
587
+ *
588
+ */
589
+ type?: string;
590
+ };
591
+ }
592
+ /**
593
+ * Represents a field whose value is derived
594
+ * from other fields in the schema.
595
+ *
596
+ * The value is read-only, and is not stored
597
+ * in the cache, nor is it sent to the server.
598
+ *
599
+ * Usage of derived fields should be minimized
600
+ * to scenarios where the derivation is known
601
+ * to be safe. For instance, derivations that
602
+ * required fields that are not always loaded
603
+ * or that require access to related resources
604
+ * that may not be loaded should be avoided.
605
+ *
606
+ * @public
607
+ */
608
+ export interface DerivedField {
609
+ /**
610
+ * The kind of field this is.
611
+ *
612
+ * @public
613
+ */
614
+ kind: 'derived';
615
+ /**
616
+ * The name of the field.
617
+ *
618
+ * @public
619
+ */
620
+ name: string;
621
+ /**
622
+ * The name of the derivation to use.
623
+ *
624
+ * Derivations are functions that take the
625
+ * record, options, and the name of the field
626
+ * as arguments, and return the derived value.
627
+ *
628
+ * Derivations are memoized, and are only
629
+ * recomputed when the fields they depend on
630
+ * change.
631
+ *
632
+ * Derivations are not stored in the cache,
633
+ * and are not sent to the server.
634
+ *
635
+ * Derivation functions must be explicitly
636
+ * registered with the schema service.
637
+ *
638
+ * @public
639
+ */
640
+ type: string;
641
+ /**
642
+ * Options to pass to the derivation, if any
643
+ *
644
+ * Must comply to the specific derivation's
645
+ * options schema.
646
+ *
647
+ * @public
648
+ */
649
+ options?: ObjectValue;
650
+ }
651
+ /**
652
+ * Represents a field that is a reference to
653
+ * another resource.
654
+ *
655
+ * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
656
+ * BY ReactiveResource
657
+ *
658
+ * @public
659
+ */
660
+ export interface ResourceField {
661
+ /**
662
+ * The kind of field this is.
663
+ *
664
+ * @public
665
+ */
666
+ kind: 'resource';
667
+ /**
668
+ * The name of the field.
669
+ *
670
+ * @public
671
+ */
672
+ name: string;
673
+ /**
674
+ * The name of the resource that this field
675
+ * refers to. In the case of a polymorphic
676
+ * relationship, this should be the trait
677
+ * or abstract type.
678
+ *
679
+ * @public
680
+ */
681
+ type: string;
682
+ /**
683
+ * Options for resources are optional. If
684
+ * not present, all options are presumed
685
+ * to be falsey
686
+ *
687
+ * @public
688
+ */
689
+ options?: {
690
+ /**
691
+ * Whether the relationship is async
692
+ *
693
+ * If true, it is expected that the cache
694
+ * data for this field will contain a link
695
+ * that can be used to fetch the related
696
+ * resource when needed.
697
+ *
698
+ * @public
699
+ */
700
+ async?: boolean;
701
+ /**
702
+ * The name of the inverse field on the
703
+ * related resource that points back to
704
+ * this field on this resource to form a
705
+ * bidirectional relationship.
706
+ *
707
+ * If null, the relationship is unidirectional.
708
+ *
709
+ * @public
710
+ */
711
+ inverse?: string | null;
712
+ /**
713
+ * If this field is satisfying a polymorphic
714
+ * relationship on another resource, then this
715
+ * should be set to the trait or abstract type
716
+ * that this resource implements.
717
+ *
718
+ * @public
719
+ */
720
+ as?: string;
721
+ /**
722
+ * Whether this field is a polymorphic relationship,
723
+ * meaning that it can point to multiple types of
724
+ * resources so long as they implement the trait
725
+ * or abstract type specified in `type`.
726
+ *
727
+ * @public
728
+ */
729
+ polymorphic?: boolean;
730
+ };
731
+ }
732
+ /**
733
+ * Represents a field that is a reference to
734
+ * a collection of other resources, potentially
735
+ * paginate.
736
+ *
737
+ * SUPPORT FOR THIS FEATURE IS NOT YET IMPLEMENTED
738
+ * BY ReactiveResource
739
+ *
740
+ * @public
741
+ */
742
+ export interface CollectionField {
743
+ /**
744
+ * The kind of field this is.
745
+ *
746
+ * @public
747
+ */
748
+ kind: 'collection';
749
+ /**
750
+ * The name of the field.
751
+ *
752
+ * @public
753
+ */
754
+ name: string;
755
+ /**
756
+ * The name of the resource that this field
757
+ * refers to. In the case of a polymorphic
758
+ * relationship, this should be the trait
759
+ * or abstract type.
760
+ *
761
+ * @public
762
+ */
763
+ type: string;
764
+ /**
765
+ * Options for resources are optional. If
766
+ * not present, all options are presumed
767
+ * to be falsey
768
+ *
769
+ * @public
770
+ */
771
+ options?: {
772
+ /**
773
+ * Whether the relationship is async
774
+ *
775
+ * If true, it is expected that the cache
776
+ * data for this field will contain links
777
+ * that can be used to fetch the related
778
+ * resources when needed.
779
+ *
780
+ * When false, it is expected that all related
781
+ * resources are loaded together with this resource,
782
+ * and that the cache data for this field will
783
+ * contain the full list of pointers.
784
+ *
785
+ * When true, it is expected that the relationship
786
+ * is paginated. If the relationship is not paginated,
787
+ * then the cache data for "page 1" would contain the
788
+ * full list of pointers, and loading "page 1" would
789
+ * load all related resources.
790
+ *
791
+ * @public
792
+ */
793
+ async?: boolean;
794
+ /**
795
+ * The name of the inverse field on the
796
+ * related resource that points back to
797
+ * this field on this resource to form a
798
+ * bidirectional relationship.
799
+ *
800
+ * If null, the relationship is unidirectional.
801
+ *
802
+ * @public
803
+ */
804
+ inverse?: string | null;
805
+ /**
806
+ * If this field is satisfying a polymorphic
807
+ * relationship on another resource, then this
808
+ * should be set to the trait or abstract type
809
+ * that this resource implements.
810
+ *
811
+ * @public
812
+ */
813
+ as?: string;
814
+ /**
815
+ * Whether this field is a polymorphic relationship,
816
+ * meaning that it can point to multiple types of
817
+ * resources so long as they implement the trait
818
+ * or abstract type specified in `type`.
819
+ *
820
+ * @public
821
+ */
822
+ polymorphic?: boolean;
823
+ };
824
+ }
825
+ /**
826
+ * > [!CAUTION]
827
+ * > This Field is LEGACY
828
+ * > It cannot be used with PolarisMode
829
+ *
830
+ * A generic "field" that can be used to define
831
+ * primitive value fields.
832
+ *
833
+ * If the field points to an object or array,
834
+ * it will not be deep-tracked.
835
+ *
836
+ * Transforms when defined are legacy transforms
837
+ * that a serializer *might* use, but their usage
838
+ * is not guaranteed.
839
+ *
840
+ * @public
841
+ */
842
+ export interface LegacyAttributeField {
843
+ /**
844
+ * The kind of field this is.
845
+ *
846
+ * @public
847
+ */
848
+ kind: 'attribute';
849
+ /**
850
+ * The name of the field.
851
+ *
852
+ * @public
853
+ */
854
+ name: string;
855
+ /**
856
+ * The name of the transform to use, if any
857
+ *
858
+ * @public
859
+ */
860
+ type?: string | null;
861
+ /**
862
+ * Options to pass to the transform, if any
863
+ *
864
+ * Must comply to the specific transform's options
865
+ * schema.
866
+ *
867
+ */
868
+ options?: ObjectValue;
869
+ }
870
+ /**
871
+ * > [!CAUTION]
872
+ * > This Field is LEGACY
873
+ *
874
+ * Represents a field that is a reference to
875
+ * another resource.
876
+ *
877
+ * This is the legacy version of the `ResourceField`.
878
+ *
879
+ * @public
880
+ */
881
+ export interface LegacyBelongsToField {
882
+ /**
883
+ * The kind of field this is.
884
+ *
885
+ * @public
886
+ */
887
+ kind: 'belongsTo';
888
+ /**
889
+ * The name of the field.
890
+ *
891
+ * @public
892
+ */
893
+ name: string;
894
+ /**
895
+ * The name of the resource that this field
896
+ * refers to. In the case of a polymorphic
897
+ * relationship, this should be the trait
898
+ * or abstract type.
899
+ *
900
+ * @public
901
+ */
902
+ type: string;
903
+ /**
904
+ * Options for belongsTo are mandatory.
905
+ *
906
+ * @public
907
+ */
908
+ options: {
909
+ /**
910
+ * Whether the relationship is async
911
+ *
912
+ * If true, it is expected that the cache
913
+ * data for this field will contain a link
914
+ * or a pointer that can be used to fetch
915
+ * the related resource when needed.
916
+ *
917
+ * Pointers are highly discouraged.
918
+ *
919
+ * @public
920
+ */
921
+ async: boolean;
922
+ /**
923
+ * The name of the inverse field on the
924
+ * related resource that points back to
925
+ * this field on this resource to form a
926
+ * bidirectional relationship.
927
+ *
928
+ * If null, the relationship is unidirectional.
929
+ *
930
+ * @public
931
+ */
932
+ inverse: string | null;
933
+ /**
934
+ * If this field is satisfying a polymorphic
935
+ * relationship on another resource, then this
936
+ * should be set to the trait or abstract type
937
+ * that this resource implements.
938
+ *
939
+ * @public
940
+ */
941
+ as?: string;
942
+ /**
943
+ * Whether this field is a polymorphic relationship,
944
+ * meaning that it can point to multiple types of
945
+ * resources so long as they implement the trait
946
+ * or abstract type specified in `type`.
947
+ *
948
+ * @public
949
+ */
950
+ polymorphic?: boolean;
951
+ /**
952
+ * Whether this field should ever make use of the legacy support infra
953
+ * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
954
+ *
955
+ * When true, none of the legacy support will be utilized. Sync relationships
956
+ * will be expected to already have all their data. When reloading a sync relationship
957
+ * you would be expected to have a `related link` available from a prior relationship
958
+ * payload e.g.
959
+ *
960
+ * ```ts
961
+ * {
962
+ * data: {
963
+ * type: 'user',
964
+ * id: '2',
965
+ * attributes: { name: 'Chris' },
966
+ * relationships: {
967
+ * bestFriend: {
968
+ * links: { related: "/users/1/bestFriend" },
969
+ * data: { type: 'user', id: '1' },
970
+ * }
971
+ * }
972
+ * },
973
+ * included: [
974
+ * { type: 'user', id: '1', attributes: { name: 'Krystan' } }
975
+ * ]
976
+ * }
977
+ * ```
978
+ *
979
+ * Async relationships will be loaded via their link if needed.
980
+ *
981
+ * @public
982
+ */
983
+ linksMode?: true;
984
+ /**
985
+ * When omitted, the cache data for this field will
986
+ * clear local state of all changes except for the
987
+ * addition of records still in the "new" state any
988
+ * time the remote data for this field is updated.
989
+ *
990
+ * When set to `false`, the cache data for this field
991
+ * will instead intelligently commit any changes from
992
+ * local state that are present in the remote data,
993
+ * leaving any remaining changes in local state still.
994
+ *
995
+ * @public
996
+ */
997
+ resetOnRemoteUpdate?: false;
998
+ };
999
+ }
1000
+ /**
1001
+ * > [!CAUTION]
1002
+ * > This Field is LEGACY
1003
+ *
1004
+ * Represents a field that is a reference to
1005
+ * another resource.
1006
+ *
1007
+ * This is the legacy version of the `ResourceField`.
1008
+ *
1009
+ * @public
1010
+ */
1011
+ export interface LinksModeBelongsToField {
1012
+ /**
1013
+ * The kind of field this is.
1014
+ *
1015
+ * @public
1016
+ */
1017
+ kind: 'belongsTo';
1018
+ /**
1019
+ * The name of the field.
1020
+ *
1021
+ * @public
1022
+ */
1023
+ name: string;
1024
+ /**
1025
+ * The name of the resource that this field
1026
+ * refers to. In the case of a polymorphic
1027
+ * relationship, this should be the trait
1028
+ * or abstract type.
1029
+ *
1030
+ * @public
1031
+ */
1032
+ type: string;
1033
+ /**
1034
+ * Options for belongsTo are mandatory.
1035
+ *
1036
+ * @public
1037
+ */
1038
+ options: {
1039
+ /**
1040
+ * Whether the relationship is async
1041
+ *
1042
+ * MUST be false for PolarisMode + LinksMode
1043
+ *
1044
+ * @public
1045
+ */
1046
+ async: false;
1047
+ /**
1048
+ * The name of the inverse field on the
1049
+ * related resource that points back to
1050
+ * this field on this resource to form a
1051
+ * bidirectional relationship.
1052
+ *
1053
+ * If null, the relationship is unidirectional.
1054
+ *
1055
+ * @public
1056
+ */
1057
+ inverse: string | null;
1058
+ /**
1059
+ * If this field is satisfying a polymorphic
1060
+ * relationship on another resource, then this
1061
+ * should be set to the trait or abstract type
1062
+ * that this resource implements.
1063
+ *
1064
+ * @public
1065
+ */
1066
+ as?: string;
1067
+ /**
1068
+ * Whether this field is a polymorphic relationship,
1069
+ * meaning that it can point to multiple types of
1070
+ * resources so long as they implement the trait
1071
+ * or abstract type specified in `type`.
1072
+ *
1073
+ * @public
1074
+ */
1075
+ polymorphic?: boolean;
1076
+ /**
1077
+ * Whether this field should ever make use of the legacy support infra
1078
+ * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1079
+ *
1080
+ * MUST be true for PolarisMode + LinksMode
1081
+ *
1082
+ * When true, none of the legacy support will be utilized. Sync relationships
1083
+ * will be expected to already have all their data. When reloading a sync relationship
1084
+ * you would be expected to have a `related link` available from a prior relationship
1085
+ * payload e.g.
1086
+ *
1087
+ * ```ts
1088
+ * {
1089
+ * data: {
1090
+ * type: 'user',
1091
+ * id: '2',
1092
+ * attributes: { name: 'Chris' },
1093
+ * relationships: {
1094
+ * bestFriend: {
1095
+ * links: { related: "/users/1/bestFriend" },
1096
+ * data: { type: 'user', id: '1' },
1097
+ * }
1098
+ * }
1099
+ * },
1100
+ * included: [
1101
+ * { type: 'user', id: '1', attributes: { name: 'Krystan' } }
1102
+ * ]
1103
+ * }
1104
+ * ```
1105
+ *
1106
+ * Async relationships will be loaded via their link if needed.
1107
+ *
1108
+ * Activating LinksMode will *also* deactivate the deprecated
1109
+ * `resetOnRemoteUpdate` behavior for this field.
1110
+ *
1111
+ * This means that when new remote state is received, the cache
1112
+ * will intelligently commit any changes from local state that
1113
+ * are present in the remote data for this field, leaving any remaining
1114
+ * changes in local state still.
1115
+ *
1116
+ * Previously, the cache would clear local state of all changes
1117
+ * except for the addition of records still in the "new" state any
1118
+ * time the remote data for this field was updated.
1119
+ *
1120
+ * @public
1121
+ */
1122
+ linksMode: true;
1123
+ };
1124
+ }
1125
+ /**
1126
+ * > [!CAUTION]
1127
+ * > This Field is LEGACY
1128
+ *
1129
+ * Represents a field that is a reference to
1130
+ * a collection of other resources.
1131
+ *
1132
+ * This is the legacy version of the `CollectionField`.
1133
+ *
1134
+ * @public
1135
+ */
1136
+ export interface LegacyHasManyField {
1137
+ /**
1138
+ * The kind of field this is.
1139
+ *
1140
+ * @public
1141
+ */
1142
+ kind: 'hasMany';
1143
+ /**
1144
+ * The name of the field.
1145
+ *
1146
+ * @public
1147
+ */
1148
+ name: string;
1149
+ /**
1150
+ * the name of the resource that this field
1151
+ * refers to. In the case of a polymorphic
1152
+ * relationship, this should be the trait
1153
+ * or abstract type.
1154
+ *
1155
+ * @public
1156
+ */
1157
+ type: string;
1158
+ /**
1159
+ * Options for hasMany are mandatory.
1160
+ *
1161
+ * @public
1162
+ */
1163
+ options: {
1164
+ /**
1165
+ * Whether the relationship is async
1166
+ *
1167
+ * If true, it is expected that the cache
1168
+ * data for this field will contain links
1169
+ * or pointers that can be used to fetch
1170
+ * the related resources when needed.
1171
+ *
1172
+ * When false, it is expected that all related
1173
+ * resources are loaded together with this resource,
1174
+ * and that the cache data for this field will
1175
+ * contain the full list of pointers.
1176
+ *
1177
+ * hasMany relationships do not support pagination.
1178
+ *
1179
+ * @public
1180
+ */
1181
+ async: boolean;
1182
+ /**
1183
+ * The name of the inverse field on the
1184
+ * related resource that points back to
1185
+ * this field on this resource to form a
1186
+ * bidirectional relationship.
1187
+ *
1188
+ * If null, the relationship is unidirectional.
1189
+ *
1190
+ * @public
1191
+ */
1192
+ inverse: string | null;
1193
+ /**
1194
+ * If this field is satisfying a polymorphic
1195
+ * relationship on another resource, then this
1196
+ * should be set to the trait or abstract type
1197
+ * that this resource implements.
1198
+ *
1199
+ * @public
1200
+ */
1201
+ as?: string;
1202
+ /**
1203
+ * Whether this field is a polymorphic relationship,
1204
+ * meaning that it can point to multiple types of
1205
+ * resources so long as they implement the trait
1206
+ * or abstract type specified in `type`.
1207
+ *
1208
+ * @public
1209
+ */
1210
+ polymorphic?: boolean;
1211
+ /**
1212
+ * Whether this field should ever make use of the legacy support infra
1213
+ * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1214
+ *
1215
+ * When true, none of the legacy support will be utilized. Sync relationships
1216
+ * will be expected to already have all their data. When reloading a sync relationship
1217
+ * you would be expected to have a `related link` available from a prior relationship
1218
+ * payload e.g.
1219
+ *
1220
+ * ```ts
1221
+ * {
1222
+ * data: {
1223
+ * type: 'user',
1224
+ * id: '2',
1225
+ * attributes: { name: 'Chris' },
1226
+ * relationships: {
1227
+ * bestFriends: {
1228
+ * links: { related: "/users/1/bestFriends" },
1229
+ * data: [ { type: 'user', id: '1' } ],
1230
+ * }
1231
+ * }
1232
+ * },
1233
+ * included: [
1234
+ * { type: 'user', id: '1', attributes: { name: 'Krystan' } }
1235
+ * ]
1236
+ * }
1237
+ * ```
1238
+ *
1239
+ * Async relationships will be loaded via their link if needed.
1240
+ *
1241
+ * @public
1242
+ */
1243
+ linksMode?: true;
1244
+ /**
1245
+ * When omitted, the cache data for this field will
1246
+ * clear local state of all changes except for the
1247
+ * addition of records still in the "new" state any
1248
+ * time the remote data for this field is updated.
1249
+ *
1250
+ * When set to `false`, the cache data for this field
1251
+ * will instead intelligently commit any changes from
1252
+ * local state that are present in the remote data,
1253
+ * leaving any remaining changes in local state still.
1254
+ *
1255
+ * @public
1256
+ */
1257
+ resetOnRemoteUpdate?: false;
1258
+ };
1259
+ }
1260
+ /**
1261
+ * > [!CAUTION]
1262
+ * > This Field is LEGACY
1263
+ *
1264
+ * Represents a field that is a reference to
1265
+ * a collection of other resources.
1266
+ *
1267
+ * This is the legacy version of the `CollectionField`.
1268
+ *
1269
+ * @public
1270
+ */
1271
+ export interface LinksModeHasManyField {
1272
+ /**
1273
+ * The kind of field this is.
1274
+ *
1275
+ * @public
1276
+ */
1277
+ kind: 'hasMany';
1278
+ /**
1279
+ * The name of the field.
1280
+ *
1281
+ * @public
1282
+ */
1283
+ name: string;
1284
+ /**
1285
+ * the name of the resource that this field
1286
+ * refers to. In the case of a polymorphic
1287
+ * relationship, this should be the trait
1288
+ * or abstract type.
1289
+ *
1290
+ * @public
1291
+ */
1292
+ type: string;
1293
+ /**
1294
+ * Options for hasMany are mandatory.
1295
+ *
1296
+ * @public
1297
+ */
1298
+ options: {
1299
+ /**
1300
+ * Whether the relationship is async
1301
+ *
1302
+ * MUST be false for PolarisMode + LinksMode
1303
+ *
1304
+ * If true, it is expected that the cache
1305
+ * data for this field will contain links
1306
+ * or pointers that can be used to fetch
1307
+ * the related resources when needed.
1308
+ *
1309
+ * When false, it is expected that all related
1310
+ * resources are loaded together with this resource,
1311
+ * and that the cache data for this field will
1312
+ * contain the full list of pointers.
1313
+ *
1314
+ * hasMany relationships do not support pagination.
1315
+ *
1316
+ * @public
1317
+ */
1318
+ async: false;
1319
+ /**
1320
+ * The name of the inverse field on the
1321
+ * related resource that points back to
1322
+ * this field on this resource to form a
1323
+ * bidirectional relationship.
1324
+ *
1325
+ * If null, the relationship is unidirectional.
1326
+ *
1327
+ * @public
1328
+ */
1329
+ inverse: string | null;
1330
+ /**
1331
+ * If this field is satisfying a polymorphic
1332
+ * relationship on another resource, then this
1333
+ * should be set to the trait or abstract type
1334
+ * that this resource implements.
1335
+ *
1336
+ * @public
1337
+ */
1338
+ as?: string;
1339
+ /**
1340
+ * Whether this field is a polymorphic relationship,
1341
+ * meaning that it can point to multiple types of
1342
+ * resources so long as they implement the trait
1343
+ * or abstract type specified in `type`.
1344
+ *
1345
+ * @public
1346
+ */
1347
+ polymorphic?: boolean;
1348
+ /**
1349
+ * Whether this field should ever make use of the legacy support infra
1350
+ * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1351
+ *
1352
+ * MUST be true for PolarisMode + LinksMode
1353
+ *
1354
+ * When true, none of the legacy support will be utilized. Sync relationships
1355
+ * will be expected to already have all their data. When reloading a sync relationship
1356
+ * you would be expected to have a `related link` available from a prior relationship
1357
+ * payload e.g.
1358
+ *
1359
+ * ```ts
1360
+ * {
1361
+ * data: {
1362
+ * type: 'user',
1363
+ * id: '2',
1364
+ * attributes: { name: 'Chris' },
1365
+ * relationships: {
1366
+ * bestFriends: {
1367
+ * links: { related: "/users/1/bestFriends" },
1368
+ * data: [ { type: 'user', id: '1' } ],
1369
+ * }
1370
+ * }
1371
+ * },
1372
+ * included: [
1373
+ * { type: 'user', id: '1', attributes: { name: 'Krystan' } }
1374
+ * ]
1375
+ * }
1376
+ * ```
1377
+ *
1378
+ * Async relationships will be loaded via their link if needed.
1379
+ *
1380
+ * Activating LinksMode will *also* deactivate the deprecated
1381
+ * `resetOnRemoteUpdate` behavior for this field.
1382
+ *
1383
+ * This means that when new remote state is received, the cache
1384
+ * will intelligently commit any changes from local state that
1385
+ * are present in the remote data for this field, leaving any remaining
1386
+ * changes in local state still.
1387
+ *
1388
+ * Previously, the cache would clear local state of all changes
1389
+ * except for the addition of records still in the "new" state any
1390
+ * time the remote data for this field was updated.
1391
+ *
1392
+ * @public
1393
+ */
1394
+ linksMode: true;
1395
+ };
1396
+ }
1397
+ /**
1398
+ * A union of all possible LegacyMode field schemas.
1399
+ *
1400
+ * Available field schemas are:
1401
+ *
1402
+ * - {@link GenericField}
1403
+ * - {@link LegacyAliasField}
1404
+ * - {@link LocalField}
1405
+ * - {@link ObjectField}
1406
+ * - {@link SchemaObjectField}
1407
+ * - {@link ArrayField}
1408
+ * - {@link SchemaArrayField}
1409
+ * - {@link DerivedField}
1410
+ * - {@link ResourceField | ResourceField (not yet implemented)}
1411
+ * - {@link CollectionField | CollectionField (not yet implemented)}
1412
+ * - {@link LegacyAttributeField}
1413
+ * - {@link LegacyBelongsToField}
1414
+ * - {@link LegacyHasManyField}
1415
+ *
1416
+ * @public
1417
+ */
1418
+ export type LegacyModeFieldSchema = GenericField | LegacyAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField;
1419
+ /**
1420
+ * A union of all possible PolarisMode field schemas.
1421
+ *
1422
+ * Available field schemas are:
1423
+ *
1424
+ * - {@link GenericField}
1425
+ * - {@link PolarisAliasField}
1426
+ * - {@link LocalField}
1427
+ * - {@link ObjectField}
1428
+ * - {@link SchemaObjectField}
1429
+ * - {@link ArrayField}
1430
+ * - {@link SchemaArrayField}
1431
+ * - {@link DerivedField}
1432
+ * - {@link ResourceField | ResourceField (not yet implemented)}
1433
+ * - {@link CollectionField | CollectionField (not yet implemented)}
1434
+ * - {@link LinksModeBelongsToField}
1435
+ * - {@link LinksModeHasManyField}
1436
+ *
1437
+ * @public
1438
+ */
1439
+ export type PolarisModeFieldSchema = GenericField | PolarisAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | LinksModeBelongsToField | LinksModeHasManyField;
1440
+ /**
1441
+ * A union of all possible LegacyMode and PolarisMode
1442
+ * field schemas.
1443
+ *
1444
+ * You likely will want to use PolarisModeFieldSchema,
1445
+ * LegacyModeFieldSchema, or ObjectFieldSchema instead
1446
+ * as appropriate as they are more specific and will
1447
+ * provide better guidance around what is valid.
1448
+ *
1449
+ * @public
1450
+ */
1451
+ export type FieldSchema = GenericField | LegacyAliasField | PolarisAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField | ResourceField | CollectionField | LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1452
+ /**
1453
+ * A union of all possible field schemas that can be
1454
+ * used in an ObjectSchema.
1455
+ *
1456
+ * @public
1457
+ */
1458
+ export type ObjectFieldSchema = GenericField | ObjectAliasField | LocalField | ObjectField | SchemaObjectField | ArrayField | SchemaArrayField | DerivedField;
1459
+ /**
1460
+ * Represents a schema for a primary resource in PolarisMode.
1461
+ *
1462
+ * Primary resources are objects with a unique identity of their
1463
+ * own which may allow them to appear in relationships, or in multiple
1464
+ * response documents.
1465
+ *
1466
+ * @public
1467
+ */
1468
+ export interface PolarisResourceSchema {
1469
+ legacy?: false;
1470
+ /**
1471
+ * For primary resources, this should be an IdentityField
1472
+ *
1473
+ * for schema-objects, this should be either a HashField or null
1474
+ *
1475
+ * @property identity
1476
+ * @type {IdentityField}
1477
+ * @public
1478
+ */
1479
+ identity: IdentityField;
1480
+ /**
1481
+ * The name of the schema
1482
+ *
1483
+ * For cacheable resources, this should be the
1484
+ * primary resource type.
1485
+ *
1486
+ * For object schemas, this should be the name
1487
+ * of the object schema.
1488
+ *
1489
+ * The names of object and resource schemas share
1490
+ * a single namespace and must not conflict.
1491
+ *
1492
+ * We recommend a naming convention for object schemas
1493
+ * such as below for ensuring uniqueness:
1494
+ *
1495
+ * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`
1496
+ * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`
1497
+ * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`
1498
+ *
1499
+ * @public
1500
+ */
1501
+ type: string;
1502
+ /**
1503
+ * The fields that make up the shape of the resource
1504
+ *
1505
+ * @public
1506
+ */
1507
+ fields: PolarisModeFieldSchema[];
1508
+ /**
1509
+ * A list of traits that this resource implements. The fields for these
1510
+ * traits should still be defined in the fields array.
1511
+ *
1512
+ * Each trait should be a string that matches the `type` of another
1513
+ * resource schema. The trait can be abstract and reference a resource
1514
+ * type that is never defined as a schema.
1515
+ *
1516
+ * @public
1517
+ */
1518
+ traits?: string[];
1519
+ }
1520
+ /**
1521
+ * Represents a schema for a primary resource in LegacyMode
1522
+ *
1523
+ * Primary resources are objects with a unique identity of their
1524
+ * own which may allow them to appear in relationships, or in multiple
1525
+ * response documents.
1526
+ *
1527
+ * @public
1528
+ */
1529
+ export interface LegacyResourceSchema {
1530
+ /**
1531
+ * A flag indicating that this is a legacy resource schema
1532
+ *
1533
+ * @public
1534
+ */
1535
+ legacy: true;
1536
+ /**
1537
+ * This should be an IdentityField.
1538
+ *
1539
+ * To maximize compatibility with Model where `id` was the
1540
+ * name of the identity field, we recommend using `{ kind: '@id', name: 'id' }`
1541
+ * for records in legacy mode, but this is not required.
1542
+ *
1543
+ * @public
1544
+ */
1545
+ identity: IdentityField;
1546
+ /**
1547
+ * The name of the schema
1548
+ *
1549
+ * For cacheable resources, this should be the
1550
+ * primary resource type.
1551
+ *
1552
+ * The names of object and resource schemas share
1553
+ * a single namespace and must not conflict.
1554
+ *
1555
+ * We recommend a naming convention for object schemas
1556
+ * such as below for ensuring uniqueness:
1557
+ *
1558
+ * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`
1559
+ * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`
1560
+ * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`
1561
+ *
1562
+ * @public
1563
+ */
1564
+ type: string;
1565
+ /**
1566
+ * The fields that make up the shape of the resource
1567
+ *
1568
+ * @public
1569
+ */
1570
+ fields: LegacyModeFieldSchema[];
1571
+ /**
1572
+ * A list of traits that this resource implements. The fields for these
1573
+ * traits should still be defined in the fields array.
1574
+ *
1575
+ * Each trait should be a string that matches the `type` of another
1576
+ * resource schema. The trait can be abstract and reference a resource
1577
+ * type that is never defined as a schema.
1578
+ *
1579
+ * @public
1580
+ */
1581
+ traits?: string[];
1582
+ }
1583
+ /**
1584
+ * A type which represents a valid JSON schema
1585
+ * definition for either a PolarisMode or a
1586
+ * LegacyMode resource.
1587
+ *
1588
+ * Note, this is separate from the type returned
1589
+ * by the SchemaService which provides fields as a Map
1590
+ * instead of as an Array.
1591
+ *
1592
+ * @public
1593
+ */
1594
+ export type ResourceSchema = PolarisResourceSchema | LegacyResourceSchema;
1595
+ /**
1596
+ * Represents a schema for an object that is not
1597
+ * a primary resource (has no unique identity of its own).
1598
+ *
1599
+ * ObjectSchemas may not currently contain relationships.
1600
+ *
1601
+ * @public
1602
+ */
1603
+ export interface ObjectSchema {
1604
+ /**
1605
+ * Either a HashField from which to calculate an identity or null
1606
+ *
1607
+ * In the case of `null`, the object's identity will be based
1608
+ * on the referential identity of the object in the cache itself
1609
+ * when an identity is needed.
1610
+ *
1611
+ * @public
1612
+ */
1613
+ identity: HashField | null;
1614
+ /**
1615
+ * The name of the schema
1616
+ *
1617
+ * The names of object and resource schemas share
1618
+ * a single namespace and must not conflict.
1619
+ *
1620
+ * We recommend a naming convention for object schemas
1621
+ * such as below for ensuring uniqueness:
1622
+ *
1623
+ * - for globally shared objects: The pattern `$field:${KlassName}` e.g. `$field:AddressObject`
1624
+ * - for resource-specific objects: The pattern `$${ResourceKlassName}:$field:${KlassName}` e.g. `$User:$field:ReusableAddress`
1625
+ * - for inline objects: The pattern `$${ResourceKlassName}.${fieldPath}:$field:anonymous` e.g. `$User.shippingAddress:$field:anonymous`
1626
+ *
1627
+ * @public
1628
+ */
1629
+ type: string;
1630
+ /**
1631
+ * The fields that make up the shape of the object
1632
+ *
1633
+ * @public
1634
+ */
1635
+ fields: ObjectFieldSchema[];
1636
+ }
1637
+ export type Schema = ResourceSchema | ObjectSchema;
1638
+ /**
1639
+ * A no-op type utility that enables type-checking resource schema
1640
+ * definitions.
1641
+ *
1642
+ * Will return the passed in schema.
1643
+ *
1644
+ * This will not validate relationship inverses or related types,
1645
+ * as doing so would require a full schema graph to be passed in
1646
+ * and no cycles in the graph to be present.
1647
+ *
1648
+ * @public
1649
+ */
1650
+ export declare function resourceSchema<T extends LegacyResourceSchema | PolarisResourceSchema>(schema: LegacyResourceSchema | PolarisResourceSchema): T;
1651
+ /**
1652
+ * A no-op type utility that enables type-checking object schema
1653
+ * definitions.
1654
+ *
1655
+ * Will return the passed in schema.
1656
+ *
1657
+ * @public
1658
+ */
1659
+ export declare function objectSchema<T extends ObjectSchema>(schema: T): T;
1660
+ /**
1661
+ * A type utility to narrow a schema to a ResourceSchema
1662
+ *
1663
+ * @public
1664
+ */
1665
+ export declare function isResourceSchema(schema: ResourceSchema | ObjectSchema): schema is ResourceSchema;
1666
+ /**
1667
+ * A type utility to narrow a schema to LegacyResourceSchema
1668
+ *
1669
+ * @public
1670
+ */
1671
+ export declare function isLegacyResourceSchema(schema: ResourceSchema | ObjectSchema): schema is LegacyResourceSchema;
1672
+ export type LegacyField = LegacyAttributeField | LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1673
+ export type LegacyRelationshipField = LegacyBelongsToField | LegacyHasManyField | LinksModeBelongsToField | LinksModeHasManyField;
1674
+ //# sourceMappingURL=fields.d.ts.map