@warp-drive-mirror/core 5.10.0-alpha.12 → 5.10.0-alpha.13
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 +32 -0
- package/dist/{-private-CjK1Dmuh.js → -private-BpyvBYFj.js} +508 -144
- package/dist/-private-BpyvBYFj.js.map +1 -0
- package/dist/{unpkg/dev/-private-Dtj8O5W7.js → -private-CmNOwhK0.js} +3 -1
- package/dist/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/{aliases-BWYW5EhX.d.ts → aliases-BQmAxXmb.d.ts} +4 -1
- package/dist/aliases-BQmAxXmb.d.ts.map +1 -0
- package/dist/{change-C7kqv2kW.d.ts → change-DClXcHvr.d.ts} +4 -2
- package/dist/change-DClXcHvr.d.ts.map +1 -0
- package/dist/{concepts-DFldVwEM.d.ts → concepts-DzuY5M1K.d.ts} +14 -5
- package/dist/concepts-DzuY5M1K.d.ts.map +1 -0
- package/dist/{configure-B_F639tN.d.ts → configure-CjsojjiI.d.ts} +7 -1
- package/dist/configure-CjsojjiI.d.ts.map +1 -0
- package/dist/configure.d.ts +1 -1
- package/dist/configure.js +1 -1
- package/dist/{document-Ca4ZZBd9.d.ts → document-Ni8Ns26t.d.ts} +22 -4
- package/dist/document-Ni8Ns26t.d.ts.map +1 -0
- package/dist/{error-0uD6GkNX.d.ts → error-APuUdUGk.d.ts} +4 -2
- package/dist/error-APuUdUGk.d.ts.map +1 -0
- package/dist/{fields-CnlWuUd5.d.ts → fields-D6173Q_a.d.ts} +126 -5
- package/dist/fields-D6173Q_a.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +1 -1
- package/dist/graph/-private.js +2 -0
- package/dist/graph/-private.js.map +1 -1
- package/dist/{graph-DLqYXP2z.d.ts → graph-rjTyJ-gd.d.ts} +25 -5
- package/dist/graph-rjTyJ-gd.d.ts.map +1 -0
- package/dist/{identifier-DQnqOSJK.d.ts → identifier-B_tK3FUw.d.ts} +29 -4
- package/dist/identifier-B_tK3FUw.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-DBnp5uP6.d.ts → internal-CgOlgOt3.d.ts} +496 -31
- package/dist/internal-CgOlgOt3.d.ts.map +1 -0
- package/dist/{json-api-raw-C5APJHHB.d.ts → json-api-raw-BxzNsCg0.d.ts} +44 -2
- package/dist/json-api-raw-BxzNsCg0.d.ts.map +1 -0
- package/dist/{mutations-CqtoGB4t.d.ts → mutations-C81gbYjB.d.ts} +18 -2
- package/dist/mutations-C81gbYjB.d.ts.map +1 -0
- package/dist/{operations-D1qA6r0_.d.ts → operations-B4pQM7D6.d.ts} +39 -5
- package/dist/operations-B4pQM7D6.d.ts.map +1 -0
- package/dist/{params-DrEx3bf8.d.ts → params-dbHiSOMF.d.ts} +11 -1
- package/dist/params-dbHiSOMF.d.ts.map +1 -0
- package/dist/{raw-D5hnjiq7.d.ts → raw-CiC64nCY.d.ts} +10 -1
- package/dist/raw-CiC64nCY.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +1 -1
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.d.ts +2 -2
- package/dist/reactive.js +3 -3
- package/dist/{record-D3QQcaIR.d.ts → record-DDxPtzcY.d.ts} +22 -2
- package/dist/record-DDxPtzcY.d.ts.map +1 -0
- package/dist/{relationship-CmHzMPKf.d.ts → relationship-BlGIXgj4.d.ts} +10 -3
- package/dist/relationship-BlGIXgj4.d.ts.map +1 -0
- package/dist/{request-Di274pQz.js → request-MiwUbGdT.js} +26 -1
- package/dist/request-MiwUbGdT.js.map +1 -0
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +86 -4
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/signals/-leaked.js +1 -1
- package/dist/{src-B9WcEdYg.js → src-DlNeupkA.js} +221 -20
- package/dist/src-DlNeupkA.js.map +1 -0
- package/dist/store/-private.d.ts +1 -1
- package/dist/store/-private.js +1 -1
- package/dist/{store-DNF9Rgoh.js → store-lcyaxrpj.js} +16 -1
- package/dist/store-lcyaxrpj.js.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/{symbols-DjRDCeX0.d.ts → symbols-Cu9un1NR.d.ts} +10 -1
- package/dist/symbols-Cu9un1NR.d.ts.map +1 -0
- package/dist/types/-private.js +1 -1
- package/dist/types/cache/aliases.d.ts +1 -1
- package/dist/types/cache/change.d.ts +1 -1
- package/dist/types/cache/mutations.d.ts +1 -1
- package/dist/types/cache/operations.d.ts +1 -1
- package/dist/types/cache/relationship.d.ts +1 -1
- package/dist/types/cache.d.ts +1 -1
- package/dist/types/graph.d.ts +1 -1
- package/dist/types/identifier.d.ts +1 -1
- package/dist/types/identifier.js +33 -3
- package/dist/types/identifier.js.map +1 -1
- package/dist/types/json/raw.d.ts +1 -1
- package/dist/types/params.d.ts +1 -1
- package/dist/types/record.d.ts +1 -1
- package/dist/types/record.js +25 -0
- package/dist/types/record.js.map +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/types/request.js +80 -0
- package/dist/types/request.js.map +1 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/schema/concepts.d.ts +1 -1
- package/dist/types/schema/fields.d.ts +1 -1
- package/dist/types/schema/fields.js +132 -3
- package/dist/types/schema/fields.js.map +1 -1
- package/dist/types/schema/schema-service.d.ts +1 -1
- package/dist/types/spec/document.d.ts +1 -1
- package/dist/types/spec/error.d.ts +1 -1
- package/dist/types/spec/json-api-raw.d.ts +1 -1
- package/dist/types/symbols.d.ts +1 -1
- package/dist/types/symbols.js +14 -0
- package/dist/types/symbols.js.map +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/unpkg/{dev-deprecated/-private-DrQgwtNS.js → dev/-private-BH4O810v.js} +508 -144
- package/dist/unpkg/dev/-private-BH4O810v.js.map +1 -0
- package/dist/{-private-Dtj8O5W7.js → unpkg/dev/-private-CmNOwhK0.js} +3 -1
- package/dist/unpkg/dev/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/dev/configure.js +1 -1
- package/dist/unpkg/dev/graph/-private.js +2 -0
- package/dist/unpkg/dev/graph/-private.js.map +1 -1
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +3 -3
- package/dist/unpkg/{dev-deprecated/request-nAaeDlS9.js → dev/request-Fe-vpe-u.js} +26 -1
- package/dist/unpkg/dev/request-Fe-vpe-u.js.map +1 -0
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -1
- package/dist/unpkg/dev/{src-CkkrRFE1.js → src-FSk0Z_Lp.js} +212 -13
- package/dist/unpkg/dev/src-FSk0Z_Lp.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +1 -1
- package/dist/unpkg/dev/{store-BIFNM_fB.js → store-BUV8Pfi7.js} +16 -1
- package/dist/unpkg/dev/store-BUV8Pfi7.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/types/-private.js +1 -1
- package/dist/unpkg/dev/types/identifier.js +33 -3
- package/dist/unpkg/dev/types/identifier.js.map +1 -1
- package/dist/unpkg/dev/types/record.js +25 -0
- package/dist/unpkg/dev/types/record.js.map +1 -1
- package/dist/unpkg/dev/types/request.js +80 -0
- package/dist/unpkg/dev/types/request.js.map +1 -1
- package/dist/unpkg/dev/types/schema/fields.js +132 -3
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev/types/symbols.js +14 -0
- package/dist/unpkg/dev/types/symbols.js.map +1 -1
- package/dist/unpkg/{dev/-private-DrQgwtNS.js → dev-deprecated/-private-BH4O810v.js} +508 -144
- package/dist/unpkg/dev-deprecated/-private-BH4O810v.js.map +1 -0
- package/dist/unpkg/{prod-deprecated/-private-Dtj8O5W7.js → dev-deprecated/-private-CmNOwhK0.js} +3 -1
- package/dist/unpkg/dev-deprecated/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/configure.js +1 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +2 -0
- package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +3 -3
- package/dist/unpkg/{dev/request-nAaeDlS9.js → dev-deprecated/request-Fe-vpe-u.js} +26 -1
- package/dist/unpkg/dev-deprecated/request-Fe-vpe-u.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/dev-deprecated/{src-oz6OaQXu.js → src-Isk_Je7q.js} +214 -13
- package/dist/unpkg/dev-deprecated/src-Isk_Je7q.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/{store-X1WN7P_O.js → store-CCZBSe0p.js} +16 -1
- package/dist/unpkg/dev-deprecated/store-CCZBSe0p.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/types/identifier.js +33 -3
- package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/record.js +25 -0
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js +80 -0
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +132 -3
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +14 -0
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/prod/-private-CmNOwhK0.js +24 -0
- package/dist/unpkg/prod/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/prod/{-private-Dg1vsF-H.js → -private-DKVDMUfT.js} +481 -138
- package/dist/unpkg/prod/-private-DKVDMUfT.js.map +1 -0
- package/dist/unpkg/prod/configure.js +1 -1
- package/dist/unpkg/prod/graph/-private.js +2 -0
- package/dist/unpkg/prod/graph/-private.js.map +1 -1
- package/dist/unpkg/prod/index.js +1 -1
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +3 -3
- package/dist/unpkg/prod/{request-DK7nNaAf.js → request-ndw2Fy91.js} +26 -1
- package/dist/unpkg/prod/request-ndw2Fy91.js.map +1 -0
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/signals/-leaked.js +1 -1
- package/dist/unpkg/prod/{src-BGKCOL5L.js → src-CoSpuocQ.js} +212 -13
- package/dist/unpkg/prod/src-CoSpuocQ.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +1 -1
- package/dist/unpkg/{prod-deprecated/store-BWhmb7Ob.js → prod/store-CQOsqdST.js} +16 -1
- package/dist/unpkg/prod/store-CQOsqdST.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod/types/-private.js +1 -1
- package/dist/unpkg/prod/types/identifier.js +33 -3
- package/dist/unpkg/prod/types/identifier.js.map +1 -1
- package/dist/unpkg/prod/types/record.js +25 -0
- package/dist/unpkg/prod/types/record.js.map +1 -1
- package/dist/unpkg/prod/types/request.js +80 -0
- package/dist/unpkg/prod/types/request.js.map +1 -1
- package/dist/unpkg/prod/types/schema/fields.js +132 -3
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod/types/symbols.js +14 -0
- package/dist/unpkg/prod/types/symbols.js.map +1 -1
- package/dist/unpkg/{dev-deprecated/-private-Dtj8O5W7.js → prod-deprecated/-private-CmNOwhK0.js} +3 -1
- package/dist/unpkg/prod-deprecated/{-private-Dtj8O5W7.js.map → -private-CmNOwhK0.js.map} +1 -1
- package/dist/unpkg/prod-deprecated/{-private-Dg1vsF-H.js → -private-DKVDMUfT.js} +481 -138
- package/dist/unpkg/prod-deprecated/-private-DKVDMUfT.js.map +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +1 -1
- package/dist/unpkg/prod-deprecated/graph/-private.js +2 -0
- package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/prod-deprecated/index.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +3 -3
- package/dist/unpkg/prod-deprecated/{request-DK7nNaAf.js → request-ndw2Fy91.js} +26 -1
- package/dist/unpkg/prod-deprecated/request-ndw2Fy91.js.map +1 -0
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/prod-deprecated/{src-CGypdIsf.js → src-FK_rMde5.js} +214 -13
- package/dist/unpkg/prod-deprecated/src-FK_rMde5.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +1 -1
- package/dist/unpkg/{prod/store-BWhmb7Ob.js → prod-deprecated/store-CQOsqdST.js} +16 -1
- package/dist/unpkg/prod-deprecated/store-CQOsqdST.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/types/identifier.js +33 -3
- package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/record.js +25 -0
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js +80 -0
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +132 -3
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +14 -0
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
- package/dist/{utils-BtURiy8l.d.ts → utils-CNmQoKm8.d.ts} +8 -1
- package/dist/utils-CNmQoKm8.d.ts.map +1 -0
- package/package.json +5 -5
- package/dist/-private-CjK1Dmuh.js.map +0 -1
- package/dist/aliases-BWYW5EhX.d.ts.map +0 -1
- package/dist/change-C7kqv2kW.d.ts.map +0 -1
- package/dist/concepts-DFldVwEM.d.ts.map +0 -1
- package/dist/configure-B_F639tN.d.ts.map +0 -1
- package/dist/document-Ca4ZZBd9.d.ts.map +0 -1
- package/dist/error-0uD6GkNX.d.ts.map +0 -1
- package/dist/fields-CnlWuUd5.d.ts.map +0 -1
- package/dist/graph-DLqYXP2z.d.ts.map +0 -1
- package/dist/identifier-DQnqOSJK.d.ts.map +0 -1
- package/dist/internal-DBnp5uP6.d.ts.map +0 -1
- package/dist/json-api-raw-C5APJHHB.d.ts.map +0 -1
- package/dist/mutations-CqtoGB4t.d.ts.map +0 -1
- package/dist/operations-D1qA6r0_.d.ts.map +0 -1
- package/dist/params-DrEx3bf8.d.ts.map +0 -1
- package/dist/raw-D5hnjiq7.d.ts.map +0 -1
- package/dist/record-D3QQcaIR.d.ts.map +0 -1
- package/dist/relationship-CmHzMPKf.d.ts.map +0 -1
- package/dist/request-Di274pQz.js.map +0 -1
- package/dist/src-B9WcEdYg.js.map +0 -1
- package/dist/store-DNF9Rgoh.js.map +0 -1
- package/dist/symbols-DjRDCeX0.d.ts.map +0 -1
- package/dist/unpkg/dev/-private-DrQgwtNS.js.map +0 -1
- package/dist/unpkg/dev/request-nAaeDlS9.js.map +0 -1
- package/dist/unpkg/dev/src-CkkrRFE1.js.map +0 -1
- package/dist/unpkg/dev/store-BIFNM_fB.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-DrQgwtNS.js.map +0 -1
- package/dist/unpkg/dev-deprecated/request-nAaeDlS9.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-oz6OaQXu.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-X1WN7P_O.js.map +0 -1
- package/dist/unpkg/prod/-private-Dg1vsF-H.js.map +0 -1
- package/dist/unpkg/prod/-private-Dtj8O5W7.js +0 -22
- package/dist/unpkg/prod/request-DK7nNaAf.js.map +0 -1
- package/dist/unpkg/prod/src-BGKCOL5L.js.map +0 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-Dg1vsF-H.js.map +0 -1
- package/dist/unpkg/prod-deprecated/request-DK7nNaAf.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-CGypdIsf.js.map +0 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +0 -1
- package/dist/utils-BtURiy8l.d.ts.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { getOrSetGlobal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient } from "./types/-private.js";
|
|
2
|
-
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal, N as waitFor, O as peekInternalSignal, P as willSyncFlushWatchers, S as consumeInternalSignal, T as getOrCreateInternalSignal, _ as entangleSignal, f as createSignalDescriptor, g as entangleInitiallyStaleSignal, h as defineSignal, j as OBJECT_SIGNAL, k as withSignalStore, p as defineGate, w as createInternalSignal, x as Signals } from "./-private-
|
|
2
|
+
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal, N as waitFor, O as peekInternalSignal, P as willSyncFlushWatchers, S as consumeInternalSignal, T as getOrCreateInternalSignal, _ as entangleSignal, f as createSignalDescriptor, g as entangleInitiallyStaleSignal, h as defineSignal, j as OBJECT_SIGNAL, k as withSignalStore, p as defineGate, w as createInternalSignal, x as Signals } from "./-private-BH4O810v.js";
|
|
3
3
|
import { EnableHydration, STRUCTURED, SkipCache } from "./types/request.js";
|
|
4
4
|
import { CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_KEY_TYPE, DEBUG_STALE_CACHE_OWNER } from "./types/identifier.js";
|
|
5
|
-
import { a as upgradePromise, c as executeNextHandler, d as getRequestResult, f as setPromiseResult, l as clearRequestResult, m as assertValidRequest, o as DOMError, p as cloneResponseProperties, s as IS_CACHE_HANDLER, t as withBrand } from "./request-
|
|
5
|
+
import { a as upgradePromise, c as executeNextHandler, d as getRequestResult, f as setPromiseResult, l as clearRequestResult, m as assertValidRequest, o as DOMError, p as cloneResponseProperties, s as IS_CACHE_HANDLER, t as withBrand } from "./request-Fe-vpe-u.js";
|
|
6
6
|
import { getRuntimeConfig, setIsMaybeMirage, setLogging } from "./types/runtime.js";
|
|
7
|
-
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-
|
|
7
|
+
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-CmNOwhK0.js";
|
|
8
8
|
import { t as getGlobalConfig } from "./runtime-vtT5WRY_.js";
|
|
9
9
|
import { RecordStore, Type } from "./types/symbols.js";
|
|
10
10
|
import { isResourceSchema } from "./types/schema/fields.js";
|
|
11
|
-
import { t as DefaultCachePolicy } from "./store-
|
|
11
|
+
import { t as DefaultCachePolicy } from "./store-BUV8Pfi7.js";
|
|
12
12
|
|
|
13
13
|
//#region src/reactive/-private/document.ts
|
|
14
14
|
function urlFromLink(link) {
|
|
@@ -20,10 +20,15 @@ function urlFromLink(link) {
|
|
|
20
20
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
21
21
|
* ReactiveResource instances.
|
|
22
22
|
*
|
|
23
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
24
|
+
* shows when a request's content is a ReactiveDocument.
|
|
25
|
+
*
|
|
23
26
|
* It is not directly instantiated by the user, and its properties should not
|
|
24
27
|
* be directly modified. Whether individual properties are mutable or not is
|
|
25
28
|
* determined by the record instance itself.
|
|
26
29
|
*
|
|
30
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
31
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
27
32
|
* @public
|
|
28
33
|
*/
|
|
29
34
|
const ReactiveDocumentProto = {
|
|
@@ -591,6 +596,8 @@ implement this hook.
|
|
|
591
596
|
|
|
592
597
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
593
598
|
|
|
599
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
600
|
+
before the store is created.
|
|
594
601
|
@public
|
|
595
602
|
*/
|
|
596
603
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -625,6 +632,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
625
632
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
626
633
|
without providing an `id` when one is missing will throw an error.
|
|
627
634
|
|
|
635
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
636
|
+
own secondary lookup tables.
|
|
628
637
|
@public
|
|
629
638
|
*/
|
|
630
639
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -642,6 +651,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
642
651
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
643
652
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
644
653
|
|
|
654
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
655
|
+
lookup tables.
|
|
645
656
|
@public
|
|
646
657
|
*/
|
|
647
658
|
function setIdentifierForgetMethod(method) {
|
|
@@ -661,6 +672,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
661
672
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
662
673
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
663
674
|
|
|
675
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
676
|
+
key-generation state.
|
|
664
677
|
@public
|
|
665
678
|
*/
|
|
666
679
|
function setIdentifierResetMethod(method) {
|
|
@@ -679,6 +692,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
679
692
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
680
693
|
```
|
|
681
694
|
|
|
695
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
696
|
+
must be set before the store is created.
|
|
682
697
|
@public
|
|
683
698
|
*/
|
|
684
699
|
function setKeyInfoForResource(method) {
|
|
@@ -1262,6 +1277,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
1262
1277
|
const { id, type, lid } = identifier;
|
|
1263
1278
|
```
|
|
1264
1279
|
|
|
1280
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
1265
1281
|
@public
|
|
1266
1282
|
@param record a record instance previously obstained from the store.
|
|
1267
1283
|
*/
|
|
@@ -1919,9 +1935,15 @@ var CacheManager = class {
|
|
|
1919
1935
|
//#region src/store/-private/managers/notification-manager.ts
|
|
1920
1936
|
/**
|
|
1921
1937
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1938
|
+
*
|
|
1939
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
1940
|
+
* or `state`.
|
|
1922
1941
|
*/
|
|
1923
1942
|
/**
|
|
1924
1943
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1944
|
+
*
|
|
1945
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
1946
|
+
* `invalidated`.
|
|
1925
1947
|
*/
|
|
1926
1948
|
function isCacheOperationValue(value) {
|
|
1927
1949
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -1929,6 +1951,9 @@ function isCacheOperationValue(value) {
|
|
|
1929
1951
|
/**
|
|
1930
1952
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1931
1953
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1954
|
+
*
|
|
1955
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
1956
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
1932
1957
|
*/
|
|
1933
1958
|
/**
|
|
1934
1959
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -1936,6 +1961,8 @@ function isCacheOperationValue(value) {
|
|
|
1936
1961
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1937
1962
|
* instead of once per key.
|
|
1938
1963
|
*
|
|
1964
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
1965
|
+
* `relationships` changes in one call.
|
|
1939
1966
|
* @since 5.9.0
|
|
1940
1967
|
* @public
|
|
1941
1968
|
*/
|
|
@@ -1970,6 +1997,8 @@ function isCacheOperationValue(value) {
|
|
|
1970
1997
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1971
1998
|
* have no local/remote duality.
|
|
1972
1999
|
*
|
|
2000
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
2001
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
1973
2002
|
* @public
|
|
1974
2003
|
*/
|
|
1975
2004
|
/**
|
|
@@ -2106,6 +2135,8 @@ function _unsubscribe(token, cache) {
|
|
|
2106
2135
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2107
2136
|
* work with any framework or change-notification system.
|
|
2108
2137
|
*
|
|
2138
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
2139
|
+
* cached resources and request documents.
|
|
2109
2140
|
* @hideconstructor
|
|
2110
2141
|
* @public
|
|
2111
2142
|
*/
|
|
@@ -2528,10 +2559,15 @@ const MUTABLE_PROPS = [
|
|
|
2528
2559
|
* as the base for relationship and legacy record-array types such as
|
|
2529
2560
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
2530
2561
|
*
|
|
2562
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
2563
|
+
* how it relates to resources.
|
|
2564
|
+
*
|
|
2531
2565
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
2532
2566
|
* both report `true`. The array stays in sync with the cache, updating
|
|
2533
2567
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
2534
2568
|
*
|
|
2569
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
2570
|
+
* and underlying relationship and legacy record arrays.
|
|
2535
2571
|
* @public
|
|
2536
2572
|
*/
|
|
2537
2573
|
/**
|
|
@@ -2850,6 +2886,8 @@ function createRequestCollection(config) {
|
|
|
2850
2886
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
2851
2887
|
* would be empty.
|
|
2852
2888
|
*
|
|
2889
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
2890
|
+
* `store.findAll`.
|
|
2853
2891
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
2854
2892
|
*/
|
|
2855
2893
|
/**
|
|
@@ -2965,6 +3003,8 @@ function _updateLiveArray() {
|
|
|
2965
3003
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
2966
3004
|
* from the store for book-keeping.
|
|
2967
3005
|
*
|
|
3006
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
3007
|
+
* `update()` and released with `destroy()`.
|
|
2968
3008
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
2969
3009
|
*/
|
|
2970
3010
|
/**
|
|
@@ -3772,6 +3812,10 @@ const app = new EmberApp(defaults, {
|
|
|
3772
3812
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
3773
3813
|
* requests for data with schemas, caching and reactivity.
|
|
3774
3814
|
*
|
|
3815
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
3816
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
3817
|
+
* through it.
|
|
3818
|
+
*
|
|
3775
3819
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
3776
3820
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
3777
3821
|
* even when you aren't sure yet.
|
|
@@ -3779,6 +3823,7 @@ const app = new EmberApp(defaults, {
|
|
|
3779
3823
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
3780
3824
|
* is possible.
|
|
3781
3825
|
*
|
|
3826
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
3782
3827
|
* @public
|
|
3783
3828
|
* @hideconstructor
|
|
3784
3829
|
*/
|
|
@@ -3986,12 +4031,25 @@ var Store = class extends BaseClass {
|
|
|
3986
4031
|
}
|
|
3987
4032
|
}
|
|
3988
4033
|
/**
|
|
3989
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
4034
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
3990
4035
|
* :::
|
|
3991
4036
|
*
|
|
3992
4037
|
* Issue a request via the configured {@link RequestManager},
|
|
3993
4038
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
3994
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
4039
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
4040
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
4041
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
4042
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
4043
|
+
* {@link StructuredDocument}.
|
|
4044
|
+
*
|
|
4045
|
+
* #### Building Requests
|
|
4046
|
+
*
|
|
4047
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
4048
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
4049
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
4050
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
4051
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
4052
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
3995
4053
|
*
|
|
3996
4054
|
* #### Request Cache Keys
|
|
3997
4055
|
*
|
|
@@ -4036,6 +4094,29 @@ var Store = class extends BaseClass {
|
|
|
4036
4094
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
4037
4095
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
4038
4096
|
*
|
|
4097
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
4098
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
4099
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
4100
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
4101
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
4102
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
4103
|
+
*
|
|
4104
|
+
* #### Typing The Response
|
|
4105
|
+
*
|
|
4106
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
4107
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
4108
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
4109
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
4110
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
4111
|
+
*
|
|
4112
|
+
* @example
|
|
4113
|
+
* ```ts
|
|
4114
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
4115
|
+
*
|
|
4116
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
4117
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
4118
|
+
* ```
|
|
4119
|
+
*
|
|
4039
4120
|
* @public
|
|
4040
4121
|
*/
|
|
4041
4122
|
request(requestConfig) {
|
|
@@ -4620,10 +4701,16 @@ function getPriority(identifier, deduped, priority) {
|
|
|
4620
4701
|
/**
|
|
4621
4702
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
4622
4703
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
4704
|
+
*
|
|
4705
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
4706
|
+
* form with plain `records` and `headers`.
|
|
4623
4707
|
*/
|
|
4624
4708
|
/**
|
|
4625
4709
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
4626
4710
|
*
|
|
4711
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
4712
|
+
* request can use the cache.
|
|
4713
|
+
*
|
|
4627
4714
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
4628
4715
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
4629
4716
|
* attached to the request.
|
|
@@ -4659,7 +4746,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
4659
4746
|
* method: 'GET',
|
|
4660
4747
|
* [EnableHydration]: true
|
|
4661
4748
|
* });
|
|
4749
|
+
* ```
|
|
4662
4750
|
*
|
|
4751
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
4752
|
+
* reactive documents when hydration is enabled.
|
|
4663
4753
|
*/
|
|
4664
4754
|
const CacheHandler = { request(context, next) {
|
|
4665
4755
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -4953,6 +5043,7 @@ the has-many.
|
|
|
4953
5043
|
We call the record to which a relationship belongs-to the
|
|
4954
5044
|
relationship's _owner_.
|
|
4955
5045
|
|
|
5046
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
4956
5047
|
@public
|
|
4957
5048
|
*/
|
|
4958
5049
|
/**
|
|
@@ -6227,10 +6318,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
6227
6318
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
6228
6319
|
* object.
|
|
6229
6320
|
*
|
|
6321
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
6322
|
+
* define the schema it reads.
|
|
6323
|
+
*
|
|
6230
6324
|
* This class is not directly instantiable. To use it, you should
|
|
6231
6325
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
6232
6326
|
* with the matching hooks provided by this package.
|
|
6233
6327
|
*
|
|
6328
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
6234
6329
|
* @hideconstructor
|
|
6235
6330
|
* @public
|
|
6236
6331
|
*/
|
|
@@ -6684,6 +6779,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
6684
6779
|
* Edits to editable resources will be automatically committed if a new
|
|
6685
6780
|
* payload from the cache matches their existing value.
|
|
6686
6781
|
*
|
|
6782
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
6783
|
+
* changed locally.
|
|
6687
6784
|
* @public
|
|
6688
6785
|
*
|
|
6689
6786
|
* @returns a promise that resolves to the editable resource
|
|
@@ -6700,6 +6797,8 @@ function checkout(resource) {
|
|
|
6700
6797
|
* approach is for either the API or a Handler to reflect saved
|
|
6701
6798
|
* changes back to update the cache.
|
|
6702
6799
|
*
|
|
6800
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
6801
|
+
* bypassing a save round-trip.
|
|
6703
6802
|
* @public
|
|
6704
6803
|
*/
|
|
6705
6804
|
function commit(record) {
|
|
@@ -6717,6 +6816,8 @@ function commit(record) {
|
|
|
6717
6816
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
6718
6817
|
* properties when creating a new legacy record.
|
|
6719
6818
|
*
|
|
6819
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
6820
|
+
* from its registered schema.
|
|
6720
6821
|
* @public
|
|
6721
6822
|
*/
|
|
6722
6823
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -6749,6 +6850,8 @@ function assertReactiveResource(record) {
|
|
|
6749
6850
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
6750
6851
|
* behavior.
|
|
6751
6852
|
*
|
|
6853
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
6854
|
+
* releases it.
|
|
6752
6855
|
* @public
|
|
6753
6856
|
*/
|
|
6754
6857
|
function teardownRecord(record) {
|
|
@@ -6803,16 +6906,25 @@ _constructor[Type] = "@constructor";
|
|
|
6803
6906
|
* This should only be used for temporary migration purposes
|
|
6804
6907
|
* to the new schema system when migrating from either Model
|
|
6805
6908
|
* or ModelFragments.
|
|
6909
|
+
*
|
|
6910
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
6911
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
6806
6912
|
*/
|
|
6807
6913
|
/**
|
|
6808
6914
|
* Describes one feature added to a resource by a schema extension, as
|
|
6809
6915
|
* classified by {@link processExtension} from the property descriptor it
|
|
6810
6916
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
6917
|
+
*
|
|
6918
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
6919
|
+
* mutable value, or a getter/setter accessor.
|
|
6811
6920
|
*/
|
|
6812
6921
|
/**
|
|
6813
6922
|
* The result of {@link processExtension} normalizing a
|
|
6814
6923
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
6815
6924
|
* by name.
|
|
6925
|
+
*
|
|
6926
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
6927
|
+
* keyed by property name.
|
|
6816
6928
|
*/
|
|
6817
6929
|
const BannedKeys = ["constructor", "__proto__"];
|
|
6818
6930
|
function processExtension(extension) {
|
|
@@ -6912,14 +7024,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
6912
7024
|
* Utility for constructing a ResourceSchema with the recommended
|
|
6913
7025
|
* fields for the PolarisMode experience.
|
|
6914
7026
|
*
|
|
7027
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7028
|
+
* create a schema with it.
|
|
7029
|
+
*
|
|
6915
7030
|
* Using this requires registering the PolarisMode derivations
|
|
6916
7031
|
*
|
|
6917
7032
|
* ```ts
|
|
6918
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
7033
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
6919
7034
|
*
|
|
6920
7035
|
* registerDerivations(schema);
|
|
6921
7036
|
* ```
|
|
6922
7037
|
*
|
|
7038
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
7039
|
+
* PolarisMode resource schema.
|
|
6923
7040
|
* @public
|
|
6924
7041
|
* @param schema
|
|
6925
7042
|
* @return {PolarisResourceSchema}
|
|
@@ -6950,6 +7067,8 @@ function withDefaults(schema) {
|
|
|
6950
7067
|
*
|
|
6951
7068
|
* `^` returns the entire identifier object.
|
|
6952
7069
|
*
|
|
7070
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
7071
|
+
* for use in derived fields.
|
|
6953
7072
|
* @public
|
|
6954
7073
|
*/
|
|
6955
7074
|
const fromIdentity = (record, options, key) => {
|
|
@@ -6973,9 +7092,14 @@ fromIdentity[Type] = "@identity";
|
|
|
6973
7092
|
* to use the PolarisMode defaults provided by
|
|
6974
7093
|
*
|
|
6975
7094
|
* ```ts
|
|
6976
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
7095
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
6977
7096
|
* ```
|
|
6978
7097
|
*
|
|
7098
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
7099
|
+
* guide explains when you need to call it.
|
|
7100
|
+
*
|
|
7101
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
7102
|
+
* `withDefaults` depend on.
|
|
6979
7103
|
* @public
|
|
6980
7104
|
*/
|
|
6981
7105
|
function registerDerivations(schema) {
|
|
@@ -7051,6 +7175,9 @@ function assertConsistentAbstractFieldShape(abstractType, fieldName, existing, i
|
|
|
7051
7175
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
7052
7176
|
* between the raw value `T` stored in the cache and the presentation value
|
|
7053
7177
|
* `PT` exposed on the record.
|
|
7178
|
+
*
|
|
7179
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
7180
|
+
* record, with optional default.
|
|
7054
7181
|
*/
|
|
7055
7182
|
/**
|
|
7056
7183
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -7073,6 +7200,12 @@ function makeCachedDerivation(derivation) {
|
|
|
7073
7200
|
/**
|
|
7074
7201
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
7075
7202
|
*
|
|
7203
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
7204
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
7205
|
+
* shows how to give a store one.
|
|
7206
|
+
*
|
|
7207
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
7208
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
7076
7209
|
* @public
|
|
7077
7210
|
*/
|
|
7078
7211
|
var SchemaService = class {
|
|
@@ -7735,6 +7868,8 @@ function mergeMap(base, toApply) {
|
|
|
7735
7868
|
* - {@link LegacyModeFieldSchema}
|
|
7736
7869
|
* - {@link PolarisModeFieldSchema}
|
|
7737
7870
|
*
|
|
7871
|
+
* @summary Schema-driven reactive records, arrays, and documents the store builds from cached data, plus the
|
|
7872
|
+
* `SchemaService` and schema types that define them.
|
|
7738
7873
|
* @module
|
|
7739
7874
|
*/
|
|
7740
7875
|
|
|
@@ -7817,6 +7952,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
7817
7952
|
* A basic Fetch Handler which converts a request into a
|
|
7818
7953
|
* `fetch` call presuming the response to be `json`.
|
|
7819
7954
|
*
|
|
7955
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
7956
|
+
* guide shows where it sits in the handler chain.
|
|
7957
|
+
*
|
|
7820
7958
|
* ```ts
|
|
7821
7959
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7822
7960
|
*
|
|
@@ -7824,6 +7962,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
7824
7962
|
* .use([Fetch]);
|
|
7825
7963
|
* ```
|
|
7826
7964
|
*
|
|
7965
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
7966
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
7827
7967
|
* @public
|
|
7828
7968
|
* @badge Handler
|
|
7829
7969
|
*/
|
|
@@ -7953,7 +8093,8 @@ function isDict(v) {
|
|
|
7953
8093
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
7954
8094
|
* ```
|
|
7955
8095
|
*
|
|
7956
|
-
* For complete usage guide see
|
|
8096
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
8097
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
7957
8098
|
*
|
|
7958
8099
|
* ## How It Works
|
|
7959
8100
|
*
|
|
@@ -7976,11 +8117,28 @@ function isDict(v) {
|
|
|
7976
8117
|
* ```ts [Setup.ts]
|
|
7977
8118
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7978
8119
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
7979
|
-
* import
|
|
8120
|
+
* import { AuthHandler } from './auth-handler';
|
|
7980
8121
|
*
|
|
7981
8122
|
* // ... create manager
|
|
7982
8123
|
* const manager = new RequestManager()
|
|
7983
|
-
* .use([
|
|
8124
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
8125
|
+
* ```
|
|
8126
|
+
*
|
|
8127
|
+
* ```ts [auth-handler.ts]
|
|
8128
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
8129
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
8130
|
+
*
|
|
8131
|
+
* const token = '<token>';
|
|
8132
|
+
*
|
|
8133
|
+
* // adds a bearer token to every request, then passes it along
|
|
8134
|
+
* export const AuthHandler: Handler = {
|
|
8135
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
8136
|
+
* const headers = new Headers(context.request.headers);
|
|
8137
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
8138
|
+
*
|
|
8139
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
8140
|
+
* },
|
|
8141
|
+
* };
|
|
7984
8142
|
* ```
|
|
7985
8143
|
*
|
|
7986
8144
|
* ```ts [Usage.ts]
|
|
@@ -7996,6 +8154,20 @@ function isDict(v) {
|
|
|
7996
8154
|
*
|
|
7997
8155
|
* :::
|
|
7998
8156
|
*
|
|
8157
|
+
* ### RequestManager vs {@link Store.request}
|
|
8158
|
+
*
|
|
8159
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
8160
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
8161
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
8162
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
8163
|
+
*
|
|
8164
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
8165
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
8166
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
8167
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
8168
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
8169
|
+
* `StructuredDocument`.
|
|
8170
|
+
*
|
|
7999
8171
|
* ### Futures
|
|
8000
8172
|
*
|
|
8001
8173
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -8094,7 +8266,23 @@ var RequestManager = class {
|
|
|
8094
8266
|
/**
|
|
8095
8267
|
* Issue a Request.
|
|
8096
8268
|
*
|
|
8097
|
-
*
|
|
8269
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
8270
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
8271
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
8272
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
8273
|
+
* `RequestManager` created on its own has neither.
|
|
8274
|
+
*
|
|
8275
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
8276
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
8277
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
8278
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
8279
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
8280
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
8281
|
+
*
|
|
8282
|
+
* @example
|
|
8283
|
+
* ```ts
|
|
8284
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
8285
|
+
* ```
|
|
8098
8286
|
*
|
|
8099
8287
|
* @public
|
|
8100
8288
|
*/
|
|
@@ -8178,6 +8366,8 @@ var RequestManager = class {
|
|
|
8178
8366
|
//#endregion
|
|
8179
8367
|
//#region src/index.ts
|
|
8180
8368
|
/**
|
|
8369
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
8370
|
+
* `useRecommendedStore` for building a configured store.
|
|
8181
8371
|
* @module
|
|
8182
8372
|
* @mergeModuleWith <project>
|
|
8183
8373
|
*/
|
|
@@ -8186,11 +8376,17 @@ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
|
8186
8376
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
8187
8377
|
/**
|
|
8188
8378
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
8379
|
+
*
|
|
8380
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
8381
|
+
* `useRecommendedStore` wires into a Store class.
|
|
8189
8382
|
*/
|
|
8190
8383
|
/**
|
|
8191
8384
|
* Creates a configured Store class with recommended defaults
|
|
8192
8385
|
* for schema handling, reactivity, caching, and request management.
|
|
8193
8386
|
*
|
|
8387
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
8388
|
+
* configuring the store with it.
|
|
8389
|
+
*
|
|
8194
8390
|
* ```ts
|
|
8195
8391
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
8196
8392
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -8293,6 +8489,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
8293
8489
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
8294
8490
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
8295
8491
|
* `LoggingHandler` does above).
|
|
8492
|
+
*
|
|
8493
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
8494
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
8296
8495
|
*/
|
|
8297
8496
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
8298
8497
|
return class AppStore extends StoreKlass {
|
|
@@ -8348,4 +8547,4 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
8348
8547
|
|
|
8349
8548
|
//#endregion
|
|
8350
8549
|
export { setIdentifierGenerationMethod as A, setRecordIdentifier as C, isRequestKey as D, fieldValueIdentity as E, coerceId as F, ensureStringId as I, log as L, setIdentifierUpdateMethod as M, setKeyInfoForResource as N, isResourceKey as O, normalizeModelName as P, logGroup as R, recordIdentifierFor as S, assertPrivateCapabilities as T, isPrivateStore as _, fromIdentity as a, StoreMap as b, instantiateRecord as c, commit as d, createLegacyManyArray as f, assertPrivateStore as g, Store as h, SchemaService as i, setIdentifierResetMethod as j, setIdentifierForgetMethod as k, teardownRecord as l, CacheHandler as m, RequestManager as n, registerDerivations as o, constructResource as p, Fetch as r, withDefaults as s, useRecommendedStore as t, checkout as u, RecordArrayManager as v, storeFor as w, _clearCaches as x, fastPush as y };
|
|
8351
|
-
//# sourceMappingURL=src-
|
|
8550
|
+
//# sourceMappingURL=src-FSk0Z_Lp.js.map
|