@warp-drive/core 5.8.0-beta.0 → 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.
- package/README.md +23 -36
- package/declarations/build-config.d.ts +18 -1
- package/declarations/configure.d.ts +1 -1
- package/declarations/graph/-private/-edge-definition.d.ts +12 -2
- package/declarations/index.d.ts +90 -8
- package/declarations/reactive/-private/default-mode.d.ts +1 -1
- package/declarations/reactive/-private/document.d.ts +58 -46
- package/declarations/reactive/-private/fields/extension.d.ts +1 -1
- package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
- package/declarations/reactive/-private/fields/managed-object.d.ts +1 -1
- package/declarations/reactive/-private/record.d.ts +10 -1
- package/declarations/reactive/-private/schema.d.ts +77 -4
- package/declarations/reactive/-private.d.ts +1 -0
- package/declarations/reactive.d.ts +13 -8
- package/declarations/request/-private/types.d.ts +1 -1
- package/declarations/request.d.ts +47 -0
- package/declarations/signals/-leaked.d.ts +2 -0
- package/declarations/signals/-private.d.ts +6 -0
- package/declarations/{store/-private/new-core-tmp → signals}/promise-state.d.ts +2 -1
- package/declarations/{store/-private/new-core-tmp → signals}/request-state.d.ts +6 -6
- package/declarations/{store/-private/new-core-tmp → signals}/request-subscription.d.ts +4 -4
- package/declarations/store/-private/cache-handler/types.d.ts +2 -16
- package/declarations/store/-private/caches/instance-cache.d.ts +5 -6
- package/declarations/store/-private/default-cache-policy.d.ts +147 -129
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +1 -1
- package/declarations/store/-private/managers/cache-key-manager.d.ts +26 -8
- package/declarations/store/-private/managers/cache-manager.d.ts +7 -18
- package/declarations/store/-private/managers/notification-manager.d.ts +1 -1
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +1 -1
- package/declarations/store/-private/record-arrays/resource-array.d.ts +1 -1
- package/declarations/store/-private/store-service.d.ts +43 -64
- package/declarations/store/-private.d.ts +0 -6
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +1 -1
- package/declarations/store/deprecated/-private.d.ts +2 -2
- package/declarations/store/deprecated/store.d.ts +33 -32
- package/declarations/store.d.ts +1 -0
- package/declarations/types/cache.d.ts +8 -6
- package/declarations/types/record.d.ts +132 -0
- package/declarations/types/request.d.ts +26 -14
- package/declarations/types/schema/fields.d.ts +37 -13
- package/declarations/{store/-types/q → types/schema}/schema-service.d.ts +15 -13
- package/declarations/types/spec/document.d.ts +34 -0
- package/declarations/types/symbols.d.ts +2 -2
- package/declarations/types.d.ts +1 -1
- package/dist/build-config.js +1 -1
- package/dist/configure-DPUFCemT.js +1940 -0
- package/dist/configure.js +2 -1
- package/dist/default-cache-policy-D7_u4YRH.js +572 -0
- package/dist/{context-C_7OLieY.js → future-BKkJJkj7.js} +174 -174
- package/dist/graph/-private.js +16 -6
- package/dist/{request-state-C955e0AL.js → index-CQP2NSqg.js} +8830 -9427
- package/dist/index.js +6 -382
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +4 -903
- package/dist/request.js +49 -1
- package/dist/signals/-leaked.js +1 -0
- package/dist/store/-private.js +1 -2
- package/dist/store.js +1 -533
- package/dist/symbols-3C1OkYtZ.js +39 -0
- package/dist/types/-private.js +1 -1
- package/dist/types/record.js +127 -0
- package/dist/types/request.js +14 -12
- package/dist/types/runtime.js +1 -1
- package/dist/types/schema/fields.js +14 -0
- package/dist/types/schema/schema-service.js +0 -0
- package/dist/types/symbols.js +2 -2
- package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
- package/dist/unpkg/dev/build-config/babel-macros.js +1 -0
- package/dist/unpkg/dev/build-config/canary-features.js +1 -0
- package/dist/unpkg/dev/build-config/debugging.js +1 -0
- package/dist/unpkg/dev/build-config/deprecations.js +1 -0
- package/dist/unpkg/dev/build-config/env.js +1 -0
- package/dist/unpkg/dev/build-config/macros.js +1 -0
- package/dist/unpkg/dev/build-config.js +1 -0
- package/dist/unpkg/dev/configure.js +1 -0
- package/dist/unpkg/dev/future-DFfOzSoe.js +672 -0
- package/dist/unpkg/dev/graph/-private.js +3132 -0
- package/dist/unpkg/dev/index-BzcBOnw9.js +9392 -0
- package/dist/unpkg/dev/index.js +6 -0
- package/dist/unpkg/dev/reactive/-private.js +1 -0
- package/dist/unpkg/dev/reactive.js +3 -0
- package/dist/unpkg/dev/request.js +49 -0
- package/dist/unpkg/dev/runtime-E1M51_-O.js +135 -0
- package/dist/unpkg/dev/signals/-leaked.js +1 -0
- package/dist/unpkg/dev/store/-private.js +55 -0
- package/dist/unpkg/dev/store.js +558 -0
- package/dist/unpkg/dev/types/-private.js +69 -0
- package/dist/unpkg/dev/types/cache/aliases.js +0 -0
- package/dist/unpkg/dev/types/cache/change.js +0 -0
- package/dist/unpkg/dev/types/cache/mutations.js +0 -0
- package/dist/unpkg/dev/types/cache/operations.js +0 -0
- package/dist/unpkg/dev/types/cache/relationship.js +0 -0
- package/dist/unpkg/dev/types/cache.js +0 -0
- package/dist/unpkg/dev/types/graph.js +0 -0
- package/dist/unpkg/dev/types/identifier.js +61 -0
- package/dist/unpkg/dev/types/json/raw.js +0 -0
- package/dist/unpkg/dev/types/params.js +0 -0
- package/dist/unpkg/dev/types/record.js +191 -0
- package/dist/unpkg/dev/types/request.js +77 -0
- package/dist/unpkg/dev/types/runtime.js +34 -0
- package/dist/unpkg/dev/types/schema/concepts.js +0 -0
- package/dist/unpkg/dev/types/schema/fields.js +505 -0
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/dev/types/schema/schema-service.js +0 -0
- package/dist/unpkg/dev/types/spec/document.js +0 -0
- package/dist/unpkg/dev/types/spec/error.js +0 -0
- package/dist/unpkg/dev/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/dev/types/symbols.js +84 -0
- package/dist/unpkg/dev/types/utils.js +0 -0
- package/dist/unpkg/dev/types.js +0 -0
- package/dist/unpkg/dev/utils/string.js +91 -0
- package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
- package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +39 -0
- package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/env.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config/macros.js +1 -0
- package/dist/unpkg/dev-deprecated/build-config.js +1 -0
- package/dist/unpkg/dev-deprecated/configure.js +1 -0
- package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +672 -0
- package/dist/unpkg/dev-deprecated/graph/-private.js +3327 -0
- package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +10007 -0
- package/dist/unpkg/dev-deprecated/index.js +5 -0
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/reactive.js +3 -0
- package/dist/unpkg/dev-deprecated/request.js +49 -0
- package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +135 -0
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -0
- package/dist/unpkg/dev-deprecated/store.js +558 -0
- package/dist/unpkg/dev-deprecated/types/-private.js +69 -0
- package/dist/unpkg/dev-deprecated/types/cache/aliases.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/change.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/mutations.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/operations.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache/relationship.js +0 -0
- package/dist/unpkg/dev-deprecated/types/cache.js +0 -0
- package/dist/unpkg/dev-deprecated/types/graph.js +0 -0
- package/dist/unpkg/dev-deprecated/types/identifier.js +61 -0
- package/dist/unpkg/dev-deprecated/types/json/raw.js +0 -0
- package/dist/unpkg/dev-deprecated/types/params.js +0 -0
- package/dist/unpkg/dev-deprecated/types/record.js +191 -0
- package/dist/unpkg/dev-deprecated/types/request.js +77 -0
- package/dist/unpkg/dev-deprecated/types/runtime.js +34 -0
- package/dist/unpkg/dev-deprecated/types/schema/concepts.js +0 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +505 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/dev-deprecated/types/schema/schema-service.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/document.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/error.js +0 -0
- package/dist/unpkg/dev-deprecated/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/dev-deprecated/types/symbols.js +84 -0
- package/dist/unpkg/dev-deprecated/types/utils.js +0 -0
- package/dist/unpkg/dev-deprecated/types.js +0 -0
- package/dist/unpkg/dev-deprecated/utils/string.js +91 -0
- package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
- package/dist/unpkg/prod/-private-sql1_mdx.js +39 -0
- package/dist/unpkg/prod/build-config/babel-macros.js +1 -0
- package/dist/unpkg/prod/build-config/canary-features.js +1 -0
- package/dist/unpkg/prod/build-config/debugging.js +1 -0
- package/dist/unpkg/prod/build-config/deprecations.js +1 -0
- package/dist/unpkg/prod/build-config/env.js +1 -0
- package/dist/unpkg/prod/build-config/macros.js +1 -0
- package/dist/unpkg/prod/build-config.js +1 -0
- package/dist/unpkg/prod/configure.js +2 -0
- package/dist/unpkg/prod/graph/-private.js +2235 -0
- package/dist/unpkg/prod/handler-EU_8ncB2.js +1619 -0
- package/dist/unpkg/prod/index.js +483 -0
- package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod/reactive/-private.js +1 -0
- package/dist/unpkg/prod/reactive.js +30 -0
- package/dist/unpkg/prod/request-BrJSCG6r.js +421 -0
- package/dist/unpkg/prod/request.js +2 -0
- package/dist/unpkg/prod/schema-BSkHyoWz.js +5219 -0
- package/dist/unpkg/prod/signals/-leaked.js +1 -0
- package/dist/unpkg/prod/store/-private.js +126 -0
- package/dist/unpkg/prod/store.js +437 -0
- package/dist/unpkg/prod/types/-private.js +49 -0
- package/dist/unpkg/prod/types/cache/aliases.js +0 -0
- package/dist/unpkg/prod/types/cache/change.js +0 -0
- package/dist/unpkg/prod/types/cache/mutations.js +0 -0
- package/dist/unpkg/prod/types/cache/operations.js +0 -0
- package/dist/unpkg/prod/types/cache/relationship.js +0 -0
- package/dist/unpkg/prod/types/cache.js +0 -0
- package/dist/unpkg/prod/types/graph.js +0 -0
- package/dist/unpkg/prod/types/identifier.js +61 -0
- package/dist/unpkg/prod/types/json/raw.js +0 -0
- package/dist/unpkg/prod/types/params.js +0 -0
- package/dist/unpkg/prod/types/record.js +191 -0
- package/dist/unpkg/prod/types/request.js +77 -0
- package/dist/unpkg/prod/types/runtime.js +34 -0
- package/dist/unpkg/prod/types/schema/concepts.js +0 -0
- package/dist/unpkg/prod/types/schema/fields.js +505 -0
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/prod/types/schema/schema-service.js +0 -0
- package/dist/unpkg/prod/types/spec/document.js +0 -0
- package/dist/unpkg/prod/types/spec/error.js +0 -0
- package/dist/unpkg/prod/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/prod/types/symbols.js +84 -0
- package/dist/unpkg/prod/types/utils.js +0 -0
- package/dist/unpkg/prod/types.js +0 -0
- package/dist/unpkg/prod/utils/string.js +72 -0
- package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
- package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +39 -0
- package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/env.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config/macros.js +1 -0
- package/dist/unpkg/prod-deprecated/build-config.js +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -0
- package/dist/unpkg/prod-deprecated/graph/-private.js +2408 -0
- package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +334 -0
- package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +26 -0
- package/dist/unpkg/prod-deprecated/index.js +483 -0
- package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -0
- package/dist/unpkg/prod-deprecated/reactive.js +5 -0
- package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +421 -0
- package/dist/unpkg/prod-deprecated/request.js +2 -0
- package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +6939 -0
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +88 -0
- package/dist/unpkg/prod-deprecated/store.js +437 -0
- package/dist/unpkg/prod-deprecated/types/-private.js +49 -0
- package/dist/unpkg/prod-deprecated/types/cache/aliases.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/change.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/mutations.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/operations.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache/relationship.js +0 -0
- package/dist/unpkg/prod-deprecated/types/cache.js +0 -0
- package/dist/unpkg/prod-deprecated/types/graph.js +0 -0
- package/dist/unpkg/prod-deprecated/types/identifier.js +61 -0
- package/dist/unpkg/prod-deprecated/types/json/raw.js +0 -0
- package/dist/unpkg/prod-deprecated/types/params.js +0 -0
- package/dist/unpkg/prod-deprecated/types/record.js +191 -0
- package/dist/unpkg/prod-deprecated/types/request.js +77 -0
- package/dist/unpkg/prod-deprecated/types/runtime.js +34 -0
- package/dist/unpkg/prod-deprecated/types/schema/concepts.js +0 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +505 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -0
- package/dist/unpkg/prod-deprecated/types/schema/schema-service.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/document.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/error.js +0 -0
- package/dist/unpkg/prod-deprecated/types/spec/json-api-raw.js +0 -0
- package/dist/unpkg/prod-deprecated/types/symbols.js +84 -0
- package/dist/unpkg/prod-deprecated/types/utils.js +0 -0
- package/dist/unpkg/prod-deprecated/types.js +0 -0
- package/dist/unpkg/prod-deprecated/utils/string.js +72 -0
- package/logos/README.md +2 -2
- package/logos/logo-yellow-slab.svg +1 -0
- package/logos/word-mark-black.svg +1 -0
- package/logos/word-mark-white.svg +1 -0
- package/package.json +12 -4
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
- package/dist/configure-C3x8YXzL.js +0 -181
- package/logos/NCC-1701-a-blue.svg +0 -4
- package/logos/NCC-1701-a-gold.svg +0 -4
- package/logos/NCC-1701-a-gold_100.svg +0 -1
- package/logos/NCC-1701-a-gold_base-64.txt +0 -1
- package/logos/NCC-1701-a.svg +0 -4
- package/logos/docs-badge.svg +0 -2
- package/logos/ember-data-logo-dark.svg +0 -12
- package/logos/ember-data-logo-light.svg +0 -12
- package/logos/social1.png +0 -0
- package/logos/social2.png +0 -0
- package/logos/warp-drive-logo-dark.svg +0 -4
- package/logos/warp-drive-logo-gold.svg +0 -4
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/configure.d.ts +0 -0
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/internal.d.ts +0 -0
- /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/signal.d.ts +0 -0
- /package/dist/{symbols-sql1_mdx.js → unpkg/dev/-private-sql1_mdx.js} +0 -0
package/declarations/store.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { RequestKey, ResourceKey } from "./identifier.js";
|
|
|
7
7
|
import type { Value } from "./json/raw.js";
|
|
8
8
|
import type { TypeFromInstanceOrString } from "./record.js";
|
|
9
9
|
import type { RequestContext, StructuredDataDocument, StructuredDocument } from "./request.js";
|
|
10
|
-
import type { ResourceDocument, SingleResourceDataDocument } from "./spec/document.js";
|
|
10
|
+
import type { CollectionResourceDataDocument, ResourceDocument, SingleResourceDataDocument } from "./spec/document.js";
|
|
11
11
|
import type { ApiError } from "./spec/error.js";
|
|
12
12
|
/**
|
|
13
13
|
* A hash of changed attributes with the key being the attribute name and the value being an
|
|
@@ -253,23 +253,25 @@ export interface Cache {
|
|
|
253
253
|
*
|
|
254
254
|
* @public
|
|
255
255
|
*/
|
|
256
|
-
willCommit(cacheKey: ResourceKey, context: RequestContext | null): void;
|
|
256
|
+
willCommit(cacheKey: ResourceKey | ResourceKey[], context: RequestContext | null): void;
|
|
257
257
|
/**
|
|
258
258
|
* [LIFECYCLE] Signals to the cache that a resource
|
|
259
259
|
* was successfully updated as part of a save transaction.
|
|
260
260
|
*
|
|
261
261
|
* @public
|
|
262
|
-
* @param the primary ResourceKey that was operated on
|
|
263
|
-
* @param
|
|
262
|
+
* @param cacheKey - the primary ResourceKey that was operated on
|
|
263
|
+
* @param result - a document in the cache format containing any updated data
|
|
264
264
|
*/
|
|
265
|
-
didCommit(cacheKey: ResourceKey, result: StructuredDataDocument<
|
|
265
|
+
didCommit(cacheKey: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument> | null): SingleResourceDataDocument;
|
|
266
|
+
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument> | null): SingleResourceDataDocument;
|
|
267
|
+
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument> | null): CollectionResourceDataDocument;
|
|
266
268
|
/**
|
|
267
269
|
* [LIFECYCLE] Signals to the cache that a resource
|
|
268
270
|
* was update via a save transaction failed.
|
|
269
271
|
*
|
|
270
272
|
* @public
|
|
271
273
|
*/
|
|
272
|
-
commitWasRejected(cacheKey: ResourceKey, errors?: ApiError[]): void;
|
|
274
|
+
commitWasRejected(cacheKey: ResourceKey | ResourceKey[], errors?: ApiError[]): void;
|
|
273
275
|
/**
|
|
274
276
|
* [LIFECYCLE] Signals to the cache that all data for a resource
|
|
275
277
|
* should be cleared.
|
|
@@ -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,12 +9,14 @@ 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
|
-
* Use these options to adjust CacheHandler behavior for a request
|
|
15
|
+
* Use these options to adjust {@link CacheHandler} behavior for a request
|
|
16
|
+
* via {@link RequestInfo.cacheOptions}.
|
|
14
17
|
*
|
|
15
18
|
*/
|
|
16
|
-
export
|
|
19
|
+
export interface CacheOptions {
|
|
17
20
|
/**
|
|
18
21
|
* A key that uniquely identifies this request. If not present, the url wil be used
|
|
19
22
|
* as the key for any GET request, while all other requests will not be cached.
|
|
@@ -57,7 +60,7 @@ export type CacheOptions = {
|
|
|
57
60
|
*
|
|
58
61
|
*/
|
|
59
62
|
[SkipCache]?: boolean;
|
|
60
|
-
}
|
|
63
|
+
}
|
|
61
64
|
export type FindRecordRequestOptions<
|
|
62
65
|
RT = unknown,
|
|
63
66
|
T = unknown
|
|
@@ -158,11 +161,15 @@ export interface FindRecordOptions extends ConstrainedRequestOptions {
|
|
|
158
161
|
include?: string | string[];
|
|
159
162
|
}
|
|
160
163
|
/**
|
|
161
|
-
* When a
|
|
162
|
-
* containing the original
|
|
163
|
-
* chain (if any), and
|
|
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.
|
|
164
168
|
*/
|
|
165
169
|
export interface StructuredDataDocument<T> {
|
|
170
|
+
/**
|
|
171
|
+
* @private
|
|
172
|
+
*/
|
|
166
173
|
[STRUCTURED]?: true;
|
|
167
174
|
/**
|
|
168
175
|
* @see {@link ImmutableRequestInfo}
|
|
@@ -172,25 +179,34 @@ export interface StructuredDataDocument<T> {
|
|
|
172
179
|
content: T;
|
|
173
180
|
}
|
|
174
181
|
/**
|
|
175
|
-
* When a
|
|
176
|
-
*
|
|
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
|
|
177
185
|
* itself.
|
|
178
186
|
*
|
|
179
187
|
* If using the error originates from the {@link Fetch | Fetch Handler}
|
|
180
188
|
* the error will be a {@link FetchError}
|
|
181
189
|
*/
|
|
182
190
|
export interface StructuredErrorDocument<T = unknown> extends Error {
|
|
191
|
+
/**
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
183
194
|
[STRUCTURED]?: true;
|
|
195
|
+
/**
|
|
196
|
+
* @see {@link ImmutableRequestInfo}
|
|
197
|
+
*/
|
|
184
198
|
request: ImmutableRequestInfo;
|
|
185
199
|
response: Response | ResponseInfo | null;
|
|
186
200
|
error: string | object;
|
|
187
201
|
content?: T;
|
|
188
202
|
}
|
|
189
203
|
/**
|
|
190
|
-
* A union of the resolve/reject data types for
|
|
204
|
+
* A union of the resolve/reject data types for the {@link Future}
|
|
205
|
+
* returned by {@link Store.request | request}
|
|
191
206
|
*
|
|
192
|
-
* See the docs for:
|
|
207
|
+
* See also the docs for:
|
|
193
208
|
*
|
|
209
|
+
* - {@link Future}
|
|
194
210
|
* - {@link StructuredDataDocument} (resolved/successful requests)
|
|
195
211
|
* - {@link StructuredErrorDocument} (rejected/failed requests)
|
|
196
212
|
*/
|
|
@@ -349,7 +365,3 @@ export interface RequestContext {
|
|
|
349
365
|
setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;
|
|
350
366
|
setResponse(response: Response | ResponseInfo | null): void;
|
|
351
367
|
}
|
|
352
|
-
export declare function withBrand<T>(obj: RequestInfo): RequestInfo<T> & {
|
|
353
|
-
[RequestSignature]: T;
|
|
354
|
-
};
|
|
355
|
-
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
1311
|
-
* from @
|
|
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 @
|
|
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.
|
|
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 @
|
|
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.
|
|
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 @
|
|
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.
|
|
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.
|
|
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
|
|
@@ -2125,18 +2138,29 @@ export interface ObjectSchema {
|
|
|
2125
2138
|
objectExtensions?: string[];
|
|
2126
2139
|
}
|
|
2127
2140
|
export type Schema = ResourceSchema | ObjectSchema;
|
|
2141
|
+
/**
|
|
2142
|
+
* A trait for use on a PolarisMode record
|
|
2143
|
+
*/
|
|
2128
2144
|
export interface PolarisTrait {
|
|
2129
2145
|
name: string;
|
|
2130
2146
|
mode: "polaris";
|
|
2131
2147
|
fields: PolarisModeFieldSchema[];
|
|
2132
2148
|
traits?: string[];
|
|
2133
2149
|
}
|
|
2150
|
+
/**
|
|
2151
|
+
* A trait for use on a LegacyMode record
|
|
2152
|
+
*/
|
|
2134
2153
|
export interface LegacyTrait {
|
|
2135
2154
|
name: string;
|
|
2136
2155
|
mode: "legacy";
|
|
2137
2156
|
fields: LegacyModeFieldSchema[];
|
|
2138
2157
|
traits?: string[];
|
|
2139
2158
|
}
|
|
2159
|
+
/**
|
|
2160
|
+
* A union of
|
|
2161
|
+
* - {@link LegacyTrait}
|
|
2162
|
+
* - {@link PolarisTrait}
|
|
2163
|
+
*/
|
|
2140
2164
|
export type Trait = LegacyTrait | PolarisTrait;
|
|
2141
2165
|
/**
|
|
2142
2166
|
* A no-op type utility that enables type-checking resource schema
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "
|
|
2
|
-
import type { ExtensibleField } from "
|
|
3
|
-
import type { ResourceKey } from "
|
|
4
|
-
import type { ObjectValue } from "
|
|
5
|
-
import type { Derivation, HashFn, Transformation } from "
|
|
6
|
-
import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "
|
|
1
|
+
import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "../../reactive.js";
|
|
2
|
+
import type { ExtensibleField } from "../../reactive/-private/schema.js";
|
|
3
|
+
import type { ResourceKey } from "../identifier.js";
|
|
4
|
+
import type { ObjectValue } from "../json/raw.js";
|
|
5
|
+
import type { Derivation, HashFn, Transformation } from "./concepts.js";
|
|
6
|
+
import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "./fields.js";
|
|
7
7
|
export type AttributesSchema = Record<string, LegacyAttributeField>;
|
|
8
8
|
export type RelationshipsSchema = Record<string, LegacyRelationshipField>;
|
|
9
9
|
interface ObjectWithStringTypeProperty {
|
|
@@ -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 `@
|
|
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 '@
|
|
35
|
+
* import { Store } from '@warp-drive/core';
|
|
36
36
|
* import CustomSchemas from './custom-schemas';
|
|
37
37
|
*
|
|
38
38
|
* export default class extends Store {
|
|
@@ -66,7 +66,7 @@ export interface SchemaService {
|
|
|
66
66
|
* Queries whether the SchemaService recognizes `type` as a resource type
|
|
67
67
|
*
|
|
68
68
|
* @public
|
|
69
|
-
* @deprecated
|
|
69
|
+
* @deprecated - use {@link SchemaService.hasResource | hasResource}
|
|
70
70
|
*/
|
|
71
71
|
doesTypeExist?(type: string): boolean;
|
|
72
72
|
/**
|
|
@@ -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 `@
|
|
232
|
+
* For instance, when using `@warp-drive/legacy/model`, the following attribute
|
|
233
233
|
* definition:
|
|
234
234
|
*
|
|
235
235
|
* ```ts
|
|
@@ -251,7 +251,7 @@ export interface SchemaService {
|
|
|
251
251
|
* ```
|
|
252
252
|
*
|
|
253
253
|
* @public
|
|
254
|
-
* @deprecated
|
|
254
|
+
* @deprecated - use {@link SchemaService.fields | fields}
|
|
255
255
|
*/
|
|
256
256
|
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
257
257
|
/**
|
|
@@ -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 @
|
|
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
|
|
@@ -330,7 +330,7 @@ export interface SchemaService {
|
|
|
330
330
|
* ```
|
|
331
331
|
*
|
|
332
332
|
* @public
|
|
333
|
-
* @deprecated
|
|
333
|
+
* @deprecated - use {@link SchemaService.fields | fields}
|
|
334
334
|
*/
|
|
335
335
|
relationshipsDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): RelationshipsSchema;
|
|
336
336
|
/**
|
|
@@ -342,6 +342,8 @@ export interface SchemaService {
|
|
|
342
342
|
/**
|
|
343
343
|
* Register an extension for either objects or arrays
|
|
344
344
|
*
|
|
345
|
+
* See also {@link CAUTION_MEGA_DANGER_ZONE_Extension}
|
|
346
|
+
*
|
|
345
347
|
* @public
|
|
346
348
|
*/
|
|
347
349
|
CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ export declare const RecordStore: "___(unique) Symbol(Store)";
|
|
|
9
9
|
* record implementations to provide a typescript
|
|
10
10
|
* hint for the type of the resource.
|
|
11
11
|
*
|
|
12
|
-
* When used,
|
|
12
|
+
* When used, WarpDrive APIs can
|
|
13
13
|
* take advantage of this to provide better type
|
|
14
14
|
* safety and intellisense.
|
|
15
15
|
*
|
|
@@ -45,7 +45,7 @@ export declare const Type: "___(unique) Symbol($type)";
|
|
|
45
45
|
* record implementations to provide a typescript
|
|
46
46
|
* hint for the type of the resource.
|
|
47
47
|
*
|
|
48
|
-
* When used,
|
|
48
|
+
* When used, WarpDrive APIs can
|
|
49
49
|
* take advantage of this to provide better type
|
|
50
50
|
* safety and intellisense.
|
|
51
51
|
*
|
package/declarations/types.d.ts
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
export type { StableRecordIdentifier, ResourceKey } from "./types/identifier.js";
|
|
8
8
|
export type { CacheCapabilitiesManager } from "./store/-types/q/cache-capabilities-manager.js";
|
|
9
9
|
export type { ModelSchema } from "./store/deprecated/-private.js";
|
|
10
|
-
export type { SchemaService } from "./
|
|
10
|
+
export type { SchemaService } from "./types/schema/schema-service.js";
|
|
11
11
|
export type { BaseFinderOptions, FindRecordOptions, LegacyResourceQuery, QueryOptions, FindAllOptions } from "./store/-types/q/store.js";
|
package/dist/build-config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { setConfig } from '@warp-drive/build-config';
|
|
1
|
+
export { babelPlugin, setConfig } from '@warp-drive/build-config';
|