@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,16 +1,16 @@
|
|
|
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-B4pCmkq-.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-oWpijCPQ.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-
|
|
8
|
-
import { t as getGlobalConfig } from "./runtime-
|
|
7
|
+
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-BiuED7nc.js";
|
|
8
|
+
import { t as getGlobalConfig } from "./runtime-RYvEtg99.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-dZViNfMK.js";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// src/reactive/-private/document.ts
|
|
14
14
|
function urlFromLink(link) {
|
|
15
15
|
if (typeof link === "string") return link;
|
|
16
16
|
return link.href;
|
|
@@ -20,10 +20,15 @@ function urlFromLink(link) {
|
|
|
20
20
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
21
21
|
* ReactiveResource instances.
|
|
22
22
|
*
|
|
23
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
24
|
+
* shows when a request's content is a ReactiveDocument.
|
|
25
|
+
*
|
|
23
26
|
* It is not directly instantiated by the user, and its properties should not
|
|
24
27
|
* be directly modified. Whether individual properties are mutable or not is
|
|
25
28
|
* determined by the record instance itself.
|
|
26
29
|
*
|
|
30
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
31
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
27
32
|
* @public
|
|
28
33
|
*/
|
|
29
34
|
const ReactiveDocumentProto = {
|
|
@@ -143,8 +148,7 @@ function createReactiveDocument(store, cacheKey, localCache) {
|
|
|
143
148
|
return doc;
|
|
144
149
|
}
|
|
145
150
|
|
|
146
|
-
|
|
147
|
-
//#region src/store/-private/debug/utils.ts
|
|
151
|
+
// src/store/-private/debug/utils.ts
|
|
148
152
|
const TEXT_COLORS = {
|
|
149
153
|
TEXT: "inherit",
|
|
150
154
|
notify: [
|
|
@@ -373,8 +377,7 @@ function _log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
|
|
|
373
377
|
return [];
|
|
374
378
|
}
|
|
375
379
|
|
|
376
|
-
|
|
377
|
-
//#region src/store/-private/caches/resource-utils.ts
|
|
380
|
+
// src/store/-private/caches/resource-utils.ts
|
|
378
381
|
function isResource(resource) {
|
|
379
382
|
return Boolean(resource && typeof resource === "object");
|
|
380
383
|
}
|
|
@@ -391,8 +394,7 @@ function hasType(resource) {
|
|
|
391
394
|
return hasProp(resource, "type");
|
|
392
395
|
}
|
|
393
396
|
|
|
394
|
-
|
|
395
|
-
//#region src/store/-private/utils/coerce-id.ts
|
|
397
|
+
// src/store/-private/utils/coerce-id.ts
|
|
396
398
|
/**
|
|
397
399
|
* Normalizes a resource `id` entering the store to a string (or `null`).
|
|
398
400
|
*
|
|
@@ -428,8 +430,7 @@ function ensureStringId(id) {
|
|
|
428
430
|
return normalized;
|
|
429
431
|
}
|
|
430
432
|
|
|
431
|
-
|
|
432
|
-
//#region src/store/-private/utils/normalize-model-name.ts
|
|
433
|
+
// src/store/-private/utils/normalize-model-name.ts
|
|
433
434
|
/**
|
|
434
435
|
* Normalizes a resource `type` to its dasherized form, e.g. `myClass` to
|
|
435
436
|
* `my-class`. Re-exported elsewhere as `_deprecatingNormalize`.
|
|
@@ -444,8 +445,7 @@ function normalizeModelName(type) {
|
|
|
444
445
|
return type;
|
|
445
446
|
}
|
|
446
447
|
|
|
447
|
-
|
|
448
|
-
//#region src/store/-private/managers/cache-key-manager.ts
|
|
448
|
+
// src/store/-private/managers/cache-key-manager.ts
|
|
449
449
|
/**
|
|
450
450
|
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
451
451
|
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
@@ -460,6 +460,57 @@ function isResourceKey(identifier) {
|
|
|
460
460
|
function isRequestKey(identifier) {
|
|
461
461
|
return !!identifier && typeof identifier === "object" && "type" in identifier && !("id" in identifier) && identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
462
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
465
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
466
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
467
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
468
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
469
|
+
*/
|
|
470
|
+
/**
|
|
471
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
472
|
+
*
|
|
473
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
474
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
475
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
476
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
477
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
478
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
479
|
+
*
|
|
480
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
481
|
+
* returns `null`.
|
|
482
|
+
*/
|
|
483
|
+
function fieldValueIdentity(schema, field, value) {
|
|
484
|
+
if (field.kind !== "schema-object" && field.kind !== "schema-array") return null;
|
|
485
|
+
if (!value || typeof value !== "object") return null;
|
|
486
|
+
const rawValue = value;
|
|
487
|
+
let type;
|
|
488
|
+
if (field.options?.polymorphic) {
|
|
489
|
+
const typePath = field.options.type ?? "type";
|
|
490
|
+
if (typePath === "@hash") {
|
|
491
|
+
((test) => {
|
|
492
|
+
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
493
|
+
})(field.type);
|
|
494
|
+
type = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
495
|
+
} else {
|
|
496
|
+
type = rawValue[typePath];
|
|
497
|
+
((test) => {
|
|
498
|
+
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
499
|
+
})(typePath && type && typeof type === "string");
|
|
500
|
+
}
|
|
501
|
+
} else {
|
|
502
|
+
((test) => {
|
|
503
|
+
if (!test) throw new Error(`A non-polymorphic ${field.kind} field must provide a SchemaObject type in its definition`);
|
|
504
|
+
})(field.type);
|
|
505
|
+
type = field.type;
|
|
506
|
+
}
|
|
507
|
+
const hashField = schema.resource({ type }).identity;
|
|
508
|
+
const hash = hashField && hashField.kind === "@hash" ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : null;
|
|
509
|
+
return {
|
|
510
|
+
type,
|
|
511
|
+
hash
|
|
512
|
+
};
|
|
513
|
+
}
|
|
463
514
|
const _crypto = typeof FastBoot !== "undefined" ? FastBoot.require("crypto") : globalThis.crypto;
|
|
464
515
|
function uuidv4() {
|
|
465
516
|
((test) => {
|
|
@@ -540,6 +591,8 @@ implement this hook.
|
|
|
540
591
|
|
|
541
592
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
542
593
|
|
|
594
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
595
|
+
before the store is created.
|
|
543
596
|
@public
|
|
544
597
|
*/
|
|
545
598
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -574,6 +627,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
574
627
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
575
628
|
without providing an `id` when one is missing will throw an error.
|
|
576
629
|
|
|
630
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
631
|
+
own secondary lookup tables.
|
|
577
632
|
@public
|
|
578
633
|
*/
|
|
579
634
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -591,6 +646,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
591
646
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
592
647
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
593
648
|
|
|
649
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
650
|
+
lookup tables.
|
|
594
651
|
@public
|
|
595
652
|
*/
|
|
596
653
|
function setIdentifierForgetMethod(method) {
|
|
@@ -610,6 +667,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
610
667
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
611
668
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
612
669
|
|
|
670
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
671
|
+
key-generation state.
|
|
613
672
|
@public
|
|
614
673
|
*/
|
|
615
674
|
function setIdentifierResetMethod(method) {
|
|
@@ -628,6 +687,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
628
687
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
629
688
|
```
|
|
630
689
|
|
|
690
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
691
|
+
must be set before the store is created.
|
|
631
692
|
@public
|
|
632
693
|
*/
|
|
633
694
|
function setKeyInfoForResource(method) {
|
|
@@ -1082,8 +1143,7 @@ function addResourceToCache(cache, identifier) {
|
|
|
1082
1143
|
if (identifier.id) typeSet.id.set(identifier.id, identifier);
|
|
1083
1144
|
}
|
|
1084
1145
|
|
|
1085
|
-
|
|
1086
|
-
//#region src/store/-private/managers/cache-capabilities-manager.ts
|
|
1146
|
+
// src/store/-private/managers/cache-capabilities-manager.ts
|
|
1087
1147
|
var CacheCapabilitiesManager = class {
|
|
1088
1148
|
/** @internal */
|
|
1089
1149
|
/** @internal */
|
|
@@ -1188,8 +1248,7 @@ var CacheCapabilitiesManager = class {
|
|
|
1188
1248
|
*/
|
|
1189
1249
|
function assertPrivateCapabilities(manager) {}
|
|
1190
1250
|
|
|
1191
|
-
|
|
1192
|
-
//#region src/store/-private/caches/instance-cache.ts
|
|
1251
|
+
// src/store/-private/caches/instance-cache.ts
|
|
1193
1252
|
function isDestroyable(record) {
|
|
1194
1253
|
return Boolean(record && typeof record === "object" && typeof record.destroy === "function");
|
|
1195
1254
|
}
|
|
@@ -1211,6 +1270,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
1211
1270
|
const { id, type, lid } = identifier;
|
|
1212
1271
|
```
|
|
1213
1272
|
|
|
1273
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
1214
1274
|
@public
|
|
1215
1275
|
@param record a record instance previously obstained from the store.
|
|
1216
1276
|
*/
|
|
@@ -1476,8 +1536,7 @@ function unloadRecord(instances, identifier) {
|
|
|
1476
1536
|
}
|
|
1477
1537
|
}
|
|
1478
1538
|
|
|
1479
|
-
|
|
1480
|
-
//#region src/store/-private/managers/cache-manager.ts
|
|
1539
|
+
// src/store/-private/managers/cache-manager.ts
|
|
1481
1540
|
/**
|
|
1482
1541
|
* The CacheManager wraps a Cache enforcing that only
|
|
1483
1542
|
* the public API surface area is exposed.
|
|
@@ -1561,7 +1620,8 @@ var CacheManager = class {
|
|
|
1561
1620
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
1562
1621
|
*
|
|
1563
1622
|
* @public
|
|
1564
|
-
* @return
|
|
1623
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
1624
|
+
* this push changed, or `undefined` when none did. Otherwise `void`.
|
|
1565
1625
|
*/
|
|
1566
1626
|
upsert(key, data, hasRecord) {
|
|
1567
1627
|
return this.___cache.upsert(key, data, hasRecord);
|
|
@@ -1863,13 +1923,18 @@ var CacheManager = class {
|
|
|
1863
1923
|
}
|
|
1864
1924
|
};
|
|
1865
1925
|
|
|
1866
|
-
|
|
1867
|
-
//#region src/store/-private/managers/notification-manager.ts
|
|
1926
|
+
// src/store/-private/managers/notification-manager.ts
|
|
1868
1927
|
/**
|
|
1869
1928
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1929
|
+
*
|
|
1930
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
1931
|
+
* or `state`.
|
|
1870
1932
|
*/
|
|
1871
1933
|
/**
|
|
1872
1934
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1935
|
+
*
|
|
1936
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
1937
|
+
* `invalidated`.
|
|
1873
1938
|
*/
|
|
1874
1939
|
function isCacheOperationValue(value) {
|
|
1875
1940
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -1877,6 +1942,9 @@ function isCacheOperationValue(value) {
|
|
|
1877
1942
|
/**
|
|
1878
1943
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1879
1944
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1945
|
+
*
|
|
1946
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
1947
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
1880
1948
|
*/
|
|
1881
1949
|
/**
|
|
1882
1950
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -1884,6 +1952,8 @@ function isCacheOperationValue(value) {
|
|
|
1884
1952
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1885
1953
|
* instead of once per key.
|
|
1886
1954
|
*
|
|
1955
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
1956
|
+
* `relationships` changes in one call.
|
|
1887
1957
|
* @since 5.9.0
|
|
1888
1958
|
* @public
|
|
1889
1959
|
*/
|
|
@@ -1918,6 +1988,8 @@ function isCacheOperationValue(value) {
|
|
|
1918
1988
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1919
1989
|
* have no local/remote duality.
|
|
1920
1990
|
*
|
|
1991
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
1992
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
1921
1993
|
* @public
|
|
1922
1994
|
*/
|
|
1923
1995
|
/**
|
|
@@ -2054,6 +2126,8 @@ function _unsubscribe(token, cache) {
|
|
|
2054
2126
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2055
2127
|
* work with any framework or change-notification system.
|
|
2056
2128
|
*
|
|
2129
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
2130
|
+
* cached resources and request documents.
|
|
2057
2131
|
* @hideconstructor
|
|
2058
2132
|
* @public
|
|
2059
2133
|
*/
|
|
@@ -2268,8 +2342,7 @@ function hasSubscribers(cache, cacheKey, value) {
|
|
|
2268
2342
|
return Boolean(callbackMap?.length);
|
|
2269
2343
|
}
|
|
2270
2344
|
|
|
2271
|
-
|
|
2272
|
-
//#region src/store/-private/record-arrays/-utils.ts
|
|
2345
|
+
// src/store/-private/record-arrays/-utils.ts
|
|
2273
2346
|
/**
|
|
2274
2347
|
* LegacyArrays have the capability of updating via `array.update()`
|
|
2275
2348
|
* and saving each contained record individually via `array.save()`
|
|
@@ -2348,8 +2421,7 @@ function safeForEach$1(instance, arr, store, callback, target) {
|
|
|
2348
2421
|
return instance;
|
|
2349
2422
|
}
|
|
2350
2423
|
|
|
2351
|
-
|
|
2352
|
-
//#region src/reactive/-private/fields/extension.ts
|
|
2424
|
+
// src/reactive/-private/fields/extension.ts
|
|
2353
2425
|
function expectNever(value) {}
|
|
2354
2426
|
function isExtensionProp(extensions, prop) {
|
|
2355
2427
|
return Boolean(extensions && typeof prop !== "number" && extensions.has(prop));
|
|
@@ -2437,8 +2509,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2437
2509
|
}
|
|
2438
2510
|
}
|
|
2439
2511
|
|
|
2440
|
-
|
|
2441
|
-
//#region src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2512
|
+
// src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2442
2513
|
/**
|
|
2443
2514
|
* The global `Proxy` constructor, retyped with the corrected
|
|
2444
2515
|
* {@link ProxyConstructor} signature above so that `target` and `receiver`
|
|
@@ -2448,8 +2519,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2448
2519
|
*/
|
|
2449
2520
|
const NativeProxy = Proxy;
|
|
2450
2521
|
|
|
2451
|
-
|
|
2452
|
-
//#region src/store/-private/record-arrays/resource-array.ts
|
|
2522
|
+
// src/store/-private/record-arrays/resource-array.ts
|
|
2453
2523
|
const IS_COLLECTION = getOrSetGlobal("IS_COLLECTION", Symbol.for("Collection"));
|
|
2454
2524
|
function isContextProp(prop) {
|
|
2455
2525
|
return prop === "destroy" || prop === "isDestroying" || prop === "isDestroyed";
|
|
@@ -2476,10 +2546,15 @@ const MUTABLE_PROPS = [
|
|
|
2476
2546
|
* as the base for relationship and legacy record-array types such as
|
|
2477
2547
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
2478
2548
|
*
|
|
2549
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
2550
|
+
* how it relates to resources.
|
|
2551
|
+
*
|
|
2479
2552
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
2480
2553
|
* both report `true`. The array stays in sync with the cache, updating
|
|
2481
2554
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
2482
2555
|
*
|
|
2556
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
2557
|
+
* and underlying relationship and legacy record arrays.
|
|
2483
2558
|
* @public
|
|
2484
2559
|
*/
|
|
2485
2560
|
/**
|
|
@@ -2736,8 +2811,7 @@ function createRequestCollection(config) {
|
|
|
2736
2811
|
});
|
|
2737
2812
|
}
|
|
2738
2813
|
|
|
2739
|
-
|
|
2740
|
-
//#region src/store/-private/record-arrays/legacy-live-array.ts
|
|
2814
|
+
// src/store/-private/record-arrays/legacy-live-array.ts
|
|
2741
2815
|
/**
|
|
2742
2816
|
* LiveArrays contain all the known records for a given `ResourceType`.
|
|
2743
2817
|
*
|
|
@@ -2798,6 +2872,8 @@ function createRequestCollection(config) {
|
|
|
2798
2872
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
2799
2873
|
* would be empty.
|
|
2800
2874
|
*
|
|
2875
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
2876
|
+
* `store.findAll`.
|
|
2801
2877
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
2802
2878
|
*/
|
|
2803
2879
|
/**
|
|
@@ -2841,8 +2917,7 @@ function _updateLiveArray() {
|
|
|
2841
2917
|
return context.store.findAll(this.modelName, { reload: true });
|
|
2842
2918
|
}
|
|
2843
2919
|
|
|
2844
|
-
|
|
2845
|
-
//#region src/store/-private/record-arrays/legacy-query.ts
|
|
2920
|
+
// src/store/-private/record-arrays/legacy-query.ts
|
|
2846
2921
|
/**
|
|
2847
2922
|
* QueryArrays contain the primary records returned when querying
|
|
2848
2923
|
* for records by `ResourceType`.
|
|
@@ -2913,6 +2988,8 @@ function _updateLiveArray() {
|
|
|
2913
2988
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
2914
2989
|
* from the store for book-keeping.
|
|
2915
2990
|
*
|
|
2991
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
2992
|
+
* `update()` and released with `destroy()`.
|
|
2916
2993
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
2917
2994
|
*/
|
|
2918
2995
|
/**
|
|
@@ -2975,8 +3052,7 @@ function destroyCollection(clear) {
|
|
|
2975
3052
|
manager._pending.delete(this);
|
|
2976
3053
|
}
|
|
2977
3054
|
|
|
2978
|
-
|
|
2979
|
-
//#region src/store/-private/managers/record-array-manager.ts
|
|
3055
|
+
// src/store/-private/managers/record-array-manager.ts
|
|
2980
3056
|
const FAKE_ARR = getOrSetGlobal("FAKE_ARR", {});
|
|
2981
3057
|
const SLICE_BATCH_SIZE = 4761;
|
|
2982
3058
|
/**
|
|
@@ -3323,6 +3399,7 @@ var RecordArrayManager = class {
|
|
|
3323
3399
|
this._managed.clear();
|
|
3324
3400
|
this._identifiers.clear();
|
|
3325
3401
|
this._pending.clear();
|
|
3402
|
+
this._staged.clear();
|
|
3326
3403
|
for (const set of this._set.values()) set.clear();
|
|
3327
3404
|
this._visibilitySet.clear();
|
|
3328
3405
|
}
|
|
@@ -3395,8 +3472,7 @@ function isLegacyLiveArray(array) {
|
|
|
3395
3472
|
return context.features !== null && context.features.DEPRECATED_CLASS_NAME === "LiveArray";
|
|
3396
3473
|
}
|
|
3397
3474
|
|
|
3398
|
-
|
|
3399
|
-
//#region src/store/-private/network/request-cache.ts
|
|
3475
|
+
// src/store/-private/network/request-cache.ts
|
|
3400
3476
|
const Touching = getOrSetGlobal("Touching", Symbol("touching"));
|
|
3401
3477
|
const RequestPromise = getOrSetGlobal("RequestPromise", Symbol("promise"));
|
|
3402
3478
|
const EMPTY_ARR = Object.freeze([]);
|
|
@@ -3607,8 +3683,7 @@ var RequestStateService = class {
|
|
|
3607
3683
|
*
|
|
3608
3684
|
* @private
|
|
3609
3685
|
*/
|
|
3610
|
-
|
|
3611
|
-
//#region src/store/-private/store-service.ts
|
|
3686
|
+
// src/store/-private/store-service.ts
|
|
3612
3687
|
globalThis.setWarpDriveLogging = setLogging;
|
|
3613
3688
|
globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
3614
3689
|
if (getGlobalConfig().WarpDriveMirror.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
@@ -3720,6 +3795,10 @@ const app = new EmberApp(defaults, {
|
|
|
3720
3795
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
3721
3796
|
* requests for data with schemas, caching and reactivity.
|
|
3722
3797
|
*
|
|
3798
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
3799
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
3800
|
+
* through it.
|
|
3801
|
+
*
|
|
3723
3802
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
3724
3803
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
3725
3804
|
* even when you aren't sure yet.
|
|
@@ -3727,6 +3806,7 @@ const app = new EmberApp(defaults, {
|
|
|
3727
3806
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
3728
3807
|
* is possible.
|
|
3729
3808
|
*
|
|
3809
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
3730
3810
|
* @public
|
|
3731
3811
|
* @hideconstructor
|
|
3732
3812
|
*/
|
|
@@ -3934,12 +4014,25 @@ var Store = class extends BaseClass {
|
|
|
3934
4014
|
}
|
|
3935
4015
|
}
|
|
3936
4016
|
/**
|
|
3937
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
4017
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
3938
4018
|
* :::
|
|
3939
4019
|
*
|
|
3940
4020
|
* Issue a request via the configured {@link RequestManager},
|
|
3941
4021
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
3942
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
4022
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
4023
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
4024
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
4025
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
4026
|
+
* {@link StructuredDocument}.
|
|
4027
|
+
*
|
|
4028
|
+
* #### Building Requests
|
|
4029
|
+
*
|
|
4030
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
4031
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
4032
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
4033
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
4034
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
4035
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
3943
4036
|
*
|
|
3944
4037
|
* #### Request Cache Keys
|
|
3945
4038
|
*
|
|
@@ -3984,6 +4077,29 @@ var Store = class extends BaseClass {
|
|
|
3984
4077
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
3985
4078
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
3986
4079
|
*
|
|
4080
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
4081
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
4082
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
4083
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
4084
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
4085
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
4086
|
+
*
|
|
4087
|
+
* #### Typing The Response
|
|
4088
|
+
*
|
|
4089
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
4090
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
4091
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
4092
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
4093
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
4094
|
+
*
|
|
4095
|
+
* @example
|
|
4096
|
+
* ```ts
|
|
4097
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
4098
|
+
*
|
|
4099
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
4100
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
4101
|
+
* ```
|
|
4102
|
+
*
|
|
3987
4103
|
* @public
|
|
3988
4104
|
*/
|
|
3989
4105
|
request(requestConfig) {
|
|
@@ -4522,8 +4638,7 @@ function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
|
|
|
4522
4638
|
return recordIdentifierFor(recordOrPromiseRecord);
|
|
4523
4639
|
}
|
|
4524
4640
|
|
|
4525
|
-
|
|
4526
|
-
//#region src/store/-private/cache-handler/utils.ts
|
|
4641
|
+
// src/store/-private/cache-handler/utils.ts
|
|
4527
4642
|
const MUTATION_OPS$1 = /* @__PURE__ */ new Set([
|
|
4528
4643
|
"createRecord",
|
|
4529
4644
|
"updateRecord",
|
|
@@ -4563,15 +4678,23 @@ function getPriority(identifier, deduped, priority) {
|
|
|
4563
4678
|
return priority;
|
|
4564
4679
|
}
|
|
4565
4680
|
|
|
4566
|
-
|
|
4567
|
-
//#region src/store/-private/cache-handler/handler.ts
|
|
4681
|
+
// src/store/-private/cache-handler/handler.ts
|
|
4568
4682
|
/**
|
|
4569
4683
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
4570
4684
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
4685
|
+
*
|
|
4686
|
+
* Only the looser form accepts `controller`, so a request carrying one, including a builder's
|
|
4687
|
+
* output spread together with a `controller`, resolves to {@link LooseStoreRequestInfo}.
|
|
4688
|
+
*
|
|
4689
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
4690
|
+
* form with plain `records` and `headers`.
|
|
4571
4691
|
*/
|
|
4572
4692
|
/**
|
|
4573
4693
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
4574
4694
|
*
|
|
4695
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
4696
|
+
* request can use the cache.
|
|
4697
|
+
*
|
|
4575
4698
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
4576
4699
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
4577
4700
|
* attached to the request.
|
|
@@ -4607,7 +4730,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
4607
4730
|
* method: 'GET',
|
|
4608
4731
|
* [EnableHydration]: true
|
|
4609
4732
|
* });
|
|
4733
|
+
* ```
|
|
4610
4734
|
*
|
|
4735
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
4736
|
+
* reactive documents when hydration is enabled.
|
|
4611
4737
|
*/
|
|
4612
4738
|
const CacheHandler = { request(context, next) {
|
|
4613
4739
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -4780,14 +4906,12 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
4780
4906
|
}] });
|
|
4781
4907
|
}
|
|
4782
4908
|
|
|
4783
|
-
|
|
4784
|
-
//#region src/store/-private/utils/is-non-empty-string.ts
|
|
4909
|
+
// src/store/-private/utils/is-non-empty-string.ts
|
|
4785
4910
|
function isNonEmptyString(str) {
|
|
4786
4911
|
return Boolean(str && typeof str === "string");
|
|
4787
4912
|
}
|
|
4788
4913
|
|
|
4789
|
-
|
|
4790
|
-
//#region src/store/-private/utils/construct-resource.ts
|
|
4914
|
+
// src/store/-private/utils/construct-resource.ts
|
|
4791
4915
|
/**
|
|
4792
4916
|
* Given an existing resource identifier object (or a {@link ResourceKey}),
|
|
4793
4917
|
* returns it unchanged aside from coercing its `id`, if present, to a string.
|
|
@@ -4859,8 +4983,7 @@ function constructResource(type, id, lid) {
|
|
|
4859
4983
|
}
|
|
4860
4984
|
}
|
|
4861
4985
|
|
|
4862
|
-
|
|
4863
|
-
//#region src/store/-private/record-arrays/legacy-many-array.ts
|
|
4986
|
+
// src/store/-private/record-arrays/legacy-many-array.ts
|
|
4864
4987
|
/**
|
|
4865
4988
|
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
4866
4989
|
relationship.
|
|
@@ -4901,6 +5024,7 @@ the has-many.
|
|
|
4901
5024
|
We call the record to which a relationship belongs-to the
|
|
4902
5025
|
relationship's _owner_.
|
|
4903
5026
|
|
|
5027
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
4904
5028
|
@public
|
|
4905
5029
|
*/
|
|
4906
5030
|
/**
|
|
@@ -4932,7 +5056,7 @@ function createLegacyManyArray(options) {
|
|
|
4932
5056
|
isAsync: options.isAsync,
|
|
4933
5057
|
isPolymorphic: options.isPolymorphic,
|
|
4934
5058
|
identifier: options.identifier,
|
|
4935
|
-
key: options.field.name,
|
|
5059
|
+
key: options.field.sourceKey ?? options.field.name,
|
|
4936
5060
|
reload,
|
|
4937
5061
|
createRecord,
|
|
4938
5062
|
notify
|
|
@@ -5131,8 +5255,7 @@ function mutate(collection, mutation, _SIGNAL) {
|
|
|
5131
5255
|
notifyInternalSignal(_SIGNAL);
|
|
5132
5256
|
}
|
|
5133
5257
|
|
|
5134
|
-
|
|
5135
|
-
//#region src/reactive/-private/kind/alias-field.ts
|
|
5258
|
+
// src/reactive/-private/kind/alias-field.ts
|
|
5136
5259
|
function getAliasField(context) {
|
|
5137
5260
|
((test) => {
|
|
5138
5261
|
if (!test) throw new Error(`Alias field access is not implemented`);
|
|
@@ -5145,8 +5268,7 @@ function setAliasField(context) {
|
|
|
5145
5268
|
return false;
|
|
5146
5269
|
}
|
|
5147
5270
|
|
|
5148
|
-
|
|
5149
|
-
//#region src/reactive/-private/fields/managed-array.ts
|
|
5271
|
+
// src/reactive/-private/fields/managed-array.ts
|
|
5150
5272
|
const ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([
|
|
5151
5273
|
Symbol.iterator,
|
|
5152
5274
|
"concat",
|
|
@@ -5246,31 +5368,11 @@ var ManagedArray = class {
|
|
|
5246
5368
|
if (field.type) return schema.transformation(field).hydrate(rawValue, field.options ?? null, self.owner);
|
|
5247
5369
|
return rawValue;
|
|
5248
5370
|
}
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
let objectType;
|
|
5255
|
-
if (field.options?.polymorphic) {
|
|
5256
|
-
const typePath = field.options.type ?? "type";
|
|
5257
|
-
if (typePath === "@hash") {
|
|
5258
|
-
((test) => {
|
|
5259
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
5260
|
-
})(field.type);
|
|
5261
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
5262
|
-
} else {
|
|
5263
|
-
objectType = rawValue[typePath];
|
|
5264
|
-
((test) => {
|
|
5265
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
5266
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
5267
|
-
}
|
|
5268
|
-
} else {
|
|
5269
|
-
((test) => {
|
|
5270
|
-
if (!test) throw new Error(`A non-polymorphic SchemaArrayField must provide a SchemaObject type in its definition`);
|
|
5271
|
-
})(field.type);
|
|
5272
|
-
objectType = field.type;
|
|
5273
|
-
}
|
|
5371
|
+
const identity = fieldValueIdentity(schema, field, rawValue);
|
|
5372
|
+
((test) => {
|
|
5373
|
+
if (!test) throw new Error(`Expected a schema-array element to resolve to a schema-object identity`);
|
|
5374
|
+
})(identity !== null);
|
|
5375
|
+
const { type: objectType, hash } = identity;
|
|
5274
5376
|
/**
|
|
5275
5377
|
* When KeyMode=@hash the ReactiveResource is keyed into
|
|
5276
5378
|
* ManagedRecordRefs by the return value of @hash on the rawValue.
|
|
@@ -5280,8 +5382,10 @@ var ManagedArray = class {
|
|
|
5280
5382
|
*/
|
|
5281
5383
|
let schemaObjectKeyValue;
|
|
5282
5384
|
if (KeyMode === "@hash") {
|
|
5283
|
-
|
|
5284
|
-
|
|
5385
|
+
((test) => {
|
|
5386
|
+
if (!test) throw new Error(`Expected the '${objectType}' schema to declare an identity hash for key: '@hash'`);
|
|
5387
|
+
})(hash !== null);
|
|
5388
|
+
schemaObjectKeyValue = hash;
|
|
5285
5389
|
} else {
|
|
5286
5390
|
if (KeyMode !== "@identity" && KeyMode !== "@index") {
|
|
5287
5391
|
((test) => {
|
|
@@ -5426,8 +5530,7 @@ Object.defineProperty(ManagedArray.prototype, "[]", {
|
|
|
5426
5530
|
get: function() {}
|
|
5427
5531
|
});
|
|
5428
5532
|
|
|
5429
|
-
|
|
5430
|
-
//#region src/reactive/-private/kind/array-field.ts
|
|
5533
|
+
// src/reactive/-private/kind/array-field.ts
|
|
5431
5534
|
function getArrayField(context) {
|
|
5432
5535
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5433
5536
|
const { record } = context;
|
|
@@ -5473,8 +5576,7 @@ function setArrayField(context) {
|
|
|
5473
5576
|
return true;
|
|
5474
5577
|
}
|
|
5475
5578
|
|
|
5476
|
-
|
|
5477
|
-
//#region src/reactive/-private/kind/attribute-field.ts
|
|
5579
|
+
// src/reactive/-private/kind/attribute-field.ts
|
|
5478
5580
|
function getAttributeField(context) {
|
|
5479
5581
|
entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5480
5582
|
const { cache } = context.store;
|
|
@@ -5485,8 +5587,7 @@ function setAttributeField(context) {
|
|
|
5485
5587
|
return true;
|
|
5486
5588
|
}
|
|
5487
5589
|
|
|
5488
|
-
|
|
5489
|
-
//#region src/reactive/-private/fields/get-field-key.ts
|
|
5590
|
+
// src/reactive/-private/fields/get-field-key.ts
|
|
5490
5591
|
const InvalidKinds = [
|
|
5491
5592
|
"alias",
|
|
5492
5593
|
"derived",
|
|
@@ -5505,8 +5606,7 @@ function getFieldCacheKey(field) {
|
|
|
5505
5606
|
return "sourceKey" in field && field.sourceKey ? field.sourceKey : field.name;
|
|
5506
5607
|
}
|
|
5507
5608
|
|
|
5508
|
-
|
|
5509
|
-
//#region src/reactive/-private/kind/belongs-to-field.ts
|
|
5609
|
+
// src/reactive/-private/kind/belongs-to-field.ts
|
|
5510
5610
|
function getBelongsToField(context) {
|
|
5511
5611
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5512
5612
|
const { field, resourceKey, store } = context;
|
|
@@ -5549,8 +5649,7 @@ function getResourceKey(record) {
|
|
|
5549
5649
|
return recordIdentifierFor(record);
|
|
5550
5650
|
}
|
|
5551
5651
|
|
|
5552
|
-
|
|
5553
|
-
//#region src/reactive/-private/kind/collection-field.ts
|
|
5652
|
+
// src/reactive/-private/kind/collection-field.ts
|
|
5554
5653
|
function getCollectionField(context) {
|
|
5555
5654
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5556
5655
|
((test) => {
|
|
@@ -5564,8 +5663,7 @@ function setCollectionField(context) {
|
|
|
5564
5663
|
return false;
|
|
5565
5664
|
}
|
|
5566
5665
|
|
|
5567
|
-
|
|
5568
|
-
//#region src/reactive/-private/kind/derived-field.ts
|
|
5666
|
+
// src/reactive/-private/kind/derived-field.ts
|
|
5569
5667
|
function getDerivedField(context) {
|
|
5570
5668
|
const { schema } = context.store;
|
|
5571
5669
|
return schema.derivation(context.field)(context.record, context.field.options ?? null, context.field.name);
|
|
@@ -5577,8 +5675,7 @@ function setDerivedField(context) {
|
|
|
5577
5675
|
return false;
|
|
5578
5676
|
}
|
|
5579
5677
|
|
|
5580
|
-
|
|
5581
|
-
//#region src/reactive/-private/kind/generic-field.ts
|
|
5678
|
+
// src/reactive/-private/kind/generic-field.ts
|
|
5582
5679
|
function getGenericField(context) {
|
|
5583
5680
|
const signal = entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5584
5681
|
signal.isStale = false;
|
|
@@ -5600,8 +5697,7 @@ function setGenericField(context) {
|
|
|
5600
5697
|
return true;
|
|
5601
5698
|
}
|
|
5602
5699
|
|
|
5603
|
-
|
|
5604
|
-
//#region src/reactive/-private/fields/many-array-manager.ts
|
|
5700
|
+
// src/reactive/-private/fields/many-array-manager.ts
|
|
5605
5701
|
var ManyArrayManager = class {
|
|
5606
5702
|
constructor(record, editable) {
|
|
5607
5703
|
const context = record[Context];
|
|
@@ -5663,8 +5759,7 @@ function extractCacheOptions(options) {
|
|
|
5663
5759
|
return cacheOptions;
|
|
5664
5760
|
}
|
|
5665
5761
|
|
|
5666
|
-
|
|
5667
|
-
//#region src/reactive/-private/kind/has-many-field.ts
|
|
5762
|
+
// src/reactive/-private/kind/has-many-field.ts
|
|
5668
5763
|
function getHasManyField(context) {
|
|
5669
5764
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5670
5765
|
const { store, field } = context;
|
|
@@ -5710,8 +5805,7 @@ function setHasManyField(context) {
|
|
|
5710
5805
|
return true;
|
|
5711
5806
|
}
|
|
5712
5807
|
|
|
5713
|
-
|
|
5714
|
-
//#region src/reactive/-private/kind/hash-field.ts
|
|
5808
|
+
// src/reactive/-private/kind/hash-field.ts
|
|
5715
5809
|
function getHashField(context) {
|
|
5716
5810
|
const { field, path, resourceKey } = context;
|
|
5717
5811
|
const { schema, cache } = context.store;
|
|
@@ -5729,8 +5823,7 @@ function setHashField(context) {
|
|
|
5729
5823
|
return false;
|
|
5730
5824
|
}
|
|
5731
5825
|
|
|
5732
|
-
|
|
5733
|
-
//#region src/reactive/-private/kind/identity-field.ts
|
|
5826
|
+
// src/reactive/-private/kind/identity-field.ts
|
|
5734
5827
|
function getIdentityField(context) {
|
|
5735
5828
|
entangleSignal(context.signals, context.record, "@identity", null);
|
|
5736
5829
|
return context.resourceKey.id;
|
|
@@ -5752,8 +5845,7 @@ function setIdentityField(context) {
|
|
|
5752
5845
|
return true;
|
|
5753
5846
|
}
|
|
5754
5847
|
|
|
5755
|
-
|
|
5756
|
-
//#region src/reactive/-private/kind/local-field.ts
|
|
5848
|
+
// src/reactive/-private/kind/local-field.ts
|
|
5757
5849
|
function getLocalField(context) {
|
|
5758
5850
|
const { field } = context;
|
|
5759
5851
|
const signal = getOrCreateInternalSignal(context.signals, context.record, field.name, field.options?.defaultValue ?? null);
|
|
@@ -5770,8 +5862,7 @@ function setLocalField(context) {
|
|
|
5770
5862
|
return true;
|
|
5771
5863
|
}
|
|
5772
5864
|
|
|
5773
|
-
|
|
5774
|
-
//#region src/reactive/-private/fields/managed-object.ts
|
|
5865
|
+
// src/reactive/-private/fields/managed-object.ts
|
|
5775
5866
|
const ObjectSymbols = /* @__PURE__ */ new Set([
|
|
5776
5867
|
OBJECT_SIGNAL,
|
|
5777
5868
|
Context,
|
|
@@ -5855,8 +5946,7 @@ function peekManagedObject(record, field) {
|
|
|
5855
5946
|
if (managedObjectMapForRecord) return managedObjectMapForRecord.get(field.name);
|
|
5856
5947
|
}
|
|
5857
5948
|
|
|
5858
|
-
|
|
5859
|
-
//#region src/reactive/-private/kind/object-field.ts
|
|
5949
|
+
// src/reactive/-private/kind/object-field.ts
|
|
5860
5950
|
function getObjectField(context) {
|
|
5861
5951
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5862
5952
|
const { record, field } = context;
|
|
@@ -5912,8 +6002,7 @@ function setObjectField(context) {
|
|
|
5912
6002
|
return true;
|
|
5913
6003
|
}
|
|
5914
6004
|
|
|
5915
|
-
|
|
5916
|
-
//#region src/reactive/-private/kind/resource-field.ts
|
|
6005
|
+
// src/reactive/-private/kind/resource-field.ts
|
|
5917
6006
|
var ResourceRelationship = class {
|
|
5918
6007
|
constructor(context) {
|
|
5919
6008
|
const { store, resourceKey } = context;
|
|
@@ -5956,8 +6045,7 @@ function setResourceField(context) {
|
|
|
5956
6045
|
return false;
|
|
5957
6046
|
}
|
|
5958
6047
|
|
|
5959
|
-
|
|
5960
|
-
//#region src/reactive/-private/kind/schema-array-field.ts
|
|
6048
|
+
// src/reactive/-private/kind/schema-array-field.ts
|
|
5961
6049
|
function setSchemaArrayField(context) {
|
|
5962
6050
|
const arrayValue = context.value === null ? null : context.value?.slice();
|
|
5963
6051
|
const fieldSignal = peekInternalSignal(context.signals, context.path.at(-1));
|
|
@@ -5974,8 +6062,7 @@ function setSchemaArrayField(context) {
|
|
|
5974
6062
|
return true;
|
|
5975
6063
|
}
|
|
5976
6064
|
|
|
5977
|
-
|
|
5978
|
-
//#region src/reactive/-private/kind/schema-object-field.ts
|
|
6065
|
+
// src/reactive/-private/kind/schema-object-field.ts
|
|
5979
6066
|
function getSchemaObjectField(context) {
|
|
5980
6067
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5981
6068
|
const { store, resourceKey, path, field } = context;
|
|
@@ -5992,29 +6079,12 @@ function getSchemaObjectField(context) {
|
|
|
5992
6079
|
}
|
|
5993
6080
|
return null;
|
|
5994
6081
|
}
|
|
5995
|
-
const
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
6002
|
-
})(field.type);
|
|
6003
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
6004
|
-
} else {
|
|
6005
|
-
objectType = rawValue[typePath];
|
|
6006
|
-
((test) => {
|
|
6007
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
6008
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
6009
|
-
}
|
|
6010
|
-
} else {
|
|
6011
|
-
((test) => {
|
|
6012
|
-
if (!test) throw new Error(`A non-polymorphic SchemaObjectField must provide a SchemaObject type in its definition`);
|
|
6013
|
-
})(field.type);
|
|
6014
|
-
objectType = field.type;
|
|
6015
|
-
}
|
|
6016
|
-
const hashField = schema.resource({ type: objectType }).identity;
|
|
6017
|
-
const identity = hashField ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : field.name;
|
|
6082
|
+
const resolved = fieldValueIdentity(store.schema, field, rawValue);
|
|
6083
|
+
((test) => {
|
|
6084
|
+
if (!test) throw new Error(`Expected a schema-object value to resolve to a schema-object identity`);
|
|
6085
|
+
})(resolved !== null);
|
|
6086
|
+
const { type: objectType, hash } = resolved;
|
|
6087
|
+
const identity = hash ?? field.name;
|
|
6018
6088
|
const cachedSchemaObject = signal.value;
|
|
6019
6089
|
if (cachedSchemaObject) {
|
|
6020
6090
|
if (cachedSchemaObject.type === objectType && cachedSchemaObject.identity === identity) return cachedSchemaObject.value;
|
|
@@ -6059,8 +6129,7 @@ function setSchemaObjectField(context) {
|
|
|
6059
6129
|
return true;
|
|
6060
6130
|
}
|
|
6061
6131
|
|
|
6062
|
-
|
|
6063
|
-
//#region src/reactive/-private/default-mode.ts
|
|
6132
|
+
// src/reactive/-private/default-mode.ts
|
|
6064
6133
|
/**
|
|
6065
6134
|
* A ReactiveResource context object passed to
|
|
6066
6135
|
* the get/set functions of a field kind implementation.
|
|
@@ -6176,14 +6245,15 @@ const DefaultMode = {
|
|
|
6176
6245
|
}
|
|
6177
6246
|
};
|
|
6178
6247
|
|
|
6179
|
-
|
|
6180
|
-
//#region src/reactive/-private/record.ts
|
|
6248
|
+
// src/reactive/-private/record.ts
|
|
6181
6249
|
const IgnoredGlobalFields = /* @__PURE__ */ new Set([
|
|
6182
6250
|
"length",
|
|
6183
6251
|
"nodeType",
|
|
6184
6252
|
"then",
|
|
6185
6253
|
"setInterval",
|
|
6186
6254
|
"document",
|
|
6255
|
+
"unknownProperty",
|
|
6256
|
+
"size",
|
|
6187
6257
|
STRUCTURED
|
|
6188
6258
|
]);
|
|
6189
6259
|
const RecordSymbols = /* @__PURE__ */ new Set([
|
|
@@ -6208,10 +6278,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
6208
6278
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
6209
6279
|
* object.
|
|
6210
6280
|
*
|
|
6281
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
6282
|
+
* define the schema it reads.
|
|
6283
|
+
*
|
|
6211
6284
|
* This class is not directly instantiable. To use it, you should
|
|
6212
6285
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
6213
6286
|
* with the matching hooks provided by this package.
|
|
6214
6287
|
*
|
|
6288
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
6215
6289
|
* @hideconstructor
|
|
6216
6290
|
* @public
|
|
6217
6291
|
*/
|
|
@@ -6665,6 +6739,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
6665
6739
|
* Edits to editable resources will be automatically committed if a new
|
|
6666
6740
|
* payload from the cache matches their existing value.
|
|
6667
6741
|
*
|
|
6742
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
6743
|
+
* changed locally.
|
|
6668
6744
|
* @public
|
|
6669
6745
|
*
|
|
6670
6746
|
* @returns a promise that resolves to the editable resource
|
|
@@ -6681,14 +6757,15 @@ function checkout(resource) {
|
|
|
6681
6757
|
* approach is for either the API or a Handler to reflect saved
|
|
6682
6758
|
* changes back to update the cache.
|
|
6683
6759
|
*
|
|
6760
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
6761
|
+
* bypassing a save round-trip.
|
|
6684
6762
|
* @public
|
|
6685
6763
|
*/
|
|
6686
6764
|
function commit(record) {
|
|
6687
6765
|
return record[Commit]();
|
|
6688
6766
|
}
|
|
6689
6767
|
|
|
6690
|
-
|
|
6691
|
-
//#region src/reactive/-private/hooks.ts
|
|
6768
|
+
// src/reactive/-private/hooks.ts
|
|
6692
6769
|
/**
|
|
6693
6770
|
* The store's default `instantiateRecord` hook implementation, which
|
|
6694
6771
|
* produces a {@link ReactiveResource} for `identifier` using the resource
|
|
@@ -6698,6 +6775,8 @@ function commit(record) {
|
|
|
6698
6775
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
6699
6776
|
* properties when creating a new legacy record.
|
|
6700
6777
|
*
|
|
6778
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
6779
|
+
* from its registered schema.
|
|
6701
6780
|
* @public
|
|
6702
6781
|
*/
|
|
6703
6782
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -6730,6 +6809,8 @@ function assertReactiveResource(record) {
|
|
|
6730
6809
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
6731
6810
|
* behavior.
|
|
6732
6811
|
*
|
|
6812
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
6813
|
+
* releases it.
|
|
6733
6814
|
* @public
|
|
6734
6815
|
*/
|
|
6735
6816
|
function teardownRecord(record) {
|
|
@@ -6737,8 +6818,7 @@ function teardownRecord(record) {
|
|
|
6737
6818
|
record[Destroy]();
|
|
6738
6819
|
}
|
|
6739
6820
|
|
|
6740
|
-
|
|
6741
|
-
//#region src/reactive/-private/schema.ts
|
|
6821
|
+
// src/reactive/-private/schema.ts
|
|
6742
6822
|
const Support = getOrSetGlobal("Support", /* @__PURE__ */ new WeakMap());
|
|
6743
6823
|
const ConstructorField = {
|
|
6744
6824
|
type: "@constructor",
|
|
@@ -6784,16 +6864,25 @@ _constructor[Type] = "@constructor";
|
|
|
6784
6864
|
* This should only be used for temporary migration purposes
|
|
6785
6865
|
* to the new schema system when migrating from either Model
|
|
6786
6866
|
* or ModelFragments.
|
|
6867
|
+
*
|
|
6868
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
6869
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
6787
6870
|
*/
|
|
6788
6871
|
/**
|
|
6789
6872
|
* Describes one feature added to a resource by a schema extension, as
|
|
6790
6873
|
* classified by {@link processExtension} from the property descriptor it
|
|
6791
6874
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
6875
|
+
*
|
|
6876
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
6877
|
+
* mutable value, or a getter/setter accessor.
|
|
6792
6878
|
*/
|
|
6793
6879
|
/**
|
|
6794
6880
|
* The result of {@link processExtension} normalizing a
|
|
6795
6881
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
6796
6882
|
* by name.
|
|
6883
|
+
*
|
|
6884
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
6885
|
+
* keyed by property name.
|
|
6797
6886
|
*/
|
|
6798
6887
|
const BannedKeys = ["constructor", "__proto__"];
|
|
6799
6888
|
function processExtension(extension) {
|
|
@@ -6893,14 +6982,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
6893
6982
|
* Utility for constructing a ResourceSchema with the recommended
|
|
6894
6983
|
* fields for the PolarisMode experience.
|
|
6895
6984
|
*
|
|
6985
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
6986
|
+
* create a schema with it.
|
|
6987
|
+
*
|
|
6896
6988
|
* Using this requires registering the PolarisMode derivations
|
|
6897
6989
|
*
|
|
6898
6990
|
* ```ts
|
|
6899
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
6991
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
6900
6992
|
*
|
|
6901
6993
|
* registerDerivations(schema);
|
|
6902
6994
|
* ```
|
|
6903
6995
|
*
|
|
6996
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
6997
|
+
* PolarisMode resource schema.
|
|
6904
6998
|
* @public
|
|
6905
6999
|
* @param schema
|
|
6906
7000
|
* @return {PolarisResourceSchema}
|
|
@@ -6931,6 +7025,8 @@ function withDefaults(schema) {
|
|
|
6931
7025
|
*
|
|
6932
7026
|
* `^` returns the entire identifier object.
|
|
6933
7027
|
*
|
|
7028
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
7029
|
+
* for use in derived fields.
|
|
6934
7030
|
* @public
|
|
6935
7031
|
*/
|
|
6936
7032
|
const fromIdentity = (record, options, key) => {
|
|
@@ -6954,9 +7050,14 @@ fromIdentity[Type] = "@identity";
|
|
|
6954
7050
|
* to use the PolarisMode defaults provided by
|
|
6955
7051
|
*
|
|
6956
7052
|
* ```ts
|
|
6957
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
7053
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
6958
7054
|
* ```
|
|
6959
7055
|
*
|
|
7056
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
7057
|
+
* guide explains when you need to call it.
|
|
7058
|
+
*
|
|
7059
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
7060
|
+
* `withDefaults` depend on.
|
|
6960
7061
|
* @public
|
|
6961
7062
|
*/
|
|
6962
7063
|
function registerDerivations(schema) {
|
|
@@ -7032,6 +7133,9 @@ function assertConsistentAbstractFieldShape(abstractType, fieldName, existing, i
|
|
|
7032
7133
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
7033
7134
|
* between the raw value `T` stored in the cache and the presentation value
|
|
7034
7135
|
* `PT` exposed on the record.
|
|
7136
|
+
*
|
|
7137
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
7138
|
+
* record, with optional default.
|
|
7035
7139
|
*/
|
|
7036
7140
|
/**
|
|
7037
7141
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -7054,6 +7158,12 @@ function makeCachedDerivation(derivation) {
|
|
|
7054
7158
|
/**
|
|
7055
7159
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
7056
7160
|
*
|
|
7161
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
7162
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
7163
|
+
* shows how to give a store one.
|
|
7164
|
+
*
|
|
7165
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
7166
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
7057
7167
|
* @public
|
|
7058
7168
|
*/
|
|
7059
7169
|
var SchemaService = class {
|
|
@@ -7443,284 +7553,7 @@ function mergeMap(base, toApply) {
|
|
|
7443
7553
|
for (const [key, value] of toApply) base.set(key, value);
|
|
7444
7554
|
}
|
|
7445
7555
|
|
|
7446
|
-
|
|
7447
|
-
//#region src/reactive.ts
|
|
7448
|
-
/**
|
|
7449
|
-
* # About
|
|
7450
|
-
*
|
|
7451
|
-
* This module provides an implementation of reactive objects that a Store may use for creating
|
|
7452
|
-
* reactive representations of the raw data for requests, resources and their relationships
|
|
7453
|
-
* stored in the cache.
|
|
7454
|
-
*
|
|
7455
|
-
* - For configuring the store to use these reactive objects, see [The Setup Guide](/guides/configuration/)
|
|
7456
|
-
* - For defining resource schemas, see [The Schema Guide](/guides/the-manual/schemas/)
|
|
7457
|
-
*
|
|
7458
|
-
* Any method that returns a record instance will use the `instantiateRecord`
|
|
7459
|
-
* hook configured above to instantiate a ReactiveResource once this is in place.
|
|
7460
|
-
* After that, its up to you what ReactiveResource can do.
|
|
7461
|
-
*
|
|
7462
|
-
* ## Modes
|
|
7463
|
-
*
|
|
7464
|
-
* ReactiveResource has two modes: `legacy` and `polaris`.
|
|
7465
|
-
*
|
|
7466
|
-
* **LegacyMode** can be used to emulate the behaviors and capabilities of WarpDrive's `Model` class,
|
|
7467
|
-
* and because there is little distinction between Model and a ReactiveResource in LegacyMode we refer
|
|
7468
|
-
* to both of these approaches as LegacyMode. This mode is the default experience in V5.
|
|
7469
|
-
*
|
|
7470
|
-
* In LegacyMode:
|
|
7471
|
-
*
|
|
7472
|
-
* - records are mutable
|
|
7473
|
-
* - local changes immediately reflect app wide
|
|
7474
|
-
* - records have all the APIs of Model (references, state props, currentState, methods etc)
|
|
7475
|
-
* - the continued use of `@warp-drive-mirror/legacy` is required (though most imports from it can be removed)
|
|
7476
|
-
* - `async: true` relationships are supported (but not recommended outside of [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
7477
|
-
*
|
|
7478
|
-
* ---
|
|
7479
|
-
*
|
|
7480
|
-
* **PolarisMode** is an upcoming suite of features that will become the default experience in V6.
|
|
7481
|
-
*
|
|
7482
|
-
* In PolarisMode:
|
|
7483
|
-
*
|
|
7484
|
-
* - records are immutable, unless creating a new resource or explicitly checking out a record for editing
|
|
7485
|
-
* - local changes are isolated until committed, displaying only via the editable version of the record
|
|
7486
|
-
* - records have a more limited API, focused on only what is in their schema.
|
|
7487
|
-
* - some common operations may have more friction to perform because intended utilities are not yet available
|
|
7488
|
-
* - `async: true` relationships are not supported (see [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
7489
|
-
* - The `@warp-drive-mirror/legacy` package is not required
|
|
7490
|
-
*
|
|
7491
|
-
* These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
|
|
7492
|
-
* a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
|
|
7493
|
-
* a ReactiveResource or a Model.
|
|
7494
|
-
*
|
|
7495
|
-
* ---
|
|
7496
|
-
*
|
|
7497
|
-
* ## Basic Usage
|
|
7498
|
-
*
|
|
7499
|
-
* ReactiveResource is a reactive object that transforms raw data from an associated
|
|
7500
|
-
* cache into reactive data backed by Signals.
|
|
7501
|
-
*
|
|
7502
|
-
* The shape of the object and the transformation of raw cache data into its
|
|
7503
|
-
* reactive form is controlled by a resource schema.
|
|
7504
|
-
*
|
|
7505
|
-
* For instance, lets say your API is a [{json:api}](https://jsonapi.org) and your store is using
|
|
7506
|
-
* the Cache provided by {@link @warp-drive-mirror/json-api! | @warp-drive-mirror/json-api}, and a request
|
|
7507
|
-
* returns the following raw data:
|
|
7508
|
-
*
|
|
7509
|
-
* ```ts
|
|
7510
|
-
* {
|
|
7511
|
-
* data: {
|
|
7512
|
-
* type: 'user',
|
|
7513
|
-
* id: '1',
|
|
7514
|
-
* attributes: { firstName: 'Chris', lastName: 'Thoburn' },
|
|
7515
|
-
* relationships: { pets: { data: [{ type: 'dog', id: '1' }] }}
|
|
7516
|
-
* },
|
|
7517
|
-
* included: [
|
|
7518
|
-
* {
|
|
7519
|
-
* type: 'dog',
|
|
7520
|
-
* id: '1',
|
|
7521
|
-
* attributes: { name: 'Rey' },
|
|
7522
|
-
* relationships: { owner: { data: { type: 'user', id: '1' }}}
|
|
7523
|
-
* }
|
|
7524
|
-
* ]
|
|
7525
|
-
* }
|
|
7526
|
-
* ```
|
|
7527
|
-
*
|
|
7528
|
-
* We could describe the `'user'` and `'dog'` resources in the above payload
|
|
7529
|
-
* with the following schemas:
|
|
7530
|
-
*
|
|
7531
|
-
* ```ts
|
|
7532
|
-
* store.schema.registerResources([
|
|
7533
|
-
* {
|
|
7534
|
-
* type: 'user',
|
|
7535
|
-
* identity: { type: '@id', name: 'id' },
|
|
7536
|
-
* fields: [
|
|
7537
|
-
* {
|
|
7538
|
-
* type: '@identity',
|
|
7539
|
-
* name: '$type',
|
|
7540
|
-
* kind: 'derived',
|
|
7541
|
-
* options: { key: 'type' },
|
|
7542
|
-
* },
|
|
7543
|
-
* { kind: 'field', name: 'firstName' },
|
|
7544
|
-
* { kind: 'field', name: 'lastName' },
|
|
7545
|
-
* {
|
|
7546
|
-
* kind: 'derived',
|
|
7547
|
-
* name: 'name',
|
|
7548
|
-
* type: 'concat',
|
|
7549
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
7550
|
-
* },
|
|
7551
|
-
* {
|
|
7552
|
-
* kind: 'hasMany',
|
|
7553
|
-
* name: 'pets',
|
|
7554
|
-
* type: 'pet',
|
|
7555
|
-
* options: {
|
|
7556
|
-
* async: false,
|
|
7557
|
-
* inverse: 'owner',
|
|
7558
|
-
* polymorphic: true,
|
|
7559
|
-
* linksMode: true,
|
|
7560
|
-
* }
|
|
7561
|
-
* }
|
|
7562
|
-
* ]
|
|
7563
|
-
* },
|
|
7564
|
-
* {
|
|
7565
|
-
* type: 'dog',
|
|
7566
|
-
* identity: { type: '@id', name: 'id' },
|
|
7567
|
-
* fields: [
|
|
7568
|
-
* {
|
|
7569
|
-
* type: '@identity',
|
|
7570
|
-
* name: '$type',
|
|
7571
|
-
* kind: 'derived',
|
|
7572
|
-
* options: { key: 'type' },
|
|
7573
|
-
* },
|
|
7574
|
-
* { kind: 'field', name: 'name' },
|
|
7575
|
-
* {
|
|
7576
|
-
* kind: 'belongsTo',
|
|
7577
|
-
* name: 'owner',
|
|
7578
|
-
* type: 'user',
|
|
7579
|
-
* options: {
|
|
7580
|
-
* async: false,
|
|
7581
|
-
* inverse: 'pets',
|
|
7582
|
-
* as: 'pet',
|
|
7583
|
-
* linksMode: true,
|
|
7584
|
-
* }
|
|
7585
|
-
* }
|
|
7586
|
-
* ]
|
|
7587
|
-
* }
|
|
7588
|
-
* ]);
|
|
7589
|
-
* ```
|
|
7590
|
-
*
|
|
7591
|
-
* With these schemas in place, the reactive objects that the store would
|
|
7592
|
-
* provide us whenever we encountered a `'user'` or a `'dog'` would be:
|
|
7593
|
-
*
|
|
7594
|
-
* ```ts
|
|
7595
|
-
* interface Pet {
|
|
7596
|
-
* readonly id: string;
|
|
7597
|
-
* readonly owner: User;
|
|
7598
|
-
* }
|
|
7599
|
-
*
|
|
7600
|
-
* interface Dog extends Pet {
|
|
7601
|
-
* readonly $type: 'dog';
|
|
7602
|
-
* readonly name: string;
|
|
7603
|
-
* }
|
|
7604
|
-
*
|
|
7605
|
-
* interface EditableUser {
|
|
7606
|
-
* readonly $type: 'user';
|
|
7607
|
-
* readonly id: string;
|
|
7608
|
-
* firstName: string;
|
|
7609
|
-
* lastName: string;
|
|
7610
|
-
* readonly name: string;
|
|
7611
|
-
* pets: Array<Dog | Pet>;
|
|
7612
|
-
* }
|
|
7613
|
-
*
|
|
7614
|
-
* interface User {
|
|
7615
|
-
* readonly $type: 'user';
|
|
7616
|
-
* readonly id: string;
|
|
7617
|
-
* readonly firstName: string;
|
|
7618
|
-
* readonly lastName: string;
|
|
7619
|
-
* readonly name: string;
|
|
7620
|
-
* readonly pets: Readonly<Array<Dog | Pet>>;
|
|
7621
|
-
* [Checkout](): Promise<EditableUser>
|
|
7622
|
-
* }>
|
|
7623
|
-
* ```
|
|
7624
|
-
*
|
|
7625
|
-
* Note how based on the schema the reactive object we receive is able to produce
|
|
7626
|
-
* `name` on user (despite no name field being in the cache), provide `$type`
|
|
7627
|
-
* pulled from the identity of the resource, and flatten the individual attributes
|
|
7628
|
-
* and relationships onto the record for easier use.
|
|
7629
|
-
*
|
|
7630
|
-
* Notice also how we typed this object with `readonly`. This is because while
|
|
7631
|
-
* ReactiveResource instances are ***deeply reactive***, they are also ***immutable***.
|
|
7632
|
-
*
|
|
7633
|
-
* We can mutate a ReactiveResource only be explicitly asking permission to do so, and
|
|
7634
|
-
* in the process gaining access to an editable copy. The immutable version will
|
|
7635
|
-
* not show any in-process edits made to this editable copy.
|
|
7636
|
-
*
|
|
7637
|
-
* ```ts
|
|
7638
|
-
* import { Checkout } from '@warp-drive-mirror/schema-record';
|
|
7639
|
-
*
|
|
7640
|
-
* const editable = await user[Checkout]();
|
|
7641
|
-
* ```
|
|
7642
|
-
*
|
|
7643
|
-
* ## Utilities
|
|
7644
|
-
*
|
|
7645
|
-
* ReactiveResource provides a schema builder that simplifies setting up a couple of
|
|
7646
|
-
* conventional fields like identity and `$type`. We can rewrite the schema
|
|
7647
|
-
* definition above using this utility like so:
|
|
7648
|
-
*
|
|
7649
|
-
* ```ts
|
|
7650
|
-
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
7651
|
-
*
|
|
7652
|
-
* store.schema.registerResources([
|
|
7653
|
-
* withDefaults({
|
|
7654
|
-
* type: 'user',
|
|
7655
|
-
* fields: [
|
|
7656
|
-
* { kind: 'field', name: 'firstName' },
|
|
7657
|
-
* { kind: 'field', name: 'lastName' },
|
|
7658
|
-
* {
|
|
7659
|
-
* kind: 'derived',
|
|
7660
|
-
* name: 'name',
|
|
7661
|
-
* type: 'concat',
|
|
7662
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
7663
|
-
* },
|
|
7664
|
-
* {
|
|
7665
|
-
* kind: 'hasMany',
|
|
7666
|
-
* name: 'pets',
|
|
7667
|
-
* type: 'pet',
|
|
7668
|
-
* options: {
|
|
7669
|
-
* async: false,
|
|
7670
|
-
* inverse: 'owner',
|
|
7671
|
-
* polymorphic: true,
|
|
7672
|
-
* linksMode: true,
|
|
7673
|
-
* resetOnRemoteUpdate: false,
|
|
7674
|
-
* }
|
|
7675
|
-
* }
|
|
7676
|
-
* ]
|
|
7677
|
-
* }),
|
|
7678
|
-
* withDefaults({
|
|
7679
|
-
* type: 'dog',
|
|
7680
|
-
* fields: [
|
|
7681
|
-
* { kind: 'field', name: 'name' },
|
|
7682
|
-
* {
|
|
7683
|
-
* kind: 'belongsTo',
|
|
7684
|
-
* name: 'owner',
|
|
7685
|
-
* type: 'user',
|
|
7686
|
-
* options: {
|
|
7687
|
-
* async: false,
|
|
7688
|
-
* inverse: 'pets',
|
|
7689
|
-
* as: 'pet',
|
|
7690
|
-
* linksMode: true,
|
|
7691
|
-
* resetOnRemoteUpdate: false,
|
|
7692
|
-
* }
|
|
7693
|
-
* }
|
|
7694
|
-
* ]
|
|
7695
|
-
* })
|
|
7696
|
-
* ]);
|
|
7697
|
-
* ```
|
|
7698
|
-
*
|
|
7699
|
-
* ## Type Support
|
|
7700
|
-
*
|
|
7701
|
-
* ### Resource Schemas
|
|
7702
|
-
*
|
|
7703
|
-
* - {@link PolarisResourceSchema}
|
|
7704
|
-
* - {@link LegacyResourceSchema}
|
|
7705
|
-
* - {@link ObjectSchema}
|
|
7706
|
-
*
|
|
7707
|
-
* ### Resource Schema Type Utils
|
|
7708
|
-
*
|
|
7709
|
-
* - {@link resourceSchema}
|
|
7710
|
-
* - {@link objectSchema}
|
|
7711
|
-
* - {@link isResourceSchema}
|
|
7712
|
-
* - {@link isLegacyResourceSchema}
|
|
7713
|
-
*
|
|
7714
|
-
* ### Field Schemas
|
|
7715
|
-
*
|
|
7716
|
-
* - {@link LegacyModeFieldSchema}
|
|
7717
|
-
* - {@link PolarisModeFieldSchema}
|
|
7718
|
-
*
|
|
7719
|
-
* @module
|
|
7720
|
-
*/
|
|
7721
|
-
|
|
7722
|
-
//#endregion
|
|
7723
|
-
//#region src/request/-private/fetch.ts
|
|
7556
|
+
// src/request/-private/fetch.ts
|
|
7724
7557
|
const _fetch = typeof fetch !== "undefined" ? (...args) => fetch(...args) : typeof FastBoot !== "undefined" ? (...args) => FastBoot.require("node-fetch")(...args) : () => {
|
|
7725
7558
|
throw new Error("No Fetch Implementation Found");
|
|
7726
7559
|
};
|
|
@@ -7798,6 +7631,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
7798
7631
|
* A basic Fetch Handler which converts a request into a
|
|
7799
7632
|
* `fetch` call presuming the response to be `json`.
|
|
7800
7633
|
*
|
|
7634
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
7635
|
+
* guide shows where it sits in the handler chain.
|
|
7636
|
+
*
|
|
7801
7637
|
* ```ts
|
|
7802
7638
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7803
7639
|
*
|
|
@@ -7805,6 +7641,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
7805
7641
|
* .use([Fetch]);
|
|
7806
7642
|
* ```
|
|
7807
7643
|
*
|
|
7644
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
7645
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
7808
7646
|
* @public
|
|
7809
7647
|
* @badge Handler
|
|
7810
7648
|
*/
|
|
@@ -7925,8 +7763,7 @@ function isDict(v) {
|
|
|
7925
7763
|
return v !== null && typeof v === "object";
|
|
7926
7764
|
}
|
|
7927
7765
|
|
|
7928
|
-
|
|
7929
|
-
//#region src/request/-private/manager.ts
|
|
7766
|
+
// src/request/-private/manager.ts
|
|
7930
7767
|
/**
|
|
7931
7768
|
* ## Import
|
|
7932
7769
|
*
|
|
@@ -7934,7 +7771,8 @@ function isDict(v) {
|
|
|
7934
7771
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
7935
7772
|
* ```
|
|
7936
7773
|
*
|
|
7937
|
-
* For complete usage guide see
|
|
7774
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
7775
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
7938
7776
|
*
|
|
7939
7777
|
* ## How It Works
|
|
7940
7778
|
*
|
|
@@ -7957,11 +7795,28 @@ function isDict(v) {
|
|
|
7957
7795
|
* ```ts [Setup.ts]
|
|
7958
7796
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7959
7797
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
7960
|
-
* import
|
|
7798
|
+
* import { AuthHandler } from './auth-handler';
|
|
7961
7799
|
*
|
|
7962
7800
|
* // ... create manager
|
|
7963
7801
|
* const manager = new RequestManager()
|
|
7964
|
-
* .use([
|
|
7802
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
7803
|
+
* ```
|
|
7804
|
+
*
|
|
7805
|
+
* ```ts [auth-handler.ts]
|
|
7806
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
7807
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
7808
|
+
*
|
|
7809
|
+
* const token = '<token>';
|
|
7810
|
+
*
|
|
7811
|
+
* // adds a bearer token to every request, then passes it along
|
|
7812
|
+
* export const AuthHandler: Handler = {
|
|
7813
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
7814
|
+
* const headers = new Headers(context.request.headers);
|
|
7815
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
7816
|
+
*
|
|
7817
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
7818
|
+
* },
|
|
7819
|
+
* };
|
|
7965
7820
|
* ```
|
|
7966
7821
|
*
|
|
7967
7822
|
* ```ts [Usage.ts]
|
|
@@ -7977,6 +7832,20 @@ function isDict(v) {
|
|
|
7977
7832
|
*
|
|
7978
7833
|
* :::
|
|
7979
7834
|
*
|
|
7835
|
+
* ### RequestManager vs {@link Store.request}
|
|
7836
|
+
*
|
|
7837
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
7838
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
7839
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
7840
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
7841
|
+
*
|
|
7842
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
7843
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
7844
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
7845
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
7846
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
7847
|
+
* `StructuredDocument`.
|
|
7848
|
+
*
|
|
7980
7849
|
* ### Futures
|
|
7981
7850
|
*
|
|
7982
7851
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -8015,6 +7884,7 @@ function isDict(v) {
|
|
|
8015
7884
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
8016
7885
|
* ```
|
|
8017
7886
|
*
|
|
7887
|
+
* @summary Runs each request through a chain of handlers that can fulfill, modify, or pass it along, and returns a `Future` for the response.
|
|
8018
7888
|
* @public
|
|
8019
7889
|
*/
|
|
8020
7890
|
var RequestManager = class {
|
|
@@ -8074,7 +7944,23 @@ var RequestManager = class {
|
|
|
8074
7944
|
/**
|
|
8075
7945
|
* Issue a Request.
|
|
8076
7946
|
*
|
|
8077
|
-
*
|
|
7947
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
7948
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
7949
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
7950
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
7951
|
+
* `RequestManager` created on its own has neither.
|
|
7952
|
+
*
|
|
7953
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
7954
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
7955
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
7956
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
7957
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
7958
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
7959
|
+
*
|
|
7960
|
+
* @example
|
|
7961
|
+
* ```ts
|
|
7962
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
7963
|
+
* ```
|
|
8078
7964
|
*
|
|
8079
7965
|
* @public
|
|
8080
7966
|
*/
|
|
@@ -8155,9 +8041,10 @@ var RequestManager = class {
|
|
|
8155
8041
|
*
|
|
8156
8042
|
* @private
|
|
8157
8043
|
*/
|
|
8158
|
-
|
|
8159
|
-
//#region src/index.ts
|
|
8044
|
+
// src/index.ts
|
|
8160
8045
|
/**
|
|
8046
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
8047
|
+
* `useRecommendedStore` for building a configured store.
|
|
8161
8048
|
* @module
|
|
8162
8049
|
* @mergeModuleWith <project>
|
|
8163
8050
|
*/
|
|
@@ -8166,11 +8053,17 @@ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
|
8166
8053
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
8167
8054
|
/**
|
|
8168
8055
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
8056
|
+
*
|
|
8057
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
8058
|
+
* `useRecommendedStore` wires into a Store class.
|
|
8169
8059
|
*/
|
|
8170
8060
|
/**
|
|
8171
8061
|
* Creates a configured Store class with recommended defaults
|
|
8172
8062
|
* for schema handling, reactivity, caching, and request management.
|
|
8173
8063
|
*
|
|
8064
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
8065
|
+
* configuring the store with it.
|
|
8066
|
+
*
|
|
8174
8067
|
* ```ts
|
|
8175
8068
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
8176
8069
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -8273,6 +8166,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
8273
8166
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
8274
8167
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
8275
8168
|
* `LoggingHandler` does above).
|
|
8169
|
+
*
|
|
8170
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
8171
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
8276
8172
|
*/
|
|
8277
8173
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
8278
8174
|
return class AppStore extends StoreKlass {
|
|
@@ -8326,6 +8222,5 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
8326
8222
|
};
|
|
8327
8223
|
}
|
|
8328
8224
|
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
//# sourceMappingURL=src-kn6qfEPI.js.map
|
|
8225
|
+
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 };
|
|
8226
|
+
//# sourceMappingURL=src-C4ET4R1n.js.map
|