@warp-drive/core 5.9.0-alpha.23 → 5.9.0-alpha.28

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 (202) hide show
  1. package/dist/{-private-_1kbGvX1.js → -private-C5eqeju3.js} +2 -2
  2. package/dist/-private-C5eqeju3.js.map +1 -0
  3. package/dist/{-private-Dj8m5x4s.js → -private-CLrxUPAb.js} +2 -2
  4. package/dist/{-private-Dj8m5x4s.js.map → -private-CLrxUPAb.js.map} +1 -1
  5. package/dist/-private-DM-bllPS.js +3530 -0
  6. package/dist/-private-DM-bllPS.js.map +1 -0
  7. package/dist/{concepts-LHsLJZMl.d.ts → concepts-DFldVwEM.d.ts} +2 -2
  8. package/dist/{concepts-LHsLJZMl.d.ts.map → concepts-DFldVwEM.d.ts.map} +1 -1
  9. package/dist/configure.js +1 -1
  10. package/dist/graph/-private.d.ts +1 -1
  11. package/dist/graph/-private.js +46 -33
  12. package/dist/graph/-private.js.map +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/dist/{internal-Cz-893zD.d.ts → internal-DtWOpxrR.d.ts} +2763 -2271
  16. package/dist/internal-DtWOpxrR.d.ts.map +1 -0
  17. package/dist/reactive/-private.d.ts +1 -1
  18. package/dist/reactive/-private.js +1 -1
  19. package/dist/reactive.d.ts +1 -1
  20. package/dist/reactive.js +3 -3
  21. package/dist/record-D3QQcaIR.d.ts.map +1 -1
  22. package/dist/{request-OFvXk6jf.js → request-Bb2yKwM-.js} +2 -2
  23. package/dist/request-Bb2yKwM-.js.map +1 -0
  24. package/dist/request.d.ts +1 -1
  25. package/dist/request.js +1 -1
  26. package/dist/signals/-leaked.d.ts +999 -2
  27. package/dist/signals/-leaked.d.ts.map +1 -1
  28. package/dist/signals/-leaked.js +2 -2
  29. package/dist/{src-Efcm2FAX.js → src-D84KLiu1.js} +192 -53
  30. package/dist/src-D84KLiu1.js.map +1 -0
  31. package/dist/store/-private.d.ts +1 -1
  32. package/dist/store/-private.js +1 -1
  33. package/dist/store-DNF9Rgoh.js.map +1 -1
  34. package/dist/store.d.ts +2 -401
  35. package/dist/types/-private.d.ts +1 -1
  36. package/dist/types/-private.d.ts.map +1 -1
  37. package/dist/types/-private.js +1 -1
  38. package/dist/types/cache.d.ts +1 -1
  39. package/dist/types/record.js.map +1 -1
  40. package/dist/types/request.d.ts +1 -1
  41. package/dist/types/request.js +1 -1
  42. package/dist/types/request.js.map +1 -1
  43. package/dist/types/runtime.js +1 -1
  44. package/dist/types/schema/concepts.d.ts +1 -1
  45. package/dist/types/schema/fields.js.map +1 -1
  46. package/dist/types/schema/schema-service.d.ts +1 -1
  47. package/dist/types/symbols.js +1 -1
  48. package/dist/types/symbols.js.map +1 -1
  49. package/dist/types.d.ts +1 -1
  50. package/dist/unpkg/dev/{-private-DRE_3rF3.js → -private-2VEwBRWp.js} +2 -2
  51. package/dist/unpkg/dev/-private-2VEwBRWp.js.map +1 -0
  52. package/dist/unpkg/dev/-private-BMzt-W-X.js +3519 -0
  53. package/dist/unpkg/dev/-private-BMzt-W-X.js.map +1 -0
  54. package/dist/unpkg/dev/{-private-uOSg0oor.js → -private-DaGaqz01.js} +2 -2
  55. package/dist/unpkg/{prod/-private-7FUQxD6x.js.map → dev/-private-DaGaqz01.js.map} +1 -1
  56. package/dist/unpkg/dev/configure.js +1 -1
  57. package/dist/unpkg/dev/graph/-private.js +46 -33
  58. package/dist/unpkg/dev/graph/-private.js.map +1 -1
  59. package/dist/unpkg/dev/index.js +1 -1
  60. package/dist/unpkg/dev/reactive/-private.js +1 -1
  61. package/dist/unpkg/dev/reactive.js +3 -3
  62. package/dist/unpkg/{dev-deprecated/request-nf8Ain5N.js → dev/request-DxUNopO0.js} +2 -2
  63. package/dist/unpkg/dev/request-DxUNopO0.js.map +1 -0
  64. package/dist/unpkg/dev/request.js +1 -1
  65. package/dist/unpkg/dev/{runtime-DvK0KPb9.js → runtime-FdPeCUwk.js} +2 -2
  66. package/dist/unpkg/dev/runtime-FdPeCUwk.js.map +1 -0
  67. package/dist/unpkg/dev/signals/-leaked.js +2 -2
  68. package/dist/unpkg/dev/{src-cnf1J-vC.js → src-B8QSNef4.js} +194 -55
  69. package/dist/unpkg/dev/src-B8QSNef4.js.map +1 -0
  70. package/dist/unpkg/dev/store/-private.js +1 -1
  71. package/dist/unpkg/dev/{store-BxBC1dq7.js → store-BRZE8mQW.js} +2 -2
  72. package/dist/unpkg/dev/store-BRZE8mQW.js.map +1 -0
  73. package/dist/unpkg/dev/store.js +1 -1
  74. package/dist/unpkg/dev/types/-private.js +1 -1
  75. package/dist/unpkg/dev/types/record.js.map +1 -1
  76. package/dist/unpkg/dev/types/request.js +1 -1
  77. package/dist/unpkg/dev/types/request.js.map +1 -1
  78. package/dist/unpkg/dev/types/runtime.js +1 -1
  79. package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
  80. package/dist/unpkg/dev/types/symbols.js +1 -1
  81. package/dist/unpkg/dev/types/symbols.js.map +1 -1
  82. package/dist/unpkg/dev-deprecated/{-private-DRE_3rF3.js → -private-2VEwBRWp.js} +2 -2
  83. package/dist/unpkg/dev-deprecated/-private-2VEwBRWp.js.map +1 -0
  84. package/dist/unpkg/dev-deprecated/-private-BMzt-W-X.js +3519 -0
  85. package/dist/unpkg/dev-deprecated/-private-BMzt-W-X.js.map +1 -0
  86. package/dist/unpkg/dev-deprecated/{-private-uOSg0oor.js → -private-DaGaqz01.js} +2 -2
  87. package/dist/unpkg/dev-deprecated/{-private-uOSg0oor.js.map → -private-DaGaqz01.js.map} +1 -1
  88. package/dist/unpkg/dev-deprecated/configure.js +1 -1
  89. package/dist/unpkg/dev-deprecated/graph/-private.js +47 -34
  90. package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -1
  91. package/dist/unpkg/dev-deprecated/index.js +1 -1
  92. package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
  93. package/dist/unpkg/dev-deprecated/reactive.js +3 -3
  94. package/dist/unpkg/{dev/request-nf8Ain5N.js → dev-deprecated/request-DxUNopO0.js} +2 -2
  95. package/dist/unpkg/dev-deprecated/request-DxUNopO0.js.map +1 -0
  96. package/dist/unpkg/dev-deprecated/request.js +1 -1
  97. package/dist/unpkg/dev-deprecated/{runtime-U4KcpxSO.js → runtime-Klu1azLv.js} +2 -2
  98. package/dist/unpkg/dev-deprecated/runtime-Klu1azLv.js.map +1 -0
  99. package/dist/unpkg/dev-deprecated/signals/-leaked.js +2 -2
  100. package/dist/unpkg/dev-deprecated/{src-Bw8M5LTu.js → src-B7fOGmde.js} +195 -56
  101. package/dist/unpkg/dev-deprecated/src-B7fOGmde.js.map +1 -0
  102. package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
  103. package/dist/unpkg/dev-deprecated/{store-BV9tvZmy.js → store-C6m5EkF2.js} +2 -2
  104. package/dist/unpkg/dev-deprecated/store-C6m5EkF2.js.map +1 -0
  105. package/dist/unpkg/dev-deprecated/store.js +1 -1
  106. package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
  107. package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
  108. package/dist/unpkg/dev-deprecated/types/request.js +1 -1
  109. package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
  110. package/dist/unpkg/dev-deprecated/types/runtime.js +1 -1
  111. package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
  112. package/dist/unpkg/dev-deprecated/types/symbols.js +1 -1
  113. package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
  114. package/dist/unpkg/prod/-private-CsR9oSoh.js +22 -0
  115. package/dist/unpkg/{prod-deprecated/-private-7FUQxD6x.js.map → prod/-private-CsR9oSoh.js.map} +1 -1
  116. package/dist/unpkg/{prod-deprecated/-private-DVU4vN6b.js → prod/-private-D4aYfYZq.js} +2 -2
  117. package/dist/unpkg/prod/-private-D4aYfYZq.js.map +1 -0
  118. package/dist/unpkg/prod/-private-DHnXWc06.js +3294 -0
  119. package/dist/unpkg/prod/-private-DHnXWc06.js.map +1 -0
  120. package/dist/unpkg/prod/configure.js +1 -1
  121. package/dist/unpkg/prod/graph/-private.js +45 -32
  122. package/dist/unpkg/prod/graph/-private.js.map +1 -1
  123. package/dist/unpkg/prod/index.js +1 -1
  124. package/dist/unpkg/prod/reactive/-private.js +1 -1
  125. package/dist/unpkg/prod/reactive.js +3 -3
  126. package/dist/unpkg/{prod-deprecated/request-C1ArecMb.js → prod/request-nsGR8kkV.js} +2 -2
  127. package/dist/unpkg/prod/request-nsGR8kkV.js.map +1 -0
  128. package/dist/unpkg/prod/request.js +1 -1
  129. package/dist/unpkg/prod/signals/-leaked.js +2 -2
  130. package/dist/unpkg/prod/{src-Bw3mYpy3.js → src-DtJbD0QO.js} +196 -53
  131. package/dist/unpkg/prod/src-DtJbD0QO.js.map +1 -0
  132. package/dist/unpkg/prod/store/-private.js +1 -1
  133. package/dist/unpkg/prod/store-BWhmb7Ob.js.map +1 -1
  134. package/dist/unpkg/prod/types/-private.js +1 -1
  135. package/dist/unpkg/prod/types/record.js.map +1 -1
  136. package/dist/unpkg/prod/types/request.js +1 -1
  137. package/dist/unpkg/prod/types/request.js.map +1 -1
  138. package/dist/unpkg/prod/types/runtime.js +1 -1
  139. package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
  140. package/dist/unpkg/prod/types/symbols.js +1 -1
  141. package/dist/unpkg/prod/types/symbols.js.map +1 -1
  142. package/dist/unpkg/prod-deprecated/{-private-7FUQxD6x.js → -private-CsR9oSoh.js} +2 -2
  143. package/dist/unpkg/{dev/-private-uOSg0oor.js.map → prod-deprecated/-private-CsR9oSoh.js.map} +1 -1
  144. package/dist/unpkg/{prod/-private-DVU4vN6b.js → prod-deprecated/-private-D4aYfYZq.js} +2 -2
  145. package/dist/unpkg/prod-deprecated/-private-D4aYfYZq.js.map +1 -0
  146. package/dist/unpkg/prod-deprecated/-private-DHnXWc06.js +3294 -0
  147. package/dist/unpkg/prod-deprecated/-private-DHnXWc06.js.map +1 -0
  148. package/dist/unpkg/prod-deprecated/configure.js +1 -1
  149. package/dist/unpkg/prod-deprecated/graph/-private.js +46 -35
  150. package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -1
  151. package/dist/unpkg/prod-deprecated/index.js +1 -1
  152. package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
  153. package/dist/unpkg/prod-deprecated/reactive.js +3 -3
  154. package/dist/unpkg/{prod/request-C1ArecMb.js → prod-deprecated/request-nsGR8kkV.js} +2 -2
  155. package/dist/unpkg/prod-deprecated/request-nsGR8kkV.js.map +1 -0
  156. package/dist/unpkg/prod-deprecated/request.js +1 -1
  157. package/dist/unpkg/prod-deprecated/signals/-leaked.js +2 -2
  158. package/dist/unpkg/prod-deprecated/{src-Byf-2odU.js → src-AuhAl7M3.js} +197 -54
  159. package/dist/unpkg/prod-deprecated/src-AuhAl7M3.js.map +1 -0
  160. package/dist/unpkg/prod-deprecated/store/-private.js +1 -1
  161. package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +1 -1
  162. package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
  163. package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
  164. package/dist/unpkg/prod-deprecated/types/request.js +1 -1
  165. package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
  166. package/dist/unpkg/prod-deprecated/types/runtime.js +1 -1
  167. package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
  168. package/dist/unpkg/prod-deprecated/types/symbols.js +1 -1
  169. package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
  170. package/package.json +8 -12
  171. package/dist/-private-RGSJppJ1.js +0 -1695
  172. package/dist/-private-RGSJppJ1.js.map +0 -1
  173. package/dist/-private-_1kbGvX1.js.map +0 -1
  174. package/dist/internal-Cz-893zD.d.ts.map +0 -1
  175. package/dist/request-OFvXk6jf.js.map +0 -1
  176. package/dist/src-Efcm2FAX.js.map +0 -1
  177. package/dist/store.d.ts.map +0 -1
  178. package/dist/unpkg/dev/-private-DRE_3rF3.js.map +0 -1
  179. package/dist/unpkg/dev/-private-DVcNXCUN.js +0 -1684
  180. package/dist/unpkg/dev/-private-DVcNXCUN.js.map +0 -1
  181. package/dist/unpkg/dev/request-nf8Ain5N.js.map +0 -1
  182. package/dist/unpkg/dev/runtime-DvK0KPb9.js.map +0 -1
  183. package/dist/unpkg/dev/src-cnf1J-vC.js.map +0 -1
  184. package/dist/unpkg/dev/store-BxBC1dq7.js.map +0 -1
  185. package/dist/unpkg/dev-deprecated/-private-DRE_3rF3.js.map +0 -1
  186. package/dist/unpkg/dev-deprecated/-private-DVcNXCUN.js +0 -1684
  187. package/dist/unpkg/dev-deprecated/-private-DVcNXCUN.js.map +0 -1
  188. package/dist/unpkg/dev-deprecated/request-nf8Ain5N.js.map +0 -1
  189. package/dist/unpkg/dev-deprecated/runtime-U4KcpxSO.js.map +0 -1
  190. package/dist/unpkg/dev-deprecated/src-Bw8M5LTu.js.map +0 -1
  191. package/dist/unpkg/dev-deprecated/store-BV9tvZmy.js.map +0 -1
  192. package/dist/unpkg/prod/-private-7FUQxD6x.js +0 -22
  193. package/dist/unpkg/prod/-private-DMOn3H9i.js +0 -1494
  194. package/dist/unpkg/prod/-private-DMOn3H9i.js.map +0 -1
  195. package/dist/unpkg/prod/-private-DVU4vN6b.js.map +0 -1
  196. package/dist/unpkg/prod/request-C1ArecMb.js.map +0 -1
  197. package/dist/unpkg/prod/src-Bw3mYpy3.js.map +0 -1
  198. package/dist/unpkg/prod-deprecated/-private-DMOn3H9i.js +0 -1494
  199. package/dist/unpkg/prod-deprecated/-private-DMOn3H9i.js.map +0 -1
  200. package/dist/unpkg/prod-deprecated/-private-DVU4vN6b.js.map +0 -1
  201. package/dist/unpkg/prod-deprecated/request-C1ArecMb.js.map +0 -1
  202. package/dist/unpkg/prod-deprecated/src-Byf-2odU.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import { a as setTransient, i as peekUniversalTransient, n as getOrSetUniversal, o as setUniversalTransient, r as peekTransient, t as getOrSetGlobal } from "../-private-_1kbGvX1.js";
1
+ import { a as setTransient, i as peekUniversalTransient, n as getOrSetUniversal, o as setUniversalTransient, r as peekTransient, t as getOrSetGlobal } from "../-private-C5eqeju3.js";
2
2
 
3
3
  export { getOrSetGlobal, getOrSetUniversal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient };
@@ -1,2 +1,2 @@
1
- import { Ht as ChangedAttributesHash, Ut as RelationshipDiff, Vt as Cache } from "../internal-Cz-893zD.js";
1
+ import { Gt as Cache, Kt as ChangedAttributesHash, qt as RelationshipDiff } from "../internal-DtWOpxrR.js";
2
2
  export { Cache, ChangedAttributesHash, RelationshipDiff };
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","names":["createIncludeValidator","validateIncludes","includes"],"sources":["../../src/types/record.ts"],"sourcesContent":["import type { Type } from './symbols.ts';\n\n/**\n * Records may be anything, They don't even\n * have to be objects.\n *\n * Whatever they are, if they have a Type\n * property, that property will be used by WarpDrive\n * and WarpDrive to provide better type safety and\n * intellisense.\n *\n * @class TypedRecordInstance\n */\nexport interface TypedRecordInstance {\n /**\n * The type of the resource.\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * @property [Type]\n * @type {Type}\n * @type {String}\n */\n [Type]: string;\n}\n\n/**\n * A type utility that extracts the Type if available,\n * otherwise it returns never.\n *\n */\nexport type TypeFromInstance<T> = T extends TypedRecordInstance ? T[typeof Type] : never;\n\n/**\n * A type utility that extracts the Type if available,\n * otherwise it returns string\n *\n */\nexport type TypeFromInstanceOrString<T> = T extends TypedRecordInstance ? T[typeof Type] : string;\n\ntype IsUniqueSymbol<T> = T extends `___(unique) Symbol(${string})` ? true : false;\ntype Unpacked<T> = T extends (infer U)[] ? U : T;\ntype NONE = { __NONE: never };\n\ntype __InternalExtract<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n V extends TypedRecordInstance,\n IncludePrefix extends boolean,\n Ignore,\n Pre extends string,\n DEPTH extends _DEPTHCOUNT,\n> =\n // if we extend T, we return the leaf value\n V extends T\n ? IncludePrefix extends false\n ? V[typeof Type]\n : Pre\n : // else if we are in Ignore we add the lead and exit\n V extends Ignore\n ? IncludePrefix extends false\n ? V[typeof Type]\n : Pre\n : // else if we are at max depth, we return never\n IS_MAX_DEPTH<DEPTH, MAX_DEPTH> extends true\n ? Pre\n : // else add T to Ignore and recurse\n ExtractUnion<MAX_DEPTH, V, IncludePrefix, Ignore | T, Pre, INC_DEPTH<DEPTH>>;\n\ntype __ExtractIfRecord<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n V,\n IncludePrefix extends boolean,\n Ignore,\n Pre extends string,\n DEPTH extends _DEPTHCOUNT,\n> = V extends TypedRecordInstance ? __InternalExtract<MAX_DEPTH, T, V, IncludePrefix, Ignore, Pre, DEPTH> : never;\n\ntype _ExtractUnion<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n IncludePrefix extends boolean,\n Ignore,\n Pre,\n DEPTH extends _DEPTHCOUNT,\n> = {\n // for each string key in the record,\n [K in keyof T]: IsUniqueSymbol<K> extends true\n ? never\n : K extends string\n ? // we recursively extract any values that resolve to a TypedRecordInstance\n __ExtractIfRecord<\n MAX_DEPTH,\n T,\n Unpacked<Awaited<T[K]>>,\n IncludePrefix,\n Ignore,\n Pre extends string ? `${Pre}.${K}` : K,\n DEPTH\n >\n : never;\n // then we return any value that is not 'never'\n}[keyof T];\n\n/**\n * A Utility that extracts either resource types or resource paths from a TypedRecordInstance.\n *\n * Its limitations are mostly around its intentional non-recursiveness. It presumes that APIs which\n * implement includes will not allow cyclical include paths, and will collapse includes by type.\n *\n * This follows closer to the JSON:API fields spec than to the includes spec in nature, but in\n * practice it is so impracticle for an API to allow z-algo include paths that this is probably\n * reasonable.\n *\n * We may need to revisit this in the future, opting to either make this restriction optional or\n * to allow for other strategies.\n *\n * There's a 90% chance this particular implementation belongs being in the JSON:API package instead\n * of core-types, but it's here for now.\n *\n */\ntype ExtractUnion<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n IncludePrefix extends boolean = false,\n Ignore = NONE,\n Pre = NONE,\n DEPTH extends _DEPTHCOUNT = 1,\n> = Exclude<\n IncludePrefix extends true\n ? // if we want to include prefix, we union with the prefix. Outer Exclude will filter any \"NONE\" types\n _ExtractUnion<MAX_DEPTH, T, IncludePrefix, Ignore, Pre, DEPTH> | Pre\n : // Else we just union the types.\n _ExtractUnion<MAX_DEPTH, T, IncludePrefix, Ignore, Pre, DEPTH> | T[typeof Type],\n NONE\n>;\n\ntype _DEPTHCOUNT = 1 | 2 | 3 | 4 | 5;\ntype INC_DEPTH<START extends _DEPTHCOUNT> = START extends 1 ? 2 : START extends 2 ? 3 : START extends 3 ? 4 : 5;\ntype IS_MAX_DEPTH<\n DEPTH extends _DEPTHCOUNT,\n MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH,\n> = DEPTH extends MAX_DEPTH ? true : false;\ntype DEFAULT_MAX_DEPTH = 3;\n/**\n * A utility that provides the union of all ResourceName for all potential\n * includes for the given TypedRecordInstance.\n *\n */\nexport type ExtractSuggestedCacheTypes<\n T extends TypedRecordInstance,\n MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH,\n> = ExtractUnion<MAX_DEPTH, T>; // ToPaths<ExpandIgnore<T, true>, false>;\n\n/**\n * A utility that provides the union type of all valid include paths for the given\n * TypedRecordInstance.\n *\n * Cyclical paths are filtered out.\n *\n */\nexport type Includes<T extends TypedRecordInstance, MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH> = ExtractUnion<\n MAX_DEPTH,\n T,\n true\n>;\n\n/**\n * A type-erased placeholder for a record instance, used where the\n * specific record type is not known or not relevant.\n */\nexport type OpaqueRecordInstance = unknown;\n\n/**\n * @internal\n */\nexport type _StringSatisfiesIncludes<T extends string, SET extends string, FT extends string> = T extends SET\n ? FT\n : T extends `${infer U},${infer V}`\n ? U extends SET\n ? _StringSatisfiesIncludes<V, Exclude<SET, U>, FT>\n : never\n : never;\n\n/**\n * Validates that the comma-separated-string `T` (e.g. `'company,company.ceo,friends'`)\n * only contains paths present in the union `SET` (typically {@link Includes}).\n *\n * TypeScript cannot autocomplete against this type; prefer {@link createIncludeValidator}\n * for a better development experience unless you are writing a similar wrapper utility.\n *\n * @example\n * ```ts\n * import type { StringSatisfiesIncludes, Includes } from '@warp-drive/core/types/record';\n *\n * const includes: StringSatisfiesIncludes<\n * 'company,company.ceo,friends',\n * Includes<User>\n * > = 'company,company.ceo,friends';\n * ```\n */\nexport type StringSatisfiesIncludes<T extends string, SET extends string> = _StringSatisfiesIncludes<T, SET, T>;\n\n/**\n * Creates a runtime validator function for comma-separated `include` strings,\n * ensuring at compile time that only valid paths for `T` (per {@link Includes})\n * are supplied.\n *\n * @example\n * ```ts\n * import { createIncludeValidator } from '@warp-drive/core/types/record';\n *\n * const userIncludesValidator = createIncludeValidator<User>;\n *\n * userIncludesValidator('company,company.ceo,friends');\n * ```\n */\nexport function createIncludeValidator<T extends TypedRecordInstance>() {\n return function validateIncludes<U extends string>(includes: StringSatisfiesIncludes<U, Includes<T>>): U {\n return includes;\n };\n}\n\n/**\n * A utility that takes two types, K and T, and produces a new type that is a \"mask\" of T based on K.\n *\n * That's a mouthful, so let's break it down:\n *\n * Let's say you have a User type and an Address type.\n *\n * ```ts\n * interface Address {\n * street: string;\n * city: string;\n * state: string;\n * zip: string;\n * }\n *\n * interface User {\n * name: string;\n * title: string;\n * address: Address;\n * }\n * ```\n *\n * Now, imagine you want to load a preview of the user with some information about their address,\n * but you don't want to load the entire user or address. You probably want to still ensure\n * the type of the data you do load matches the underlying Address and User types, but doesn't\n * include everything.\n *\n * If you did this manually, you might do something like this:\n *\n * ```ts\n * interface UserPreview {\n * name: string;\n * address: AddressPreview;\n * }\n *\n * interface AddressPreview {\n * city: string;\n * }\n * ```\n *\n * From a TypeScript performance perspective, this is the best way to approach these preview\n * types, but this is also tedious and error-prone, especially if the User or Address types change.\n *\n * For Address, we could create a validated type using `Pick`:\n *\n * ```ts\n * type AddressPreview = Pick<Address, 'city'>;\n * ```\n *\n * This ensures that if the Address type changes, our AddressPreview will still be valid.\n * However, for UserPreview, we can't just use `Pick` because the `address` property is of type `Address`,\n * not `AddressPreview`. This is where the `Mask` type comes in.\n *\n * With `Mask`, we define the `UserPreview` in two parts\n * - first, we define the subset of fields we want to include from `User`, using `Pick` or an interface.\n * - then, we use `Mask` to replace the related types of fields like Address with their more limited subset.\n *\n * Here's how we can do it:\n *\n * ```ts\n * // First, we define the base of UserPreview with Pick\n * type UserPreviewBase = Pick<User, 'name' | 'address'>;\n * // Then, we use Mask to replace Address with AddressPreview\n * type UserPreview = Mask<{ address: AddressPreview }, UserPreviewBase>;\n * ```\n *\n * Now, `UserPreview` will have the `name` field from `User` and the `address` field will be of type `AddressPreview`.\n * This way, if the `User` or `Address` types change, TypeScript will ensure that our `UserPreview` and `AddressPreview`\n * types remain valid and consistent with the underlying types.\n *\n * But what if your app has data with massive interfaces such that the TypeScript performance of this\n * approach becomes a problem? In that case, see {@link Validate}\n */\nexport type Mask<K extends object, T extends K> = {\n [P in keyof T]: P extends keyof K ? (T[P] extends K[P] ? K[P] : never) : T[P];\n};\n\n/**\n * A utility that takes two types, K and T, and ensures that K is a valid subset of T.\n *\n * That's a mouthful, so let's break it down:\n *\n * Let's say you have a User type and an Address type.\n *\n * ```ts\n * interface Address {\n * street: string;\n * city: string;\n * state: string;\n * zip: string;\n * }\n *\n * interface User {\n * name: string;\n * title: string;\n * address: Address;\n * }\n * ```\n *\n * Now, imagine you want to load a preview of the user with some information about their address,\n * but you don't want to load the entire user or address. You probably want to still ensure\n * the type of the data you do load matches the underlying Address and User types, but doesn't\n * include everything.\n *\n * You might do something like this:\n *\n * ```ts\n * interface UserPreview {\n * name: string;\n * address: AddressPreview;\n * }\n *\n * interface AddressPreview {\n * city: string;\n * }\n * ```\n *\n * From a TypeScript performance perspective, this is the best way to approach these preview\n * types, but this is also error-prone, especially if the User or Address types change.\n *\n * Validate can help ensure that your preview types remain valid.\n *\n * ```ts\n * type IsValidUserPreview = Validate<UserPreview, User>; // This will be valid\n * ```\n *\n * For help creating subsets of types, see {@link Mask}\n */\nexport type Validate<K extends object, T extends K> = T extends K ? K : never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgOA,SAAgBA,yBAAwD;CACtE,OAAO,SAASC,iBAAmCC,UAAsD;EACvG,OAAOA;CACT;AACF"}
1
+ {"version":3,"file":"record.js","names":["createIncludeValidator","validateIncludes","includes"],"sources":["../../src/types/record.ts"],"sourcesContent":["import type { Type } from './symbols.ts';\n\n/**\n * Records may be anything, They don't even\n * have to be objects.\n *\n * Whatever they are, if they have a Type\n * property, that property will be used by WarpDrive\n * and WarpDrive to provide better type safety and\n * intellisense.\n *\n * @class TypedRecordInstance\n */\nexport interface TypedRecordInstance {\n /**\n * The type of the resource.\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * @property [Type]\n * @type {Type}\n * @type {String}\n */\n [Type]: string;\n}\n\n/**\n * A type utility that extracts the Type if available,\n * otherwise it returns never.\n *\n */\nexport type TypeFromInstance<T> = T extends TypedRecordInstance ? T[typeof Type] : never;\n\n/**\n * A type utility that extracts the Type if available,\n * otherwise it returns string\n *\n */\nexport type TypeFromInstanceOrString<T> = T extends TypedRecordInstance ? T[typeof Type] : string;\n\ntype IsUniqueSymbol<T> = T extends `___(unique) Symbol(${string})` ? true : false;\ntype Unpacked<T> = T extends (infer U)[] ? U : T;\ntype NONE = { __NONE: never };\n\ntype __InternalExtract<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n V extends TypedRecordInstance,\n IncludePrefix extends boolean,\n Ignore,\n Pre extends string,\n DEPTH extends _DEPTHCOUNT,\n> =\n // if we extend T, we return the leaf value\n V extends T\n ? IncludePrefix extends false\n ? V[typeof Type]\n : Pre\n : // else if we are in Ignore we add the lead and exit\n V extends Ignore\n ? IncludePrefix extends false\n ? V[typeof Type]\n : Pre\n : // else if we are at max depth, we return never\n IS_MAX_DEPTH<DEPTH, MAX_DEPTH> extends true\n ? Pre\n : // else add T to Ignore and recurse\n ExtractUnion<MAX_DEPTH, V, IncludePrefix, Ignore | T, Pre, INC_DEPTH<DEPTH>>;\n\ntype __ExtractIfRecord<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n V,\n IncludePrefix extends boolean,\n Ignore,\n Pre extends string,\n DEPTH extends _DEPTHCOUNT,\n> = V extends TypedRecordInstance ? __InternalExtract<MAX_DEPTH, T, V, IncludePrefix, Ignore, Pre, DEPTH> : never;\n\ntype _ExtractUnion<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n IncludePrefix extends boolean,\n Ignore,\n Pre,\n DEPTH extends _DEPTHCOUNT,\n> = {\n // for each string key in the record,\n [K in keyof T]: IsUniqueSymbol<K> extends true\n ? never\n : K extends string\n ? // we recursively extract any values that resolve to a TypedRecordInstance\n __ExtractIfRecord<\n MAX_DEPTH,\n T,\n Unpacked<Awaited<T[K]>>,\n IncludePrefix,\n Ignore,\n Pre extends string ? `${Pre}.${K}` : K,\n DEPTH\n >\n : never;\n // then we return any value that is not 'never'\n}[keyof T];\n\n/**\n * A Utility that extracts either resource types or resource paths from a TypedRecordInstance.\n *\n * Its limitations are mostly around its intentional non-recursiveness. It presumes that APIs which\n * implement includes will not allow cyclical include paths, and will collapse includes by type.\n *\n * This follows closer to the JSON:API fields spec than to the includes spec in nature, but in\n * practice it is so impracticle for an API to allow z-algo include paths that this is probably\n * reasonable.\n *\n * We may need to revisit this in the future, opting to either make this restriction optional or\n * to allow for other strategies.\n *\n * There's a 90% chance this particular implementation belongs being in the JSON:API package instead\n * of core-types, but it's here for now.\n *\n */\ntype ExtractUnion<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n IncludePrefix extends boolean = false,\n Ignore = NONE,\n Pre = NONE,\n DEPTH extends _DEPTHCOUNT = 1,\n> = Exclude<\n IncludePrefix extends true\n ? // if we want to include prefix, we union with the prefix. Outer Exclude will filter any \"NONE\" types\n _ExtractUnion<MAX_DEPTH, T, IncludePrefix, Ignore, Pre, DEPTH> | Pre\n : // Else we just union the types.\n _ExtractUnion<MAX_DEPTH, T, IncludePrefix, Ignore, Pre, DEPTH> | T[typeof Type],\n NONE\n>;\n\ntype _DEPTHCOUNT = 1 | 2 | 3 | 4 | 5;\ntype INC_DEPTH<START extends _DEPTHCOUNT> = START extends 1 ? 2 : START extends 2 ? 3 : START extends 3 ? 4 : 5;\ntype IS_MAX_DEPTH<\n DEPTH extends _DEPTHCOUNT,\n MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH,\n> = DEPTH extends MAX_DEPTH ? true : false;\ntype DEFAULT_MAX_DEPTH = 3;\n/**\n * A utility that provides the union of all ResourceName for all potential\n * includes for the given TypedRecordInstance.\n *\n */\nexport type ExtractSuggestedCacheTypes<\n T extends TypedRecordInstance,\n MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH,\n> = ExtractUnion<MAX_DEPTH, T>; // ToPaths<ExpandIgnore<T, true>, false>;\n\n/**\n * A utility that provides the union type of all valid include paths for the given\n * TypedRecordInstance.\n *\n * Cyclical paths are filtered out.\n *\n */\nexport type Includes<T extends TypedRecordInstance, MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH> = ExtractUnion<\n MAX_DEPTH,\n T,\n true\n>;\n\n/**\n * A type-erased placeholder for a record instance, used where the\n * specific record type is not known or not relevant.\n */\nexport type OpaqueRecordInstance = unknown;\n\n/**\n * @internal\n */\nexport type _StringSatisfiesIncludes<T extends string, SET extends string, FT extends string> = T extends SET\n ? FT\n : T extends `${infer U},${infer V}`\n ? U extends SET\n ? _StringSatisfiesIncludes<V, Exclude<SET, U>, FT>\n : never\n : never;\n\n/**\n * Validates that the comma-separated-string `T` (e.g. `'company,company.ceo,friends'`)\n * only contains paths present in the union `SET` (typically {@link Includes}).\n *\n * TypeScript cannot autocomplete against this type; prefer {@link createIncludeValidator}\n * for a better development experience unless you are writing a similar wrapper utility.\n *\n * @example\n * ```ts\n * import type { StringSatisfiesIncludes, Includes } from '@warp-drive/core/types/record';\n *\n * const includes: StringSatisfiesIncludes<\n * 'company,company.ceo,friends',\n * Includes<User>\n * > = 'company,company.ceo,friends';\n * ```\n */\nexport type StringSatisfiesIncludes<T extends string, SET extends string> = _StringSatisfiesIncludes<T, SET, T>;\n\n/**\n * Creates a runtime validator function for comma-separated `include` strings,\n * ensuring at compile time that only valid paths for `T` (per {@link Includes})\n * are supplied.\n *\n * @example\n * ```ts\n * import { createIncludeValidator } from '@warp-drive/core/types/record';\n *\n * const userIncludesValidator = createIncludeValidator<User>;\n *\n * userIncludesValidator('company,company.ceo,friends');\n * ```\n */\nexport function createIncludeValidator<T extends TypedRecordInstance>() {\n return function validateIncludes<U extends string>(includes: StringSatisfiesIncludes<U, Includes<T>>): U {\n return includes;\n };\n}\n\n/**\n * A utility that takes two types, K and T, and produces a new type that is a \"mask\" of T based on K.\n *\n * That's a mouthful, so let's break it down:\n *\n * Let's say you have a User type and an Address type.\n *\n * ```ts\n * interface Address {\n * street: string;\n * city: string;\n * state: string;\n * zip: string;\n * }\n *\n * interface User {\n * name: string;\n * title: string;\n * address: Address;\n * }\n * ```\n *\n * Now, imagine you want to load a preview of the user with some information about their address,\n * but you don't want to load the entire user or address. You probably want to still ensure\n * the type of the data you do load matches the underlying Address and User types, but doesn't\n * include everything.\n *\n * If you did this manually, you might do something like this:\n *\n * ```ts\n * interface UserPreview {\n * name: string;\n * address: AddressPreview;\n * }\n *\n * interface AddressPreview {\n * city: string;\n * }\n * ```\n *\n * From a TypeScript performance perspective, this is the best way to approach these preview\n * types, but this is also tedious and error-prone, especially if the User or Address types change.\n *\n * For Address, we could create a validated type using `Pick`:\n *\n * ```ts\n * type AddressPreview = Pick<Address, 'city'>;\n * ```\n *\n * This ensures that if the Address type changes, our AddressPreview will still be valid.\n * However, for UserPreview, we can't just use `Pick` because the `address` property is of type `Address`,\n * not `AddressPreview`. This is where the `Mask` type comes in.\n *\n * With `Mask`, we define the `UserPreview` in two parts\n * - first, we define the subset of fields we want to include from `User`, using `Pick` or an interface.\n * - then, we use `Mask` to replace the related types of fields like Address with their more limited subset.\n *\n * Here's how we can do it:\n *\n * ```ts\n * // First, we define the base of UserPreview with Pick\n * type UserPreviewBase = Pick<User, 'name' | 'address'>;\n * // Then, we use Mask to replace Address with AddressPreview\n * type UserPreview = Mask<{ address: AddressPreview }, UserPreviewBase>;\n * ```\n *\n * Now, `UserPreview` will have the `name` field from `User` and the `address` field will be of type `AddressPreview`.\n * This way, if the `User` or `Address` types change, TypeScript will ensure that our `UserPreview` and `AddressPreview`\n * types remain valid and consistent with the underlying types.\n *\n * But what if your app has data with massive interfaces such that the TypeScript performance of this\n * approach becomes a problem? In that case, see {@link Validate}\n */\nexport type Mask<K extends object, T extends K> = {\n [P in keyof T]: P extends keyof K ? (T[P] extends K[P] ? K[P] : never) : T[P];\n};\n\n/**\n * A utility that takes two types, K and T, and ensures that K is a valid subset of T.\n *\n * That's a mouthful, so let's break it down:\n *\n * Let's say you have a User type and an Address type.\n *\n * ```ts\n * interface Address {\n * street: string;\n * city: string;\n * state: string;\n * zip: string;\n * }\n *\n * interface User {\n * name: string;\n * title: string;\n * address: Address;\n * }\n * ```\n *\n * Now, imagine you want to load a preview of the user with some information about their address,\n * but you don't want to load the entire user or address. You probably want to still ensure\n * the type of the data you do load matches the underlying Address and User types, but doesn't\n * include everything.\n *\n * You might do something like this:\n *\n * ```ts\n * interface UserPreview {\n * name: string;\n * address: AddressPreview;\n * }\n *\n * interface AddressPreview {\n * city: string;\n * }\n * ```\n *\n * From a TypeScript performance perspective, this is the best way to approach these preview\n * types, but this is also error-prone, especially if the User or Address types change.\n *\n * Validate can help ensure that your preview types remain valid.\n *\n * ```ts\n * type IsValidUserPreview = Validate<UserPreview, User>; // This will be valid\n * ```\n *\n * For help creating subsets of types, see {@link Mask}\n */\nexport type Validate<K extends object, T extends K> = T extends K ? K : never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgOA,SAAgBA,yBAAwD;CACtE,OAAO,SAASC,iBAAmCC,UAAsD;EACvG,OAAOA;CACT;AACF"}
@@ -1,2 +1,2 @@
1
- import { An as SkipCache, Cn as PostQueryRequestOptions, Dn as RequestInfo, En as RequestContext, Fn as FetchError, Mn as StructuredDocument, Nn as StructuredErrorDocument, On as ResponseInfo, Pn as UpdateRequestOptions, Sn as ImmutableUpdateRequestOptions, Tn as RemotelyAccessibleIdentifier, _n as IS_FUTURE, bn as ImmutableHeaders, dn as CreateRequestOptions, fn as DeleteRequestOptions, gn as HTTPMethod, hn as FindRecordRequestOptions, jn as StructuredDataDocument, kn as STRUCTURED, ln as CacheOptions, mn as FindRecordOptions, pn as EnableHydration, un as ConstrainedRequestOptions, vn as ImmutableCreateRequestOptions, wn as QueryRequestOptions, xn as ImmutableRequestInfo, yn as ImmutableDeleteRequestOptions } from "../internal-Cz-893zD.js";
1
+ import { An as EnableHydration, Bn as PostQueryRequestOptions, Dn as ConstrainedRequestOptions, En as CacheOptions, Fn as ImmutableCreateRequestOptions, Gn as ResponseInfo, Hn as RemotelyAccessibleIdentifier, In as ImmutableDeleteRequestOptions, Jn as StructuredDataDocument, Kn as STRUCTURED, Ln as ImmutableHeaders, Mn as FindRecordRequestOptions, Nn as HTTPMethod, On as CreateRequestOptions, Pn as IS_FUTURE, Qn as FetchError, Rn as ImmutableRequestInfo, Un as RequestContext, Vn as QueryRequestOptions, Wn as RequestInfo, Xn as StructuredErrorDocument, Yn as StructuredDocument, Zn as UpdateRequestOptions, jn as FindRecordOptions, kn as DeleteRequestOptions, qn as SkipCache, zn as ImmutableUpdateRequestOptions } from "../internal-DtWOpxrR.js";
2
2
  export { CacheOptions, ConstrainedRequestOptions, CreateRequestOptions, DeleteRequestOptions, EnableHydration, type FetchError, FindRecordOptions, FindRecordRequestOptions, HTTPMethod, IS_FUTURE, ImmutableCreateRequestOptions, ImmutableDeleteRequestOptions, ImmutableHeaders, ImmutableRequestInfo, ImmutableUpdateRequestOptions, PostQueryRequestOptions, QueryRequestOptions, RemotelyAccessibleIdentifier, RequestContext, RequestInfo, ResponseInfo, STRUCTURED, SkipCache, StructuredDataDocument, StructuredDocument, StructuredErrorDocument, UpdateRequestOptions };
@@ -1,4 +1,4 @@
1
- import { n as getOrSetUniversal, t as getOrSetGlobal } from "../-private-_1kbGvX1.js";
1
+ import { n as getOrSetUniversal, t as getOrSetGlobal } from "../-private-C5eqeju3.js";
2
2
 
3
3
  //#region src/types/request.ts
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","names":["getOrSetGlobal","getOrSetUniversal","SkipCache","Symbol","for","EnableHydration","IS_FUTURE","STRUCTURED"],"sources":["../../src/types/request.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Future, Handler } from '../request.ts';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Fetch } from '../request/-private/fetch.ts';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { RequestManager } from '../request/-private/manager.ts';\nimport type { FetchError } from '../request/-private/utils.ts';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { RequestLoadingState } from '../signals/request-state.ts';\nimport type { Store } from '../store/-private.ts';\nimport { getOrSetGlobal, getOrSetUniversal } from './-private.ts';\nimport type { ResourceKey } from './identifier.ts';\nimport type { QueryParamsSerializationOptions } from './params.ts';\nimport type {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Includes,\n TypeFromInstanceOrString,\n} from './record.ts';\nimport type { ResourceIdentifierObject } from './spec/json-api-raw.ts';\nimport type { RequestSignature } from './symbols.ts';\n\n/**\n * A {@link RequestInfo.cacheOptions | cacheOptions} flag which, when set,\n * signals that a request should never be handled by the cache-manager and\n * thus will never resolve from cache nor update the cache.\n */\nexport const SkipCache: '___(unique) Symbol(SkipCache)' = getOrSetUniversal('SkipCache', Symbol.for('wd:skip-cache'));\n/**\n * A {@link RequestInfo} flag which, when set, signals to the store's\n * `instantiateRecord` hook that the resolved content should be hydrated\n * into reactive records rather than returned as raw data.\n */\nexport const EnableHydration: '___(unique) Symbol(EnableHydration)' = getOrSetUniversal(\n 'EnableHydration',\n Symbol.for('wd:enable-hydration')\n);\n/**\n * @private\n */\nexport const IS_FUTURE: '___(unique) Symbol(IS_FUTURE)' = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));\n/**\n * @private\n */\nexport const STRUCTURED: '___(unique) Symbol(DOC)' = getOrSetGlobal('DOC', Symbol('DOC'));\n\nexport type { FetchError };\n\n/**\n * The HTTP methods WarpDrive's request layer supports.\n */\nexport type HTTPMethod =\n | 'QUERY'\n | 'GET'\n | 'OPTIONS'\n | 'POST'\n | 'PUT'\n | 'PATCH'\n | 'DELETE'\n | 'HEAD'\n | 'CONNECT'\n | 'TRACE';\n\n/**\n * Use these options to adjust {@link CacheHandler} behavior for a request\n * via {@link RequestInfo.cacheOptions}.\n *\n */\nexport interface CacheOptions {\n /**\n * A key that uniquely identifies this request. If not present, the url wil be used\n * as the key for any GET request, while all other requests will not be cached.\n *\n */\n key?: string;\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n *\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n *\n */\n backgroundReload?: boolean;\n /**\n * Useful for metadata around when to invalidate the cache. Typically used\n * by strategies that invalidate requests by resource type when a new resource\n * of that type has been created. See the CachePolicy implementation\n * provided by `@ember-data/request-utils` for an example.\n *\n * It is recommended to only use this for query/queryRecord requests where\n * new records created later would affect the results, though using it for\n * findRecord requests is also supported if desired where it may be useful\n * when a create may affect the result of a sideloaded relationship.\n *\n * Generally it is better to patch the cache directly for relationship updates\n * than to invalidate findRecord requests for one.\n *\n */\n // TODO: Ideally this would be T extends TypedRecordInstance ? ExtractSuggestedCacheTypes<T>[] : string[];\n // but that leads to `Type instantiation is excessively deep and possibly infinite.`\n // issues when `T` has many properties.\n types?: string[];\n\n /**\n * If true, the request will never be handled by the cache-manager and thus\n * will never resolve from cache nor update the cache.\n *\n * Generally this is only used for legacy request that manage resource cache\n * updates in a non-standard way via the LegacyNetworkHandler.\n *\n */\n [SkipCache]?: boolean;\n}\n/**\n * The request shape produced by the `findRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type FindRecordRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'GET';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions;\n /**\n * the name of the request operation\n */\n op: 'findRecord';\n /**\n * the resource being requested\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `query` request builders, for\n * use with {@link Store.request}.\n */\nexport type QueryRequestOptions<RT = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'GET';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions;\n /**\n * the name of the request operation\n */\n op: 'query';\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `postQuery` request builders, for\n * use with {@link Store.request}.\n */\nexport type PostQueryRequestOptions<RT = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'POST' | 'QUERY';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * see {@link CacheOptions}. A `key` is required since `POST`/`QUERY`\n * requests otherwise have no cache-safe way to derive one from the url.\n */\n cacheOptions: CacheOptions & {\n /**\n * a key that uniquely identifies this request\n */\n key: string;\n };\n /**\n * the name of the request operation\n */\n op: 'query';\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `deleteRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type DeleteRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'DELETE';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the name of the request operation\n */\n op: 'deleteRecord';\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * data for handlers to convert into the request body\n */\n data: {\n /**\n * the resource being deleted\n */\n record: ResourceKey<TypeFromInstanceOrString<T>>;\n };\n /**\n * the resource being deleted\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\ntype ImmutableRequest<T> = Readonly<T> & {\n readonly headers: ImmutableHeaders;\n readonly records: [ResourceKey];\n};\n\n/**\n * The request shape produced by the `updateRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type UpdateRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'PATCH' | 'PUT';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the name of the request operation\n */\n op: 'updateRecord';\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * data for handlers to convert into the request body\n */\n data: {\n /**\n * the resource being updated\n */\n record: ResourceKey<TypeFromInstanceOrString<T>>;\n };\n /**\n * the resource being updated\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `createRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type CreateRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'POST';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the name of the request operation\n */\n op: 'createRecord';\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * data for handlers to convert into the request body\n */\n data: {\n /**\n * the resource being created\n */\n record: ResourceKey<TypeFromInstanceOrString<T>>;\n };\n /**\n * the resource being created\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The immutable, handler-facing form of {@link DeleteRequestOptions}.\n */\nexport type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;\n/**\n * The immutable, handler-facing form of {@link UpdateRequestOptions}.\n */\nexport type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;\n/**\n * The immutable, handler-facing form of {@link CreateRequestOptions}.\n */\nexport type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;\n\n/**\n * A minimal reference to a resource sufficient to build a URL for it,\n * as accepted by the request builders.\n */\nexport type RemotelyAccessibleIdentifier<T extends string = string> = {\n /**\n * the resource's persisted id\n */\n id: string;\n /**\n * the resource's type\n */\n type: T;\n /**\n * the local identifier WarpDrive has assigned to the resource, if known\n */\n lid?: string;\n};\n\n/**\n * Options accepted by the request builders for constraining how a\n * request's url is constructed and how the request interacts with the cache.\n */\nexport interface ConstrainedRequestOptions {\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n */\n backgroundReload?: boolean;\n /**\n * The host to use when constructing the request's url, overriding any\n * host configured via `setBuildURLConfig`.\n */\n host?: string;\n /**\n * The namespace to use when constructing the request's url, overriding\n * any namespace configured via `setBuildURLConfig`.\n */\n namespace?: string;\n /**\n * The resource path to use when constructing the request's url,\n * overriding the default of pluralizing the resource's type.\n */\n resourcePath?: string;\n /**\n * Options for how to serialize the request's query params, see {@link QueryParamsSerializationOptions}.\n */\n urlParamsSettings?: QueryParamsSerializationOptions;\n}\n\n/**\n * Options accepted by the `findRecord` request builders.\n */\nexport interface FindRecordOptions extends ConstrainedRequestOptions {\n /**\n * the relationship paths to sideload, see {@link Includes}\n */\n include?: string | string[];\n}\n\n/**\n * When a {@link Future} resolves, it returns an object\n * containing the original {@link RequestInfo | request},\n * the {@link Response | response} set by the handler chain (if any), and\n * the processed content.\n */\nexport interface StructuredDataDocument<T> {\n /**\n * @private\n */\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n /**\n * the response set by the handler chain, if any\n */\n response: Response | ResponseInfo | null;\n /**\n * the processed content of the response\n */\n content: T;\n}\n\n/**\n * When a {@link Future} rejects, it throws either an {@link Error}\n * an {@link AggregateError} or a {@link DOMException} that maintains\n * the `{ request, response, content }` shape but is also an Error instance\n * itself.\n *\n * If using the error originates from the {@link Fetch | Fetch Handler}\n * the error will be a {@link FetchError}\n */\nexport interface StructuredErrorDocument<T = unknown> extends Error {\n /**\n * @private\n */\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n /**\n * the response set by the handler chain, if any\n */\n response: Response | ResponseInfo | null;\n /**\n * the error that caused the request to fail\n */\n error: string | object;\n /**\n * the processed content of the response, if any was received before the failure\n */\n content?: T;\n}\n\n/**\n * A union of the resolve/reject data types for the {@link Future}\n * returned by {@link Store.request | request}\n *\n * See also the docs for:\n *\n * - {@link Future}\n * - {@link StructuredDataDocument} (resolved/successful requests)\n * - {@link StructuredErrorDocument} (rejected/failed requests)\n */\nexport type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;\n\n/**\n * The {@link RequestInit} interface accepted by the native {@link fetch} API.\n *\n * WarpDrive provides our own typings due to incompleteness in the native typings.\n *\n * @privateRemarks\n * - [MDN Reference (fetch)](https://developer.mozilla.org/docs/Web/API/Window/fetch)\n * - [MDN Reference (RequestInit)](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit)\n * - [MDN Reference (Request)](https://developer.mozilla.org/docs/Web/API/Request)\n *\n */\ninterface NativeRequestInit {\n /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.\n */\n cache?: RequestCache;\n /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.\n */\n credentials?: RequestCredentials;\n /** Returns the kind of resource requested by request, e.g., \"document\" or \"script\".\n */\n destination?: RequestDestination;\n /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the \"Host\" header.\n */\n headers?: Headers;\n /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]\n */\n integrity?: string;\n /** Returns a boolean indicating whether or not request can outlive the global in which it was created.\n */\n keepalive?: boolean;\n /** Returns request's HTTP method, which is \"GET\" by default.\n */\n method?: HTTPMethod;\n /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs.\n *\n * `no-cors` is not allowed for streaming request bodies.\n *\n */\n mode?: RequestMode;\n /**\n * provides an explicit priority hint for the request.\n */\n priority?: RequestPriority;\n /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.\n */\n redirect?: RequestRedirect;\n /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and \"about:client\" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made.\n */\n referrer?: string;\n /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer.\n */\n referrerPolicy?: ReferrerPolicy;\n /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.\n */\n signal?: AbortSignal;\n /** Returns the URL of request as a string.\n */\n url?: string;\n /** Any body that you want to add to your request. Note that a GET or HEAD request may not have a body.\n */\n body?: BodyInit | null;\n\n /**\n * When sending a ReadableStream as the body of a request, 'half' must be\n * specified.\n *\n * [Half Duplex Further Reading](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#half_duplex)\n *\n */\n duplex?: 'half';\n}\n\n/**\n * A read-only {@link Headers} instance, as passed to {@link Handler | Handlers}\n * via {@link ImmutableRequestInfo.headers}.\n */\nexport interface ImmutableHeaders extends Headers {\n /**\n * Returns a mutable clone of these headers, if supported by the implementation.\n */\n clone?(): Headers;\n /**\n * Returns the headers as an array of `[key, value]` pairs.\n */\n toJSON(): [string, string][];\n}\n\n/**\n * Extends JavaScript's native {@link fetch} {@link NativeRequestInit | RequestInit} with additional\n * properties specific to the {@link RequestManager | RequestManager's} capabilities.\n *\n * This interface is used to define the shape of a request that can be made via\n * either the {@link RequestManager.request} or {@link Store.request} methods.\n *\n * @privateRemarks\n * - [MDN Reference (fetch)](https://developer.mozilla.org/docs/Web/API/Window/fetch)\n * - [MDN Reference (RequestInit)](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit)\n * - [MDN Reference (Request)](https://developer.mozilla.org/docs/Web/API/Request)\n *\n * @public\n * @since 4.12\n */\nexport interface RequestInfo<RT = unknown> extends NativeRequestInit {\n /**\n * If provided, used instead of the AbortController auto-configured for each request by the RequestManager\n *\n */\n controller?: AbortController;\n\n /**\n * @see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions;\n /**\n * The {@link Store} the request was made against, if made via\n * {@link Store.request} rather than directly against a {@link RequestManager}.\n *\n * A {@link Handler} can read this off of {@link RequestContext.request | context.request}\n * to reach store state (the cache, other services attached to a custom\n * store subclass, etc.) without needing any Ember DI/`setOwner` wiring at\n * handler-construction time. This works for a handler of any shape (a\n * function, plain object, or class) because the store is attached to each\n * request individually rather than to the handler itself.\n *\n * The trade-off is that this is only populated for requests issued via\n * {@link Store.request | store.request(...)}; a request issued directly\n * against a {@link RequestManager} will not have it set unless the caller\n * supplies it explicitly. Handlers that rely on it should treat it as\n * optional.\n *\n * @example\n * ```ts\n * const LoggingHandler = {\n * request<T>(context: RequestContext, next: NextFn<T>) {\n * const store = context.request.store;\n * if (store) {\n * console.log(`[${store.constructor.name}] ${context.request.url ?? ''}`);\n * }\n * return next(context.request);\n * },\n * };\n * ```\n */\n store?: Store;\n\n /**\n * The name of the request operation, if any (e.g. `'findRecord'`, `'query'`).\n */\n op?: string;\n\n /**\n * The {@link ResourceKey | ResourceKeys} of the primary resources involved in the request\n * (if any). This may be used by handlers to perform transactional\n * operations on the store.\n *\n */\n records?: ResourceKey[];\n\n /**\n * If true, this request will not be tracked by test waiters.\n */\n disableTestWaiter?: boolean;\n /**\n * data that a handler should convert into\n * the query (GET) or body (POST).\n *\n * Note: It is recommended that builders set query params\n * and body directly in most scenarios.\n *\n */\n data?: Record<string, unknown>;\n /**\n * options specifically intended for {@link Handler | Handlers}\n * to utilize to process the request\n *\n */\n options?: Record<string, unknown>;\n\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n\n /**\n * see {@link EnableHydration}\n */\n [EnableHydration]?: boolean;\n}\n\n/**\n * Immutable version of {@link RequestInfo}. This is what is passed to handlers.\n *\n */\nexport type ImmutableRequestInfo<RT = unknown> = Readonly<Omit<RequestInfo<RT>, 'controller'>> & {\n /**\n * see {@link CacheOptions}\n */\n readonly cacheOptions?: Readonly<CacheOptions>;\n /**\n * see {@link ImmutableHeaders}\n */\n readonly headers?: ImmutableHeaders;\n /**\n * see {@link RequestInfo.data}\n */\n readonly data?: Readonly<Record<string, unknown>>;\n /**\n * see {@link RequestInfo.options}\n */\n readonly options?: Readonly<Record<string, unknown>>;\n\n /** Whether the request body has been read.\n */\n readonly bodyUsed?: boolean;\n};\n\n/**\n * An immutable, JSON-serializable subset of the native {@link Response}\n * interface.\n */\nexport interface ResponseInfo {\n /**\n * see {@link ImmutableHeaders}\n */\n readonly headers: ImmutableHeaders; // to do, maybe not this?\n /**\n * whether the response's status code was in the 200-299 range\n */\n readonly ok: boolean;\n /**\n * whether the response is the result of a redirect\n */\n readonly redirected: boolean;\n /**\n * the response's HTTP status code\n */\n readonly status: number;\n /**\n * the status message associated with the response's status code\n */\n readonly statusText: string;\n /**\n * the type of the response, see [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n */\n readonly type: ResponseType;\n /**\n * the url of the response\n */\n readonly url: string;\n}\n\n/**\n * The object a {@link Handler} uses to fulfill a request: it provides a\n * readonly view of the {@link RequestContext.request | request} and methods\n * for supplying the {@link Future}'s stream and final response.\n */\nexport interface RequestContext {\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n /**\n * a unique id for this request\n */\n id: number;\n\n /**\n * Supplies the stream of the response's content, if available, enabling\n * consumers to monitor download progress via {@link RequestLoadingState}.\n */\n setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;\n /**\n * Supplies the response for the request.\n */\n setResponse(response: Response | ResponseInfo | null): void;\n}\n"],"mappings":";;;;;;;;AA0BA,MAAaE,YAA6CD,kBAAkB,aAAaE,OAAOC,IAAI,eAAe,CAAC;;;;;;AAMpH,MAAaC,kBAAyDJ,kBACpE,mBACAE,OAAOC,IAAI,qBAAqB,CAClC;;;;AAIA,MAAaE,YAA6CN,eAAe,aAAaG,OAAO,WAAW,CAAC;;;;AAIzG,MAAaI,aAAwCP,eAAe,OAAOG,OAAO,KAAK,CAAC"}
1
+ {"version":3,"file":"request.js","names":["getOrSetGlobal","getOrSetUniversal","SkipCache","Symbol","for","EnableHydration","IS_FUTURE","STRUCTURED"],"sources":["../../src/types/request.ts"],"sourcesContent":["// oxlint-disable-next-line no-unused-vars\nimport type { Future, Handler } from '../request.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { Fetch } from '../request/-private/fetch.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { RequestManager } from '../request/-private/manager.ts';\nimport type { FetchError } from '../request/-private/utils.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { RequestLoadingState } from '../signals/request-state.ts';\nimport type { Store } from '../store/-private.ts';\nimport { getOrSetGlobal, getOrSetUniversal } from './-private.ts';\nimport type { ResourceKey } from './identifier.ts';\nimport type { QueryParamsSerializationOptions } from './params.ts';\nimport type {\n // oxlint-disable-next-line no-unused-vars\n Includes,\n TypeFromInstanceOrString,\n} from './record.ts';\nimport type { ResourceIdentifierObject } from './spec/json-api-raw.ts';\nimport type { RequestSignature } from './symbols.ts';\n\n/**\n * A {@link RequestInfo.cacheOptions | cacheOptions} flag which, when set,\n * signals that a request should never be handled by the cache-manager and\n * thus will never resolve from cache nor update the cache.\n */\nexport const SkipCache: '___(unique) Symbol(SkipCache)' = getOrSetUniversal('SkipCache', Symbol.for('wd:skip-cache'));\n/**\n * A {@link RequestInfo} flag which, when set, signals to the store's\n * `instantiateRecord` hook that the resolved content should be hydrated\n * into reactive records rather than returned as raw data.\n */\nexport const EnableHydration: '___(unique) Symbol(EnableHydration)' = getOrSetUniversal(\n 'EnableHydration',\n Symbol.for('wd:enable-hydration')\n);\n/**\n * @private\n */\nexport const IS_FUTURE: '___(unique) Symbol(IS_FUTURE)' = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));\n/**\n * @private\n */\nexport const STRUCTURED: '___(unique) Symbol(DOC)' = getOrSetGlobal('DOC', Symbol('DOC'));\n\nexport type { FetchError };\n\n/**\n * The HTTP methods WarpDrive's request layer supports.\n */\nexport type HTTPMethod =\n | 'QUERY'\n | 'GET'\n | 'OPTIONS'\n | 'POST'\n | 'PUT'\n | 'PATCH'\n | 'DELETE'\n | 'HEAD'\n | 'CONNECT'\n | 'TRACE';\n\n/**\n * Use these options to adjust {@link CacheHandler} behavior for a request\n * via {@link RequestInfo.cacheOptions}.\n *\n */\nexport interface CacheOptions {\n /**\n * A key that uniquely identifies this request. If not present, the url wil be used\n * as the key for any GET request, while all other requests will not be cached.\n *\n */\n key?: string;\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n *\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n *\n */\n backgroundReload?: boolean;\n /**\n * Useful for metadata around when to invalidate the cache. Typically used\n * by strategies that invalidate requests by resource type when a new resource\n * of that type has been created. See the CachePolicy implementation\n * provided by `@ember-data/request-utils` for an example.\n *\n * It is recommended to only use this for query/queryRecord requests where\n * new records created later would affect the results, though using it for\n * findRecord requests is also supported if desired where it may be useful\n * when a create may affect the result of a sideloaded relationship.\n *\n * Generally it is better to patch the cache directly for relationship updates\n * than to invalidate findRecord requests for one.\n *\n */\n // TODO: Ideally this would be T extends TypedRecordInstance ? ExtractSuggestedCacheTypes<T>[] : string[];\n // but that leads to `Type instantiation is excessively deep and possibly infinite.`\n // issues when `T` has many properties.\n types?: string[];\n\n /**\n * If true, the request will never be handled by the cache-manager and thus\n * will never resolve from cache nor update the cache.\n *\n * Generally this is only used for legacy request that manage resource cache\n * updates in a non-standard way via the LegacyNetworkHandler.\n *\n */\n [SkipCache]?: boolean;\n}\n/**\n * The request shape produced by the `findRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type FindRecordRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'GET';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions;\n /**\n * the name of the request operation\n */\n op: 'findRecord';\n /**\n * the resource being requested\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `query` request builders, for\n * use with {@link Store.request}.\n */\nexport type QueryRequestOptions<RT = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'GET';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions;\n /**\n * the name of the request operation\n */\n op: 'query';\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `postQuery` request builders, for\n * use with {@link Store.request}.\n */\nexport type PostQueryRequestOptions<RT = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'POST' | 'QUERY';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * see {@link CacheOptions}. A `key` is required since `POST`/`QUERY`\n * requests otherwise have no cache-safe way to derive one from the url.\n */\n cacheOptions: CacheOptions & {\n /**\n * a key that uniquely identifies this request\n */\n key: string;\n };\n /**\n * the name of the request operation\n */\n op: 'query';\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `deleteRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type DeleteRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'DELETE';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the name of the request operation\n */\n op: 'deleteRecord';\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * data for handlers to convert into the request body\n */\n data: {\n /**\n * the resource being deleted\n */\n record: ResourceKey<TypeFromInstanceOrString<T>>;\n };\n /**\n * the resource being deleted\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\ntype ImmutableRequest<T> = Readonly<T> & {\n readonly headers: ImmutableHeaders;\n readonly records: [ResourceKey];\n};\n\n/**\n * The request shape produced by the `updateRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type UpdateRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'PATCH' | 'PUT';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the name of the request operation\n */\n op: 'updateRecord';\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * data for handlers to convert into the request body\n */\n data: {\n /**\n * the resource being updated\n */\n record: ResourceKey<TypeFromInstanceOrString<T>>;\n };\n /**\n * the resource being updated\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The request shape produced by the `createRecord` request builders, for\n * use with {@link Store.request}.\n */\nexport type CreateRequestOptions<RT = unknown, T = unknown> = {\n /**\n * the url to request\n */\n url: string;\n /**\n * the HTTP method to use\n */\n method: 'POST';\n /**\n * the headers to send with the request\n */\n headers: Headers;\n /**\n * the name of the request operation\n */\n op: 'createRecord';\n /**\n * the body to send with the request\n */\n body?: string | BodyInit | FormData;\n /**\n * data for handlers to convert into the request body\n */\n data: {\n /**\n * the resource being created\n */\n record: ResourceKey<TypeFromInstanceOrString<T>>;\n };\n /**\n * the resource being created\n */\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n};\n\n/**\n * The immutable, handler-facing form of {@link DeleteRequestOptions}.\n */\nexport type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;\n/**\n * The immutable, handler-facing form of {@link UpdateRequestOptions}.\n */\nexport type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;\n/**\n * The immutable, handler-facing form of {@link CreateRequestOptions}.\n */\nexport type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;\n\n/**\n * A minimal reference to a resource sufficient to build a URL for it,\n * as accepted by the request builders.\n */\nexport type RemotelyAccessibleIdentifier<T extends string = string> = {\n /**\n * the resource's persisted id\n */\n id: string;\n /**\n * the resource's type\n */\n type: T;\n /**\n * the local identifier WarpDrive has assigned to the resource, if known\n */\n lid?: string;\n};\n\n/**\n * Options accepted by the request builders for constraining how a\n * request's url is constructed and how the request interacts with the cache.\n */\nexport interface ConstrainedRequestOptions {\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n */\n backgroundReload?: boolean;\n /**\n * The host to use when constructing the request's url, overriding any\n * host configured via `setBuildURLConfig`.\n */\n host?: string;\n /**\n * The namespace to use when constructing the request's url, overriding\n * any namespace configured via `setBuildURLConfig`.\n */\n namespace?: string;\n /**\n * The resource path to use when constructing the request's url,\n * overriding the default of pluralizing the resource's type.\n */\n resourcePath?: string;\n /**\n * Options for how to serialize the request's query params, see {@link QueryParamsSerializationOptions}.\n */\n urlParamsSettings?: QueryParamsSerializationOptions;\n}\n\n/**\n * Options accepted by the `findRecord` request builders.\n */\nexport interface FindRecordOptions extends ConstrainedRequestOptions {\n /**\n * the relationship paths to sideload, see {@link Includes}\n */\n include?: string | string[];\n}\n\n/**\n * When a {@link Future} resolves, it returns an object\n * containing the original {@link RequestInfo | request},\n * the {@link Response | response} set by the handler chain (if any), and\n * the processed content.\n */\nexport interface StructuredDataDocument<T> {\n /**\n * @private\n */\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n /**\n * the response set by the handler chain, if any\n */\n response: Response | ResponseInfo | null;\n /**\n * the processed content of the response\n */\n content: T;\n}\n\n/**\n * When a {@link Future} rejects, it throws either an {@link Error}\n * an {@link AggregateError} or a {@link DOMException} that maintains\n * the `{ request, response, content }` shape but is also an Error instance\n * itself.\n *\n * If using the error originates from the {@link Fetch | Fetch Handler}\n * the error will be a {@link FetchError}\n */\nexport interface StructuredErrorDocument<T = unknown> extends Error {\n /**\n * @private\n */\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n /**\n * the response set by the handler chain, if any\n */\n response: Response | ResponseInfo | null;\n /**\n * the error that caused the request to fail\n */\n error: string | object;\n /**\n * the processed content of the response, if any was received before the failure\n */\n content?: T;\n}\n\n/**\n * A union of the resolve/reject data types for the {@link Future}\n * returned by {@link Store.request | request}\n *\n * See also the docs for:\n *\n * - {@link Future}\n * - {@link StructuredDataDocument} (resolved/successful requests)\n * - {@link StructuredErrorDocument} (rejected/failed requests)\n */\nexport type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;\n\n/**\n * The {@link RequestInit} interface accepted by the native {@link fetch} API.\n *\n * WarpDrive provides our own typings due to incompleteness in the native typings.\n *\n * @privateRemarks\n * - [MDN Reference (fetch)](https://developer.mozilla.org/docs/Web/API/Window/fetch)\n * - [MDN Reference (RequestInit)](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit)\n * - [MDN Reference (Request)](https://developer.mozilla.org/docs/Web/API/Request)\n *\n */\ninterface NativeRequestInit {\n /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.\n */\n cache?: RequestCache;\n /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.\n */\n credentials?: RequestCredentials;\n /** Returns the kind of resource requested by request, e.g., \"document\" or \"script\".\n */\n destination?: RequestDestination;\n /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the \"Host\" header.\n */\n headers?: Headers;\n /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]\n */\n integrity?: string;\n /** Returns a boolean indicating whether or not request can outlive the global in which it was created.\n */\n keepalive?: boolean;\n /** Returns request's HTTP method, which is \"GET\" by default.\n */\n method?: HTTPMethod;\n /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs.\n *\n * `no-cors` is not allowed for streaming request bodies.\n *\n */\n mode?: RequestMode;\n /**\n * provides an explicit priority hint for the request.\n */\n priority?: RequestPriority;\n /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.\n */\n redirect?: RequestRedirect;\n /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and \"about:client\" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made.\n */\n referrer?: string;\n /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer.\n */\n referrerPolicy?: ReferrerPolicy;\n /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.\n */\n signal?: AbortSignal;\n /** Returns the URL of request as a string.\n */\n url?: string;\n /** Any body that you want to add to your request. Note that a GET or HEAD request may not have a body.\n */\n body?: BodyInit | null;\n\n /**\n * When sending a ReadableStream as the body of a request, 'half' must be\n * specified.\n *\n * [Half Duplex Further Reading](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#half_duplex)\n *\n */\n duplex?: 'half';\n}\n\n/**\n * A read-only {@link Headers} instance, as passed to {@link Handler | Handlers}\n * via {@link ImmutableRequestInfo.headers}.\n */\nexport interface ImmutableHeaders extends Headers {\n /**\n * Returns a mutable clone of these headers, if supported by the implementation.\n */\n clone?(): Headers;\n /**\n * Returns the headers as an array of `[key, value]` pairs.\n */\n toJSON(): [string, string][];\n}\n\n/**\n * Extends JavaScript's native {@link fetch} {@link NativeRequestInit | RequestInit} with additional\n * properties specific to the {@link RequestManager | RequestManager's} capabilities.\n *\n * This interface is used to define the shape of a request that can be made via\n * either the {@link RequestManager.request} or {@link Store.request} methods.\n *\n * @privateRemarks\n * - [MDN Reference (fetch)](https://developer.mozilla.org/docs/Web/API/Window/fetch)\n * - [MDN Reference (RequestInit)](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit)\n * - [MDN Reference (Request)](https://developer.mozilla.org/docs/Web/API/Request)\n *\n * @public\n * @since 4.12\n */\nexport interface RequestInfo<RT = unknown> extends NativeRequestInit {\n /**\n * If provided, used instead of the AbortController auto-configured for each request by the RequestManager\n *\n */\n controller?: AbortController;\n\n /**\n * @see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions;\n /**\n * The {@link Store} the request was made against, if made via\n * {@link Store.request} rather than directly against a {@link RequestManager}.\n *\n * A {@link Handler} can read this off of {@link RequestContext.request | context.request}\n * to reach store state (the cache, other services attached to a custom\n * store subclass, etc.) without needing any Ember DI/`setOwner` wiring at\n * handler-construction time. This works for a handler of any shape (a\n * function, plain object, or class) because the store is attached to each\n * request individually rather than to the handler itself.\n *\n * The trade-off is that this is only populated for requests issued via\n * {@link Store.request | store.request(...)}; a request issued directly\n * against a {@link RequestManager} will not have it set unless the caller\n * supplies it explicitly. Handlers that rely on it should treat it as\n * optional.\n *\n * @example\n * ```ts\n * const LoggingHandler = {\n * request<T>(context: RequestContext, next: NextFn<T>) {\n * const store = context.request.store;\n * if (store) {\n * console.log(`[${store.constructor.name}] ${context.request.url ?? ''}`);\n * }\n * return next(context.request);\n * },\n * };\n * ```\n */\n store?: Store;\n\n /**\n * The name of the request operation, if any (e.g. `'findRecord'`, `'query'`).\n */\n op?: string;\n\n /**\n * The {@link ResourceKey | ResourceKeys} of the primary resources involved in the request\n * (if any). This may be used by handlers to perform transactional\n * operations on the store.\n *\n */\n records?: ResourceKey[];\n\n /**\n * If true, this request will not be tracked by test waiters.\n */\n disableTestWaiter?: boolean;\n /**\n * data that a handler should convert into\n * the query (GET) or body (POST).\n *\n * Note: It is recommended that builders set query params\n * and body directly in most scenarios.\n *\n */\n data?: Record<string, unknown>;\n /**\n * options specifically intended for {@link Handler | Handlers}\n * to utilize to process the request\n *\n */\n options?: Record<string, unknown>;\n\n /**\n * @private used only to carry the response type for type inference purposes\n */\n [RequestSignature]?: RT;\n\n /**\n * see {@link EnableHydration}\n */\n [EnableHydration]?: boolean;\n}\n\n/**\n * Immutable version of {@link RequestInfo}. This is what is passed to handlers.\n *\n */\nexport type ImmutableRequestInfo<RT = unknown> = Readonly<Omit<RequestInfo<RT>, 'controller'>> & {\n /**\n * see {@link CacheOptions}\n */\n readonly cacheOptions?: Readonly<CacheOptions>;\n /**\n * see {@link ImmutableHeaders}\n */\n readonly headers?: ImmutableHeaders;\n /**\n * see {@link RequestInfo.data}\n */\n readonly data?: Readonly<Record<string, unknown>>;\n /**\n * see {@link RequestInfo.options}\n */\n readonly options?: Readonly<Record<string, unknown>>;\n\n /** Whether the request body has been read.\n */\n readonly bodyUsed?: boolean;\n};\n\n/**\n * An immutable, JSON-serializable subset of the native {@link Response}\n * interface.\n */\nexport interface ResponseInfo {\n /**\n * see {@link ImmutableHeaders}\n */\n readonly headers: ImmutableHeaders; // to do, maybe not this?\n /**\n * whether the response's status code was in the 200-299 range\n */\n readonly ok: boolean;\n /**\n * whether the response is the result of a redirect\n */\n readonly redirected: boolean;\n /**\n * the response's HTTP status code\n */\n readonly status: number;\n /**\n * the status message associated with the response's status code\n */\n readonly statusText: string;\n /**\n * the type of the response, see [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n */\n readonly type: ResponseType;\n /**\n * the url of the response\n */\n readonly url: string;\n}\n\n/**\n * The object a {@link Handler} uses to fulfill a request: it provides a\n * readonly view of the {@link RequestContext.request | request} and methods\n * for supplying the {@link Future}'s stream and final response.\n */\nexport interface RequestContext {\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n /**\n * a unique id for this request\n */\n id: number;\n\n /**\n * Supplies the stream of the response's content, if available, enabling\n * consumers to monitor download progress via {@link RequestLoadingState}.\n */\n setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;\n /**\n * Supplies the response for the request.\n */\n setResponse(response: Response | ResponseInfo | null): void;\n}\n"],"mappings":";;;;;;;;AA0BA,MAAaE,YAA6CD,kBAAkB,aAAaE,OAAOC,IAAI,eAAe,CAAC;;;;;;AAMpH,MAAaC,kBAAyDJ,kBACpE,mBACAE,OAAOC,IAAI,qBAAqB,CAClC;;;;AAIA,MAAaE,YAA6CN,eAAe,aAAaG,OAAO,WAAW,CAAC;;;;AAIzG,MAAaI,aAAwCP,eAAe,OAAOG,OAAO,KAAK,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as getOrSetUniversal } from "../-private-_1kbGvX1.js";
1
+ import { n as getOrSetUniversal } from "../-private-C5eqeju3.js";
2
2
 
3
3
  //#region src/types/runtime.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { n as HashFn, r as Transformation, t as Derivation } from "../../concepts-LHsLJZMl.js";
1
+ import { n as HashFn, r as Transformation, t as Derivation } from "../../concepts-DFldVwEM.js";
2
2
  export { Derivation, HashFn, Transformation };
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","names":["resourceSchema","schema","objectSchema","isResourceSchema","identity","kind","isLegacyResourceSchema","legacy"],"sources":["../../../src/types/schema/fields.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { SchemaService } from '../../types.ts';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { Cache } from '../cache.ts';\nimport type { ObjectValue, PrimitiveValue, Value } from '../json/raw.ts';\n\n/**\n * Options signature for Legacy Attributes.\n */\nexport interface AttrOptions {\n /**\n * A primitive value or a function which produces a value.\n */\n defaultValue?: PrimitiveValue | (() => Value);\n [key: string]: Value | (() => Value) | undefined;\n}\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link GenericField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\n /**\n * the name of the {@link Transformation} 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 raw data for the field.~~ (not yet implemented)\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 raw data for the field.~~ (not yet implemented)\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 * The name of the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link IdentityField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * entityUrn: '324523-sadf34-345'\n * }\n * ```\n *\n * But the app desires to use `record.id; // '324523-sadf34-345'`\n *\n * Then `name` would be set to `'id'` and\n * `sourceKey` would be set to `'entityUrn'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * the schema-objects it contains have 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?: {\n /**\n * The default value to use for the field when no value\n * has yet been set.\n */\n defaultValue?: PrimitiveValue;\n };\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 the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link ObjectField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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?: {\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n\n [key: string]: Value | undefined;\n };\n}\n\n/**\n * Represents a field whose value is an object\n * with a well-defined structure described by\n * a schema-object (a non-resource schema).\n *\n * If the object's structure is not well-defined,\n * use 'object' instead.\n *\n * By default, a SchemaObject within\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link SchemaObjectField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\n /**\n * If the field is not polymorphic:\n *\n * The name of the ObjectSchema that describes the\n * structure of the object.\n *\n * If the field is polymorphic:\n *\n * The name of the hashFn to use to extract\n * the type from the contained value or null.\n *\n * @public\n */\n type: string | null;\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 * If true, if no value for this field exists in the cache,\n * an empty `{}` will be used as the source for a new SchemaObject\n * of the associated schema type, as opposed to the field's\n * value being `null`.\n *\n * If `polymorphic` is `true`, defaultValue will be considered `false`.\n */\n defaultValue?: boolean;\n\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n\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 * The default is `'type'`.\n *\n * Valid options are:\n *\n * - `'@hash'` : will lookup the `@hash` function specified by\n * SchemaObjectField.type and use it to calculate the type for each value.\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.\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 the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link ArrayField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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?: {\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\n\n [key: string]: Value | undefined;\n };\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link SchemaArrayField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\n /**\n * If the SchemaArray is not polymorphic:\n *\n * The name of the ObjectSchema that describes the\n * structure of the objects in the array.\n *\n * If the SchemaArray is polymorphic:\n *\n * The name of the hashFn to use to extract\n * the type from contained members or null.\n *\n * @public\n */\n type: string | null;\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 * If true, if no value for this field exists in the cache,\n * an empty `[]` will be used as the value of the field,\n * as opposed to the field's value being `null`.\n *\n */\n defaultValue?: boolean;\n\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n\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 * The default is `'type'`.\n *\n * Valid options are:\n *\n * - `'@hash'` : will lookup the `@hash` function specified by\n * SchemaArrayField.type and use it to calculate the type for each value.\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.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link ResourceField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link CollectionField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 /**\n * The name of the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LegacyAttributeField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\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 * See {@link AttrOptions} for more info.\n */\n options?: AttrOptions;\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LegacyBelongsToField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 request infra\n * from @warp-drive/legacy/compat and the LegacyNetworkMiddleware for\n * adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `null`, or `data` points\n * to a resource present in the document's `included` array\n *\n * A related link lets you omit the related resource from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LinksModeBelongsToField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 @warp-drive/legacy/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 * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `null`, or `data` points\n * to a resource present in the document's `included` array\n *\n * A related link lets you omit the related resource from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LegacyHasManyField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\n\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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 @warp-drive/legacy/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `[]`, or every resource\n * identifier in `data` is present in the document's `included` array\n *\n * A related link lets you omit the related resources from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LinksModeHasManyField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 @warp-drive/legacy/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 * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `[]`, or every resource\n * identifier in `data` is present in the document's `included` array\n *\n * A related link lets you omit the related resources from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 LegacyMode and PolarisMode\n * field schemas that represent data that could be in\n * the cache.\n *\n * In other words this will not include types like alias\n * fields, local fields, or derived fields.\n *\n * @public\n */\nexport type CacheableFieldSchema =\n | IdentityField\n | GenericField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\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 | LegacyAttributeField\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 /**\n * A flag indicating that this is not a legacy resource schema.\n *\n * @public\n */\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 * @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 * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this resource should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: 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 /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n}\n\n/**\n * A union of {@link ResourceSchema} and {@link ObjectSchema} representing\n * any schema that can be registered with or returned by the SchemaService.\n *\n * @public\n */\nexport type Schema = ResourceSchema | ObjectSchema;\n\n/**\n * A trait for use on a PolarisMode record.\n *\n * Traits are reusable collections of fields that can be composed onto a\n * resource schema, often to describe a polymorphic capability shared by\n * multiple resource types.\n */\nexport interface PolarisTrait {\n /**\n * The name of the trait.\n *\n * This is the string referenced by a resource schema's `traits` array,\n * or by another trait's `traits` array, in order to make use of this\n * trait.\n */\n name: string;\n\n /**\n * The mode this trait is valid for use with.\n *\n * A PolarisTrait may only be applied to PolarisMode resource schemas.\n */\n mode: 'polaris';\n\n /**\n * The fields that this trait contributes to any resource schema\n * that implements it.\n */\n fields: PolarisModeFieldSchema[];\n\n /**\n * A list of other traits that this trait itself implements.\n *\n * As with a resource schema's `traits`, each entry should be a string\n * matching the `name` of another trait.\n */\n traits?: string[];\n}\n\n/**\n * A trait for use on a LegacyMode record.\n *\n * Traits are reusable collections of fields that can be composed onto a\n * resource schema, often to describe a polymorphic capability shared by\n * multiple resource types.\n */\nexport interface LegacyTrait {\n /**\n * The name of the trait.\n *\n * This is the string referenced by a resource schema's `traits` array,\n * or by another trait's `traits` array, in order to make use of this\n * trait.\n */\n name: string;\n\n /**\n * The mode this trait is valid for use with.\n *\n * A LegacyTrait may only be applied to LegacyMode resource schemas.\n */\n mode: 'legacy';\n\n /**\n * The fields that this trait contributes to any resource schema\n * that implements it.\n */\n fields: LegacyModeFieldSchema[];\n\n /**\n * A list of other traits that this trait itself implements.\n *\n * As with a resource schema's `traits`, each entry should be a string\n * matching the `name` of another trait.\n */\n traits?: string[];\n}\n\n/**\n * A union of\n * - {@link LegacyTrait}\n * - {@link PolarisTrait}\n */\nexport type Trait = LegacyTrait | PolarisTrait;\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\n/**\n * A union of all field schemas considered \"legacy\", i.e. those historically\n * associated with `@warp-drive/legacy/model`'s Attribute, BelongsTo and\n * HasMany fields, including their LinksMode variants.\n *\n * Available field schemas are:\n *\n * - {@link LegacyAttributeField}\n * - {@link LegacyBelongsToField}\n * - {@link LegacyHasManyField}\n * - {@link LinksModeBelongsToField}\n * - {@link LinksModeHasManyField}\n *\n * @public\n */\nexport type LegacyField =\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n\n/**\n * A union of all legacy relationship field schemas, i.e. {@link LegacyField}\n * excluding {@link LegacyAttributeField}.\n *\n * Available field schemas are:\n *\n * - {@link LegacyBelongsToField}\n * - {@link LegacyHasManyField}\n * - {@link LinksModeBelongsToField}\n * - {@link LinksModeHasManyField}\n *\n * @public\n */\nexport type LegacyRelationshipField =\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA68EA,SAAgBA,eACdC,QACG;CACH,OAAOA;AACT;;;;;;;;;AAUA,SAAgBC,aAAqCD,QAAc;CACjE,OAAOA;AACT;;;;;;AAOA,SAAgBE,iBAAiBF,QAAiE;CAChG,OAAOA,QAAQG,UAAUC,SAAS;AACpC;;;;;;AAOA,SAAgBC,uBAAuBL,QAAuE;CAC5G,OAAOE,iBAAiBF,MAAM,KAAKA,OAAOM,WAAW;AACvD"}
1
+ {"version":3,"file":"fields.js","names":["resourceSchema","schema","objectSchema","isResourceSchema","identity","kind","isLegacyResourceSchema","legacy"],"sources":["../../../src/types/schema/fields.ts"],"sourcesContent":["// oxlint-disable-next-line no-unused-vars\nimport type { SchemaService } from '../../types.ts';\n// oxlint-disable-next-line no-unused-vars\nimport type { Cache } from '../cache.ts';\nimport type { ObjectValue, PrimitiveValue, Value } from '../json/raw.ts';\n\n/**\n * Options signature for Legacy Attributes.\n */\nexport interface AttrOptions {\n /**\n * A primitive value or a function which produces a value.\n */\n defaultValue?: PrimitiveValue | (() => Value);\n [key: string]: Value | (() => Value) | undefined;\n}\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link GenericField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\n /**\n * the name of the {@link Transformation} 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 raw data for the field.~~ (not yet implemented)\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 raw data for the field.~~ (not yet implemented)\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 * The name of the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link IdentityField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * entityUrn: '324523-sadf34-345'\n * }\n * ```\n *\n * But the app desires to use `record.id; // '324523-sadf34-345'`\n *\n * Then `name` would be set to `'id'` and\n * `sourceKey` would be set to `'entityUrn'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * the schema-objects it contains have 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?: {\n /**\n * The default value to use for the field when no value\n * has yet been set.\n */\n defaultValue?: PrimitiveValue;\n };\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 the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link ObjectField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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?: {\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n\n [key: string]: Value | undefined;\n };\n}\n\n/**\n * Represents a field whose value is an object\n * with a well-defined structure described by\n * a schema-object (a non-resource schema).\n *\n * If the object's structure is not well-defined,\n * use 'object' instead.\n *\n * By default, a SchemaObject within\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link SchemaObjectField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\n /**\n * If the field is not polymorphic:\n *\n * The name of the ObjectSchema that describes the\n * structure of the object.\n *\n * If the field is polymorphic:\n *\n * The name of the hashFn to use to extract\n * the type from the contained value or null.\n *\n * @public\n */\n type: string | null;\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 * If true, if no value for this field exists in the cache,\n * an empty `{}` will be used as the source for a new SchemaObject\n * of the associated schema type, as opposed to the field's\n * value being `null`.\n *\n * If `polymorphic` is `true`, defaultValue will be considered `false`.\n */\n defaultValue?: boolean;\n\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n\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 * The default is `'type'`.\n *\n * Valid options are:\n *\n * - `'@hash'` : will lookup the `@hash` function specified by\n * SchemaObjectField.type and use it to calculate the type for each value.\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.\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 the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link ArrayField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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?: {\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\n\n [key: string]: Value | undefined;\n };\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link SchemaArrayField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\n /**\n * If the SchemaArray is not polymorphic:\n *\n * The name of the ObjectSchema that describes the\n * structure of the objects in the array.\n *\n * If the SchemaArray is polymorphic:\n *\n * The name of the hashFn to use to extract\n * the type from contained members or null.\n *\n * @public\n */\n type: string | null;\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 * If true, if no value for this field exists in the cache,\n * an empty `[]` will be used as the value of the field,\n * as opposed to the field's value being `null`.\n *\n */\n defaultValue?: boolean;\n\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\n /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n\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 * The default is `'type'`.\n *\n * Valid options are:\n *\n * - `'@hash'` : will lookup the `@hash` function specified by\n * SchemaArrayField.type and use it to calculate the type for each value.\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.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link ResourceField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link CollectionField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 /**\n * The name of the field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LegacyAttributeField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: string;\n\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 * See {@link AttrOptions} for more info.\n */\n options?: AttrOptions;\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LegacyBelongsToField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 request infra\n * from @warp-drive/legacy/compat and the LegacyNetworkMiddleware for\n * adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `null`, or `data` points\n * to a resource present in the document's `included` array\n *\n * A related link lets you omit the related resource from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LinksModeBelongsToField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 @warp-drive/legacy/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 * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `null`, or `data` points\n * to a resource present in the document's `included` array\n *\n * A related link lets you omit the related resource from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LegacyHasManyField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\n\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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 @warp-drive/legacy/model and the LegacyNetworkMiddleware for adapters and serializers.\n *\n * When true, none of the legacy support will be utilized. Sync relationships\n * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `[]`, or every resource\n * identifier in `data` is present in the document's `included` array\n *\n * A related link lets you omit the related resources from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 field as returned by the API\n * and inserted into the {@link Cache} if it differs\n * from {@link LinksModeHasManyField.name}\n *\n * For instance, if the API returns:\n *\n * ```ts\n * {\n * attributes: {\n * 'first-name': 'Chris'\n * }\n * }\n * ```\n *\n * But the app desires to use `record.firstName; // 'Chris'`\n *\n * Then `name` would be set to `'firstName'` and\n * `sourceKey` would be set to `'first-name'`.\n *\n * This option is only needed when the value differs from name.\n */\n sourceKey?: 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 * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this array is allowed to use.\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to arrays to support migrating away from deprecated behaviors\n * such as Ember's \"ArrayLike\" and FragmentArray from ember-data-model-fragments\n */\n arrayExtensions?: string[];\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 * If the inverse field definition uses a sourceKey,\n * this should still be the name of the field, not the sourceKey.\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 @warp-drive/legacy/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 * (`async: false`, currently the only supported combination) must satisfy\n * one of the following whenever pushed to the cache:\n *\n * - a `links.related` link is present, **or**\n * - the relationship is fully linked: `data` is `[]`, or every resource\n * identifier in `data` is present in the document's `included` array\n *\n * A related link lets you omit the related resources from `included`; a\n * `data` key that is missing entirely, or explicitly `undefined`, is never\n * valid unless a `links.related` link is present.\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 LegacyMode and PolarisMode\n * field schemas that represent data that could be in\n * the cache.\n *\n * In other words this will not include types like alias\n * fields, local fields, or derived fields.\n *\n * @public\n */\nexport type CacheableFieldSchema =\n | IdentityField\n | GenericField\n | ObjectField\n | SchemaObjectField\n | ArrayField\n | SchemaArrayField\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 | LegacyAttributeField\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 /**\n * A flag indicating that this is not a legacy resource schema.\n *\n * @public\n */\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 * @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 * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this resource should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: 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 /**\n * ::: warning ⚠️ Dangerous Feature Ahead\n * :::\n *\n * Configures which extensions this object should use.\n *\n * Extensions are registered with the store's schema service\n * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}\n *\n * Extensions should only be used for temporary enhancements\n * to objects to support migrating away from deprecated patterns\n * like custom getters, computeds, and methods\n */\n objectExtensions?: string[];\n}\n\n/**\n * A union of {@link ResourceSchema} and {@link ObjectSchema} representing\n * any schema that can be registered with or returned by the SchemaService.\n *\n * @public\n */\nexport type Schema = ResourceSchema | ObjectSchema;\n\n/**\n * A trait for use on a PolarisMode record.\n *\n * Traits are reusable collections of fields that can be composed onto a\n * resource schema, often to describe a polymorphic capability shared by\n * multiple resource types.\n */\nexport interface PolarisTrait {\n /**\n * The name of the trait.\n *\n * This is the string referenced by a resource schema's `traits` array,\n * or by another trait's `traits` array, in order to make use of this\n * trait.\n */\n name: string;\n\n /**\n * The mode this trait is valid for use with.\n *\n * A PolarisTrait may only be applied to PolarisMode resource schemas.\n */\n mode: 'polaris';\n\n /**\n * The fields that this trait contributes to any resource schema\n * that implements it.\n */\n fields: PolarisModeFieldSchema[];\n\n /**\n * A list of other traits that this trait itself implements.\n *\n * As with a resource schema's `traits`, each entry should be a string\n * matching the `name` of another trait.\n */\n traits?: string[];\n}\n\n/**\n * A trait for use on a LegacyMode record.\n *\n * Traits are reusable collections of fields that can be composed onto a\n * resource schema, often to describe a polymorphic capability shared by\n * multiple resource types.\n */\nexport interface LegacyTrait {\n /**\n * The name of the trait.\n *\n * This is the string referenced by a resource schema's `traits` array,\n * or by another trait's `traits` array, in order to make use of this\n * trait.\n */\n name: string;\n\n /**\n * The mode this trait is valid for use with.\n *\n * A LegacyTrait may only be applied to LegacyMode resource schemas.\n */\n mode: 'legacy';\n\n /**\n * The fields that this trait contributes to any resource schema\n * that implements it.\n */\n fields: LegacyModeFieldSchema[];\n\n /**\n * A list of other traits that this trait itself implements.\n *\n * As with a resource schema's `traits`, each entry should be a string\n * matching the `name` of another trait.\n */\n traits?: string[];\n}\n\n/**\n * A union of\n * - {@link LegacyTrait}\n * - {@link PolarisTrait}\n */\nexport type Trait = LegacyTrait | PolarisTrait;\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\n/**\n * A union of all field schemas considered \"legacy\", i.e. those historically\n * associated with `@warp-drive/legacy/model`'s Attribute, BelongsTo and\n * HasMany fields, including their LinksMode variants.\n *\n * Available field schemas are:\n *\n * - {@link LegacyAttributeField}\n * - {@link LegacyBelongsToField}\n * - {@link LegacyHasManyField}\n * - {@link LinksModeBelongsToField}\n * - {@link LinksModeHasManyField}\n *\n * @public\n */\nexport type LegacyField =\n | LegacyAttributeField\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n\n/**\n * A union of all legacy relationship field schemas, i.e. {@link LegacyField}\n * excluding {@link LegacyAttributeField}.\n *\n * Available field schemas are:\n *\n * - {@link LegacyBelongsToField}\n * - {@link LegacyHasManyField}\n * - {@link LinksModeBelongsToField}\n * - {@link LinksModeHasManyField}\n *\n * @public\n */\nexport type LegacyRelationshipField =\n | LegacyBelongsToField\n | LegacyHasManyField\n | LinksModeBelongsToField\n | LinksModeHasManyField;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA68EA,SAAgBA,eACdC,QACG;CACH,OAAOA;AACT;;;;;;;;;AAUA,SAAgBC,aAAqCD,QAAc;CACjE,OAAOA;AACT;;;;;;AAOA,SAAgBE,iBAAiBF,QAAiE;CAChG,OAAOA,QAAQG,UAAUC,SAAS;AACpC;;;;;;AAOA,SAAgBC,uBAAuBL,QAAuE;CAC5G,OAAOE,iBAAiBF,MAAM,KAAKA,OAAOM,WAAW;AACvD"}
@@ -1,2 +1,2 @@
1
- import { Gn as RelationshipsSchema, Kn as SchemaService, Wn as AttributesSchema } from "../../internal-Cz-893zD.js";
1
+ import { Xt as RelationshipsSchema, Yt as AttributesSchema, Zt as SchemaService } from "../../internal-DtWOpxrR.js";
2
2
  export { AttributesSchema, RelationshipsSchema, SchemaService };
@@ -1,4 +1,4 @@
1
- import { t as getOrSetGlobal } from "../-private-_1kbGvX1.js";
1
+ import { t as getOrSetGlobal } from "../-private-C5eqeju3.js";
2
2
 
3
3
  //#region src/types/symbols.ts
4
4
  /**