@warp-drive/core 5.8.0-alpha.9 → 5.8.0-beta.1

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 (258) hide show
  1. package/README.md +22 -38
  2. package/declarations/configure.d.ts +1 -1
  3. package/declarations/graph/-private/-edge-definition.d.ts +12 -2
  4. package/declarations/index.d.ts +14 -9
  5. package/declarations/reactive/-private/default-mode.d.ts +1 -1
  6. package/declarations/reactive/-private/fields/extension.d.ts +1 -1
  7. package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
  8. package/declarations/reactive/-private/fields/managed-object.d.ts +1 -1
  9. package/declarations/reactive/-private/record.d.ts +10 -1
  10. package/declarations/reactive/-private.d.ts +1 -0
  11. package/declarations/reactive.d.ts +11 -7
  12. package/declarations/request/-private/types.d.ts +1 -1
  13. package/declarations/signals/-leaked.d.ts +2 -0
  14. package/declarations/signals/-private.d.ts +6 -0
  15. package/declarations/{store/-private/new-core-tmp → signals}/promise-state.d.ts +1 -1
  16. package/declarations/{store/-private/new-core-tmp → signals}/request-state.d.ts +6 -6
  17. package/declarations/{store/-private/new-core-tmp → signals}/request-subscription.d.ts +4 -4
  18. package/declarations/store/-private/cache-handler/types.d.ts +2 -16
  19. package/declarations/store/-private/caches/instance-cache.d.ts +1 -1
  20. package/declarations/store/-private/managers/cache-manager.d.ts +1 -14
  21. package/declarations/store/-private/managers/notification-manager.d.ts +1 -1
  22. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +1 -1
  23. package/declarations/store/-private/record-arrays/resource-array.d.ts +1 -1
  24. package/declarations/store/-private/store-service.d.ts +2 -2
  25. package/declarations/store/-private.d.ts +0 -6
  26. package/declarations/store/deprecated/-private.d.ts +2 -2
  27. package/declarations/store/deprecated/store.d.ts +1 -1
  28. package/declarations/store.d.ts +1 -0
  29. package/declarations/types/cache.d.ts +2 -2
  30. package/declarations/types/record.d.ts +132 -0
  31. package/declarations/types/request.d.ts +22 -8
  32. package/declarations/types/schema/fields.d.ts +26 -13
  33. package/declarations/types/schema/schema-service.d.ts +4 -4
  34. package/declarations/types/spec/document.d.ts +34 -0
  35. package/dist/configure-DPUFCemT.js +1940 -0
  36. package/dist/configure.js +2 -1
  37. package/dist/{request-oqoLC9rz.js → future-BKkJJkj7.js} +1 -48
  38. package/dist/graph/-private.js +15 -5
  39. package/dist/{index-B1cSRj-N.js → index-CQP2NSqg.js} +63 -1812
  40. package/dist/index.js +5 -5
  41. package/dist/reactive/-private.js +1 -1
  42. package/dist/reactive.js +4 -129
  43. package/dist/request.js +49 -1
  44. package/dist/signals/-leaked.js +1 -0
  45. package/dist/store/-private.js +1 -2
  46. package/dist/symbols-3C1OkYtZ.js +39 -0
  47. package/dist/types/-private.js +1 -1
  48. package/dist/types/record.js +127 -0
  49. package/dist/types/request.js +11 -7
  50. package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
  51. package/dist/unpkg/dev/build-config/babel-macros.js +1 -0
  52. package/dist/unpkg/dev/build-config/canary-features.js +1 -0
  53. package/dist/unpkg/dev/build-config/debugging.js +1 -0
  54. package/dist/unpkg/dev/build-config/deprecations.js +1 -0
  55. package/dist/unpkg/dev/build-config/env.js +1 -0
  56. package/dist/unpkg/dev/build-config/macros.js +1 -0
  57. package/dist/unpkg/dev/build-config.js +1 -0
  58. package/dist/unpkg/dev/configure.js +1 -0
  59. package/dist/unpkg/dev/future-DFfOzSoe.js +672 -0
  60. package/dist/unpkg/dev/graph/-private.js +3132 -0
  61. package/dist/unpkg/dev/index-BzcBOnw9.js +9392 -0
  62. package/dist/unpkg/dev/index.js +6 -0
  63. package/dist/unpkg/dev/reactive/-private.js +1 -0
  64. package/dist/unpkg/dev/reactive.js +3 -0
  65. package/dist/unpkg/dev/request.js +49 -0
  66. package/dist/unpkg/dev/runtime-E1M51_-O.js +135 -0
  67. package/dist/unpkg/dev/signals/-leaked.js +1 -0
  68. package/dist/unpkg/dev/store/-private.js +55 -0
  69. package/dist/unpkg/dev/store.js +558 -0
  70. package/dist/unpkg/dev/types/-private.js +69 -0
  71. package/dist/unpkg/dev/types/cache/aliases.js +0 -0
  72. package/dist/unpkg/dev/types/cache/change.js +0 -0
  73. package/dist/unpkg/dev/types/cache/mutations.js +0 -0
  74. package/dist/unpkg/dev/types/cache/operations.js +0 -0
  75. package/dist/unpkg/dev/types/cache/relationship.js +0 -0
  76. package/dist/unpkg/dev/types/cache.js +0 -0
  77. package/dist/unpkg/dev/types/graph.js +0 -0
  78. package/dist/unpkg/dev/types/identifier.js +61 -0
  79. package/dist/unpkg/dev/types/json/raw.js +0 -0
  80. package/dist/unpkg/dev/types/params.js +0 -0
  81. package/dist/unpkg/dev/types/record.js +191 -0
  82. package/dist/unpkg/dev/types/request.js +77 -0
  83. package/dist/unpkg/dev/types/runtime.js +34 -0
  84. package/dist/unpkg/dev/types/schema/concepts.js +0 -0
  85. package/dist/unpkg/dev/types/schema/fields.js +505 -0
  86. package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -0
  87. package/dist/unpkg/dev/types/schema/schema-service.js +0 -0
  88. package/dist/unpkg/dev/types/spec/document.js +0 -0
  89. package/dist/unpkg/dev/types/spec/error.js +0 -0
  90. package/dist/unpkg/dev/types/spec/json-api-raw.js +0 -0
  91. package/dist/unpkg/dev/types/symbols.js +84 -0
  92. package/dist/unpkg/dev/types/utils.js +0 -0
  93. package/dist/unpkg/dev/types.js +0 -0
  94. package/dist/unpkg/dev/utils/string.js +91 -0
  95. package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
  96. package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +39 -0
  97. package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +1 -0
  98. package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -0
  99. package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -0
  100. package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -0
  101. package/dist/unpkg/dev-deprecated/build-config/env.js +1 -0
  102. package/dist/unpkg/dev-deprecated/build-config/macros.js +1 -0
  103. package/dist/unpkg/dev-deprecated/build-config.js +1 -0
  104. package/dist/unpkg/dev-deprecated/configure.js +1 -0
  105. package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +672 -0
  106. package/dist/unpkg/dev-deprecated/graph/-private.js +3327 -0
  107. package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +10007 -0
  108. package/dist/unpkg/dev-deprecated/index.js +5 -0
  109. package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -0
  110. package/dist/unpkg/dev-deprecated/reactive.js +3 -0
  111. package/dist/unpkg/dev-deprecated/request.js +49 -0
  112. package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +135 -0
  113. package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
  114. package/dist/unpkg/dev-deprecated/store/-private.js +1 -0
  115. package/dist/unpkg/dev-deprecated/store.js +558 -0
  116. package/dist/unpkg/dev-deprecated/types/-private.js +69 -0
  117. package/dist/unpkg/dev-deprecated/types/cache/aliases.js +0 -0
  118. package/dist/unpkg/dev-deprecated/types/cache/change.js +0 -0
  119. package/dist/unpkg/dev-deprecated/types/cache/mutations.js +0 -0
  120. package/dist/unpkg/dev-deprecated/types/cache/operations.js +0 -0
  121. package/dist/unpkg/dev-deprecated/types/cache/relationship.js +0 -0
  122. package/dist/unpkg/dev-deprecated/types/cache.js +0 -0
  123. package/dist/unpkg/dev-deprecated/types/graph.js +0 -0
  124. package/dist/unpkg/dev-deprecated/types/identifier.js +61 -0
  125. package/dist/unpkg/dev-deprecated/types/json/raw.js +0 -0
  126. package/dist/unpkg/dev-deprecated/types/params.js +0 -0
  127. package/dist/unpkg/dev-deprecated/types/record.js +191 -0
  128. package/dist/unpkg/dev-deprecated/types/request.js +77 -0
  129. package/dist/unpkg/dev-deprecated/types/runtime.js +34 -0
  130. package/dist/unpkg/dev-deprecated/types/schema/concepts.js +0 -0
  131. package/dist/unpkg/dev-deprecated/types/schema/fields.js +505 -0
  132. package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -0
  133. package/dist/unpkg/dev-deprecated/types/schema/schema-service.js +0 -0
  134. package/dist/unpkg/dev-deprecated/types/spec/document.js +0 -0
  135. package/dist/unpkg/dev-deprecated/types/spec/error.js +0 -0
  136. package/dist/unpkg/dev-deprecated/types/spec/json-api-raw.js +0 -0
  137. package/dist/unpkg/dev-deprecated/types/symbols.js +84 -0
  138. package/dist/unpkg/dev-deprecated/types/utils.js +0 -0
  139. package/dist/unpkg/dev-deprecated/types.js +0 -0
  140. package/dist/unpkg/dev-deprecated/utils/string.js +91 -0
  141. package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
  142. package/dist/unpkg/prod/-private-sql1_mdx.js +39 -0
  143. package/dist/unpkg/prod/build-config/babel-macros.js +1 -0
  144. package/dist/unpkg/prod/build-config/canary-features.js +1 -0
  145. package/dist/unpkg/prod/build-config/debugging.js +1 -0
  146. package/dist/unpkg/prod/build-config/deprecations.js +1 -0
  147. package/dist/unpkg/prod/build-config/env.js +1 -0
  148. package/dist/unpkg/prod/build-config/macros.js +1 -0
  149. package/dist/unpkg/prod/build-config.js +1 -0
  150. package/dist/unpkg/prod/configure.js +2 -0
  151. package/dist/unpkg/prod/graph/-private.js +2235 -0
  152. package/dist/unpkg/prod/handler-EU_8ncB2.js +1619 -0
  153. package/dist/unpkg/prod/index.js +483 -0
  154. package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
  155. package/dist/unpkg/prod/reactive/-private.js +1 -0
  156. package/dist/unpkg/prod/reactive.js +30 -0
  157. package/dist/unpkg/prod/request-BrJSCG6r.js +421 -0
  158. package/dist/unpkg/prod/request.js +2 -0
  159. package/dist/unpkg/prod/schema-BSkHyoWz.js +5219 -0
  160. package/dist/unpkg/prod/signals/-leaked.js +1 -0
  161. package/dist/unpkg/prod/store/-private.js +126 -0
  162. package/dist/unpkg/prod/store.js +437 -0
  163. package/dist/unpkg/prod/types/-private.js +49 -0
  164. package/dist/unpkg/prod/types/cache/aliases.js +0 -0
  165. package/dist/unpkg/prod/types/cache/change.js +0 -0
  166. package/dist/unpkg/prod/types/cache/mutations.js +0 -0
  167. package/dist/unpkg/prod/types/cache/operations.js +0 -0
  168. package/dist/unpkg/prod/types/cache/relationship.js +0 -0
  169. package/dist/unpkg/prod/types/cache.js +0 -0
  170. package/dist/unpkg/prod/types/graph.js +0 -0
  171. package/dist/unpkg/prod/types/identifier.js +61 -0
  172. package/dist/unpkg/prod/types/json/raw.js +0 -0
  173. package/dist/unpkg/prod/types/params.js +0 -0
  174. package/dist/unpkg/prod/types/record.js +191 -0
  175. package/dist/unpkg/prod/types/request.js +77 -0
  176. package/dist/unpkg/prod/types/runtime.js +34 -0
  177. package/dist/unpkg/prod/types/schema/concepts.js +0 -0
  178. package/dist/unpkg/prod/types/schema/fields.js +505 -0
  179. package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -0
  180. package/dist/unpkg/prod/types/schema/schema-service.js +0 -0
  181. package/dist/unpkg/prod/types/spec/document.js +0 -0
  182. package/dist/unpkg/prod/types/spec/error.js +0 -0
  183. package/dist/unpkg/prod/types/spec/json-api-raw.js +0 -0
  184. package/dist/unpkg/prod/types/symbols.js +84 -0
  185. package/dist/unpkg/prod/types/utils.js +0 -0
  186. package/dist/unpkg/prod/types.js +0 -0
  187. package/dist/unpkg/prod/utils/string.js +72 -0
  188. package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
  189. package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +39 -0
  190. package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +1 -0
  191. package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -0
  192. package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -0
  193. package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -0
  194. package/dist/unpkg/prod-deprecated/build-config/env.js +1 -0
  195. package/dist/unpkg/prod-deprecated/build-config/macros.js +1 -0
  196. package/dist/unpkg/prod-deprecated/build-config.js +1 -0
  197. package/dist/unpkg/prod-deprecated/configure.js +2 -0
  198. package/dist/unpkg/prod-deprecated/graph/-private.js +2408 -0
  199. package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +334 -0
  200. package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +26 -0
  201. package/dist/unpkg/prod-deprecated/index.js +483 -0
  202. package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
  203. package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -0
  204. package/dist/unpkg/prod-deprecated/reactive.js +5 -0
  205. package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +421 -0
  206. package/dist/unpkg/prod-deprecated/request.js +2 -0
  207. package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +6939 -0
  208. package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
  209. package/dist/unpkg/prod-deprecated/store/-private.js +88 -0
  210. package/dist/unpkg/prod-deprecated/store.js +437 -0
  211. package/dist/unpkg/prod-deprecated/types/-private.js +49 -0
  212. package/dist/unpkg/prod-deprecated/types/cache/aliases.js +0 -0
  213. package/dist/unpkg/prod-deprecated/types/cache/change.js +0 -0
  214. package/dist/unpkg/prod-deprecated/types/cache/mutations.js +0 -0
  215. package/dist/unpkg/prod-deprecated/types/cache/operations.js +0 -0
  216. package/dist/unpkg/prod-deprecated/types/cache/relationship.js +0 -0
  217. package/dist/unpkg/prod-deprecated/types/cache.js +0 -0
  218. package/dist/unpkg/prod-deprecated/types/graph.js +0 -0
  219. package/dist/unpkg/prod-deprecated/types/identifier.js +61 -0
  220. package/dist/unpkg/prod-deprecated/types/json/raw.js +0 -0
  221. package/dist/unpkg/prod-deprecated/types/params.js +0 -0
  222. package/dist/unpkg/prod-deprecated/types/record.js +191 -0
  223. package/dist/unpkg/prod-deprecated/types/request.js +77 -0
  224. package/dist/unpkg/prod-deprecated/types/runtime.js +34 -0
  225. package/dist/unpkg/prod-deprecated/types/schema/concepts.js +0 -0
  226. package/dist/unpkg/prod-deprecated/types/schema/fields.js +505 -0
  227. package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -0
  228. package/dist/unpkg/prod-deprecated/types/schema/schema-service.js +0 -0
  229. package/dist/unpkg/prod-deprecated/types/spec/document.js +0 -0
  230. package/dist/unpkg/prod-deprecated/types/spec/error.js +0 -0
  231. package/dist/unpkg/prod-deprecated/types/spec/json-api-raw.js +0 -0
  232. package/dist/unpkg/prod-deprecated/types/symbols.js +84 -0
  233. package/dist/unpkg/prod-deprecated/types/utils.js +0 -0
  234. package/dist/unpkg/prod-deprecated/types.js +0 -0
  235. package/dist/unpkg/prod-deprecated/utils/string.js +72 -0
  236. package/logos/README.md +2 -2
  237. package/logos/logo-yellow-slab.svg +1 -0
  238. package/logos/word-mark-black.svg +1 -0
  239. package/logos/word-mark-white.svg +1 -0
  240. package/package.json +11 -3
  241. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
  242. package/dist/configure-C3x8YXzL.js +0 -181
  243. package/logos/NCC-1701-a-blue.svg +0 -4
  244. package/logos/NCC-1701-a-gold.svg +0 -4
  245. package/logos/NCC-1701-a-gold_100.svg +0 -1
  246. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  247. package/logos/NCC-1701-a.svg +0 -4
  248. package/logos/docs-badge.svg +0 -2
  249. package/logos/ember-data-logo-dark.svg +0 -12
  250. package/logos/ember-data-logo-light.svg +0 -12
  251. package/logos/social1.png +0 -0
  252. package/logos/social2.png +0 -0
  253. package/logos/warp-drive-logo-dark.svg +0 -4
  254. package/logos/warp-drive-logo-gold.svg +0 -4
  255. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/configure.d.ts +0 -0
  256. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/internal.d.ts +0 -0
  257. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/signal.d.ts +0 -0
  258. /package/dist/{symbols-sql1_mdx.js → unpkg/dev/-private-sql1_mdx.js} +0 -0
@@ -134,4 +134,136 @@ export type StringSatisfiesIncludes<
134
134
  SET extends string
135
135
  > = _StringSatisfiesIncludes<T, SET, T>;
136
136
  export declare function createIncludeValidator<T extends TypedRecordInstance>(): <U extends string>(includes: StringSatisfiesIncludes<U, Includes<T>>) => U;
137
+ /**
138
+ * A utility that takes two types, K and T, and produces a new type that is a "mask" of T based on K.
139
+ *
140
+ * That's a mouthful, so let's break it down:
141
+ *
142
+ * Let's say you have a User type and an Address type.
143
+ *
144
+ * ```ts
145
+ * interface Address {
146
+ * street: string;
147
+ * city: string;
148
+ * state: string;
149
+ * zip: string;
150
+ * }
151
+ *
152
+ * interface User {
153
+ * name: string;
154
+ * title: string;
155
+ * address: Address;
156
+ * }
157
+ * ```
158
+ *
159
+ * Now, imagine you want to load a preview of the user with some information about their address,
160
+ * but you don't want to load the entire user or address. You probably want to still ensure
161
+ * the type of the data you do load matches the underlying Address and User types, but doesn't
162
+ * include everything.
163
+ *
164
+ * If you did this manually, you might do something like this:
165
+ *
166
+ * ```ts
167
+ * interface UserPreview {
168
+ * name: string;
169
+ * address: AddressPreview;
170
+ * }
171
+ *
172
+ * interface AddressPreview {
173
+ * city: string;
174
+ * }
175
+ * ```
176
+ *
177
+ * From a TypeScript performance perspective, this is the best way to approach these preview
178
+ * types, but this is also tedious and error-prone, especially if the User or Address types change.
179
+ *
180
+ * For Address, we could create a validated type using `Pick`:
181
+ *
182
+ * ```ts
183
+ * type AddressPreview = Pick<Address, 'city'>;
184
+ * ```
185
+ *
186
+ * This ensures that if the Address type changes, our AddressPreview will still be valid.
187
+ * However, for UserPreview, we can't just use `Pick` because the `address` property is of type `Address`,
188
+ * not `AddressPreview`. This is where the `Mask` type comes in.
189
+ *
190
+ * With `Mask`, we define the `UserPreview` in two parts
191
+ * - first, we define the subset of fields we want to include from `User`, using `Pick` or an interface.
192
+ * - then, we use `Mask` to replace the related types of fields like Address with their more limited subset.
193
+ *
194
+ * Here's how we can do it:
195
+ *
196
+ * ```ts
197
+ * // First, we define the base of UserPreview with Pick
198
+ * type UserPreviewBase = Pick<User, 'name' | 'address'>;
199
+ * // Then, we use Mask to replace Address with AddressPreview
200
+ * type UserPreview = Mask<{ address: AddressPreview }, UserPreviewBase>;
201
+ * ```
202
+ *
203
+ * Now, `UserPreview` will have the `name` field from `User` and the `address` field will be of type `AddressPreview`.
204
+ * This way, if the `User` or `Address` types change, TypeScript will ensure that our `UserPreview` and `AddressPreview`
205
+ * types remain valid and consistent with the underlying types.
206
+ *
207
+ * But what if your app has data with massive interfaces such that the TypeScript performance of this
208
+ * approach becomes a problem? In that case, see {@link Validate}
209
+ */
210
+ export type Mask<
211
+ K extends object,
212
+ T extends K
213
+ > = { [P in keyof T] : P extends keyof K ? (T[P] extends K[P] ? K[P] : never) : T[P] };
214
+ /**
215
+ * A utility that takes two types, K and T, and ensures that K is a valid subset of T.
216
+ *
217
+ * That's a mouthful, so let's break it down:
218
+ *
219
+ * Let's say you have a User type and an Address type.
220
+ *
221
+ * ```ts
222
+ * interface Address {
223
+ * street: string;
224
+ * city: string;
225
+ * state: string;
226
+ * zip: string;
227
+ * }
228
+ *
229
+ * interface User {
230
+ * name: string;
231
+ * title: string;
232
+ * address: Address;
233
+ * }
234
+ * ```
235
+ *
236
+ * Now, imagine you want to load a preview of the user with some information about their address,
237
+ * but you don't want to load the entire user or address. You probably want to still ensure
238
+ * the type of the data you do load matches the underlying Address and User types, but doesn't
239
+ * include everything.
240
+ *
241
+ * You might do something like this:
242
+ *
243
+ * ```ts
244
+ * interface UserPreview {
245
+ * name: string;
246
+ * address: AddressPreview;
247
+ * }
248
+ *
249
+ * interface AddressPreview {
250
+ * city: string;
251
+ * }
252
+ * ```
253
+ *
254
+ * From a TypeScript performance perspective, this is the best way to approach these preview
255
+ * types, but this is also error-prone, especially if the User or Address types change.
256
+ *
257
+ * Validate can help ensure that your preview types remain valid.
258
+ *
259
+ * ```ts
260
+ * type IsValidUserPreview = Validate<UserPreview, User>; // This will be valid
261
+ * ```
262
+ *
263
+ * For help creating subsets of types, see {@link Mask}
264
+ */
265
+ export type Validate<
266
+ K extends object,
267
+ T extends K
268
+ > = T extends K ? K : never;
137
269
  export {};
@@ -1,3 +1,4 @@
1
+ import type { FetchError } from "../request/-private/utils.js";
1
2
  import type { Store } from "../store/-private.js";
2
3
  import type { ResourceKey } from "./identifier.js";
3
4
  import type { QueryParamsSerializationOptions } from "./params.js";
@@ -8,6 +9,7 @@ export declare const SkipCache: "___(unique) Symbol(SkipCache)";
8
9
  export declare const EnableHydration: "___(unique) Symbol(EnableHydration)";
9
10
  export declare const IS_FUTURE: "___(unique) Symbol(IS_FUTURE)";
10
11
  export declare const STRUCTURED: "___(unique) Symbol(DOC)";
12
+ export type { FetchError };
11
13
  export type HTTPMethod = "QUERY" | "GET" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "CONNECT" | "TRACE";
12
14
  /**
13
15
  * Use these options to adjust {@link CacheHandler} behavior for a request
@@ -159,11 +161,15 @@ export interface FindRecordOptions extends ConstrainedRequestOptions {
159
161
  include?: string | string[];
160
162
  }
161
163
  /**
162
- * When a handler chain resolves, it returns an object
163
- * containing the original request, the response set by the handler
164
- * chain (if any), and the processed content.
164
+ * When a {@link Future} resolves, it returns an object
165
+ * containing the original {@link RequestInfo | request},
166
+ * the {@link Response | response} set by the handler chain (if any), and
167
+ * the processed content.
165
168
  */
166
169
  export interface StructuredDataDocument<T> {
170
+ /**
171
+ * @private
172
+ */
167
173
  [STRUCTURED]?: true;
168
174
  /**
169
175
  * @see {@link ImmutableRequestInfo}
@@ -173,25 +179,34 @@ export interface StructuredDataDocument<T> {
173
179
  content: T;
174
180
  }
175
181
  /**
176
- * When a handler chain rejects, it throws an Error that maintains the
177
- * `{ request, response, content }` shape but is also an Error instance
182
+ * When a {@link Future} rejects, it throws either an {@link Error}
183
+ * an {@link AggregateError} or a {@link DOMException} that maintains
184
+ * the `{ request, response, content }` shape but is also an Error instance
178
185
  * itself.
179
186
  *
180
187
  * If using the error originates from the {@link Fetch | Fetch Handler}
181
188
  * the error will be a {@link FetchError}
182
189
  */
183
190
  export interface StructuredErrorDocument<T = unknown> extends Error {
191
+ /**
192
+ * @private
193
+ */
184
194
  [STRUCTURED]?: true;
195
+ /**
196
+ * @see {@link ImmutableRequestInfo}
197
+ */
185
198
  request: ImmutableRequestInfo;
186
199
  response: Response | ResponseInfo | null;
187
200
  error: string | object;
188
201
  content?: T;
189
202
  }
190
203
  /**
191
- * A union of the resolve/reject data types for a request.
204
+ * A union of the resolve/reject data types for the {@link Future}
205
+ * returned by {@link Store.request | request}
192
206
  *
193
- * See the docs for:
207
+ * See also the docs for:
194
208
  *
209
+ * - {@link Future}
195
210
  * - {@link StructuredDataDocument} (resolved/successful requests)
196
211
  * - {@link StructuredErrorDocument} (rejected/failed requests)
197
212
  */
@@ -350,4 +365,3 @@ export interface RequestContext {
350
365
  setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;
351
366
  setResponse(response: Response | ResponseInfo | null): void;
352
367
  }
353
- export {};
@@ -571,7 +571,7 @@ export interface SchemaObjectField {
571
571
  * Configures which extensions this object should use.
572
572
  *
573
573
  * Extensions are registered with the store's schema service
574
- * via {@link SchemaService.registerDangerousObjectExtension}
574
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
575
575
  *
576
576
  * Extensions should only be used for temporary enhancements
577
577
  * to objects to support migrating away from deprecated patterns
@@ -673,7 +673,7 @@ export interface ArrayField {
673
673
  *
674
674
  * Configures which extensions this array is allowed to use.
675
675
  * Extensions are registered with the store's schema service
676
- * via {@link SchemaService.registerDangerousArrayExtension}
676
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
677
677
  *
678
678
  * Extensions should only be used for temporary enhancements
679
679
  * to arrays to support migrating away from deprecated behaviors
@@ -786,7 +786,7 @@ export interface SchemaArrayField {
786
786
  *
787
787
  * Configures which extensions this array is allowed to use.
788
788
  * Extensions are registered with the store's schema service
789
- * via {@link SchemaService.registerDangerousArrayExtension}
789
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
790
790
  *
791
791
  * Extensions should only be used for temporary enhancements
792
792
  * to arrays to support migrating away from deprecated behaviors
@@ -800,7 +800,7 @@ export interface SchemaArrayField {
800
800
  * Configures which extensions this object should use.
801
801
  *
802
802
  * Extensions are registered with the store's schema service
803
- * via {@link SchemaService.registerDangerousObjectExtension}
803
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
804
804
  *
805
805
  * Extensions should only be used for temporary enhancements
806
806
  * to objects to support migrating away from deprecated patterns
@@ -1285,6 +1285,9 @@ export interface LegacyBelongsToField {
1285
1285
  *
1286
1286
  * If null, the relationship is unidirectional.
1287
1287
  *
1288
+ * If the inverse field definition uses a sourceKey,
1289
+ * this should still be the name of the field, not the sourceKey.
1290
+ *
1288
1291
  * @public
1289
1292
  */
1290
1293
  inverse: string | null;
@@ -1307,8 +1310,9 @@ export interface LegacyBelongsToField {
1307
1310
  */
1308
1311
  polymorphic?: boolean;
1309
1312
  /**
1310
- * Whether this field should ever make use of the legacy support infra
1311
- * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1313
+ * Whether this field should ever make use of the legacy request infra
1314
+ * from @warp-drive/legacy/compat and the LegacyNetworkMiddleware for
1315
+ * adapters and serializers.
1312
1316
  *
1313
1317
  * When true, none of the legacy support will be utilized. Sync relationships
1314
1318
  * will be expected to already have all their data. When reloading a sync relationship
@@ -1433,6 +1437,9 @@ export interface LinksModeBelongsToField {
1433
1437
  *
1434
1438
  * If null, the relationship is unidirectional.
1435
1439
  *
1440
+ * If the inverse field definition uses a sourceKey,
1441
+ * this should still be the name of the field, not the sourceKey.
1442
+ *
1436
1443
  * @public
1437
1444
  */
1438
1445
  inverse: string | null;
@@ -1456,7 +1463,7 @@ export interface LinksModeBelongsToField {
1456
1463
  polymorphic?: boolean;
1457
1464
  /**
1458
1465
  * Whether this field should ever make use of the legacy support infra
1459
- * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1466
+ * from @warp-drive/legacy/model and the LegacyNetworkMiddleware for adapters and serializers.
1460
1467
  *
1461
1468
  * MUST be true for PolarisMode + LinksMode
1462
1469
  *
@@ -1571,7 +1578,7 @@ export interface LegacyHasManyField {
1571
1578
  *
1572
1579
  * Configures which extensions this array is allowed to use.
1573
1580
  * Extensions are registered with the store's schema service
1574
- * via {@link SchemaService.registerDangerousArrayExtension}
1581
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
1575
1582
  *
1576
1583
  * Extensions should only be used for temporary enhancements
1577
1584
  * to arrays to support migrating away from deprecated behaviors
@@ -1604,6 +1611,9 @@ export interface LegacyHasManyField {
1604
1611
  *
1605
1612
  * If null, the relationship is unidirectional.
1606
1613
  *
1614
+ * If the inverse field definition uses a sourceKey,
1615
+ * this should still be the name of the field, not the sourceKey.
1616
+ *
1607
1617
  * @public
1608
1618
  */
1609
1619
  inverse: string | null;
@@ -1627,7 +1637,7 @@ export interface LegacyHasManyField {
1627
1637
  polymorphic?: boolean;
1628
1638
  /**
1629
1639
  * Whether this field should ever make use of the legacy support infra
1630
- * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1640
+ * from @warp-drive/legacy/model and the LegacyNetworkMiddleware for adapters and serializers.
1631
1641
  *
1632
1642
  * When true, none of the legacy support will be utilized. Sync relationships
1633
1643
  * will be expected to already have all their data. When reloading a sync relationship
@@ -1742,7 +1752,7 @@ export interface LinksModeHasManyField {
1742
1752
  *
1743
1753
  * Configures which extensions this array is allowed to use.
1744
1754
  * Extensions are registered with the store's schema service
1745
- * via {@link SchemaService.registerDangerousArrayExtension}
1755
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
1746
1756
  *
1747
1757
  * Extensions should only be used for temporary enhancements
1748
1758
  * to arrays to support migrating away from deprecated behaviors
@@ -1777,6 +1787,9 @@ export interface LinksModeHasManyField {
1777
1787
  *
1778
1788
  * If null, the relationship is unidirectional.
1779
1789
  *
1790
+ * If the inverse field definition uses a sourceKey,
1791
+ * this should still be the name of the field, not the sourceKey.
1792
+ *
1780
1793
  * @public
1781
1794
  */
1782
1795
  inverse: string | null;
@@ -1800,7 +1813,7 @@ export interface LinksModeHasManyField {
1800
1813
  polymorphic?: boolean;
1801
1814
  /**
1802
1815
  * Whether this field should ever make use of the legacy support infra
1803
- * from @ember-data/model and the LegacyNetworkMiddleware for adapters and serializers.
1816
+ * from @warp-drive/legacy/model and the LegacyNetworkMiddleware for adapters and serializers.
1804
1817
  *
1805
1818
  * MUST be true for PolarisMode + LinksMode
1806
1819
  *
@@ -2048,7 +2061,7 @@ export interface LegacyResourceSchema {
2048
2061
  * Configures which extensions this resource should use.
2049
2062
  *
2050
2063
  * Extensions are registered with the store's schema service
2051
- * via {@link SchemaService.registerDangerousObjectExtension}
2064
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
2052
2065
  *
2053
2066
  * Extensions should only be used for temporary enhancements
2054
2067
  * to objects to support migrating away from deprecated patterns
@@ -2116,7 +2129,7 @@ export interface ObjectSchema {
2116
2129
  * Configures which extensions this object should use.
2117
2130
  *
2118
2131
  * Extensions are registered with the store's schema service
2119
- * via {@link SchemaService.registerDangerousObjectExtension}
2132
+ * via {@link SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension}
2120
2133
  *
2121
2134
  * Extensions should only be used for temporary enhancements
2122
2135
  * to objects to support migrating away from deprecated patterns
@@ -21,7 +21,7 @@ interface ObjectWithStringTypeProperty {
21
21
  * The primary requirement is merely that any information the service needs to correctly
22
22
  * respond to an inquest is available by the time it is asked.
23
23
  *
24
- * The `@ember-data/model` package provides an implementation of this service which
24
+ * The `@warp-drive/legacy/model` package provides an implementation of this service which
25
25
  * makes use of your model classes as the source of information to respond to queries
26
26
  * about resource schema. While this is useful, this may not be ideal for your application.
27
27
  * For instance, Schema information could be sideloaded or pre-flighted for API calls,
@@ -32,7 +32,7 @@ interface ObjectWithStringTypeProperty {
32
32
  * hook to return an instance of your service.
33
33
  *
34
34
  * ```ts
35
- * import Store from '@ember-data/store';
35
+ * import { Store } from '@warp-drive/core';
36
36
  * import CustomSchemas from './custom-schemas';
37
37
  *
38
38
  * export default class extends Store {
@@ -229,7 +229,7 @@ export interface SchemaService {
229
229
  * be a string reference to a `transform`, and `options` which
230
230
  * should be dictionary in which any key:value pairs are permissable.
231
231
  *
232
- * For instance, when using `@ember-data/model`, the following attribute
232
+ * For instance, when using `@warp-drive/legacy/model`, the following attribute
233
233
  * definition:
234
234
  *
235
235
  * ```ts
@@ -283,7 +283,7 @@ export interface SchemaService {
283
283
  * - `options.as` a string representing the abstract type that the concrete side of
284
284
  * a relationship must specify when fulfilling a polymorphic inverse.
285
285
  *
286
- * For example, the following Model using @ember-data/model would generate this relationships
286
+ * For example, the following Model using @warp-drive/legacy/model would generate this relationships
287
287
  * definition by default:
288
288
  *
289
289
  * ```js
@@ -1,11 +1,21 @@
1
1
  import type { PersistedResourceKey } from "../identifier.js";
2
2
  import type { ApiError } from "./error.js";
3
3
  import type { Links, Meta, PaginationLinks } from "./json-api-raw.js";
4
+ /**
5
+ * This type represents a raw {json:api} document for a meta-only
6
+ * document returned by a request intended to be inserted into the cache.
7
+ */
4
8
  export interface ResourceMetaDocument {
5
9
  lid?: string;
6
10
  meta: Meta;
7
11
  links?: Links | PaginationLinks;
8
12
  }
13
+ /**
14
+ * This type represents a raw {json:api} document for a single resource
15
+ * returned by a request intended to be inserted into the cache.
16
+ *
17
+ * For the Reactive value returned by a request using the store, use {@link ReactiveDataDocument} instead.
18
+ */
9
19
  export interface SingleResourceDataDocument<
10
20
  T = PersistedResourceKey,
11
21
  R = PersistedResourceKey
@@ -16,6 +26,12 @@ export interface SingleResourceDataDocument<
16
26
  data: T | null;
17
27
  included?: R[];
18
28
  }
29
+ /**
30
+ * This type represents a raw {json:api} document for a resource collection
31
+ * returned by a request intended to be inserted into the cache.
32
+ *
33
+ * For the Reactive value returned by a request using the store, use {@link ReactiveDataDocument} instead.
34
+ */
19
35
  export interface CollectionResourceDataDocument<T = PersistedResourceKey> {
20
36
  lid?: string;
21
37
  links?: Links | PaginationLinks;
@@ -23,11 +39,29 @@ export interface CollectionResourceDataDocument<T = PersistedResourceKey> {
23
39
  data: T[];
24
40
  included?: T[];
25
41
  }
42
+ /**
43
+ * A type useful for representing the raw {json:api} documents that
44
+ * the cache may use.
45
+ *
46
+ * For the Reactive value returned by a request using the store, use {@link ReactiveDataDocument} instead.
47
+ */
26
48
  export type ResourceDataDocument<T = PersistedResourceKey> = SingleResourceDataDocument<T> | CollectionResourceDataDocument<T>;
49
+ /**
50
+ * A type useful for representing the raw {json:api} Error documents that
51
+ * the cache may use.
52
+ *
53
+ * For the Reactive value returned by a request using the store, use {@link ReactiveErrorDocument} instead.
54
+ */
27
55
  export interface ResourceErrorDocument {
28
56
  lid?: string;
29
57
  links?: Links | PaginationLinks;
30
58
  meta?: Meta;
31
59
  errors: ApiError[];
32
60
  }
61
+ /**
62
+ * A type useful for representing the raw {json:api} documents that
63
+ * the cache may use.
64
+ *
65
+ * For the Reactive value returned by a request using the store, use {@link ReactiveDocument} instead.
66
+ */
33
67
  export type ResourceDocument<T = PersistedResourceKey> = ResourceMetaDocument | SingleResourceDataDocument<T> | CollectionResourceDataDocument<T> | ResourceErrorDocument;