@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,13 +1,13 @@
|
|
|
1
1
|
import { getOrSetGlobal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient } from "./types/-private.js";
|
|
2
|
-
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal, 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, 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-DKVDMUfT.js";
|
|
3
3
|
import { EnableHydration, STRUCTURED, SkipCache } from "./types/request.js";
|
|
4
|
-
import { a as upgradePromise, c as executeNextHandler, d as getRequestResult, f as setPromiseResult, l as clearRequestResult, o as DOMError, p as cloneResponseProperties, s as IS_CACHE_HANDLER, t as withBrand } from "./request-
|
|
5
|
-
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-
|
|
4
|
+
import { a as upgradePromise, c as executeNextHandler, d as getRequestResult, f as setPromiseResult, l as clearRequestResult, o as DOMError, p as cloneResponseProperties, s as IS_CACHE_HANDLER, t as withBrand } from "./request-ndw2Fy91.js";
|
|
5
|
+
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-CmNOwhK0.js";
|
|
6
6
|
import { CACHE_OWNER } from "./types/identifier.js";
|
|
7
7
|
import { dasherize } from "./utils/string.js";
|
|
8
8
|
import { RecordStore, Type } from "./types/symbols.js";
|
|
9
9
|
import { isResourceSchema } from "./types/schema/fields.js";
|
|
10
|
-
import { t as DefaultCachePolicy } from "./store-
|
|
10
|
+
import { t as DefaultCachePolicy } from "./store-CQOsqdST.js";
|
|
11
11
|
import { setIsMaybeMirage } from "./types/runtime.js";
|
|
12
12
|
import * as _importSync20 from "@ember/object";
|
|
13
13
|
|
|
@@ -21,10 +21,15 @@ function urlFromLink(link) {
|
|
|
21
21
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
22
22
|
* ReactiveResource instances.
|
|
23
23
|
*
|
|
24
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
25
|
+
* shows when a request's content is a ReactiveDocument.
|
|
26
|
+
*
|
|
24
27
|
* It is not directly instantiated by the user, and its properties should not
|
|
25
28
|
* be directly modified. Whether individual properties are mutable or not is
|
|
26
29
|
* determined by the record instance itself.
|
|
27
30
|
*
|
|
31
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
32
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
28
33
|
* @public
|
|
29
34
|
*/
|
|
30
35
|
const ReactiveDocumentProto = {
|
|
@@ -234,6 +239,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
234
239
|
const { id, type, lid } = identifier;
|
|
235
240
|
```
|
|
236
241
|
|
|
242
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
237
243
|
@public
|
|
238
244
|
@param record a record instance previously obstained from the store.
|
|
239
245
|
*/
|
|
@@ -646,6 +652,8 @@ implement this hook.
|
|
|
646
652
|
|
|
647
653
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
648
654
|
|
|
655
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
656
|
+
before the store is created.
|
|
649
657
|
@public
|
|
650
658
|
*/
|
|
651
659
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -680,6 +688,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
680
688
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
681
689
|
without providing an `id` when one is missing will throw an error.
|
|
682
690
|
|
|
691
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
692
|
+
own secondary lookup tables.
|
|
683
693
|
@public
|
|
684
694
|
*/
|
|
685
695
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -697,6 +707,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
697
707
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
698
708
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
699
709
|
|
|
710
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
711
|
+
lookup tables.
|
|
700
712
|
@public
|
|
701
713
|
*/
|
|
702
714
|
function setIdentifierForgetMethod(method) {
|
|
@@ -716,6 +728,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
716
728
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
717
729
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
718
730
|
|
|
731
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
732
|
+
key-generation state.
|
|
719
733
|
@public
|
|
720
734
|
*/
|
|
721
735
|
function setIdentifierResetMethod(method) {
|
|
@@ -734,6 +748,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
734
748
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
735
749
|
```
|
|
736
750
|
|
|
751
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
752
|
+
must be set before the store is created.
|
|
737
753
|
@public
|
|
738
754
|
*/
|
|
739
755
|
function setKeyInfoForResource(method) {
|
|
@@ -1082,9 +1098,15 @@ function addResourceToCache(cache, identifier) {
|
|
|
1082
1098
|
//#region src/store/-private/managers/notification-manager.ts
|
|
1083
1099
|
/**
|
|
1084
1100
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1101
|
+
*
|
|
1102
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
1103
|
+
* or `state`.
|
|
1085
1104
|
*/
|
|
1086
1105
|
/**
|
|
1087
1106
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1107
|
+
*
|
|
1108
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
1109
|
+
* `invalidated`.
|
|
1088
1110
|
*/
|
|
1089
1111
|
function isCacheOperationValue(value) {
|
|
1090
1112
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -1092,6 +1114,9 @@ function isCacheOperationValue(value) {
|
|
|
1092
1114
|
/**
|
|
1093
1115
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1094
1116
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1117
|
+
*
|
|
1118
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
1119
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
1095
1120
|
*/
|
|
1096
1121
|
/**
|
|
1097
1122
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -1099,6 +1124,8 @@ function isCacheOperationValue(value) {
|
|
|
1099
1124
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1100
1125
|
* instead of once per key.
|
|
1101
1126
|
*
|
|
1127
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
1128
|
+
* `relationships` changes in one call.
|
|
1102
1129
|
* @since 5.9.0
|
|
1103
1130
|
* @public
|
|
1104
1131
|
*/
|
|
@@ -1133,6 +1160,8 @@ function isCacheOperationValue(value) {
|
|
|
1133
1160
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1134
1161
|
* have no local/remote duality.
|
|
1135
1162
|
*
|
|
1163
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
1164
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
1136
1165
|
* @public
|
|
1137
1166
|
*/
|
|
1138
1167
|
/**
|
|
@@ -1243,6 +1272,8 @@ function _unsubscribe(token, cache) {
|
|
|
1243
1272
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
1244
1273
|
* work with any framework or change-notification system.
|
|
1245
1274
|
*
|
|
1275
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
1276
|
+
* cached resources and request documents.
|
|
1246
1277
|
* @hideconstructor
|
|
1247
1278
|
* @public
|
|
1248
1279
|
*/
|
|
@@ -1613,10 +1644,15 @@ const MUTABLE_PROPS = [
|
|
|
1613
1644
|
* as the base for relationship and legacy record-array types such as
|
|
1614
1645
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
1615
1646
|
*
|
|
1647
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
1648
|
+
* how it relates to resources.
|
|
1649
|
+
*
|
|
1616
1650
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
1617
1651
|
* both report `true`. The array stays in sync with the cache, updating
|
|
1618
1652
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
1619
1653
|
*
|
|
1654
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
1655
|
+
* and underlying relationship and legacy record arrays.
|
|
1620
1656
|
* @public
|
|
1621
1657
|
*/
|
|
1622
1658
|
/**
|
|
@@ -1889,6 +1925,8 @@ function createRequestCollection(config) {
|
|
|
1889
1925
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
1890
1926
|
* would be empty.
|
|
1891
1927
|
*
|
|
1928
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
1929
|
+
* `store.findAll`.
|
|
1892
1930
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
1893
1931
|
*/
|
|
1894
1932
|
/**
|
|
@@ -2000,6 +2038,8 @@ function _updateLiveArray() {
|
|
|
2000
2038
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
2001
2039
|
* from the store for book-keeping.
|
|
2002
2040
|
*
|
|
2041
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
2042
|
+
* `update()` and released with `destroy()`.
|
|
2003
2043
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
2004
2044
|
*/
|
|
2005
2045
|
/**
|
|
@@ -2700,6 +2740,10 @@ const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
|
|
|
2700
2740
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
2701
2741
|
* requests for data with schemas, caching and reactivity.
|
|
2702
2742
|
*
|
|
2743
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
2744
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
2745
|
+
* through it.
|
|
2746
|
+
*
|
|
2703
2747
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
2704
2748
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
2705
2749
|
* even when you aren't sure yet.
|
|
@@ -2707,6 +2751,7 @@ const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
|
|
|
2707
2751
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
2708
2752
|
* is possible.
|
|
2709
2753
|
*
|
|
2754
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
2710
2755
|
* @public
|
|
2711
2756
|
* @hideconstructor
|
|
2712
2757
|
*/
|
|
@@ -2891,12 +2936,25 @@ var Store = class extends BaseClass {
|
|
|
2891
2936
|
/** @internal */
|
|
2892
2937
|
_getAllPending() {}
|
|
2893
2938
|
/**
|
|
2894
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
2939
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
2895
2940
|
* :::
|
|
2896
2941
|
*
|
|
2897
2942
|
* Issue a request via the configured {@link RequestManager},
|
|
2898
2943
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
2899
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
2944
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
2945
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
2946
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
2947
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
2948
|
+
* {@link StructuredDocument}.
|
|
2949
|
+
*
|
|
2950
|
+
* #### Building Requests
|
|
2951
|
+
*
|
|
2952
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
2953
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
2954
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
2955
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
2956
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
2957
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
2900
2958
|
*
|
|
2901
2959
|
* #### Request Cache Keys
|
|
2902
2960
|
*
|
|
@@ -2941,6 +2999,29 @@ var Store = class extends BaseClass {
|
|
|
2941
2999
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
2942
3000
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
2943
3001
|
*
|
|
3002
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
3003
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
3004
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
3005
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
3006
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
3007
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
3008
|
+
*
|
|
3009
|
+
* #### Typing The Response
|
|
3010
|
+
*
|
|
3011
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
3012
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
3013
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
3014
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
3015
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
3016
|
+
*
|
|
3017
|
+
* @example
|
|
3018
|
+
* ```ts
|
|
3019
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
3020
|
+
*
|
|
3021
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
3022
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
3023
|
+
* ```
|
|
3024
|
+
*
|
|
2944
3025
|
* @public
|
|
2945
3026
|
*/
|
|
2946
3027
|
request(requestConfig) {
|
|
@@ -3441,6 +3522,8 @@ function _convertPreloadRelationshipToJSON(value, type) {
|
|
|
3441
3522
|
* for @warp-drive-mirror/legacy/model or when wrapping schema for legacy
|
|
3442
3523
|
* Adapters/Serializers.
|
|
3443
3524
|
*
|
|
3525
|
+
* @summary Legacy shape of a Model class's static schema API (fields, attributes, relationships, iterators) used
|
|
3526
|
+
* by the legacy schema service and Adapters/Serializers.
|
|
3444
3527
|
*/
|
|
3445
3528
|
function _resourceIsFullDeleted(identifier, cache) {
|
|
3446
3529
|
return cache.isDeletionCommitted(identifier) || cache.isNew(identifier) && cache.isDeleted(identifier);
|
|
@@ -3817,10 +3900,16 @@ function getPriority(identifier, deduped, priority) {
|
|
|
3817
3900
|
/**
|
|
3818
3901
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
3819
3902
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
3903
|
+
*
|
|
3904
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
3905
|
+
* form with plain `records` and `headers`.
|
|
3820
3906
|
*/
|
|
3821
3907
|
/**
|
|
3822
3908
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
3823
3909
|
*
|
|
3910
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
3911
|
+
* request can use the cache.
|
|
3912
|
+
*
|
|
3824
3913
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
3825
3914
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
3826
3915
|
* attached to the request.
|
|
@@ -3856,7 +3945,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
3856
3945
|
* method: 'GET',
|
|
3857
3946
|
* [EnableHydration]: true
|
|
3858
3947
|
* });
|
|
3948
|
+
* ```
|
|
3859
3949
|
*
|
|
3950
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
3951
|
+
* reactive documents when hydration is enabled.
|
|
3860
3952
|
*/
|
|
3861
3953
|
const CacheHandler = { request(context, next) {
|
|
3862
3954
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -4123,6 +4215,7 @@ the has-many.
|
|
|
4123
4215
|
We call the record to which a relationship belongs-to the
|
|
4124
4216
|
relationship's _owner_.
|
|
4125
4217
|
|
|
4218
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
4126
4219
|
@public
|
|
4127
4220
|
*/
|
|
4128
4221
|
/**
|
|
@@ -5542,10 +5635,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
5542
5635
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
5543
5636
|
* object.
|
|
5544
5637
|
*
|
|
5638
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
5639
|
+
* define the schema it reads.
|
|
5640
|
+
*
|
|
5545
5641
|
* This class is not directly instantiable. To use it, you should
|
|
5546
5642
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
5547
5643
|
* with the matching hooks provided by this package.
|
|
5548
5644
|
*
|
|
5645
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
5549
5646
|
* @hideconstructor
|
|
5550
5647
|
* @public
|
|
5551
5648
|
*/
|
|
@@ -5941,6 +6038,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
5941
6038
|
* Edits to editable resources will be automatically committed if a new
|
|
5942
6039
|
* payload from the cache matches their existing value.
|
|
5943
6040
|
*
|
|
6041
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
6042
|
+
* changed locally.
|
|
5944
6043
|
* @public
|
|
5945
6044
|
*
|
|
5946
6045
|
* @returns a promise that resolves to the editable resource
|
|
@@ -5957,6 +6056,8 @@ function checkout(resource) {
|
|
|
5957
6056
|
* approach is for either the API or a Handler to reflect saved
|
|
5958
6057
|
* changes back to update the cache.
|
|
5959
6058
|
*
|
|
6059
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
6060
|
+
* bypassing a save round-trip.
|
|
5960
6061
|
* @public
|
|
5961
6062
|
*/
|
|
5962
6063
|
function commit(record) {
|
|
@@ -5974,6 +6075,8 @@ function commit(record) {
|
|
|
5974
6075
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
5975
6076
|
* properties when creating a new legacy record.
|
|
5976
6077
|
*
|
|
6078
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
6079
|
+
* from its registered schema.
|
|
5977
6080
|
* @public
|
|
5978
6081
|
*/
|
|
5979
6082
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -5997,6 +6100,8 @@ function instantiateRecord(store, identifier, createArgs) {
|
|
|
5997
6100
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
5998
6101
|
* behavior.
|
|
5999
6102
|
*
|
|
6103
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
6104
|
+
* releases it.
|
|
6000
6105
|
* @public
|
|
6001
6106
|
*/
|
|
6002
6107
|
function teardownRecord(record) {
|
|
@@ -6046,16 +6151,25 @@ _constructor[Type] = "@constructor";
|
|
|
6046
6151
|
* This should only be used for temporary migration purposes
|
|
6047
6152
|
* to the new schema system when migrating from either Model
|
|
6048
6153
|
* or ModelFragments.
|
|
6154
|
+
*
|
|
6155
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
6156
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
6049
6157
|
*/
|
|
6050
6158
|
/**
|
|
6051
6159
|
* Describes one feature added to a resource by a schema extension, as
|
|
6052
6160
|
* classified by {@link processExtension} from the property descriptor it
|
|
6053
6161
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
6162
|
+
*
|
|
6163
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
6164
|
+
* mutable value, or a getter/setter accessor.
|
|
6054
6165
|
*/
|
|
6055
6166
|
/**
|
|
6056
6167
|
* The result of {@link processExtension} normalizing a
|
|
6057
6168
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
6058
6169
|
* by name.
|
|
6170
|
+
*
|
|
6171
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
6172
|
+
* keyed by property name.
|
|
6059
6173
|
*/
|
|
6060
6174
|
const BannedKeys = ["constructor", "__proto__"];
|
|
6061
6175
|
function processExtension(extension) {
|
|
@@ -6145,14 +6259,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
6145
6259
|
* Utility for constructing a ResourceSchema with the recommended
|
|
6146
6260
|
* fields for the PolarisMode experience.
|
|
6147
6261
|
*
|
|
6262
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
6263
|
+
* create a schema with it.
|
|
6264
|
+
*
|
|
6148
6265
|
* Using this requires registering the PolarisMode derivations
|
|
6149
6266
|
*
|
|
6150
6267
|
* ```ts
|
|
6151
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
6268
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
6152
6269
|
*
|
|
6153
6270
|
* registerDerivations(schema);
|
|
6154
6271
|
* ```
|
|
6155
6272
|
*
|
|
6273
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
6274
|
+
* PolarisMode resource schema.
|
|
6156
6275
|
* @public
|
|
6157
6276
|
* @param schema
|
|
6158
6277
|
* @return {PolarisResourceSchema}
|
|
@@ -6183,6 +6302,8 @@ function withDefaults(schema) {
|
|
|
6183
6302
|
*
|
|
6184
6303
|
* `^` returns the entire identifier object.
|
|
6185
6304
|
*
|
|
6305
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
6306
|
+
* for use in derived fields.
|
|
6186
6307
|
* @public
|
|
6187
6308
|
*/
|
|
6188
6309
|
const fromIdentity = (record, options, key) => {
|
|
@@ -6195,9 +6316,14 @@ fromIdentity[Type] = "@identity";
|
|
|
6195
6316
|
* to use the PolarisMode defaults provided by
|
|
6196
6317
|
*
|
|
6197
6318
|
* ```ts
|
|
6198
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
6319
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
6199
6320
|
* ```
|
|
6200
6321
|
*
|
|
6322
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
6323
|
+
* guide explains when you need to call it.
|
|
6324
|
+
*
|
|
6325
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
6326
|
+
* `withDefaults` depend on.
|
|
6201
6327
|
* @public
|
|
6202
6328
|
*/
|
|
6203
6329
|
function registerDerivations(schema) {
|
|
@@ -6208,6 +6334,9 @@ function registerDerivations(schema) {
|
|
|
6208
6334
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
6209
6335
|
* between the raw value `T` stored in the cache and the presentation value
|
|
6210
6336
|
* `PT` exposed on the record.
|
|
6337
|
+
*
|
|
6338
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
6339
|
+
* record, with optional default.
|
|
6211
6340
|
*/
|
|
6212
6341
|
/**
|
|
6213
6342
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -6230,6 +6359,12 @@ function makeCachedDerivation(derivation) {
|
|
|
6230
6359
|
/**
|
|
6231
6360
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
6232
6361
|
*
|
|
6362
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
6363
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
6364
|
+
* shows how to give a store one.
|
|
6365
|
+
*
|
|
6366
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
6367
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
6233
6368
|
* @public
|
|
6234
6369
|
*/
|
|
6235
6370
|
var SchemaService = class {
|
|
@@ -6821,6 +6956,8 @@ function mergeMap(base, toApply) {
|
|
|
6821
6956
|
* - {@link LegacyModeFieldSchema}
|
|
6822
6957
|
* - {@link PolarisModeFieldSchema}
|
|
6823
6958
|
*
|
|
6959
|
+
* @summary Schema-driven reactive records, arrays, and documents the store builds from cached data, plus the
|
|
6960
|
+
* `SchemaService` and schema types that define them.
|
|
6824
6961
|
* @module
|
|
6825
6962
|
*/
|
|
6826
6963
|
|
|
@@ -6898,6 +7035,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
6898
7035
|
* A basic Fetch Handler which converts a request into a
|
|
6899
7036
|
* `fetch` call presuming the response to be `json`.
|
|
6900
7037
|
*
|
|
7038
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
7039
|
+
* guide shows where it sits in the handler chain.
|
|
7040
|
+
*
|
|
6901
7041
|
* ```ts
|
|
6902
7042
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
6903
7043
|
*
|
|
@@ -6905,6 +7045,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
6905
7045
|
* .use([Fetch]);
|
|
6906
7046
|
* ```
|
|
6907
7047
|
*
|
|
7048
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
7049
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
6908
7050
|
* @public
|
|
6909
7051
|
* @badge Handler
|
|
6910
7052
|
*/
|
|
@@ -7031,7 +7173,8 @@ function isDict(v) {
|
|
|
7031
7173
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
7032
7174
|
* ```
|
|
7033
7175
|
*
|
|
7034
|
-
* For complete usage guide see
|
|
7176
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
7177
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
7035
7178
|
*
|
|
7036
7179
|
* ## How It Works
|
|
7037
7180
|
*
|
|
@@ -7054,11 +7197,28 @@ function isDict(v) {
|
|
|
7054
7197
|
* ```ts [Setup.ts]
|
|
7055
7198
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7056
7199
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
7057
|
-
* import
|
|
7200
|
+
* import { AuthHandler } from './auth-handler';
|
|
7058
7201
|
*
|
|
7059
7202
|
* // ... create manager
|
|
7060
7203
|
* const manager = new RequestManager()
|
|
7061
|
-
* .use([
|
|
7204
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
7205
|
+
* ```
|
|
7206
|
+
*
|
|
7207
|
+
* ```ts [auth-handler.ts]
|
|
7208
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
7209
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
7210
|
+
*
|
|
7211
|
+
* const token = '<token>';
|
|
7212
|
+
*
|
|
7213
|
+
* // adds a bearer token to every request, then passes it along
|
|
7214
|
+
* export const AuthHandler: Handler = {
|
|
7215
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
7216
|
+
* const headers = new Headers(context.request.headers);
|
|
7217
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
7218
|
+
*
|
|
7219
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
7220
|
+
* },
|
|
7221
|
+
* };
|
|
7062
7222
|
* ```
|
|
7063
7223
|
*
|
|
7064
7224
|
* ```ts [Usage.ts]
|
|
@@ -7074,6 +7234,20 @@ function isDict(v) {
|
|
|
7074
7234
|
*
|
|
7075
7235
|
* :::
|
|
7076
7236
|
*
|
|
7237
|
+
* ### RequestManager vs {@link Store.request}
|
|
7238
|
+
*
|
|
7239
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
7240
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
7241
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
7242
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
7243
|
+
*
|
|
7244
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
7245
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
7246
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
7247
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
7248
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
7249
|
+
* `StructuredDocument`.
|
|
7250
|
+
*
|
|
7077
7251
|
* ### Futures
|
|
7078
7252
|
*
|
|
7079
7253
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -7163,7 +7337,23 @@ var RequestManager = class {
|
|
|
7163
7337
|
/**
|
|
7164
7338
|
* Issue a Request.
|
|
7165
7339
|
*
|
|
7166
|
-
*
|
|
7340
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
7341
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
7342
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
7343
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
7344
|
+
* `RequestManager` created on its own has neither.
|
|
7345
|
+
*
|
|
7346
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
7347
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
7348
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
7349
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
7350
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
7351
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
7352
|
+
*
|
|
7353
|
+
* @example
|
|
7354
|
+
* ```ts
|
|
7355
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
7356
|
+
* ```
|
|
7167
7357
|
*
|
|
7168
7358
|
* @public
|
|
7169
7359
|
*/
|
|
@@ -7225,17 +7415,25 @@ var RequestManager = class {
|
|
|
7225
7415
|
//#endregion
|
|
7226
7416
|
//#region src/index.ts
|
|
7227
7417
|
/**
|
|
7418
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
7419
|
+
* `useRecommendedStore` for building a configured store.
|
|
7228
7420
|
* @module
|
|
7229
7421
|
* @mergeModuleWith <project>
|
|
7230
7422
|
*/
|
|
7231
7423
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
7232
7424
|
/**
|
|
7233
7425
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
7426
|
+
*
|
|
7427
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
7428
|
+
* `useRecommendedStore` wires into a Store class.
|
|
7234
7429
|
*/
|
|
7235
7430
|
/**
|
|
7236
7431
|
* Creates a configured Store class with recommended defaults
|
|
7237
7432
|
* for schema handling, reactivity, caching, and request management.
|
|
7238
7433
|
*
|
|
7434
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
7435
|
+
* configuring the store with it.
|
|
7436
|
+
*
|
|
7239
7437
|
* ```ts
|
|
7240
7438
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
7241
7439
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -7338,6 +7536,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
7338
7536
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
7339
7537
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
7340
7538
|
* `LoggingHandler` does above).
|
|
7539
|
+
*
|
|
7540
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
7541
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
7341
7542
|
*/
|
|
7342
7543
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
7343
7544
|
return class AppStore extends StoreKlass {
|
|
@@ -7393,4 +7594,4 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
7393
7594
|
|
|
7394
7595
|
//#endregion
|
|
7395
7596
|
export { normalizeModelName as A, isRequestKey as C, setIdentifierResetMethod as D, setIdentifierGenerationMethod as E, recordIdentifierFor as F, setRecordIdentifier as I, storeFor as L, ensureStringId as M, StoreMap as N, setIdentifierUpdateMethod as O, _clearCaches as P, assertPrivateCapabilities as R, fieldValueIdentity as S, setIdentifierForgetMethod as T, Store as _, fromIdentity as a, RecordArrayManager as b, instantiateRecord as c, commit as d, log as f, CacheHandler as g, constructResource as h, SchemaService as i, coerceId as j, setKeyInfoForResource as k, teardownRecord as l, createLegacyManyArray as m, RequestManager as n, registerDerivations as o, logGroup as p, Fetch as r, withDefaults as s, useRecommendedStore as t, checkout as u, assertPrivateStore as v, isResourceKey as w, fastPush as x, isPrivateStore as y };
|
|
7396
|
-
//# sourceMappingURL=src-
|
|
7597
|
+
//# sourceMappingURL=src-FK_rMde5.js.map
|