@warp-drive-mirror/core 5.10.0-alpha.2 → 5.10.0-alpha.21
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 +116 -6
- package/dist/{-private-ffnwf62T.js → -private-BiuED7nc.js} +5 -4
- package/dist/{-private-ffnwf62T.js.map → -private-BiuED7nc.js.map} +1 -1
- package/dist/{-private-CArItnX4.js → -private-CvZfrDZl.js} +566 -179
- package/dist/-private-CvZfrDZl.js.map +1 -0
- package/dist/{aliases-BWYW5EhX.d.ts → aliases-BG5TxALl.d.ts} +4 -3
- package/dist/aliases-BG5TxALl.d.ts.map +1 -0
- package/dist/{change-C7kqv2kW.d.ts → change-INHMiZ2a.d.ts} +4 -4
- package/dist/change-INHMiZ2a.d.ts.map +1 -0
- package/dist/{concepts-DFldVwEM.d.ts → concepts-vh86nAcd.d.ts} +14 -7
- package/dist/concepts-vh86nAcd.d.ts.map +1 -0
- package/dist/{configure-B_F639tN.d.ts → configure-BfXDuPUb.d.ts} +57 -10
- package/dist/configure-BfXDuPUb.d.ts.map +1 -0
- package/dist/configure.d.ts +2 -2
- package/dist/configure.js +2 -2
- package/dist/{document-Ca4ZZBd9.d.ts → document-B8Fup751.d.ts} +22 -6
- package/dist/document-B8Fup751.d.ts.map +1 -0
- package/dist/{error-0uD6GkNX.d.ts → error-j5n1yL9m.d.ts} +4 -4
- package/dist/error-j5n1yL9m.d.ts.map +1 -0
- package/dist/{fields-FM7peCiM.d.ts → fields-r1rZJB9d.d.ts} +134 -9
- package/dist/fields-r1rZJB9d.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +1 -1
- package/dist/graph/-private.js +25 -40
- package/dist/graph/-private.js.map +1 -1
- package/dist/{graph-DLqYXP2z.d.ts → graph-BqxaFjEb.d.ts} +25 -7
- package/dist/graph-BqxaFjEb.d.ts.map +1 -0
- package/dist/{identifier-DQnqOSJK.d.ts → identifier-DmgDehQK.d.ts} +29 -6
- package/dist/identifier-DmgDehQK.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-BrqYbG_y.d.ts → internal-D_WIXC4r.d.ts} +1524 -1121
- package/dist/internal-D_WIXC4r.d.ts.map +1 -0
- package/dist/{json-api-raw-C5APJHHB.d.ts → json-api-raw-juUdIITO.d.ts} +44 -4
- package/dist/json-api-raw-juUdIITO.d.ts.map +1 -0
- package/dist/{mutations-CqtoGB4t.d.ts → mutations-CA39mior.d.ts} +18 -4
- package/dist/mutations-CA39mior.d.ts.map +1 -0
- package/dist/{operations-D1qA6r0_.d.ts → operations-C1WAEKKq.d.ts} +39 -7
- package/dist/operations-C1WAEKKq.d.ts.map +1 -0
- package/dist/{params-DrEx3bf8.d.ts → params-CNLjCRyH.d.ts} +11 -3
- package/dist/params-CNLjCRyH.d.ts.map +1 -0
- package/dist/{raw-D5hnjiq7.d.ts → raw-adYGuEGM.d.ts} +10 -3
- package/dist/raw-adYGuEGM.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-f5-uOgHt.d.ts} +22 -4
- package/dist/record-f5-uOgHt.d.ts.map +1 -0
- package/dist/{relationship-CmHzMPKf.d.ts → relationship-99pc4CaS.d.ts} +10 -5
- package/dist/relationship-99pc4CaS.d.ts.map +1 -0
- package/dist/{request-o_qGAoFV.js → request-CxtnNIIp.js} +52 -23
- package/dist/request-CxtnNIIp.js.map +1 -0
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +86 -18
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/signals/-leaked.js +1 -1
- package/dist/{src-C-xK8l3f.js → src-ccp1WKyt.js} +350 -456
- package/dist/src-ccp1WKyt.js.map +1 -0
- package/dist/store/-private.d.ts +2 -2
- package/dist/store/-private.js +2 -2
- package/dist/{store-DNF9Rgoh.js → store-C8iKKtQK.js} +17 -3
- package/dist/store-C8iKKtQK.js.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/{symbols-DjRDCeX0.d.ts → symbols-DVa1PMFG.d.ts} +10 -3
- package/dist/symbols-DVa1PMFG.d.ts.map +1 -0
- package/dist/types/-private.d.ts +1 -2
- package/dist/types/-private.d.ts.map +1 -1
- package/dist/types/-private.js +115 -2
- package/dist/types/-private.js.map +1 -0
- 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 +34 -5
- 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 +26 -2
- package/dist/types/record.js.map +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/types/request.js +82 -3
- package/dist/types/request.js.map +1 -1
- package/dist/types/runtime.d.ts +10 -7
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/runtime.js +9 -6
- package/dist/types/runtime.js.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 +133 -5
- 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 +16 -3
- 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-CM5N2rtZ.js → dev/-private-B4pCmkq-.js} +566 -179
- package/dist/unpkg/dev/-private-B4pCmkq-.js.map +1 -0
- package/dist/unpkg/{prod-deprecated/-private-207KndDu.js → dev/-private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{dev-deprecated/-private-BO-nArRb.js.map → dev/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/dev/configure.js +2 -2
- package/dist/unpkg/dev/graph/-private.js +26 -41
- 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-DXPAtRhE.js → dev/request-oWpijCPQ.js} +52 -23
- package/dist/unpkg/dev/request-oWpijCPQ.js.map +1 -0
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/{runtime-DW881fpw.js → runtime-RYvEtg99.js} +2 -3
- package/dist/unpkg/dev/{runtime-DW881fpw.js.map → runtime-RYvEtg99.js.map} +1 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -1
- package/dist/unpkg/dev/{src-kn6qfEPI.js → src-C4ET4R1n.js} +339 -444
- package/dist/unpkg/dev/src-C4ET4R1n.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +2 -2
- package/dist/unpkg/{dev-deprecated/store-D-z_1Jxe.js → dev/store-dZViNfMK.js} +18 -4
- package/dist/unpkg/dev/store-dZViNfMK.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/types/-private.js +106 -2
- package/dist/unpkg/dev/types/-private.js.map +1 -0
- package/dist/unpkg/dev/types/identifier.js +34 -5
- package/dist/unpkg/dev/types/identifier.js.map +1 -1
- package/dist/unpkg/dev/types/record.js +26 -2
- package/dist/unpkg/dev/types/record.js.map +1 -1
- package/dist/unpkg/dev/types/request.js +82 -3
- package/dist/unpkg/dev/types/request.js.map +1 -1
- package/dist/unpkg/dev/types/runtime.js +9 -6
- package/dist/unpkg/dev/types/runtime.js.map +1 -1
- package/dist/unpkg/dev/types/schema/fields.js +133 -5
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev/types/symbols.js +16 -3
- package/dist/unpkg/dev/types/symbols.js.map +1 -1
- package/dist/unpkg/dev/utils/string.js +1 -2
- package/dist/unpkg/{dev/-private-CM5N2rtZ.js → dev-deprecated/-private-B4pCmkq-.js} +566 -179
- package/dist/unpkg/dev-deprecated/-private-B4pCmkq-.js.map +1 -0
- package/dist/unpkg/dev-deprecated/{-private-BO-nArRb.js → -private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{prod/-private-207KndDu.js.map → dev-deprecated/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/configure.js +2 -2
- package/dist/unpkg/dev-deprecated/graph/-private.js +26 -41
- 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-DXPAtRhE.js → dev-deprecated/request-oWpijCPQ.js} +52 -23
- package/dist/unpkg/dev-deprecated/request-oWpijCPQ.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/{runtime-BIra6K31.js → runtime-DZVuMuzL.js} +2 -3
- package/dist/unpkg/dev-deprecated/{runtime-BIra6K31.js.map → runtime-DZVuMuzL.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/dev-deprecated/{src-DXwW-R57.js → src-jHpowq3S.js} +344 -450
- package/dist/unpkg/dev-deprecated/src-jHpowq3S.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +2 -2
- package/dist/unpkg/{dev/store-C0p6sclI.js → dev-deprecated/store-I7YB0_rC.js} +18 -4
- package/dist/unpkg/dev-deprecated/store-I7YB0_rC.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +106 -2
- package/dist/unpkg/dev-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/identifier.js +34 -5
- package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/record.js +26 -2
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js +82 -3
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/runtime.js +9 -6
- package/dist/unpkg/dev-deprecated/types/runtime.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +133 -5
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +16 -3
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/dev-deprecated/utils/string.js +1 -2
- package/dist/unpkg/prod/-private-BiuED7nc.js +23 -0
- package/dist/unpkg/{prod-deprecated/-private-207KndDu.js.map → prod/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/{prod-deprecated/-private-CdDed4yB.js → prod/-private-CrUi_3E_.js} +539 -173
- package/dist/unpkg/prod/-private-CrUi_3E_.js.map +1 -0
- package/dist/unpkg/prod/configure.js +2 -2
- package/dist/unpkg/prod/graph/-private.js +24 -35
- 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-C7WZg-zk.js → request-Cgw3j6Dx.js} +51 -21
- package/dist/unpkg/prod/request-Cgw3j6Dx.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-B-GfFQcx.js → src-DFmPDGQ6.js} +311 -414
- package/dist/unpkg/prod/src-DFmPDGQ6.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +2 -2
- package/dist/unpkg/prod/{store-BWhmb7Ob.js → store-Bz9R5hGB.js} +17 -3
- package/dist/unpkg/prod/store-Bz9R5hGB.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod/types/-private.js +94 -2
- package/dist/unpkg/prod/types/-private.js.map +1 -0
- package/dist/unpkg/prod/types/identifier.js +34 -5
- package/dist/unpkg/prod/types/identifier.js.map +1 -1
- package/dist/unpkg/prod/types/record.js +26 -2
- package/dist/unpkg/prod/types/record.js.map +1 -1
- package/dist/unpkg/prod/types/request.js +82 -3
- package/dist/unpkg/prod/types/request.js.map +1 -1
- package/dist/unpkg/prod/types/runtime.js +9 -6
- package/dist/unpkg/prod/types/runtime.js.map +1 -1
- package/dist/unpkg/prod/types/schema/fields.js +133 -5
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod/types/symbols.js +16 -3
- package/dist/unpkg/prod/types/symbols.js.map +1 -1
- package/dist/unpkg/prod/utils/string.js +1 -2
- package/dist/unpkg/{dev/-private-BO-nArRb.js → prod-deprecated/-private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{dev/-private-BO-nArRb.js.map → prod-deprecated/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/{prod/-private-CdDed4yB.js → prod-deprecated/-private-CrUi_3E_.js} +539 -173
- package/dist/unpkg/prod-deprecated/-private-CrUi_3E_.js.map +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -2
- package/dist/unpkg/prod-deprecated/graph/-private.js +24 -35
- 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-C7WZg-zk.js → request-Cgw3j6Dx.js} +51 -21
- package/dist/unpkg/prod-deprecated/request-Cgw3j6Dx.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-Bp8ZJctZ.js → src-BgQLcshl.js} +316 -420
- package/dist/unpkg/prod-deprecated/src-BgQLcshl.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +2 -2
- package/dist/unpkg/prod-deprecated/{store-BWhmb7Ob.js → store-Bz9R5hGB.js} +17 -3
- package/dist/unpkg/prod-deprecated/store-Bz9R5hGB.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +94 -2
- package/dist/unpkg/prod-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/identifier.js +34 -5
- package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/record.js +26 -2
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js +82 -3
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/runtime.js +9 -6
- package/dist/unpkg/prod-deprecated/types/runtime.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +133 -5
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +16 -3
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/prod-deprecated/utils/string.js +1 -2
- package/dist/utils/string.d.ts +0 -2
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +1 -2
- package/dist/{utils-BtURiy8l.d.ts → utils-BVKvrO6e.d.ts} +8 -3
- package/dist/utils-BVKvrO6e.d.ts.map +1 -0
- package/logos/README.md +1 -1
- package/package.json +9 -9
- package/dist/-private-CArItnX4.js.map +0 -1
- package/dist/-private-CWh7qdp_.js +0 -120
- package/dist/-private-CWh7qdp_.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-FM7peCiM.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-BrqYbG_y.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-o_qGAoFV.js.map +0 -1
- package/dist/src-C-xK8l3f.js.map +0 -1
- package/dist/store-DNF9Rgoh.js.map +0 -1
- package/dist/symbols-DjRDCeX0.d.ts.map +0 -1
- package/dist/types/schema/fields.type-test.d.ts +0 -1
- package/dist/types/schema/fields.type-test.js +0 -79
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev/-private-BP52H-vC.js +0 -111
- package/dist/unpkg/dev/-private-BP52H-vC.js.map +0 -1
- package/dist/unpkg/dev/-private-CM5N2rtZ.js.map +0 -1
- package/dist/unpkg/dev/request-DXPAtRhE.js.map +0 -1
- package/dist/unpkg/dev/src-kn6qfEPI.js.map +0 -1
- package/dist/unpkg/dev/store-C0p6sclI.js.map +0 -1
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-BP52H-vC.js +0 -111
- package/dist/unpkg/dev-deprecated/-private-BP52H-vC.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-CM5N2rtZ.js.map +0 -1
- package/dist/unpkg/dev-deprecated/request-DXPAtRhE.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-DXwW-R57.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-D-z_1Jxe.js.map +0 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod/-private-207KndDu.js +0 -22
- package/dist/unpkg/prod/-private-CdDed4yB.js.map +0 -1
- package/dist/unpkg/prod/-private-JmhZBKGb.js +0 -99
- package/dist/unpkg/prod/-private-JmhZBKGb.js.map +0 -1
- package/dist/unpkg/prod/request-C7WZg-zk.js.map +0 -1
- package/dist/unpkg/prod/src-B-GfFQcx.js.map +0 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-CdDed4yB.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-JmhZBKGb.js +0 -99
- package/dist/unpkg/prod-deprecated/-private-JmhZBKGb.js.map +0 -1
- package/dist/unpkg/prod-deprecated/request-C7WZg-zk.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-Bp8ZJctZ.js.map +0 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/utils-BtURiy8l.d.ts.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal,
|
|
1
|
+
import { getOrSetGlobal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient } from "./types/-private.js";
|
|
2
|
+
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal, F as willSyncFlushWatchers, O as peekInternalSignal, P as waitFor, 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-CvZfrDZl.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-CxtnNIIp.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-BiuED7nc.js";
|
|
8
8
|
import { dasherize } from "./utils/string.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-C8iKKtQK.js";
|
|
12
12
|
import { dependencySatisfies, getGlobalConfig, importSync, macroCondition } from "@embroider/macros";
|
|
13
13
|
import { deprecate, warn } from "@ember/debug";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// src/reactive/-private/document.ts
|
|
16
16
|
function urlFromLink(link) {
|
|
17
17
|
if (typeof link === "string") return link;
|
|
18
18
|
return link.href;
|
|
@@ -22,10 +22,15 @@ function urlFromLink(link) {
|
|
|
22
22
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
23
23
|
* ReactiveResource instances.
|
|
24
24
|
*
|
|
25
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
26
|
+
* shows when a request's content is a ReactiveDocument.
|
|
27
|
+
*
|
|
25
28
|
* It is not directly instantiated by the user, and its properties should not
|
|
26
29
|
* be directly modified. Whether individual properties are mutable or not is
|
|
27
30
|
* determined by the record instance itself.
|
|
28
31
|
*
|
|
32
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
33
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
29
34
|
* @public
|
|
30
35
|
*/
|
|
31
36
|
const ReactiveDocumentProto = {
|
|
@@ -145,8 +150,7 @@ function createReactiveDocument(store, cacheKey, localCache) {
|
|
|
145
150
|
return doc;
|
|
146
151
|
}
|
|
147
152
|
|
|
148
|
-
|
|
149
|
-
//#region src/store/-private/debug/utils.ts
|
|
153
|
+
// src/store/-private/debug/utils.ts
|
|
150
154
|
const TEXT_COLORS = {
|
|
151
155
|
TEXT: "inherit",
|
|
152
156
|
notify: [
|
|
@@ -375,8 +379,7 @@ function _log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
|
|
|
375
379
|
return [];
|
|
376
380
|
}
|
|
377
381
|
|
|
378
|
-
|
|
379
|
-
//#region src/store/-private/caches/resource-utils.ts
|
|
382
|
+
// src/store/-private/caches/resource-utils.ts
|
|
380
383
|
function isResource(resource) {
|
|
381
384
|
return Boolean(resource && typeof resource === "object");
|
|
382
385
|
}
|
|
@@ -393,8 +396,7 @@ function hasType(resource) {
|
|
|
393
396
|
return hasProp(resource, "type");
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
|
|
397
|
-
//#region src/store/-private/utils/coerce-id.ts
|
|
399
|
+
// src/store/-private/utils/coerce-id.ts
|
|
398
400
|
/**
|
|
399
401
|
* Normalizes a resource `id` entering the store to a string (or `null`).
|
|
400
402
|
*
|
|
@@ -445,8 +447,7 @@ function ensureStringId(id) {
|
|
|
445
447
|
return normalized;
|
|
446
448
|
}
|
|
447
449
|
|
|
448
|
-
|
|
449
|
-
//#region src/store/-private/utils/normalize-model-name.ts
|
|
450
|
+
// src/store/-private/utils/normalize-model-name.ts
|
|
450
451
|
/**
|
|
451
452
|
* Normalizes a resource `type` to its dasherized form, e.g. `myClass` to
|
|
452
453
|
* `my-class`. Re-exported elsewhere as `_deprecatingNormalize`.
|
|
@@ -474,8 +475,7 @@ function normalizeModelName(type) {
|
|
|
474
475
|
return type;
|
|
475
476
|
}
|
|
476
477
|
|
|
477
|
-
|
|
478
|
-
//#region src/store/-private/utils/uuid-polyfill.ts
|
|
478
|
+
// src/store/-private/utils/uuid-polyfill.ts
|
|
479
479
|
function installPolyfill() {
|
|
480
480
|
const isFastBoot = typeof FastBoot !== "undefined";
|
|
481
481
|
const CRYPTO = isFastBoot ? FastBoot.require("crypto") : globalThis.crypto;
|
|
@@ -521,8 +521,7 @@ function installPolyfill() {
|
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
|
|
525
|
-
//#region src/store/-private/managers/cache-key-manager.ts
|
|
524
|
+
// src/store/-private/managers/cache-key-manager.ts
|
|
526
525
|
/**
|
|
527
526
|
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
528
527
|
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
@@ -539,6 +538,57 @@ function isRequestKey(identifier) {
|
|
|
539
538
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) return !!identifier && typeof identifier === "object" && "type" in identifier && !("id" in identifier) && identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
540
539
|
else return identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
541
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
543
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
544
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
545
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
546
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
547
|
+
*/
|
|
548
|
+
/**
|
|
549
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
550
|
+
*
|
|
551
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
552
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
553
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
554
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
555
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
556
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
557
|
+
*
|
|
558
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
559
|
+
* returns `null`.
|
|
560
|
+
*/
|
|
561
|
+
function fieldValueIdentity(schema, field, value) {
|
|
562
|
+
if (field.kind !== "schema-object" && field.kind !== "schema-array") return null;
|
|
563
|
+
if (!value || typeof value !== "object") return null;
|
|
564
|
+
const rawValue = value;
|
|
565
|
+
let type;
|
|
566
|
+
if (field.options?.polymorphic) {
|
|
567
|
+
const typePath = field.options.type ?? "type";
|
|
568
|
+
if (typePath === "@hash") {
|
|
569
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
570
|
+
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
571
|
+
})(field.type);
|
|
572
|
+
type = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
573
|
+
} else {
|
|
574
|
+
type = rawValue[typePath];
|
|
575
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
576
|
+
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
577
|
+
})(typePath && type && typeof type === "string");
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
581
|
+
if (!test) throw new Error(`A non-polymorphic ${field.kind} field must provide a SchemaObject type in its definition`);
|
|
582
|
+
})(field.type);
|
|
583
|
+
type = field.type;
|
|
584
|
+
}
|
|
585
|
+
const hashField = schema.resource({ type }).identity;
|
|
586
|
+
const hash = hashField && hashField.kind === "@hash" ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : null;
|
|
587
|
+
return {
|
|
588
|
+
type,
|
|
589
|
+
hash
|
|
590
|
+
};
|
|
591
|
+
}
|
|
542
592
|
const _crypto = typeof FastBoot !== "undefined" ? FastBoot.require("crypto") : globalThis.crypto;
|
|
543
593
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.polyfillUUID)) installPolyfill();
|
|
544
594
|
function uuidv4() {
|
|
@@ -620,6 +670,8 @@ implement this hook.
|
|
|
620
670
|
|
|
621
671
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
622
672
|
|
|
673
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
674
|
+
before the store is created.
|
|
623
675
|
@public
|
|
624
676
|
*/
|
|
625
677
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -654,6 +706,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
654
706
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
655
707
|
without providing an `id` when one is missing will throw an error.
|
|
656
708
|
|
|
709
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
710
|
+
own secondary lookup tables.
|
|
657
711
|
@public
|
|
658
712
|
*/
|
|
659
713
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -671,6 +725,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
671
725
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
672
726
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
673
727
|
|
|
728
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
729
|
+
lookup tables.
|
|
674
730
|
@public
|
|
675
731
|
*/
|
|
676
732
|
function setIdentifierForgetMethod(method) {
|
|
@@ -690,6 +746,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
690
746
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
691
747
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
692
748
|
|
|
749
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
750
|
+
key-generation state.
|
|
693
751
|
@public
|
|
694
752
|
*/
|
|
695
753
|
function setIdentifierResetMethod(method) {
|
|
@@ -708,6 +766,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
708
766
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
709
767
|
```
|
|
710
768
|
|
|
769
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
770
|
+
must be set before the store is created.
|
|
711
771
|
@public
|
|
712
772
|
*/
|
|
713
773
|
function setKeyInfoForResource(method) {
|
|
@@ -1191,8 +1251,7 @@ function addResourceToCache(cache, identifier) {
|
|
|
1191
1251
|
if (identifier.id) typeSet.id.set(identifier.id, identifier);
|
|
1192
1252
|
}
|
|
1193
1253
|
|
|
1194
|
-
|
|
1195
|
-
//#region src/store/-private/managers/cache-capabilities-manager.ts
|
|
1254
|
+
// src/store/-private/managers/cache-capabilities-manager.ts
|
|
1196
1255
|
var CacheCapabilitiesManager = class {
|
|
1197
1256
|
/** @internal */
|
|
1198
1257
|
/** @internal */
|
|
@@ -1300,8 +1359,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
1300
1359
|
*/
|
|
1301
1360
|
function assertPrivateCapabilities(manager) {}
|
|
1302
1361
|
|
|
1303
|
-
|
|
1304
|
-
//#region src/store/-private/caches/instance-cache.ts
|
|
1362
|
+
// src/store/-private/caches/instance-cache.ts
|
|
1305
1363
|
function isDestroyable(record) {
|
|
1306
1364
|
return Boolean(record && typeof record === "object" && typeof record.destroy === "function");
|
|
1307
1365
|
}
|
|
@@ -1323,6 +1381,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
1323
1381
|
const { id, type, lid } = identifier;
|
|
1324
1382
|
```
|
|
1325
1383
|
|
|
1384
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
1326
1385
|
@public
|
|
1327
1386
|
@param record a record instance previously obstained from the store.
|
|
1328
1387
|
*/
|
|
@@ -1608,8 +1667,7 @@ function unloadRecord(instances, identifier) {
|
|
|
1608
1667
|
}
|
|
1609
1668
|
}
|
|
1610
1669
|
|
|
1611
|
-
|
|
1612
|
-
//#region src/store/-private/managers/cache-manager.ts
|
|
1670
|
+
// src/store/-private/managers/cache-manager.ts
|
|
1613
1671
|
/**
|
|
1614
1672
|
* The CacheManager wraps a Cache enforcing that only
|
|
1615
1673
|
* the public API surface area is exposed.
|
|
@@ -1693,7 +1751,8 @@ var CacheManager = class {
|
|
|
1693
1751
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
1694
1752
|
*
|
|
1695
1753
|
* @public
|
|
1696
|
-
* @return
|
|
1754
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
1755
|
+
* this push changed, or `undefined` when none did. Otherwise `void`.
|
|
1697
1756
|
*/
|
|
1698
1757
|
upsert(key, data, hasRecord) {
|
|
1699
1758
|
return this.___cache.upsert(key, data, hasRecord);
|
|
@@ -1995,13 +2054,18 @@ var CacheManager = class {
|
|
|
1995
2054
|
}
|
|
1996
2055
|
};
|
|
1997
2056
|
|
|
1998
|
-
|
|
1999
|
-
//#region src/store/-private/managers/notification-manager.ts
|
|
2057
|
+
// src/store/-private/managers/notification-manager.ts
|
|
2000
2058
|
/**
|
|
2001
2059
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
2060
|
+
*
|
|
2061
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
2062
|
+
* or `state`.
|
|
2002
2063
|
*/
|
|
2003
2064
|
/**
|
|
2004
2065
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
2066
|
+
*
|
|
2067
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
2068
|
+
* `invalidated`.
|
|
2005
2069
|
*/
|
|
2006
2070
|
function isCacheOperationValue(value) {
|
|
2007
2071
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -2009,6 +2073,9 @@ function isCacheOperationValue(value) {
|
|
|
2009
2073
|
/**
|
|
2010
2074
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
2011
2075
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
2076
|
+
*
|
|
2077
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
2078
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
2012
2079
|
*/
|
|
2013
2080
|
/**
|
|
2014
2081
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -2016,6 +2083,8 @@ function isCacheOperationValue(value) {
|
|
|
2016
2083
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
2017
2084
|
* instead of once per key.
|
|
2018
2085
|
*
|
|
2086
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
2087
|
+
* `relationships` changes in one call.
|
|
2019
2088
|
* @since 5.9.0
|
|
2020
2089
|
* @public
|
|
2021
2090
|
*/
|
|
@@ -2050,6 +2119,8 @@ function isCacheOperationValue(value) {
|
|
|
2050
2119
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
2051
2120
|
* have no local/remote duality.
|
|
2052
2121
|
*
|
|
2122
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
2123
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
2053
2124
|
* @public
|
|
2054
2125
|
*/
|
|
2055
2126
|
/**
|
|
@@ -2188,6 +2259,8 @@ function _unsubscribe(token, cache) {
|
|
|
2188
2259
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2189
2260
|
* work with any framework or change-notification system.
|
|
2190
2261
|
*
|
|
2262
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
2263
|
+
* cached resources and request documents.
|
|
2191
2264
|
* @hideconstructor
|
|
2192
2265
|
* @public
|
|
2193
2266
|
*/
|
|
@@ -2414,8 +2487,7 @@ function hasSubscribers(cache, cacheKey, value) {
|
|
|
2414
2487
|
return Boolean(callbackMap?.length);
|
|
2415
2488
|
}
|
|
2416
2489
|
|
|
2417
|
-
|
|
2418
|
-
//#region src/store/-private/record-arrays/-utils.ts
|
|
2490
|
+
// src/store/-private/record-arrays/-utils.ts
|
|
2419
2491
|
/**
|
|
2420
2492
|
* LegacyArrays have the capability of updating via `array.update()`
|
|
2421
2493
|
* and saving each contained record individually via `array.save()`
|
|
@@ -2494,8 +2566,7 @@ function safeForEach$1(instance, arr, store, callback, target) {
|
|
|
2494
2566
|
return instance;
|
|
2495
2567
|
}
|
|
2496
2568
|
|
|
2497
|
-
|
|
2498
|
-
//#region src/reactive/-private/fields/extension.ts
|
|
2569
|
+
// src/reactive/-private/fields/extension.ts
|
|
2499
2570
|
function expectNever(value) {}
|
|
2500
2571
|
function isExtensionProp(extensions, prop) {
|
|
2501
2572
|
return Boolean(extensions && typeof prop !== "number" && extensions.has(prop));
|
|
@@ -2583,8 +2654,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2583
2654
|
}
|
|
2584
2655
|
}
|
|
2585
2656
|
|
|
2586
|
-
|
|
2587
|
-
//#region src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2657
|
+
// src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2588
2658
|
/**
|
|
2589
2659
|
* The global `Proxy` constructor, retyped with the corrected
|
|
2590
2660
|
* {@link ProxyConstructor} signature above so that `target` and `receiver`
|
|
@@ -2594,8 +2664,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2594
2664
|
*/
|
|
2595
2665
|
const NativeProxy = Proxy;
|
|
2596
2666
|
|
|
2597
|
-
|
|
2598
|
-
//#region src/store/-private/record-arrays/resource-array.ts
|
|
2667
|
+
// src/store/-private/record-arrays/resource-array.ts
|
|
2599
2668
|
const IS_COLLECTION = getOrSetGlobal("IS_COLLECTION", Symbol.for("Collection"));
|
|
2600
2669
|
function isContextProp(prop) {
|
|
2601
2670
|
return prop === "destroy" || prop === "isDestroying" || prop === "isDestroyed";
|
|
@@ -2622,10 +2691,15 @@ const MUTABLE_PROPS = [
|
|
|
2622
2691
|
* as the base for relationship and legacy record-array types such as
|
|
2623
2692
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
2624
2693
|
*
|
|
2694
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
2695
|
+
* how it relates to resources.
|
|
2696
|
+
*
|
|
2625
2697
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
2626
2698
|
* both report `true`. The array stays in sync with the cache, updating
|
|
2627
2699
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
2628
2700
|
*
|
|
2701
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
2702
|
+
* and underlying relationship and legacy record arrays.
|
|
2629
2703
|
* @public
|
|
2630
2704
|
*/
|
|
2631
2705
|
/**
|
|
@@ -2884,8 +2958,7 @@ function createRequestCollection(config) {
|
|
|
2884
2958
|
});
|
|
2885
2959
|
}
|
|
2886
2960
|
|
|
2887
|
-
|
|
2888
|
-
//#region src/store/-private/record-arrays/legacy-live-array.ts
|
|
2961
|
+
// src/store/-private/record-arrays/legacy-live-array.ts
|
|
2889
2962
|
/**
|
|
2890
2963
|
* LiveArrays contain all the known records for a given `ResourceType`.
|
|
2891
2964
|
*
|
|
@@ -2946,6 +3019,8 @@ function createRequestCollection(config) {
|
|
|
2946
3019
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
2947
3020
|
* would be empty.
|
|
2948
3021
|
*
|
|
3022
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
3023
|
+
* `store.findAll`.
|
|
2949
3024
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
2950
3025
|
*/
|
|
2951
3026
|
/**
|
|
@@ -2989,8 +3064,7 @@ function _updateLiveArray() {
|
|
|
2989
3064
|
return context.store.findAll(this.modelName, { reload: true });
|
|
2990
3065
|
}
|
|
2991
3066
|
|
|
2992
|
-
|
|
2993
|
-
//#region src/store/-private/record-arrays/legacy-query.ts
|
|
3067
|
+
// src/store/-private/record-arrays/legacy-query.ts
|
|
2994
3068
|
/**
|
|
2995
3069
|
* QueryArrays contain the primary records returned when querying
|
|
2996
3070
|
* for records by `ResourceType`.
|
|
@@ -3061,6 +3135,8 @@ function _updateLiveArray() {
|
|
|
3061
3135
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
3062
3136
|
* from the store for book-keeping.
|
|
3063
3137
|
*
|
|
3138
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
3139
|
+
* `update()` and released with `destroy()`.
|
|
3064
3140
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
3065
3141
|
*/
|
|
3066
3142
|
/**
|
|
@@ -3123,8 +3199,7 @@ function destroyCollection(clear) {
|
|
|
3123
3199
|
manager._pending.delete(this);
|
|
3124
3200
|
}
|
|
3125
3201
|
|
|
3126
|
-
|
|
3127
|
-
//#region src/store/-private/managers/record-array-manager.ts
|
|
3202
|
+
// src/store/-private/managers/record-array-manager.ts
|
|
3128
3203
|
const FAKE_ARR = getOrSetGlobal("FAKE_ARR", {});
|
|
3129
3204
|
const SLICE_BATCH_SIZE = 4761;
|
|
3130
3205
|
/**
|
|
@@ -3471,6 +3546,7 @@ var RecordArrayManager = class {
|
|
|
3471
3546
|
this._managed.clear();
|
|
3472
3547
|
this._identifiers.clear();
|
|
3473
3548
|
this._pending.clear();
|
|
3549
|
+
this._staged.clear();
|
|
3474
3550
|
for (const set of this._set.values()) set.clear();
|
|
3475
3551
|
this._visibilitySet.clear();
|
|
3476
3552
|
}
|
|
@@ -3543,8 +3619,7 @@ function isLegacyLiveArray(array) {
|
|
|
3543
3619
|
return context.features !== null && context.features.DEPRECATED_CLASS_NAME === "LiveArray";
|
|
3544
3620
|
}
|
|
3545
3621
|
|
|
3546
|
-
|
|
3547
|
-
//#region src/store/-private/network/request-cache.ts
|
|
3622
|
+
// src/store/-private/network/request-cache.ts
|
|
3548
3623
|
const Touching = getOrSetGlobal("Touching", Symbol("touching"));
|
|
3549
3624
|
const RequestPromise = getOrSetGlobal("RequestPromise", Symbol("promise"));
|
|
3550
3625
|
const EMPTY_ARR = macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? Object.freeze([]) : [];
|
|
@@ -3755,8 +3830,7 @@ var RequestStateService = class {
|
|
|
3755
3830
|
*
|
|
3756
3831
|
* @private
|
|
3757
3832
|
*/
|
|
3758
|
-
|
|
3759
|
-
//#region src/store/-private/store-service.ts
|
|
3833
|
+
// src/store/-private/store-service.ts
|
|
3760
3834
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
3761
3835
|
globalThis.setWarpDriveLogging = setLogging;
|
|
3762
3836
|
globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
@@ -3883,6 +3957,10 @@ const app = new EmberApp(defaults, {
|
|
|
3883
3957
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
3884
3958
|
* requests for data with schemas, caching and reactivity.
|
|
3885
3959
|
*
|
|
3960
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
3961
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
3962
|
+
* through it.
|
|
3963
|
+
*
|
|
3886
3964
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
3887
3965
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
3888
3966
|
* even when you aren't sure yet.
|
|
@@ -3890,6 +3968,7 @@ const app = new EmberApp(defaults, {
|
|
|
3890
3968
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
3891
3969
|
* is possible.
|
|
3892
3970
|
*
|
|
3971
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
3893
3972
|
* @public
|
|
3894
3973
|
* @hideconstructor
|
|
3895
3974
|
*/
|
|
@@ -4104,12 +4183,25 @@ var Store = class extends BaseClass {
|
|
|
4104
4183
|
}
|
|
4105
4184
|
}
|
|
4106
4185
|
/**
|
|
4107
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
4186
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
4108
4187
|
* :::
|
|
4109
4188
|
*
|
|
4110
4189
|
* Issue a request via the configured {@link RequestManager},
|
|
4111
4190
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
4112
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
4191
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
4192
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
4193
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
4194
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
4195
|
+
* {@link StructuredDocument}.
|
|
4196
|
+
*
|
|
4197
|
+
* #### Building Requests
|
|
4198
|
+
*
|
|
4199
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
4200
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
4201
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
4202
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
4203
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
4204
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
4113
4205
|
*
|
|
4114
4206
|
* #### Request Cache Keys
|
|
4115
4207
|
*
|
|
@@ -4154,6 +4246,29 @@ var Store = class extends BaseClass {
|
|
|
4154
4246
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
4155
4247
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
4156
4248
|
*
|
|
4249
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
4250
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
4251
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
4252
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
4253
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
4254
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
4255
|
+
*
|
|
4256
|
+
* #### Typing The Response
|
|
4257
|
+
*
|
|
4258
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
4259
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
4260
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
4261
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
4262
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
4263
|
+
*
|
|
4264
|
+
* @example
|
|
4265
|
+
* ```ts
|
|
4266
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
4267
|
+
*
|
|
4268
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
4269
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
4270
|
+
* ```
|
|
4271
|
+
*
|
|
4157
4272
|
* @public
|
|
4158
4273
|
*/
|
|
4159
4274
|
request(requestConfig) {
|
|
@@ -4744,8 +4859,7 @@ function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
|
|
|
4744
4859
|
return recordIdentifierFor(recordOrPromiseRecord);
|
|
4745
4860
|
}
|
|
4746
4861
|
|
|
4747
|
-
|
|
4748
|
-
//#region src/store/deprecated/-private.ts
|
|
4862
|
+
// src/store/deprecated/-private.ts
|
|
4749
4863
|
function preloadData(store, identifier, preload) {
|
|
4750
4864
|
const jsonPayload = {};
|
|
4751
4865
|
const fields = store.schema.fields(identifier);
|
|
@@ -4792,6 +4906,8 @@ function _convertPreloadRelationshipToJSON(value, type) {
|
|
|
4792
4906
|
* for @warp-drive-mirror/legacy/model or when wrapping schema for legacy
|
|
4793
4907
|
* Adapters/Serializers.
|
|
4794
4908
|
*
|
|
4909
|
+
* @summary Legacy shape of a Model class's static schema API (fields, attributes, relationships, iterators) used
|
|
4910
|
+
* by the legacy schema service and Adapters/Serializers.
|
|
4795
4911
|
*/
|
|
4796
4912
|
function _resourceIsFullDeleted(identifier, cache) {
|
|
4797
4913
|
return cache.isDeletionCommitted(identifier) || cache.isNew(identifier) && cache.isDeleted(identifier);
|
|
@@ -5022,15 +5138,14 @@ var ShimModelClass = class {
|
|
|
5022
5138
|
}
|
|
5023
5139
|
};
|
|
5024
5140
|
|
|
5025
|
-
|
|
5026
|
-
//#region src/store/deprecated/store.ts
|
|
5141
|
+
// src/store/deprecated/store.ts
|
|
5027
5142
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_REQUEST_METHODS)) {
|
|
5028
5143
|
Store.prototype.findRecord = function(resource, id, options) {
|
|
5029
5144
|
deprecate(`store.findRecord is deprecated. Use store.request instead.`, false, {
|
|
5030
5145
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5031
5146
|
until: "6.0",
|
|
5032
5147
|
for: "@warp-drive-mirror/core",
|
|
5033
|
-
url: "https://
|
|
5148
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5034
5149
|
since: {
|
|
5035
5150
|
enabled: "5.7",
|
|
5036
5151
|
available: "5.7"
|
|
@@ -5075,7 +5190,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5075
5190
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5076
5191
|
until: "6.0",
|
|
5077
5192
|
for: "@warp-drive-mirror/core",
|
|
5078
|
-
url: "https://
|
|
5193
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5079
5194
|
since: {
|
|
5080
5195
|
enabled: "5.7",
|
|
5081
5196
|
available: "5.7"
|
|
@@ -5104,7 +5219,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5104
5219
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5105
5220
|
until: "6.0",
|
|
5106
5221
|
for: "@warp-drive-mirror/core",
|
|
5107
|
-
url: "https://
|
|
5222
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5108
5223
|
since: {
|
|
5109
5224
|
enabled: "5.7",
|
|
5110
5225
|
available: "5.7"
|
|
@@ -5137,7 +5252,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5137
5252
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5138
5253
|
until: "6.0",
|
|
5139
5254
|
for: "@warp-drive-mirror/core",
|
|
5140
|
-
url: "https://
|
|
5255
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5141
5256
|
since: {
|
|
5142
5257
|
enabled: "5.7",
|
|
5143
5258
|
available: "5.7"
|
|
@@ -5170,7 +5285,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5170
5285
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5171
5286
|
until: "6.0",
|
|
5172
5287
|
for: "@warp-drive-mirror/core",
|
|
5173
|
-
url: "https://
|
|
5288
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5174
5289
|
since: {
|
|
5175
5290
|
enabled: "5.7",
|
|
5176
5291
|
available: "5.7"
|
|
@@ -5203,7 +5318,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5203
5318
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5204
5319
|
until: "6.0",
|
|
5205
5320
|
for: "@warp-drive-mirror/core",
|
|
5206
|
-
url: "https://
|
|
5321
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5207
5322
|
since: {
|
|
5208
5323
|
enabled: "5.7",
|
|
5209
5324
|
available: "5.7"
|
|
@@ -5225,7 +5340,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5225
5340
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5226
5341
|
until: "6.0",
|
|
5227
5342
|
for: "@warp-drive-mirror/core",
|
|
5228
|
-
url: "https://
|
|
5343
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5229
5344
|
since: {
|
|
5230
5345
|
enabled: "5.7",
|
|
5231
5346
|
available: "5.7"
|
|
@@ -5266,8 +5381,7 @@ function upgradeInstanceCaches(cache) {
|
|
|
5266
5381
|
return withReferences;
|
|
5267
5382
|
}
|
|
5268
5383
|
|
|
5269
|
-
|
|
5270
|
-
//#region src/store/-private/cache-handler/utils.ts
|
|
5384
|
+
// src/store/-private/cache-handler/utils.ts
|
|
5271
5385
|
const MUTATION_OPS$1 = /* @__PURE__ */ new Set([
|
|
5272
5386
|
"createRecord",
|
|
5273
5387
|
"updateRecord",
|
|
@@ -5307,15 +5421,23 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5307
5421
|
return priority;
|
|
5308
5422
|
}
|
|
5309
5423
|
|
|
5310
|
-
|
|
5311
|
-
//#region src/store/-private/cache-handler/handler.ts
|
|
5424
|
+
// src/store/-private/cache-handler/handler.ts
|
|
5312
5425
|
/**
|
|
5313
5426
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
5314
5427
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
5428
|
+
*
|
|
5429
|
+
* Only the looser form accepts `controller`, so a request carrying one, including a builder's
|
|
5430
|
+
* output spread together with a `controller`, resolves to {@link LooseStoreRequestInfo}.
|
|
5431
|
+
*
|
|
5432
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
5433
|
+
* form with plain `records` and `headers`.
|
|
5315
5434
|
*/
|
|
5316
5435
|
/**
|
|
5317
5436
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
5318
5437
|
*
|
|
5438
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
5439
|
+
* request can use the cache.
|
|
5440
|
+
*
|
|
5319
5441
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
5320
5442
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
5321
5443
|
* attached to the request.
|
|
@@ -5351,7 +5473,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5351
5473
|
* method: 'GET',
|
|
5352
5474
|
* [EnableHydration]: true
|
|
5353
5475
|
* });
|
|
5476
|
+
* ```
|
|
5354
5477
|
*
|
|
5478
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
5479
|
+
* reactive documents when hydration is enabled.
|
|
5355
5480
|
*/
|
|
5356
5481
|
const CacheHandler = { request(context, next) {
|
|
5357
5482
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -5532,14 +5657,12 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
5532
5657
|
}] });
|
|
5533
5658
|
}
|
|
5534
5659
|
|
|
5535
|
-
|
|
5536
|
-
//#region src/store/-private/utils/is-non-empty-string.ts
|
|
5660
|
+
// src/store/-private/utils/is-non-empty-string.ts
|
|
5537
5661
|
function isNonEmptyString(str) {
|
|
5538
5662
|
return Boolean(str && typeof str === "string");
|
|
5539
5663
|
}
|
|
5540
5664
|
|
|
5541
|
-
|
|
5542
|
-
//#region src/store/-private/utils/construct-resource.ts
|
|
5665
|
+
// src/store/-private/utils/construct-resource.ts
|
|
5543
5666
|
/**
|
|
5544
5667
|
* Given an existing resource identifier object (or a {@link ResourceKey}),
|
|
5545
5668
|
* returns it unchanged aside from coercing its `id`, if present, to a string.
|
|
@@ -5611,8 +5734,7 @@ function constructResource(type, id, lid) {
|
|
|
5611
5734
|
}
|
|
5612
5735
|
}
|
|
5613
5736
|
|
|
5614
|
-
|
|
5615
|
-
//#region src/store/-private/record-arrays/legacy-many-array.ts
|
|
5737
|
+
// src/store/-private/record-arrays/legacy-many-array.ts
|
|
5616
5738
|
/**
|
|
5617
5739
|
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
5618
5740
|
relationship.
|
|
@@ -5653,6 +5775,7 @@ the has-many.
|
|
|
5653
5775
|
We call the record to which a relationship belongs-to the
|
|
5654
5776
|
relationship's _owner_.
|
|
5655
5777
|
|
|
5778
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
5656
5779
|
@public
|
|
5657
5780
|
*/
|
|
5658
5781
|
/**
|
|
@@ -5684,7 +5807,7 @@ function createLegacyManyArray(options) {
|
|
|
5684
5807
|
isAsync: options.isAsync,
|
|
5685
5808
|
isPolymorphic: options.isPolymorphic,
|
|
5686
5809
|
identifier: options.identifier,
|
|
5687
|
-
key: options.field.name,
|
|
5810
|
+
key: options.field.sourceKey ?? options.field.name,
|
|
5688
5811
|
reload,
|
|
5689
5812
|
createRecord,
|
|
5690
5813
|
notify
|
|
@@ -5961,8 +6084,7 @@ function mutate(collection, mutation, _SIGNAL) {
|
|
|
5961
6084
|
notifyInternalSignal(_SIGNAL);
|
|
5962
6085
|
}
|
|
5963
6086
|
|
|
5964
|
-
|
|
5965
|
-
//#region src/reactive/-private/kind/alias-field.ts
|
|
6087
|
+
// src/reactive/-private/kind/alias-field.ts
|
|
5966
6088
|
function getAliasField(context) {
|
|
5967
6089
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
5968
6090
|
if (!test) throw new Error(`Alias field access is not implemented`);
|
|
@@ -5975,8 +6097,7 @@ function setAliasField(context) {
|
|
|
5975
6097
|
return false;
|
|
5976
6098
|
}
|
|
5977
6099
|
|
|
5978
|
-
|
|
5979
|
-
//#region src/reactive/-private/fields/managed-array.ts
|
|
6100
|
+
// src/reactive/-private/fields/managed-array.ts
|
|
5980
6101
|
const ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([
|
|
5981
6102
|
Symbol.iterator,
|
|
5982
6103
|
"concat",
|
|
@@ -6076,31 +6197,11 @@ var ManagedArray = class {
|
|
|
6076
6197
|
if (field.type) return schema.transformation(field).hydrate(rawValue, field.options ?? null, self.owner);
|
|
6077
6198
|
return rawValue;
|
|
6078
6199
|
}
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
let objectType;
|
|
6085
|
-
if (field.options?.polymorphic) {
|
|
6086
|
-
const typePath = field.options.type ?? "type";
|
|
6087
|
-
if (typePath === "@hash") {
|
|
6088
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6089
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
6090
|
-
})(field.type);
|
|
6091
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
6092
|
-
} else {
|
|
6093
|
-
objectType = rawValue[typePath];
|
|
6094
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6095
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
6096
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
6097
|
-
}
|
|
6098
|
-
} else {
|
|
6099
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6100
|
-
if (!test) throw new Error(`A non-polymorphic SchemaArrayField must provide a SchemaObject type in its definition`);
|
|
6101
|
-
})(field.type);
|
|
6102
|
-
objectType = field.type;
|
|
6103
|
-
}
|
|
6200
|
+
const identity = fieldValueIdentity(schema, field, rawValue);
|
|
6201
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6202
|
+
if (!test) throw new Error(`Expected a schema-array element to resolve to a schema-object identity`);
|
|
6203
|
+
})(identity !== null);
|
|
6204
|
+
const { type: objectType, hash } = identity;
|
|
6104
6205
|
/**
|
|
6105
6206
|
* When KeyMode=@hash the ReactiveResource is keyed into
|
|
6106
6207
|
* ManagedRecordRefs by the return value of @hash on the rawValue.
|
|
@@ -6110,8 +6211,10 @@ var ManagedArray = class {
|
|
|
6110
6211
|
*/
|
|
6111
6212
|
let schemaObjectKeyValue;
|
|
6112
6213
|
if (KeyMode === "@hash") {
|
|
6113
|
-
|
|
6114
|
-
|
|
6214
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6215
|
+
if (!test) throw new Error(`Expected the '${objectType}' schema to declare an identity hash for key: '@hash'`);
|
|
6216
|
+
})(hash !== null);
|
|
6217
|
+
schemaObjectKeyValue = hash;
|
|
6115
6218
|
} else {
|
|
6116
6219
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
6117
6220
|
if (KeyMode !== "@identity" && KeyMode !== "@index") {
|
|
@@ -6260,8 +6363,7 @@ Object.defineProperty(ManagedArray.prototype, "[]", {
|
|
|
6260
6363
|
}
|
|
6261
6364
|
});
|
|
6262
6365
|
|
|
6263
|
-
|
|
6264
|
-
//#region src/reactive/-private/kind/array-field.ts
|
|
6366
|
+
// src/reactive/-private/kind/array-field.ts
|
|
6265
6367
|
function getArrayField(context) {
|
|
6266
6368
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6267
6369
|
const { record } = context;
|
|
@@ -6307,8 +6409,7 @@ function setArrayField(context) {
|
|
|
6307
6409
|
return true;
|
|
6308
6410
|
}
|
|
6309
6411
|
|
|
6310
|
-
|
|
6311
|
-
//#region src/reactive/-private/kind/attribute-field.ts
|
|
6412
|
+
// src/reactive/-private/kind/attribute-field.ts
|
|
6312
6413
|
function getAttributeField(context) {
|
|
6313
6414
|
entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6314
6415
|
const { cache } = context.store;
|
|
@@ -6319,8 +6420,7 @@ function setAttributeField(context) {
|
|
|
6319
6420
|
return true;
|
|
6320
6421
|
}
|
|
6321
6422
|
|
|
6322
|
-
|
|
6323
|
-
//#region src/reactive/-private/fields/get-field-key.ts
|
|
6423
|
+
// src/reactive/-private/fields/get-field-key.ts
|
|
6324
6424
|
const InvalidKinds = [
|
|
6325
6425
|
"alias",
|
|
6326
6426
|
"derived",
|
|
@@ -6339,8 +6439,7 @@ function getFieldCacheKey(field) {
|
|
|
6339
6439
|
return "sourceKey" in field && field.sourceKey ? field.sourceKey : field.name;
|
|
6340
6440
|
}
|
|
6341
6441
|
|
|
6342
|
-
|
|
6343
|
-
//#region src/reactive/-private/kind/belongs-to-field.ts
|
|
6442
|
+
// src/reactive/-private/kind/belongs-to-field.ts
|
|
6344
6443
|
function getBelongsToField(context) {
|
|
6345
6444
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6346
6445
|
const { field, resourceKey, store } = context;
|
|
@@ -6383,8 +6482,7 @@ function getResourceKey(record) {
|
|
|
6383
6482
|
return recordIdentifierFor(record);
|
|
6384
6483
|
}
|
|
6385
6484
|
|
|
6386
|
-
|
|
6387
|
-
//#region src/reactive/-private/kind/collection-field.ts
|
|
6485
|
+
// src/reactive/-private/kind/collection-field.ts
|
|
6388
6486
|
function getCollectionField(context) {
|
|
6389
6487
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6390
6488
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
@@ -6398,8 +6496,7 @@ function setCollectionField(context) {
|
|
|
6398
6496
|
return false;
|
|
6399
6497
|
}
|
|
6400
6498
|
|
|
6401
|
-
|
|
6402
|
-
//#region src/reactive/-private/kind/derived-field.ts
|
|
6499
|
+
// src/reactive/-private/kind/derived-field.ts
|
|
6403
6500
|
function getDerivedField(context) {
|
|
6404
6501
|
const { schema } = context.store;
|
|
6405
6502
|
return schema.derivation(context.field)(context.record, context.field.options ?? null, context.field.name);
|
|
@@ -6411,8 +6508,7 @@ function setDerivedField(context) {
|
|
|
6411
6508
|
return false;
|
|
6412
6509
|
}
|
|
6413
6510
|
|
|
6414
|
-
|
|
6415
|
-
//#region src/reactive/-private/kind/generic-field.ts
|
|
6511
|
+
// src/reactive/-private/kind/generic-field.ts
|
|
6416
6512
|
function getGenericField(context) {
|
|
6417
6513
|
const signal = entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6418
6514
|
signal.isStale = false;
|
|
@@ -6434,8 +6530,7 @@ function setGenericField(context) {
|
|
|
6434
6530
|
return true;
|
|
6435
6531
|
}
|
|
6436
6532
|
|
|
6437
|
-
|
|
6438
|
-
//#region src/reactive/-private/fields/many-array-manager.ts
|
|
6533
|
+
// src/reactive/-private/fields/many-array-manager.ts
|
|
6439
6534
|
var ManyArrayManager = class {
|
|
6440
6535
|
constructor(record, editable) {
|
|
6441
6536
|
const context = record[Context];
|
|
@@ -6497,8 +6592,7 @@ function extractCacheOptions(options) {
|
|
|
6497
6592
|
return cacheOptions;
|
|
6498
6593
|
}
|
|
6499
6594
|
|
|
6500
|
-
|
|
6501
|
-
//#region src/reactive/-private/kind/has-many-field.ts
|
|
6595
|
+
// src/reactive/-private/kind/has-many-field.ts
|
|
6502
6596
|
function getHasManyField(context) {
|
|
6503
6597
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6504
6598
|
const { store, field } = context;
|
|
@@ -6544,8 +6638,7 @@ function setHasManyField(context) {
|
|
|
6544
6638
|
return true;
|
|
6545
6639
|
}
|
|
6546
6640
|
|
|
6547
|
-
|
|
6548
|
-
//#region src/reactive/-private/kind/hash-field.ts
|
|
6641
|
+
// src/reactive/-private/kind/hash-field.ts
|
|
6549
6642
|
function getHashField(context) {
|
|
6550
6643
|
const { field, path, resourceKey } = context;
|
|
6551
6644
|
const { schema, cache } = context.store;
|
|
@@ -6563,8 +6656,7 @@ function setHashField(context) {
|
|
|
6563
6656
|
return false;
|
|
6564
6657
|
}
|
|
6565
6658
|
|
|
6566
|
-
|
|
6567
|
-
//#region src/reactive/-private/kind/identity-field.ts
|
|
6659
|
+
// src/reactive/-private/kind/identity-field.ts
|
|
6568
6660
|
function getIdentityField(context) {
|
|
6569
6661
|
entangleSignal(context.signals, context.record, "@identity", null);
|
|
6570
6662
|
return context.resourceKey.id;
|
|
@@ -6586,8 +6678,7 @@ function setIdentityField(context) {
|
|
|
6586
6678
|
return true;
|
|
6587
6679
|
}
|
|
6588
6680
|
|
|
6589
|
-
|
|
6590
|
-
//#region src/reactive/-private/kind/local-field.ts
|
|
6681
|
+
// src/reactive/-private/kind/local-field.ts
|
|
6591
6682
|
function getLocalField(context) {
|
|
6592
6683
|
const { field } = context;
|
|
6593
6684
|
const signal = getOrCreateInternalSignal(context.signals, context.record, field.name, field.options?.defaultValue ?? null);
|
|
@@ -6604,8 +6695,7 @@ function setLocalField(context) {
|
|
|
6604
6695
|
return true;
|
|
6605
6696
|
}
|
|
6606
6697
|
|
|
6607
|
-
|
|
6608
|
-
//#region src/reactive/-private/fields/managed-object.ts
|
|
6698
|
+
// src/reactive/-private/fields/managed-object.ts
|
|
6609
6699
|
const ObjectSymbols = /* @__PURE__ */ new Set([
|
|
6610
6700
|
OBJECT_SIGNAL,
|
|
6611
6701
|
Context,
|
|
@@ -6689,8 +6779,7 @@ function peekManagedObject(record, field) {
|
|
|
6689
6779
|
if (managedObjectMapForRecord) return managedObjectMapForRecord.get(field.name);
|
|
6690
6780
|
}
|
|
6691
6781
|
|
|
6692
|
-
|
|
6693
|
-
//#region src/reactive/-private/kind/object-field.ts
|
|
6782
|
+
// src/reactive/-private/kind/object-field.ts
|
|
6694
6783
|
function getObjectField(context) {
|
|
6695
6784
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6696
6785
|
const { record, field } = context;
|
|
@@ -6746,8 +6835,7 @@ function setObjectField(context) {
|
|
|
6746
6835
|
return true;
|
|
6747
6836
|
}
|
|
6748
6837
|
|
|
6749
|
-
|
|
6750
|
-
//#region src/reactive/-private/kind/resource-field.ts
|
|
6838
|
+
// src/reactive/-private/kind/resource-field.ts
|
|
6751
6839
|
var ResourceRelationship = class {
|
|
6752
6840
|
constructor(context) {
|
|
6753
6841
|
const { store, resourceKey } = context;
|
|
@@ -6795,8 +6883,7 @@ function setResourceField(context) {
|
|
|
6795
6883
|
return false;
|
|
6796
6884
|
}
|
|
6797
6885
|
|
|
6798
|
-
|
|
6799
|
-
//#region src/reactive/-private/kind/schema-array-field.ts
|
|
6886
|
+
// src/reactive/-private/kind/schema-array-field.ts
|
|
6800
6887
|
function setSchemaArrayField(context) {
|
|
6801
6888
|
const arrayValue = context.value === null ? null : context.value?.slice();
|
|
6802
6889
|
const fieldSignal = peekInternalSignal(context.signals, context.path.at(-1));
|
|
@@ -6813,8 +6900,7 @@ function setSchemaArrayField(context) {
|
|
|
6813
6900
|
return true;
|
|
6814
6901
|
}
|
|
6815
6902
|
|
|
6816
|
-
|
|
6817
|
-
//#region src/reactive/-private/kind/schema-object-field.ts
|
|
6903
|
+
// src/reactive/-private/kind/schema-object-field.ts
|
|
6818
6904
|
function getSchemaObjectField(context) {
|
|
6819
6905
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6820
6906
|
const { store, resourceKey, path, field } = context;
|
|
@@ -6831,29 +6917,12 @@ function getSchemaObjectField(context) {
|
|
|
6831
6917
|
}
|
|
6832
6918
|
return null;
|
|
6833
6919
|
}
|
|
6834
|
-
const
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
6841
|
-
})(field.type);
|
|
6842
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
6843
|
-
} else {
|
|
6844
|
-
objectType = rawValue[typePath];
|
|
6845
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6846
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
6847
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
6848
|
-
}
|
|
6849
|
-
} else {
|
|
6850
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6851
|
-
if (!test) throw new Error(`A non-polymorphic SchemaObjectField must provide a SchemaObject type in its definition`);
|
|
6852
|
-
})(field.type);
|
|
6853
|
-
objectType = field.type;
|
|
6854
|
-
}
|
|
6855
|
-
const hashField = schema.resource({ type: objectType }).identity;
|
|
6856
|
-
const identity = hashField ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : field.name;
|
|
6920
|
+
const resolved = fieldValueIdentity(store.schema, field, rawValue);
|
|
6921
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6922
|
+
if (!test) throw new Error(`Expected a schema-object value to resolve to a schema-object identity`);
|
|
6923
|
+
})(resolved !== null);
|
|
6924
|
+
const { type: objectType, hash } = resolved;
|
|
6925
|
+
const identity = hash ?? field.name;
|
|
6857
6926
|
const cachedSchemaObject = signal.value;
|
|
6858
6927
|
if (cachedSchemaObject) {
|
|
6859
6928
|
if (cachedSchemaObject.type === objectType && cachedSchemaObject.identity === identity) return cachedSchemaObject.value;
|
|
@@ -6898,8 +6967,7 @@ function setSchemaObjectField(context) {
|
|
|
6898
6967
|
return true;
|
|
6899
6968
|
}
|
|
6900
6969
|
|
|
6901
|
-
|
|
6902
|
-
//#region src/reactive/-private/default-mode.ts
|
|
6970
|
+
// src/reactive/-private/default-mode.ts
|
|
6903
6971
|
/**
|
|
6904
6972
|
* A ReactiveResource context object passed to
|
|
6905
6973
|
* the get/set functions of a field kind implementation.
|
|
@@ -7015,14 +7083,15 @@ const DefaultMode = {
|
|
|
7015
7083
|
}
|
|
7016
7084
|
};
|
|
7017
7085
|
|
|
7018
|
-
|
|
7019
|
-
//#region src/reactive/-private/record.ts
|
|
7086
|
+
// src/reactive/-private/record.ts
|
|
7020
7087
|
const IgnoredGlobalFields = /* @__PURE__ */ new Set([
|
|
7021
7088
|
"length",
|
|
7022
7089
|
"nodeType",
|
|
7023
7090
|
"then",
|
|
7024
7091
|
"setInterval",
|
|
7025
7092
|
"document",
|
|
7093
|
+
"unknownProperty",
|
|
7094
|
+
"size",
|
|
7026
7095
|
STRUCTURED
|
|
7027
7096
|
]);
|
|
7028
7097
|
const RecordSymbols = /* @__PURE__ */ new Set([
|
|
@@ -7047,10 +7116,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
7047
7116
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
7048
7117
|
* object.
|
|
7049
7118
|
*
|
|
7119
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7120
|
+
* define the schema it reads.
|
|
7121
|
+
*
|
|
7050
7122
|
* This class is not directly instantiable. To use it, you should
|
|
7051
7123
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
7052
7124
|
* with the matching hooks provided by this package.
|
|
7053
7125
|
*
|
|
7126
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
7054
7127
|
* @hideconstructor
|
|
7055
7128
|
* @public
|
|
7056
7129
|
*/
|
|
@@ -7504,6 +7577,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
7504
7577
|
* Edits to editable resources will be automatically committed if a new
|
|
7505
7578
|
* payload from the cache matches their existing value.
|
|
7506
7579
|
*
|
|
7580
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
7581
|
+
* changed locally.
|
|
7507
7582
|
* @public
|
|
7508
7583
|
*
|
|
7509
7584
|
* @returns a promise that resolves to the editable resource
|
|
@@ -7520,14 +7595,15 @@ function checkout(resource) {
|
|
|
7520
7595
|
* approach is for either the API or a Handler to reflect saved
|
|
7521
7596
|
* changes back to update the cache.
|
|
7522
7597
|
*
|
|
7598
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
7599
|
+
* bypassing a save round-trip.
|
|
7523
7600
|
* @public
|
|
7524
7601
|
*/
|
|
7525
7602
|
function commit(record) {
|
|
7526
7603
|
return record[Commit]();
|
|
7527
7604
|
}
|
|
7528
7605
|
|
|
7529
|
-
|
|
7530
|
-
//#region src/reactive/-private/hooks.ts
|
|
7606
|
+
// src/reactive/-private/hooks.ts
|
|
7531
7607
|
/**
|
|
7532
7608
|
* The store's default `instantiateRecord` hook implementation, which
|
|
7533
7609
|
* produces a {@link ReactiveResource} for `identifier` using the resource
|
|
@@ -7537,6 +7613,8 @@ function commit(record) {
|
|
|
7537
7613
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
7538
7614
|
* properties when creating a new legacy record.
|
|
7539
7615
|
*
|
|
7616
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
7617
|
+
* from its registered schema.
|
|
7540
7618
|
* @public
|
|
7541
7619
|
*/
|
|
7542
7620
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -7569,6 +7647,8 @@ function assertReactiveResource(record) {
|
|
|
7569
7647
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
7570
7648
|
* behavior.
|
|
7571
7649
|
*
|
|
7650
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
7651
|
+
* releases it.
|
|
7572
7652
|
* @public
|
|
7573
7653
|
*/
|
|
7574
7654
|
function teardownRecord(record) {
|
|
@@ -7576,8 +7656,7 @@ function teardownRecord(record) {
|
|
|
7576
7656
|
record[Destroy]();
|
|
7577
7657
|
}
|
|
7578
7658
|
|
|
7579
|
-
|
|
7580
|
-
//#region src/reactive/-private/schema.ts
|
|
7659
|
+
// src/reactive/-private/schema.ts
|
|
7581
7660
|
const Support = getOrSetGlobal("Support", /* @__PURE__ */ new WeakMap());
|
|
7582
7661
|
const ConstructorField = {
|
|
7583
7662
|
type: "@constructor",
|
|
@@ -7623,16 +7702,25 @@ _constructor[Type] = "@constructor";
|
|
|
7623
7702
|
* This should only be used for temporary migration purposes
|
|
7624
7703
|
* to the new schema system when migrating from either Model
|
|
7625
7704
|
* or ModelFragments.
|
|
7705
|
+
*
|
|
7706
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
7707
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
7626
7708
|
*/
|
|
7627
7709
|
/**
|
|
7628
7710
|
* Describes one feature added to a resource by a schema extension, as
|
|
7629
7711
|
* classified by {@link processExtension} from the property descriptor it
|
|
7630
7712
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
7713
|
+
*
|
|
7714
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
7715
|
+
* mutable value, or a getter/setter accessor.
|
|
7631
7716
|
*/
|
|
7632
7717
|
/**
|
|
7633
7718
|
* The result of {@link processExtension} normalizing a
|
|
7634
7719
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
7635
7720
|
* by name.
|
|
7721
|
+
*
|
|
7722
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
7723
|
+
* keyed by property name.
|
|
7636
7724
|
*/
|
|
7637
7725
|
const BannedKeys = ["constructor", "__proto__"];
|
|
7638
7726
|
function processExtension(extension) {
|
|
@@ -7732,14 +7820,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
7732
7820
|
* Utility for constructing a ResourceSchema with the recommended
|
|
7733
7821
|
* fields for the PolarisMode experience.
|
|
7734
7822
|
*
|
|
7823
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7824
|
+
* create a schema with it.
|
|
7825
|
+
*
|
|
7735
7826
|
* Using this requires registering the PolarisMode derivations
|
|
7736
7827
|
*
|
|
7737
7828
|
* ```ts
|
|
7738
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
7829
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
7739
7830
|
*
|
|
7740
7831
|
* registerDerivations(schema);
|
|
7741
7832
|
* ```
|
|
7742
7833
|
*
|
|
7834
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
7835
|
+
* PolarisMode resource schema.
|
|
7743
7836
|
* @public
|
|
7744
7837
|
* @param schema
|
|
7745
7838
|
* @return {PolarisResourceSchema}
|
|
@@ -7770,6 +7863,8 @@ function withDefaults(schema) {
|
|
|
7770
7863
|
*
|
|
7771
7864
|
* `^` returns the entire identifier object.
|
|
7772
7865
|
*
|
|
7866
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
7867
|
+
* for use in derived fields.
|
|
7773
7868
|
* @public
|
|
7774
7869
|
*/
|
|
7775
7870
|
const fromIdentity = (record, options, key) => {
|
|
@@ -7793,9 +7888,14 @@ fromIdentity[Type] = "@identity";
|
|
|
7793
7888
|
* to use the PolarisMode defaults provided by
|
|
7794
7889
|
*
|
|
7795
7890
|
* ```ts
|
|
7796
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
7891
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
7797
7892
|
* ```
|
|
7798
7893
|
*
|
|
7894
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
7895
|
+
* guide explains when you need to call it.
|
|
7896
|
+
*
|
|
7897
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
7898
|
+
* `withDefaults` depend on.
|
|
7799
7899
|
* @public
|
|
7800
7900
|
*/
|
|
7801
7901
|
function registerDerivations(schema) {
|
|
@@ -7871,6 +7971,9 @@ function assertConsistentAbstractFieldShape(abstractType, fieldName, existing, i
|
|
|
7871
7971
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
7872
7972
|
* between the raw value `T` stored in the cache and the presentation value
|
|
7873
7973
|
* `PT` exposed on the record.
|
|
7974
|
+
*
|
|
7975
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
7976
|
+
* record, with optional default.
|
|
7874
7977
|
*/
|
|
7875
7978
|
/**
|
|
7876
7979
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -7893,6 +7996,12 @@ function makeCachedDerivation(derivation) {
|
|
|
7893
7996
|
/**
|
|
7894
7997
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
7895
7998
|
*
|
|
7999
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
8000
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
8001
|
+
* shows how to give a store one.
|
|
8002
|
+
*
|
|
8003
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
8004
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
7896
8005
|
* @public
|
|
7897
8006
|
*/
|
|
7898
8007
|
var SchemaService = class {
|
|
@@ -8329,284 +8438,7 @@ function mergeMap(base, toApply) {
|
|
|
8329
8438
|
for (const [key, value] of toApply) base.set(key, value);
|
|
8330
8439
|
}
|
|
8331
8440
|
|
|
8332
|
-
|
|
8333
|
-
//#region src/reactive.ts
|
|
8334
|
-
/**
|
|
8335
|
-
* # About
|
|
8336
|
-
*
|
|
8337
|
-
* This module provides an implementation of reactive objects that a Store may use for creating
|
|
8338
|
-
* reactive representations of the raw data for requests, resources and their relationships
|
|
8339
|
-
* stored in the cache.
|
|
8340
|
-
*
|
|
8341
|
-
* - For configuring the store to use these reactive objects, see [The Setup Guide](/guides/configuration/)
|
|
8342
|
-
* - For defining resource schemas, see [The Schema Guide](/guides/the-manual/schemas/)
|
|
8343
|
-
*
|
|
8344
|
-
* Any method that returns a record instance will use the `instantiateRecord`
|
|
8345
|
-
* hook configured above to instantiate a ReactiveResource once this is in place.
|
|
8346
|
-
* After that, its up to you what ReactiveResource can do.
|
|
8347
|
-
*
|
|
8348
|
-
* ## Modes
|
|
8349
|
-
*
|
|
8350
|
-
* ReactiveResource has two modes: `legacy` and `polaris`.
|
|
8351
|
-
*
|
|
8352
|
-
* **LegacyMode** can be used to emulate the behaviors and capabilities of WarpDrive's `Model` class,
|
|
8353
|
-
* and because there is little distinction between Model and a ReactiveResource in LegacyMode we refer
|
|
8354
|
-
* to both of these approaches as LegacyMode. This mode is the default experience in V5.
|
|
8355
|
-
*
|
|
8356
|
-
* In LegacyMode:
|
|
8357
|
-
*
|
|
8358
|
-
* - records are mutable
|
|
8359
|
-
* - local changes immediately reflect app wide
|
|
8360
|
-
* - records have all the APIs of Model (references, state props, currentState, methods etc)
|
|
8361
|
-
* - the continued use of `@warp-drive-mirror/legacy` is required (though most imports from it can be removed)
|
|
8362
|
-
* - `async: true` relationships are supported (but not recommended outside of [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8363
|
-
*
|
|
8364
|
-
* ---
|
|
8365
|
-
*
|
|
8366
|
-
* **PolarisMode** is an upcoming suite of features that will become the default experience in V6.
|
|
8367
|
-
*
|
|
8368
|
-
* In PolarisMode:
|
|
8369
|
-
*
|
|
8370
|
-
* - records are immutable, unless creating a new resource or explicitly checking out a record for editing
|
|
8371
|
-
* - local changes are isolated until committed, displaying only via the editable version of the record
|
|
8372
|
-
* - records have a more limited API, focused on only what is in their schema.
|
|
8373
|
-
* - some common operations may have more friction to perform because intended utilities are not yet available
|
|
8374
|
-
* - `async: true` relationships are not supported (see [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8375
|
-
* - The `@warp-drive-mirror/legacy` package is not required
|
|
8376
|
-
*
|
|
8377
|
-
* These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
|
|
8378
|
-
* a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
|
|
8379
|
-
* a ReactiveResource or a Model.
|
|
8380
|
-
*
|
|
8381
|
-
* ---
|
|
8382
|
-
*
|
|
8383
|
-
* ## Basic Usage
|
|
8384
|
-
*
|
|
8385
|
-
* ReactiveResource is a reactive object that transforms raw data from an associated
|
|
8386
|
-
* cache into reactive data backed by Signals.
|
|
8387
|
-
*
|
|
8388
|
-
* The shape of the object and the transformation of raw cache data into its
|
|
8389
|
-
* reactive form is controlled by a resource schema.
|
|
8390
|
-
*
|
|
8391
|
-
* For instance, lets say your API is a [{json:api}](https://jsonapi.org) and your store is using
|
|
8392
|
-
* the Cache provided by {@link @warp-drive-mirror/json-api! | @warp-drive-mirror/json-api}, and a request
|
|
8393
|
-
* returns the following raw data:
|
|
8394
|
-
*
|
|
8395
|
-
* ```ts
|
|
8396
|
-
* {
|
|
8397
|
-
* data: {
|
|
8398
|
-
* type: 'user',
|
|
8399
|
-
* id: '1',
|
|
8400
|
-
* attributes: { firstName: 'Chris', lastName: 'Thoburn' },
|
|
8401
|
-
* relationships: { pets: { data: [{ type: 'dog', id: '1' }] }}
|
|
8402
|
-
* },
|
|
8403
|
-
* included: [
|
|
8404
|
-
* {
|
|
8405
|
-
* type: 'dog',
|
|
8406
|
-
* id: '1',
|
|
8407
|
-
* attributes: { name: 'Rey' },
|
|
8408
|
-
* relationships: { owner: { data: { type: 'user', id: '1' }}}
|
|
8409
|
-
* }
|
|
8410
|
-
* ]
|
|
8411
|
-
* }
|
|
8412
|
-
* ```
|
|
8413
|
-
*
|
|
8414
|
-
* We could describe the `'user'` and `'dog'` resources in the above payload
|
|
8415
|
-
* with the following schemas:
|
|
8416
|
-
*
|
|
8417
|
-
* ```ts
|
|
8418
|
-
* store.schema.registerResources([
|
|
8419
|
-
* {
|
|
8420
|
-
* type: 'user',
|
|
8421
|
-
* identity: { type: '@id', name: 'id' },
|
|
8422
|
-
* fields: [
|
|
8423
|
-
* {
|
|
8424
|
-
* type: '@identity',
|
|
8425
|
-
* name: '$type',
|
|
8426
|
-
* kind: 'derived',
|
|
8427
|
-
* options: { key: 'type' },
|
|
8428
|
-
* },
|
|
8429
|
-
* { kind: 'field', name: 'firstName' },
|
|
8430
|
-
* { kind: 'field', name: 'lastName' },
|
|
8431
|
-
* {
|
|
8432
|
-
* kind: 'derived',
|
|
8433
|
-
* name: 'name',
|
|
8434
|
-
* type: 'concat',
|
|
8435
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8436
|
-
* },
|
|
8437
|
-
* {
|
|
8438
|
-
* kind: 'hasMany',
|
|
8439
|
-
* name: 'pets',
|
|
8440
|
-
* type: 'pet',
|
|
8441
|
-
* options: {
|
|
8442
|
-
* async: false,
|
|
8443
|
-
* inverse: 'owner',
|
|
8444
|
-
* polymorphic: true,
|
|
8445
|
-
* linksMode: true,
|
|
8446
|
-
* }
|
|
8447
|
-
* }
|
|
8448
|
-
* ]
|
|
8449
|
-
* },
|
|
8450
|
-
* {
|
|
8451
|
-
* type: 'dog',
|
|
8452
|
-
* identity: { type: '@id', name: 'id' },
|
|
8453
|
-
* fields: [
|
|
8454
|
-
* {
|
|
8455
|
-
* type: '@identity',
|
|
8456
|
-
* name: '$type',
|
|
8457
|
-
* kind: 'derived',
|
|
8458
|
-
* options: { key: 'type' },
|
|
8459
|
-
* },
|
|
8460
|
-
* { kind: 'field', name: 'name' },
|
|
8461
|
-
* {
|
|
8462
|
-
* kind: 'belongsTo',
|
|
8463
|
-
* name: 'owner',
|
|
8464
|
-
* type: 'user',
|
|
8465
|
-
* options: {
|
|
8466
|
-
* async: false,
|
|
8467
|
-
* inverse: 'pets',
|
|
8468
|
-
* as: 'pet',
|
|
8469
|
-
* linksMode: true,
|
|
8470
|
-
* }
|
|
8471
|
-
* }
|
|
8472
|
-
* ]
|
|
8473
|
-
* }
|
|
8474
|
-
* ]);
|
|
8475
|
-
* ```
|
|
8476
|
-
*
|
|
8477
|
-
* With these schemas in place, the reactive objects that the store would
|
|
8478
|
-
* provide us whenever we encountered a `'user'` or a `'dog'` would be:
|
|
8479
|
-
*
|
|
8480
|
-
* ```ts
|
|
8481
|
-
* interface Pet {
|
|
8482
|
-
* readonly id: string;
|
|
8483
|
-
* readonly owner: User;
|
|
8484
|
-
* }
|
|
8485
|
-
*
|
|
8486
|
-
* interface Dog extends Pet {
|
|
8487
|
-
* readonly $type: 'dog';
|
|
8488
|
-
* readonly name: string;
|
|
8489
|
-
* }
|
|
8490
|
-
*
|
|
8491
|
-
* interface EditableUser {
|
|
8492
|
-
* readonly $type: 'user';
|
|
8493
|
-
* readonly id: string;
|
|
8494
|
-
* firstName: string;
|
|
8495
|
-
* lastName: string;
|
|
8496
|
-
* readonly name: string;
|
|
8497
|
-
* pets: Array<Dog | Pet>;
|
|
8498
|
-
* }
|
|
8499
|
-
*
|
|
8500
|
-
* interface User {
|
|
8501
|
-
* readonly $type: 'user';
|
|
8502
|
-
* readonly id: string;
|
|
8503
|
-
* readonly firstName: string;
|
|
8504
|
-
* readonly lastName: string;
|
|
8505
|
-
* readonly name: string;
|
|
8506
|
-
* readonly pets: Readonly<Array<Dog | Pet>>;
|
|
8507
|
-
* [Checkout](): Promise<EditableUser>
|
|
8508
|
-
* }>
|
|
8509
|
-
* ```
|
|
8510
|
-
*
|
|
8511
|
-
* Note how based on the schema the reactive object we receive is able to produce
|
|
8512
|
-
* `name` on user (despite no name field being in the cache), provide `$type`
|
|
8513
|
-
* pulled from the identity of the resource, and flatten the individual attributes
|
|
8514
|
-
* and relationships onto the record for easier use.
|
|
8515
|
-
*
|
|
8516
|
-
* Notice also how we typed this object with `readonly`. This is because while
|
|
8517
|
-
* ReactiveResource instances are ***deeply reactive***, they are also ***immutable***.
|
|
8518
|
-
*
|
|
8519
|
-
* We can mutate a ReactiveResource only be explicitly asking permission to do so, and
|
|
8520
|
-
* in the process gaining access to an editable copy. The immutable version will
|
|
8521
|
-
* not show any in-process edits made to this editable copy.
|
|
8522
|
-
*
|
|
8523
|
-
* ```ts
|
|
8524
|
-
* import { Checkout } from '@warp-drive-mirror/schema-record';
|
|
8525
|
-
*
|
|
8526
|
-
* const editable = await user[Checkout]();
|
|
8527
|
-
* ```
|
|
8528
|
-
*
|
|
8529
|
-
* ## Utilities
|
|
8530
|
-
*
|
|
8531
|
-
* ReactiveResource provides a schema builder that simplifies setting up a couple of
|
|
8532
|
-
* conventional fields like identity and `$type`. We can rewrite the schema
|
|
8533
|
-
* definition above using this utility like so:
|
|
8534
|
-
*
|
|
8535
|
-
* ```ts
|
|
8536
|
-
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
8537
|
-
*
|
|
8538
|
-
* store.schema.registerResources([
|
|
8539
|
-
* withDefaults({
|
|
8540
|
-
* type: 'user',
|
|
8541
|
-
* fields: [
|
|
8542
|
-
* { kind: 'field', name: 'firstName' },
|
|
8543
|
-
* { kind: 'field', name: 'lastName' },
|
|
8544
|
-
* {
|
|
8545
|
-
* kind: 'derived',
|
|
8546
|
-
* name: 'name',
|
|
8547
|
-
* type: 'concat',
|
|
8548
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8549
|
-
* },
|
|
8550
|
-
* {
|
|
8551
|
-
* kind: 'hasMany',
|
|
8552
|
-
* name: 'pets',
|
|
8553
|
-
* type: 'pet',
|
|
8554
|
-
* options: {
|
|
8555
|
-
* async: false,
|
|
8556
|
-
* inverse: 'owner',
|
|
8557
|
-
* polymorphic: true,
|
|
8558
|
-
* linksMode: true,
|
|
8559
|
-
* resetOnRemoteUpdate: false,
|
|
8560
|
-
* }
|
|
8561
|
-
* }
|
|
8562
|
-
* ]
|
|
8563
|
-
* }),
|
|
8564
|
-
* withDefaults({
|
|
8565
|
-
* type: 'dog',
|
|
8566
|
-
* fields: [
|
|
8567
|
-
* { kind: 'field', name: 'name' },
|
|
8568
|
-
* {
|
|
8569
|
-
* kind: 'belongsTo',
|
|
8570
|
-
* name: 'owner',
|
|
8571
|
-
* type: 'user',
|
|
8572
|
-
* options: {
|
|
8573
|
-
* async: false,
|
|
8574
|
-
* inverse: 'pets',
|
|
8575
|
-
* as: 'pet',
|
|
8576
|
-
* linksMode: true,
|
|
8577
|
-
* resetOnRemoteUpdate: false,
|
|
8578
|
-
* }
|
|
8579
|
-
* }
|
|
8580
|
-
* ]
|
|
8581
|
-
* })
|
|
8582
|
-
* ]);
|
|
8583
|
-
* ```
|
|
8584
|
-
*
|
|
8585
|
-
* ## Type Support
|
|
8586
|
-
*
|
|
8587
|
-
* ### Resource Schemas
|
|
8588
|
-
*
|
|
8589
|
-
* - {@link PolarisResourceSchema}
|
|
8590
|
-
* - {@link LegacyResourceSchema}
|
|
8591
|
-
* - {@link ObjectSchema}
|
|
8592
|
-
*
|
|
8593
|
-
* ### Resource Schema Type Utils
|
|
8594
|
-
*
|
|
8595
|
-
* - {@link resourceSchema}
|
|
8596
|
-
* - {@link objectSchema}
|
|
8597
|
-
* - {@link isResourceSchema}
|
|
8598
|
-
* - {@link isLegacyResourceSchema}
|
|
8599
|
-
*
|
|
8600
|
-
* ### Field Schemas
|
|
8601
|
-
*
|
|
8602
|
-
* - {@link LegacyModeFieldSchema}
|
|
8603
|
-
* - {@link PolarisModeFieldSchema}
|
|
8604
|
-
*
|
|
8605
|
-
* @module
|
|
8606
|
-
*/
|
|
8607
|
-
|
|
8608
|
-
//#endregion
|
|
8609
|
-
//#region src/request/-private/fetch.ts
|
|
8441
|
+
// src/request/-private/fetch.ts
|
|
8610
8442
|
const _fetch = typeof fetch !== "undefined" ? (...args) => fetch(...args) : typeof FastBoot !== "undefined" ? (...args) => FastBoot.require("node-fetch")(...args) : () => {
|
|
8611
8443
|
throw new Error("No Fetch Implementation Found");
|
|
8612
8444
|
};
|
|
@@ -8684,6 +8516,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
8684
8516
|
* A basic Fetch Handler which converts a request into a
|
|
8685
8517
|
* `fetch` call presuming the response to be `json`.
|
|
8686
8518
|
*
|
|
8519
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
8520
|
+
* guide shows where it sits in the handler chain.
|
|
8521
|
+
*
|
|
8687
8522
|
* ```ts
|
|
8688
8523
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
8689
8524
|
*
|
|
@@ -8691,6 +8526,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
8691
8526
|
* .use([Fetch]);
|
|
8692
8527
|
* ```
|
|
8693
8528
|
*
|
|
8529
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
8530
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
8694
8531
|
* @public
|
|
8695
8532
|
* @badge Handler
|
|
8696
8533
|
*/
|
|
@@ -8811,8 +8648,7 @@ function isDict(v) {
|
|
|
8811
8648
|
return v !== null && typeof v === "object";
|
|
8812
8649
|
}
|
|
8813
8650
|
|
|
8814
|
-
|
|
8815
|
-
//#region src/request/-private/manager.ts
|
|
8651
|
+
// src/request/-private/manager.ts
|
|
8816
8652
|
/**
|
|
8817
8653
|
* ## Import
|
|
8818
8654
|
*
|
|
@@ -8820,7 +8656,8 @@ function isDict(v) {
|
|
|
8820
8656
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
8821
8657
|
* ```
|
|
8822
8658
|
*
|
|
8823
|
-
* For complete usage guide see
|
|
8659
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
8660
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
8824
8661
|
*
|
|
8825
8662
|
* ## How It Works
|
|
8826
8663
|
*
|
|
@@ -8843,11 +8680,28 @@ function isDict(v) {
|
|
|
8843
8680
|
* ```ts [Setup.ts]
|
|
8844
8681
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
8845
8682
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
8846
|
-
* import
|
|
8683
|
+
* import { AuthHandler } from './auth-handler';
|
|
8847
8684
|
*
|
|
8848
8685
|
* // ... create manager
|
|
8849
8686
|
* const manager = new RequestManager()
|
|
8850
|
-
* .use([
|
|
8687
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
8688
|
+
* ```
|
|
8689
|
+
*
|
|
8690
|
+
* ```ts [auth-handler.ts]
|
|
8691
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
8692
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
8693
|
+
*
|
|
8694
|
+
* const token = '<token>';
|
|
8695
|
+
*
|
|
8696
|
+
* // adds a bearer token to every request, then passes it along
|
|
8697
|
+
* export const AuthHandler: Handler = {
|
|
8698
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
8699
|
+
* const headers = new Headers(context.request.headers);
|
|
8700
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
8701
|
+
*
|
|
8702
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
8703
|
+
* },
|
|
8704
|
+
* };
|
|
8851
8705
|
* ```
|
|
8852
8706
|
*
|
|
8853
8707
|
* ```ts [Usage.ts]
|
|
@@ -8863,6 +8717,20 @@ function isDict(v) {
|
|
|
8863
8717
|
*
|
|
8864
8718
|
* :::
|
|
8865
8719
|
*
|
|
8720
|
+
* ### RequestManager vs {@link Store.request}
|
|
8721
|
+
*
|
|
8722
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
8723
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
8724
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
8725
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
8726
|
+
*
|
|
8727
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
8728
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
8729
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
8730
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
8731
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
8732
|
+
* `StructuredDocument`.
|
|
8733
|
+
*
|
|
8866
8734
|
* ### Futures
|
|
8867
8735
|
*
|
|
8868
8736
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -8901,6 +8769,7 @@ function isDict(v) {
|
|
|
8901
8769
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
8902
8770
|
* ```
|
|
8903
8771
|
*
|
|
8772
|
+
* @summary Runs each request through a chain of handlers that can fulfill, modify, or pass it along, and returns a `Future` for the response.
|
|
8904
8773
|
* @public
|
|
8905
8774
|
*/
|
|
8906
8775
|
var RequestManager = class {
|
|
@@ -8964,7 +8833,23 @@ var RequestManager = class {
|
|
|
8964
8833
|
/**
|
|
8965
8834
|
* Issue a Request.
|
|
8966
8835
|
*
|
|
8967
|
-
*
|
|
8836
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
8837
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
8838
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
8839
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
8840
|
+
* `RequestManager` created on its own has neither.
|
|
8841
|
+
*
|
|
8842
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
8843
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
8844
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
8845
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
8846
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
8847
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
8848
|
+
*
|
|
8849
|
+
* @example
|
|
8850
|
+
* ```ts
|
|
8851
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
8852
|
+
* ```
|
|
8968
8853
|
*
|
|
8969
8854
|
* @public
|
|
8970
8855
|
*/
|
|
@@ -9049,9 +8934,10 @@ var RequestManager = class {
|
|
|
9049
8934
|
*
|
|
9050
8935
|
* @private
|
|
9051
8936
|
*/
|
|
9052
|
-
|
|
9053
|
-
//#region src/index.ts
|
|
8937
|
+
// src/index.ts
|
|
9054
8938
|
/**
|
|
8939
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
8940
|
+
* `useRecommendedStore` for building a configured store.
|
|
9055
8941
|
* @module
|
|
9056
8942
|
* @mergeModuleWith <project>
|
|
9057
8943
|
*/
|
|
@@ -9062,11 +8948,17 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
|
9062
8948
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
9063
8949
|
/**
|
|
9064
8950
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
8951
|
+
*
|
|
8952
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
8953
|
+
* `useRecommendedStore` wires into a Store class.
|
|
9065
8954
|
*/
|
|
9066
8955
|
/**
|
|
9067
8956
|
* Creates a configured Store class with recommended defaults
|
|
9068
8957
|
* for schema handling, reactivity, caching, and request management.
|
|
9069
8958
|
*
|
|
8959
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
8960
|
+
* configuring the store with it.
|
|
8961
|
+
*
|
|
9070
8962
|
* ```ts
|
|
9071
8963
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
9072
8964
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -9169,6 +9061,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
9169
9061
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
9170
9062
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
9171
9063
|
* `LoggingHandler` does above).
|
|
9064
|
+
*
|
|
9065
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
9066
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
9172
9067
|
*/
|
|
9173
9068
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
9174
9069
|
return class AppStore extends StoreKlass {
|
|
@@ -9222,6 +9117,5 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
9222
9117
|
};
|
|
9223
9118
|
}
|
|
9224
9119
|
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
//# sourceMappingURL=src-C-xK8l3f.js.map
|
|
9120
|
+
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 };
|
|
9121
|
+
//# sourceMappingURL=src-ccp1WKyt.js.map
|