@warp-drive-mirror/core 5.10.0-alpha.2 → 5.10.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -6
- package/dist/{-private-ffnwf62T.js → -private-BiuED7nc.js} +5 -4
- package/dist/{-private-ffnwf62T.js.map → -private-BiuED7nc.js.map} +1 -1
- package/dist/{-private-CArItnX4.js → -private-CvZfrDZl.js} +566 -179
- package/dist/-private-CvZfrDZl.js.map +1 -0
- package/dist/{aliases-BWYW5EhX.d.ts → aliases-BG5TxALl.d.ts} +4 -3
- package/dist/aliases-BG5TxALl.d.ts.map +1 -0
- package/dist/{change-C7kqv2kW.d.ts → change-INHMiZ2a.d.ts} +4 -4
- package/dist/change-INHMiZ2a.d.ts.map +1 -0
- package/dist/{concepts-DFldVwEM.d.ts → concepts-vh86nAcd.d.ts} +14 -7
- package/dist/concepts-vh86nAcd.d.ts.map +1 -0
- package/dist/{configure-B_F639tN.d.ts → configure-BfXDuPUb.d.ts} +57 -10
- package/dist/configure-BfXDuPUb.d.ts.map +1 -0
- package/dist/configure.d.ts +2 -2
- package/dist/configure.js +2 -2
- package/dist/{document-Ca4ZZBd9.d.ts → document-B8Fup751.d.ts} +22 -6
- package/dist/document-B8Fup751.d.ts.map +1 -0
- package/dist/{error-0uD6GkNX.d.ts → error-j5n1yL9m.d.ts} +4 -4
- package/dist/error-j5n1yL9m.d.ts.map +1 -0
- package/dist/{fields-FM7peCiM.d.ts → fields-r1rZJB9d.d.ts} +134 -9
- package/dist/fields-r1rZJB9d.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +1 -1
- package/dist/graph/-private.js +25 -40
- package/dist/graph/-private.js.map +1 -1
- package/dist/{graph-DLqYXP2z.d.ts → graph-BqxaFjEb.d.ts} +25 -7
- package/dist/graph-BqxaFjEb.d.ts.map +1 -0
- package/dist/{identifier-DQnqOSJK.d.ts → identifier-DmgDehQK.d.ts} +29 -6
- package/dist/identifier-DmgDehQK.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-BrqYbG_y.d.ts → internal-D_WIXC4r.d.ts} +1524 -1121
- package/dist/internal-D_WIXC4r.d.ts.map +1 -0
- package/dist/{json-api-raw-C5APJHHB.d.ts → json-api-raw-juUdIITO.d.ts} +44 -4
- package/dist/json-api-raw-juUdIITO.d.ts.map +1 -0
- package/dist/{mutations-CqtoGB4t.d.ts → mutations-CA39mior.d.ts} +18 -4
- package/dist/mutations-CA39mior.d.ts.map +1 -0
- package/dist/{operations-D1qA6r0_.d.ts → operations-C1WAEKKq.d.ts} +39 -7
- package/dist/operations-C1WAEKKq.d.ts.map +1 -0
- package/dist/{params-DrEx3bf8.d.ts → params-CNLjCRyH.d.ts} +11 -3
- package/dist/params-CNLjCRyH.d.ts.map +1 -0
- package/dist/{raw-D5hnjiq7.d.ts → raw-adYGuEGM.d.ts} +10 -3
- package/dist/raw-adYGuEGM.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +1 -1
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.d.ts +2 -2
- package/dist/reactive.js +3 -3
- package/dist/{record-D3QQcaIR.d.ts → record-f5-uOgHt.d.ts} +22 -4
- package/dist/record-f5-uOgHt.d.ts.map +1 -0
- package/dist/{relationship-CmHzMPKf.d.ts → relationship-99pc4CaS.d.ts} +10 -5
- package/dist/relationship-99pc4CaS.d.ts.map +1 -0
- package/dist/{request-o_qGAoFV.js → request-CxtnNIIp.js} +52 -23
- package/dist/request-CxtnNIIp.js.map +1 -0
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +86 -18
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/signals/-leaked.js +1 -1
- package/dist/{src-C-xK8l3f.js → src-ccp1WKyt.js} +350 -456
- package/dist/src-ccp1WKyt.js.map +1 -0
- package/dist/store/-private.d.ts +2 -2
- package/dist/store/-private.js +2 -2
- package/dist/{store-DNF9Rgoh.js → store-C8iKKtQK.js} +17 -3
- package/dist/store-C8iKKtQK.js.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/{symbols-DjRDCeX0.d.ts → symbols-DVa1PMFG.d.ts} +10 -3
- package/dist/symbols-DVa1PMFG.d.ts.map +1 -0
- package/dist/types/-private.d.ts +1 -2
- package/dist/types/-private.d.ts.map +1 -1
- package/dist/types/-private.js +115 -2
- package/dist/types/-private.js.map +1 -0
- package/dist/types/cache/aliases.d.ts +1 -1
- package/dist/types/cache/change.d.ts +1 -1
- package/dist/types/cache/mutations.d.ts +1 -1
- package/dist/types/cache/operations.d.ts +1 -1
- package/dist/types/cache/relationship.d.ts +1 -1
- package/dist/types/cache.d.ts +1 -1
- package/dist/types/graph.d.ts +1 -1
- package/dist/types/identifier.d.ts +1 -1
- package/dist/types/identifier.js +34 -5
- package/dist/types/identifier.js.map +1 -1
- package/dist/types/json/raw.d.ts +1 -1
- package/dist/types/params.d.ts +1 -1
- package/dist/types/record.d.ts +1 -1
- package/dist/types/record.js +26 -2
- package/dist/types/record.js.map +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/types/request.js +82 -3
- package/dist/types/request.js.map +1 -1
- package/dist/types/runtime.d.ts +10 -7
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/runtime.js +9 -6
- package/dist/types/runtime.js.map +1 -1
- package/dist/types/schema/concepts.d.ts +1 -1
- package/dist/types/schema/fields.d.ts +1 -1
- package/dist/types/schema/fields.js +133 -5
- package/dist/types/schema/fields.js.map +1 -1
- package/dist/types/schema/schema-service.d.ts +1 -1
- package/dist/types/spec/document.d.ts +1 -1
- package/dist/types/spec/error.d.ts +1 -1
- package/dist/types/spec/json-api-raw.d.ts +1 -1
- package/dist/types/symbols.d.ts +1 -1
- package/dist/types/symbols.js +16 -3
- package/dist/types/symbols.js.map +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/unpkg/{dev-deprecated/-private-CM5N2rtZ.js → dev/-private-B4pCmkq-.js} +566 -179
- package/dist/unpkg/dev/-private-B4pCmkq-.js.map +1 -0
- package/dist/unpkg/{prod-deprecated/-private-207KndDu.js → dev/-private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{dev-deprecated/-private-BO-nArRb.js.map → dev/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/dev/configure.js +2 -2
- package/dist/unpkg/dev/graph/-private.js +26 -41
- package/dist/unpkg/dev/graph/-private.js.map +1 -1
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +3 -3
- package/dist/unpkg/{dev-deprecated/request-DXPAtRhE.js → dev/request-oWpijCPQ.js} +52 -23
- package/dist/unpkg/dev/request-oWpijCPQ.js.map +1 -0
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/{runtime-DW881fpw.js → runtime-RYvEtg99.js} +2 -3
- package/dist/unpkg/dev/{runtime-DW881fpw.js.map → runtime-RYvEtg99.js.map} +1 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -1
- package/dist/unpkg/dev/{src-kn6qfEPI.js → src-C4ET4R1n.js} +339 -444
- package/dist/unpkg/dev/src-C4ET4R1n.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +2 -2
- package/dist/unpkg/{dev-deprecated/store-D-z_1Jxe.js → dev/store-dZViNfMK.js} +18 -4
- package/dist/unpkg/dev/store-dZViNfMK.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/types/-private.js +106 -2
- package/dist/unpkg/dev/types/-private.js.map +1 -0
- package/dist/unpkg/dev/types/identifier.js +34 -5
- package/dist/unpkg/dev/types/identifier.js.map +1 -1
- package/dist/unpkg/dev/types/record.js +26 -2
- package/dist/unpkg/dev/types/record.js.map +1 -1
- package/dist/unpkg/dev/types/request.js +82 -3
- package/dist/unpkg/dev/types/request.js.map +1 -1
- package/dist/unpkg/dev/types/runtime.js +9 -6
- package/dist/unpkg/dev/types/runtime.js.map +1 -1
- package/dist/unpkg/dev/types/schema/fields.js +133 -5
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev/types/symbols.js +16 -3
- package/dist/unpkg/dev/types/symbols.js.map +1 -1
- package/dist/unpkg/dev/utils/string.js +1 -2
- package/dist/unpkg/{dev/-private-CM5N2rtZ.js → dev-deprecated/-private-B4pCmkq-.js} +566 -179
- package/dist/unpkg/dev-deprecated/-private-B4pCmkq-.js.map +1 -0
- package/dist/unpkg/dev-deprecated/{-private-BO-nArRb.js → -private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{prod/-private-207KndDu.js.map → dev-deprecated/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/configure.js +2 -2
- package/dist/unpkg/dev-deprecated/graph/-private.js +26 -41
- package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +3 -3
- package/dist/unpkg/{dev/request-DXPAtRhE.js → dev-deprecated/request-oWpijCPQ.js} +52 -23
- package/dist/unpkg/dev-deprecated/request-oWpijCPQ.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/{runtime-BIra6K31.js → runtime-DZVuMuzL.js} +2 -3
- package/dist/unpkg/dev-deprecated/{runtime-BIra6K31.js.map → runtime-DZVuMuzL.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/dev-deprecated/{src-DXwW-R57.js → src-jHpowq3S.js} +344 -450
- package/dist/unpkg/dev-deprecated/src-jHpowq3S.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +2 -2
- package/dist/unpkg/{dev/store-C0p6sclI.js → dev-deprecated/store-I7YB0_rC.js} +18 -4
- package/dist/unpkg/dev-deprecated/store-I7YB0_rC.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +106 -2
- package/dist/unpkg/dev-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/identifier.js +34 -5
- package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/record.js +26 -2
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js +82 -3
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/runtime.js +9 -6
- package/dist/unpkg/dev-deprecated/types/runtime.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +133 -5
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +16 -3
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/dev-deprecated/utils/string.js +1 -2
- package/dist/unpkg/prod/-private-BiuED7nc.js +23 -0
- package/dist/unpkg/{prod-deprecated/-private-207KndDu.js.map → prod/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/{prod-deprecated/-private-CdDed4yB.js → prod/-private-CrUi_3E_.js} +539 -173
- package/dist/unpkg/prod/-private-CrUi_3E_.js.map +1 -0
- package/dist/unpkg/prod/configure.js +2 -2
- package/dist/unpkg/prod/graph/-private.js +24 -35
- package/dist/unpkg/prod/graph/-private.js.map +1 -1
- package/dist/unpkg/prod/index.js +1 -1
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +3 -3
- package/dist/unpkg/prod/{request-C7WZg-zk.js → request-Cgw3j6Dx.js} +51 -21
- package/dist/unpkg/prod/request-Cgw3j6Dx.js.map +1 -0
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/signals/-leaked.js +1 -1
- package/dist/unpkg/prod/{src-B-GfFQcx.js → src-DFmPDGQ6.js} +311 -414
- package/dist/unpkg/prod/src-DFmPDGQ6.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +2 -2
- package/dist/unpkg/prod/{store-BWhmb7Ob.js → store-Bz9R5hGB.js} +17 -3
- package/dist/unpkg/prod/store-Bz9R5hGB.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod/types/-private.js +94 -2
- package/dist/unpkg/prod/types/-private.js.map +1 -0
- package/dist/unpkg/prod/types/identifier.js +34 -5
- package/dist/unpkg/prod/types/identifier.js.map +1 -1
- package/dist/unpkg/prod/types/record.js +26 -2
- package/dist/unpkg/prod/types/record.js.map +1 -1
- package/dist/unpkg/prod/types/request.js +82 -3
- package/dist/unpkg/prod/types/request.js.map +1 -1
- package/dist/unpkg/prod/types/runtime.js +9 -6
- package/dist/unpkg/prod/types/runtime.js.map +1 -1
- package/dist/unpkg/prod/types/schema/fields.js +133 -5
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod/types/symbols.js +16 -3
- package/dist/unpkg/prod/types/symbols.js.map +1 -1
- package/dist/unpkg/prod/utils/string.js +1 -2
- package/dist/unpkg/{dev/-private-BO-nArRb.js → prod-deprecated/-private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{dev/-private-BO-nArRb.js.map → prod-deprecated/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/{prod/-private-CdDed4yB.js → prod-deprecated/-private-CrUi_3E_.js} +539 -173
- package/dist/unpkg/prod-deprecated/-private-CrUi_3E_.js.map +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -2
- package/dist/unpkg/prod-deprecated/graph/-private.js +24 -35
- package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/prod-deprecated/index.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +3 -3
- package/dist/unpkg/prod-deprecated/{request-C7WZg-zk.js → request-Cgw3j6Dx.js} +51 -21
- package/dist/unpkg/prod-deprecated/request-Cgw3j6Dx.js.map +1 -0
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/prod-deprecated/{src-Bp8ZJctZ.js → src-BgQLcshl.js} +316 -420
- package/dist/unpkg/prod-deprecated/src-BgQLcshl.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +2 -2
- package/dist/unpkg/prod-deprecated/{store-BWhmb7Ob.js → store-Bz9R5hGB.js} +17 -3
- package/dist/unpkg/prod-deprecated/store-Bz9R5hGB.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +94 -2
- package/dist/unpkg/prod-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/identifier.js +34 -5
- package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/record.js +26 -2
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js +82 -3
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/runtime.js +9 -6
- package/dist/unpkg/prod-deprecated/types/runtime.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +133 -5
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +16 -3
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/prod-deprecated/utils/string.js +1 -2
- package/dist/utils/string.d.ts +0 -2
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +1 -2
- package/dist/{utils-BtURiy8l.d.ts → utils-BVKvrO6e.d.ts} +8 -3
- package/dist/utils-BVKvrO6e.d.ts.map +1 -0
- package/logos/README.md +1 -1
- package/package.json +9 -9
- package/dist/-private-CArItnX4.js.map +0 -1
- package/dist/-private-CWh7qdp_.js +0 -120
- package/dist/-private-CWh7qdp_.js.map +0 -1
- package/dist/aliases-BWYW5EhX.d.ts.map +0 -1
- package/dist/change-C7kqv2kW.d.ts.map +0 -1
- package/dist/concepts-DFldVwEM.d.ts.map +0 -1
- package/dist/configure-B_F639tN.d.ts.map +0 -1
- package/dist/document-Ca4ZZBd9.d.ts.map +0 -1
- package/dist/error-0uD6GkNX.d.ts.map +0 -1
- package/dist/fields-FM7peCiM.d.ts.map +0 -1
- package/dist/graph-DLqYXP2z.d.ts.map +0 -1
- package/dist/identifier-DQnqOSJK.d.ts.map +0 -1
- package/dist/internal-BrqYbG_y.d.ts.map +0 -1
- package/dist/json-api-raw-C5APJHHB.d.ts.map +0 -1
- package/dist/mutations-CqtoGB4t.d.ts.map +0 -1
- package/dist/operations-D1qA6r0_.d.ts.map +0 -1
- package/dist/params-DrEx3bf8.d.ts.map +0 -1
- package/dist/raw-D5hnjiq7.d.ts.map +0 -1
- package/dist/record-D3QQcaIR.d.ts.map +0 -1
- package/dist/relationship-CmHzMPKf.d.ts.map +0 -1
- package/dist/request-o_qGAoFV.js.map +0 -1
- package/dist/src-C-xK8l3f.js.map +0 -1
- package/dist/store-DNF9Rgoh.js.map +0 -1
- package/dist/symbols-DjRDCeX0.d.ts.map +0 -1
- package/dist/types/schema/fields.type-test.d.ts +0 -1
- package/dist/types/schema/fields.type-test.js +0 -79
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev/-private-BP52H-vC.js +0 -111
- package/dist/unpkg/dev/-private-BP52H-vC.js.map +0 -1
- package/dist/unpkg/dev/-private-CM5N2rtZ.js.map +0 -1
- package/dist/unpkg/dev/request-DXPAtRhE.js.map +0 -1
- package/dist/unpkg/dev/src-kn6qfEPI.js.map +0 -1
- package/dist/unpkg/dev/store-C0p6sclI.js.map +0 -1
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-BP52H-vC.js +0 -111
- package/dist/unpkg/dev-deprecated/-private-BP52H-vC.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-CM5N2rtZ.js.map +0 -1
- package/dist/unpkg/dev-deprecated/request-DXPAtRhE.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-DXwW-R57.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-D-z_1Jxe.js.map +0 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod/-private-207KndDu.js +0 -22
- package/dist/unpkg/prod/-private-CdDed4yB.js.map +0 -1
- package/dist/unpkg/prod/-private-JmhZBKGb.js +0 -99
- package/dist/unpkg/prod/-private-JmhZBKGb.js.map +0 -1
- package/dist/unpkg/prod/request-C7WZg-zk.js.map +0 -1
- package/dist/unpkg/prod/src-B-GfFQcx.js.map +0 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-CdDed4yB.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-JmhZBKGb.js +0 -99
- package/dist/unpkg/prod-deprecated/-private-JmhZBKGb.js.map +0 -1
- package/dist/unpkg/prod-deprecated/request-C7WZg-zk.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-Bp8ZJctZ.js.map +0 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/utils-BtURiy8l.d.ts.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal,
|
|
1
|
+
import { getOrSetGlobal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient } from "./types/-private.js";
|
|
2
|
+
import { A as ARRAY_SIGNAL, C as createInternalMemo, D as notifyInternalSignal, F as willSyncFlushWatchers, O as peekInternalSignal, P as waitFor, S as consumeInternalSignal, T as getOrCreateInternalSignal, _ as entangleSignal, f as createSignalDescriptor, g as entangleInitiallyStaleSignal, h as defineSignal, j as OBJECT_SIGNAL, k as withSignalStore, p as defineGate, w as createInternalSignal, x as Signals } from "./-private-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-
|
|
7
|
+
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-BiuED7nc.js";
|
|
8
8
|
import { dasherize } from "./utils/string.js";
|
|
9
|
-
import { t as getGlobalConfig } from "./runtime-
|
|
9
|
+
import { t as getGlobalConfig } from "./runtime-DZVuMuzL.js";
|
|
10
10
|
import { RecordStore, Type } from "./types/symbols.js";
|
|
11
11
|
import { isResourceSchema } from "./types/schema/fields.js";
|
|
12
|
-
import { t as DefaultCachePolicy } from "./store-
|
|
12
|
+
import { t as DefaultCachePolicy } from "./store-I7YB0_rC.js";
|
|
13
13
|
import * as _importSync20 from "@ember/object";
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// src/reactive/-private/document.ts
|
|
16
16
|
function urlFromLink(link) {
|
|
17
17
|
if (typeof link === "string") return link;
|
|
18
18
|
return link.href;
|
|
@@ -22,10 +22,15 @@ function urlFromLink(link) {
|
|
|
22
22
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
23
23
|
* ReactiveResource instances.
|
|
24
24
|
*
|
|
25
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
26
|
+
* shows when a request's content is a ReactiveDocument.
|
|
27
|
+
*
|
|
25
28
|
* It is not directly instantiated by the user, and its properties should not
|
|
26
29
|
* be directly modified. Whether individual properties are mutable or not is
|
|
27
30
|
* determined by the record instance itself.
|
|
28
31
|
*
|
|
32
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
33
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
29
34
|
* @public
|
|
30
35
|
*/
|
|
31
36
|
const ReactiveDocumentProto = {
|
|
@@ -145,8 +150,7 @@ function createReactiveDocument(store, cacheKey, localCache) {
|
|
|
145
150
|
return doc;
|
|
146
151
|
}
|
|
147
152
|
|
|
148
|
-
|
|
149
|
-
//#region src/store/-private/debug/utils.ts
|
|
153
|
+
// src/store/-private/debug/utils.ts
|
|
150
154
|
const TEXT_COLORS = {
|
|
151
155
|
TEXT: "inherit",
|
|
152
156
|
notify: [
|
|
@@ -375,8 +379,7 @@ function _log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
|
|
|
375
379
|
return [];
|
|
376
380
|
}
|
|
377
381
|
|
|
378
|
-
|
|
379
|
-
//#region src/store/-private/caches/resource-utils.ts
|
|
382
|
+
// src/store/-private/caches/resource-utils.ts
|
|
380
383
|
function isResource(resource) {
|
|
381
384
|
return Boolean(resource && typeof resource === "object");
|
|
382
385
|
}
|
|
@@ -393,8 +396,7 @@ function hasType(resource) {
|
|
|
393
396
|
return hasProp(resource, "type");
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
|
|
397
|
-
//#region src/store/-private/utils/coerce-id.ts
|
|
399
|
+
// src/store/-private/utils/coerce-id.ts
|
|
398
400
|
/**
|
|
399
401
|
* Normalizes a resource `id` entering the store to a string (or `null`).
|
|
400
402
|
*
|
|
@@ -433,8 +435,7 @@ function ensureStringId(id) {
|
|
|
433
435
|
return normalized;
|
|
434
436
|
}
|
|
435
437
|
|
|
436
|
-
|
|
437
|
-
//#region src/store/-private/utils/normalize-model-name.ts
|
|
438
|
+
// src/store/-private/utils/normalize-model-name.ts
|
|
438
439
|
/**
|
|
439
440
|
* Normalizes a resource `type` to its dasherized form, e.g. `myClass` to
|
|
440
441
|
* `my-class`. Re-exported elsewhere as `_deprecatingNormalize`.
|
|
@@ -453,8 +454,7 @@ function normalizeModelName(type) {
|
|
|
453
454
|
}
|
|
454
455
|
}
|
|
455
456
|
|
|
456
|
-
|
|
457
|
-
//#region src/store/-private/managers/cache-key-manager.ts
|
|
457
|
+
// src/store/-private/managers/cache-key-manager.ts
|
|
458
458
|
/**
|
|
459
459
|
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
460
460
|
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
@@ -469,6 +469,57 @@ function isResourceKey(identifier) {
|
|
|
469
469
|
function isRequestKey(identifier) {
|
|
470
470
|
return !!identifier && typeof identifier === "object" && "type" in identifier && !("id" in identifier) && identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
471
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
474
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
475
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
476
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
477
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
478
|
+
*/
|
|
479
|
+
/**
|
|
480
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
481
|
+
*
|
|
482
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
483
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
484
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
485
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
486
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
487
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
488
|
+
*
|
|
489
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
490
|
+
* returns `null`.
|
|
491
|
+
*/
|
|
492
|
+
function fieldValueIdentity(schema, field, value) {
|
|
493
|
+
if (field.kind !== "schema-object" && field.kind !== "schema-array") return null;
|
|
494
|
+
if (!value || typeof value !== "object") return null;
|
|
495
|
+
const rawValue = value;
|
|
496
|
+
let type;
|
|
497
|
+
if (field.options?.polymorphic) {
|
|
498
|
+
const typePath = field.options.type ?? "type";
|
|
499
|
+
if (typePath === "@hash") {
|
|
500
|
+
((test) => {
|
|
501
|
+
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
502
|
+
})(field.type);
|
|
503
|
+
type = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
504
|
+
} else {
|
|
505
|
+
type = rawValue[typePath];
|
|
506
|
+
((test) => {
|
|
507
|
+
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
508
|
+
})(typePath && type && typeof type === "string");
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
((test) => {
|
|
512
|
+
if (!test) throw new Error(`A non-polymorphic ${field.kind} field must provide a SchemaObject type in its definition`);
|
|
513
|
+
})(field.type);
|
|
514
|
+
type = field.type;
|
|
515
|
+
}
|
|
516
|
+
const hashField = schema.resource({ type }).identity;
|
|
517
|
+
const hash = hashField && hashField.kind === "@hash" ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : null;
|
|
518
|
+
return {
|
|
519
|
+
type,
|
|
520
|
+
hash
|
|
521
|
+
};
|
|
522
|
+
}
|
|
472
523
|
const _crypto = typeof FastBoot !== "undefined" ? FastBoot.require("crypto") : globalThis.crypto;
|
|
473
524
|
function uuidv4() {
|
|
474
525
|
((test) => {
|
|
@@ -549,6 +600,8 @@ implement this hook.
|
|
|
549
600
|
|
|
550
601
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
551
602
|
|
|
603
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
604
|
+
before the store is created.
|
|
552
605
|
@public
|
|
553
606
|
*/
|
|
554
607
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -583,6 +636,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
583
636
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
584
637
|
without providing an `id` when one is missing will throw an error.
|
|
585
638
|
|
|
639
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
640
|
+
own secondary lookup tables.
|
|
586
641
|
@public
|
|
587
642
|
*/
|
|
588
643
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -600,6 +655,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
600
655
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
601
656
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
602
657
|
|
|
658
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
659
|
+
lookup tables.
|
|
603
660
|
@public
|
|
604
661
|
*/
|
|
605
662
|
function setIdentifierForgetMethod(method) {
|
|
@@ -619,6 +676,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
619
676
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
620
677
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
621
678
|
|
|
679
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
680
|
+
key-generation state.
|
|
622
681
|
@public
|
|
623
682
|
*/
|
|
624
683
|
function setIdentifierResetMethod(method) {
|
|
@@ -637,6 +696,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
637
696
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
638
697
|
```
|
|
639
698
|
|
|
699
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
700
|
+
must be set before the store is created.
|
|
640
701
|
@public
|
|
641
702
|
*/
|
|
642
703
|
function setKeyInfoForResource(method) {
|
|
@@ -1091,8 +1152,7 @@ function addResourceToCache(cache, identifier) {
|
|
|
1091
1152
|
if (identifier.id) typeSet.id.set(identifier.id, identifier);
|
|
1092
1153
|
}
|
|
1093
1154
|
|
|
1094
|
-
|
|
1095
|
-
//#region src/store/-private/managers/cache-capabilities-manager.ts
|
|
1155
|
+
// src/store/-private/managers/cache-capabilities-manager.ts
|
|
1096
1156
|
var CacheCapabilitiesManager = class {
|
|
1097
1157
|
/** @internal */
|
|
1098
1158
|
/** @internal */
|
|
@@ -1193,8 +1253,7 @@ CacheCapabilitiesManager.prototype.getSchemaDefinitionService = function() {
|
|
|
1193
1253
|
*/
|
|
1194
1254
|
function assertPrivateCapabilities(manager) {}
|
|
1195
1255
|
|
|
1196
|
-
|
|
1197
|
-
//#region src/store/-private/caches/instance-cache.ts
|
|
1256
|
+
// src/store/-private/caches/instance-cache.ts
|
|
1198
1257
|
function isDestroyable(record) {
|
|
1199
1258
|
return Boolean(record && typeof record === "object" && typeof record.destroy === "function");
|
|
1200
1259
|
}
|
|
@@ -1216,6 +1275,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
1216
1275
|
const { id, type, lid } = identifier;
|
|
1217
1276
|
```
|
|
1218
1277
|
|
|
1278
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
1219
1279
|
@public
|
|
1220
1280
|
@param record a record instance previously obstained from the store.
|
|
1221
1281
|
*/
|
|
@@ -1481,8 +1541,7 @@ function unloadRecord(instances, identifier) {
|
|
|
1481
1541
|
}
|
|
1482
1542
|
}
|
|
1483
1543
|
|
|
1484
|
-
|
|
1485
|
-
//#region src/store/-private/managers/cache-manager.ts
|
|
1544
|
+
// src/store/-private/managers/cache-manager.ts
|
|
1486
1545
|
/**
|
|
1487
1546
|
* The CacheManager wraps a Cache enforcing that only
|
|
1488
1547
|
* the public API surface area is exposed.
|
|
@@ -1566,7 +1625,8 @@ var CacheManager = class {
|
|
|
1566
1625
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
1567
1626
|
*
|
|
1568
1627
|
* @public
|
|
1569
|
-
* @return
|
|
1628
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
1629
|
+
* this push changed, or `undefined` when none did. Otherwise `void`.
|
|
1570
1630
|
*/
|
|
1571
1631
|
upsert(key, data, hasRecord) {
|
|
1572
1632
|
return this.___cache.upsert(key, data, hasRecord);
|
|
@@ -1868,13 +1928,18 @@ var CacheManager = class {
|
|
|
1868
1928
|
}
|
|
1869
1929
|
};
|
|
1870
1930
|
|
|
1871
|
-
|
|
1872
|
-
//#region src/store/-private/managers/notification-manager.ts
|
|
1931
|
+
// src/store/-private/managers/notification-manager.ts
|
|
1873
1932
|
/**
|
|
1874
1933
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1934
|
+
*
|
|
1935
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
1936
|
+
* or `state`.
|
|
1875
1937
|
*/
|
|
1876
1938
|
/**
|
|
1877
1939
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1940
|
+
*
|
|
1941
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
1942
|
+
* `invalidated`.
|
|
1878
1943
|
*/
|
|
1879
1944
|
function isCacheOperationValue(value) {
|
|
1880
1945
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -1882,6 +1947,9 @@ function isCacheOperationValue(value) {
|
|
|
1882
1947
|
/**
|
|
1883
1948
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1884
1949
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1950
|
+
*
|
|
1951
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
1952
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
1885
1953
|
*/
|
|
1886
1954
|
/**
|
|
1887
1955
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -1889,6 +1957,8 @@ function isCacheOperationValue(value) {
|
|
|
1889
1957
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1890
1958
|
* instead of once per key.
|
|
1891
1959
|
*
|
|
1960
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
1961
|
+
* `relationships` changes in one call.
|
|
1892
1962
|
* @since 5.9.0
|
|
1893
1963
|
* @public
|
|
1894
1964
|
*/
|
|
@@ -1923,6 +1993,8 @@ function isCacheOperationValue(value) {
|
|
|
1923
1993
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1924
1994
|
* have no local/remote duality.
|
|
1925
1995
|
*
|
|
1996
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
1997
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
1926
1998
|
* @public
|
|
1927
1999
|
*/
|
|
1928
2000
|
/**
|
|
@@ -2059,6 +2131,8 @@ function _unsubscribe(token, cache) {
|
|
|
2059
2131
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2060
2132
|
* work with any framework or change-notification system.
|
|
2061
2133
|
*
|
|
2134
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
2135
|
+
* cached resources and request documents.
|
|
2062
2136
|
* @hideconstructor
|
|
2063
2137
|
* @public
|
|
2064
2138
|
*/
|
|
@@ -2273,8 +2347,7 @@ function hasSubscribers(cache, cacheKey, value) {
|
|
|
2273
2347
|
return Boolean(callbackMap?.length);
|
|
2274
2348
|
}
|
|
2275
2349
|
|
|
2276
|
-
|
|
2277
|
-
//#region src/store/-private/record-arrays/-utils.ts
|
|
2350
|
+
// src/store/-private/record-arrays/-utils.ts
|
|
2278
2351
|
/**
|
|
2279
2352
|
* LegacyArrays have the capability of updating via `array.update()`
|
|
2280
2353
|
* and saving each contained record individually via `array.save()`
|
|
@@ -2353,8 +2426,7 @@ function safeForEach$1(instance, arr, store, callback, target) {
|
|
|
2353
2426
|
return instance;
|
|
2354
2427
|
}
|
|
2355
2428
|
|
|
2356
|
-
|
|
2357
|
-
//#region src/reactive/-private/fields/extension.ts
|
|
2429
|
+
// src/reactive/-private/fields/extension.ts
|
|
2358
2430
|
function expectNever(value) {}
|
|
2359
2431
|
function isExtensionProp(extensions, prop) {
|
|
2360
2432
|
return Boolean(extensions && typeof prop !== "number" && extensions.has(prop));
|
|
@@ -2442,8 +2514,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2442
2514
|
}
|
|
2443
2515
|
}
|
|
2444
2516
|
|
|
2445
|
-
|
|
2446
|
-
//#region src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2517
|
+
// src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2447
2518
|
/**
|
|
2448
2519
|
* The global `Proxy` constructor, retyped with the corrected
|
|
2449
2520
|
* {@link ProxyConstructor} signature above so that `target` and `receiver`
|
|
@@ -2453,8 +2524,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2453
2524
|
*/
|
|
2454
2525
|
const NativeProxy = Proxy;
|
|
2455
2526
|
|
|
2456
|
-
|
|
2457
|
-
//#region src/store/-private/record-arrays/resource-array.ts
|
|
2527
|
+
// src/store/-private/record-arrays/resource-array.ts
|
|
2458
2528
|
const IS_COLLECTION = getOrSetGlobal("IS_COLLECTION", Symbol.for("Collection"));
|
|
2459
2529
|
function isContextProp(prop) {
|
|
2460
2530
|
return prop === "destroy" || prop === "isDestroying" || prop === "isDestroyed";
|
|
@@ -2481,10 +2551,15 @@ const MUTABLE_PROPS = [
|
|
|
2481
2551
|
* as the base for relationship and legacy record-array types such as
|
|
2482
2552
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
2483
2553
|
*
|
|
2554
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
2555
|
+
* how it relates to resources.
|
|
2556
|
+
*
|
|
2484
2557
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
2485
2558
|
* both report `true`. The array stays in sync with the cache, updating
|
|
2486
2559
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
2487
2560
|
*
|
|
2561
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
2562
|
+
* and underlying relationship and legacy record arrays.
|
|
2488
2563
|
* @public
|
|
2489
2564
|
*/
|
|
2490
2565
|
/**
|
|
@@ -2743,8 +2818,7 @@ function createRequestCollection(config) {
|
|
|
2743
2818
|
});
|
|
2744
2819
|
}
|
|
2745
2820
|
|
|
2746
|
-
|
|
2747
|
-
//#region src/store/-private/record-arrays/legacy-live-array.ts
|
|
2821
|
+
// src/store/-private/record-arrays/legacy-live-array.ts
|
|
2748
2822
|
/**
|
|
2749
2823
|
* LiveArrays contain all the known records for a given `ResourceType`.
|
|
2750
2824
|
*
|
|
@@ -2805,6 +2879,8 @@ function createRequestCollection(config) {
|
|
|
2805
2879
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
2806
2880
|
* would be empty.
|
|
2807
2881
|
*
|
|
2882
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
2883
|
+
* `store.findAll`.
|
|
2808
2884
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
2809
2885
|
*/
|
|
2810
2886
|
/**
|
|
@@ -2848,8 +2924,7 @@ function _updateLiveArray() {
|
|
|
2848
2924
|
return context.store.findAll(this.modelName, { reload: true });
|
|
2849
2925
|
}
|
|
2850
2926
|
|
|
2851
|
-
|
|
2852
|
-
//#region src/store/-private/record-arrays/legacy-query.ts
|
|
2927
|
+
// src/store/-private/record-arrays/legacy-query.ts
|
|
2853
2928
|
/**
|
|
2854
2929
|
* QueryArrays contain the primary records returned when querying
|
|
2855
2930
|
* for records by `ResourceType`.
|
|
@@ -2920,6 +2995,8 @@ function _updateLiveArray() {
|
|
|
2920
2995
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
2921
2996
|
* from the store for book-keeping.
|
|
2922
2997
|
*
|
|
2998
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
2999
|
+
* `update()` and released with `destroy()`.
|
|
2923
3000
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
2924
3001
|
*/
|
|
2925
3002
|
/**
|
|
@@ -2982,8 +3059,7 @@ function destroyCollection(clear) {
|
|
|
2982
3059
|
manager._pending.delete(this);
|
|
2983
3060
|
}
|
|
2984
3061
|
|
|
2985
|
-
|
|
2986
|
-
//#region src/store/-private/managers/record-array-manager.ts
|
|
3062
|
+
// src/store/-private/managers/record-array-manager.ts
|
|
2987
3063
|
const FAKE_ARR = getOrSetGlobal("FAKE_ARR", {});
|
|
2988
3064
|
const SLICE_BATCH_SIZE = 4761;
|
|
2989
3065
|
/**
|
|
@@ -3330,6 +3406,7 @@ var RecordArrayManager = class {
|
|
|
3330
3406
|
this._managed.clear();
|
|
3331
3407
|
this._identifiers.clear();
|
|
3332
3408
|
this._pending.clear();
|
|
3409
|
+
this._staged.clear();
|
|
3333
3410
|
for (const set of this._set.values()) set.clear();
|
|
3334
3411
|
this._visibilitySet.clear();
|
|
3335
3412
|
}
|
|
@@ -3402,8 +3479,7 @@ function isLegacyLiveArray(array) {
|
|
|
3402
3479
|
return context.features !== null && context.features.DEPRECATED_CLASS_NAME === "LiveArray";
|
|
3403
3480
|
}
|
|
3404
3481
|
|
|
3405
|
-
|
|
3406
|
-
//#region src/store/-private/network/request-cache.ts
|
|
3482
|
+
// src/store/-private/network/request-cache.ts
|
|
3407
3483
|
const Touching = getOrSetGlobal("Touching", Symbol("touching"));
|
|
3408
3484
|
const RequestPromise = getOrSetGlobal("RequestPromise", Symbol("promise"));
|
|
3409
3485
|
const EMPTY_ARR = Object.freeze([]);
|
|
@@ -3614,8 +3690,7 @@ var RequestStateService = class {
|
|
|
3614
3690
|
*
|
|
3615
3691
|
* @private
|
|
3616
3692
|
*/
|
|
3617
|
-
|
|
3618
|
-
//#region ../../node_modules/.pnpm/@embroider+macros@1.20.7/node_modules/@embroider/macros/src/addon/es-compat2.js
|
|
3693
|
+
// ../../node_modules/.pnpm/@embroider+macros@1.21.4/node_modules/@embroider/macros/src/addon/es-compat2.js
|
|
3619
3694
|
function esCompat(m) {
|
|
3620
3695
|
return m?.__esModule ? m : {
|
|
3621
3696
|
default: m,
|
|
@@ -3623,8 +3698,7 @@ function esCompat(m) {
|
|
|
3623
3698
|
};
|
|
3624
3699
|
}
|
|
3625
3700
|
|
|
3626
|
-
|
|
3627
|
-
//#region src/store/-private/store-service.ts
|
|
3701
|
+
// src/store/-private/store-service.ts
|
|
3628
3702
|
globalThis.setWarpDriveLogging = setLogging;
|
|
3629
3703
|
globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
3630
3704
|
if (getGlobalConfig().WarpDriveMirror.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
|
|
@@ -3736,6 +3810,10 @@ const app = new EmberApp(defaults, {
|
|
|
3736
3810
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
3737
3811
|
* requests for data with schemas, caching and reactivity.
|
|
3738
3812
|
*
|
|
3813
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
3814
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
3815
|
+
* through it.
|
|
3816
|
+
*
|
|
3739
3817
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
3740
3818
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
3741
3819
|
* even when you aren't sure yet.
|
|
@@ -3743,6 +3821,7 @@ const app = new EmberApp(defaults, {
|
|
|
3743
3821
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
3744
3822
|
* is possible.
|
|
3745
3823
|
*
|
|
3824
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
3746
3825
|
* @public
|
|
3747
3826
|
* @hideconstructor
|
|
3748
3827
|
*/
|
|
@@ -3950,12 +4029,25 @@ var Store = class extends BaseClass {
|
|
|
3950
4029
|
}
|
|
3951
4030
|
}
|
|
3952
4031
|
/**
|
|
3953
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
4032
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
3954
4033
|
* :::
|
|
3955
4034
|
*
|
|
3956
4035
|
* Issue a request via the configured {@link RequestManager},
|
|
3957
4036
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
3958
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
4037
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
4038
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
4039
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
4040
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
4041
|
+
* {@link StructuredDocument}.
|
|
4042
|
+
*
|
|
4043
|
+
* #### Building Requests
|
|
4044
|
+
*
|
|
4045
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
4046
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
4047
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
4048
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
4049
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
4050
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
3959
4051
|
*
|
|
3960
4052
|
* #### Request Cache Keys
|
|
3961
4053
|
*
|
|
@@ -4000,6 +4092,29 @@ var Store = class extends BaseClass {
|
|
|
4000
4092
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
4001
4093
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
4002
4094
|
*
|
|
4095
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
4096
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
4097
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
4098
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
4099
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
4100
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
4101
|
+
*
|
|
4102
|
+
* #### Typing The Response
|
|
4103
|
+
*
|
|
4104
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
4105
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
4106
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
4107
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
4108
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
4109
|
+
*
|
|
4110
|
+
* @example
|
|
4111
|
+
* ```ts
|
|
4112
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
4113
|
+
*
|
|
4114
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
4115
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
4116
|
+
* ```
|
|
4117
|
+
*
|
|
4003
4118
|
* @public
|
|
4004
4119
|
*/
|
|
4005
4120
|
request(requestConfig) {
|
|
@@ -4553,8 +4668,7 @@ function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
|
|
|
4553
4668
|
return recordIdentifierFor(recordOrPromiseRecord);
|
|
4554
4669
|
}
|
|
4555
4670
|
|
|
4556
|
-
|
|
4557
|
-
//#region src/store/deprecated/-private.ts
|
|
4671
|
+
// src/store/deprecated/-private.ts
|
|
4558
4672
|
function preloadData(store, identifier, preload) {
|
|
4559
4673
|
const jsonPayload = {};
|
|
4560
4674
|
const fields = store.schema.fields(identifier);
|
|
@@ -4601,6 +4715,8 @@ function _convertPreloadRelationshipToJSON(value, type) {
|
|
|
4601
4715
|
* for @warp-drive-mirror/legacy/model or when wrapping schema for legacy
|
|
4602
4716
|
* Adapters/Serializers.
|
|
4603
4717
|
*
|
|
4718
|
+
* @summary Legacy shape of a Model class's static schema API (fields, attributes, relationships, iterators) used
|
|
4719
|
+
* by the legacy schema service and Adapters/Serializers.
|
|
4604
4720
|
*/
|
|
4605
4721
|
function _resourceIsFullDeleted(identifier, cache) {
|
|
4606
4722
|
return cache.isDeletionCommitted(identifier) || cache.isNew(identifier) && cache.isDeleted(identifier);
|
|
@@ -4831,8 +4947,7 @@ var ShimModelClass = class {
|
|
|
4831
4947
|
}
|
|
4832
4948
|
};
|
|
4833
4949
|
|
|
4834
|
-
|
|
4835
|
-
//#region src/store/deprecated/store.ts
|
|
4950
|
+
// src/store/deprecated/store.ts
|
|
4836
4951
|
Store.prototype.findRecord = function(resource, id, options) {
|
|
4837
4952
|
console.warn(`store.findRecord is deprecated. Use store.request instead.`);
|
|
4838
4953
|
((test) => {
|
|
@@ -5010,8 +5125,7 @@ function upgradeInstanceCaches(cache) {
|
|
|
5010
5125
|
return withReferences;
|
|
5011
5126
|
}
|
|
5012
5127
|
|
|
5013
|
-
|
|
5014
|
-
//#region src/store/-private/cache-handler/utils.ts
|
|
5128
|
+
// src/store/-private/cache-handler/utils.ts
|
|
5015
5129
|
const MUTATION_OPS$1 = /* @__PURE__ */ new Set([
|
|
5016
5130
|
"createRecord",
|
|
5017
5131
|
"updateRecord",
|
|
@@ -5051,15 +5165,23 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5051
5165
|
return priority;
|
|
5052
5166
|
}
|
|
5053
5167
|
|
|
5054
|
-
|
|
5055
|
-
//#region src/store/-private/cache-handler/handler.ts
|
|
5168
|
+
// src/store/-private/cache-handler/handler.ts
|
|
5056
5169
|
/**
|
|
5057
5170
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
5058
5171
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
5172
|
+
*
|
|
5173
|
+
* Only the looser form accepts `controller`, so a request carrying one, including a builder's
|
|
5174
|
+
* output spread together with a `controller`, resolves to {@link LooseStoreRequestInfo}.
|
|
5175
|
+
*
|
|
5176
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
5177
|
+
* form with plain `records` and `headers`.
|
|
5059
5178
|
*/
|
|
5060
5179
|
/**
|
|
5061
5180
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
5062
5181
|
*
|
|
5182
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
5183
|
+
* request can use the cache.
|
|
5184
|
+
*
|
|
5063
5185
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
5064
5186
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
5065
5187
|
* attached to the request.
|
|
@@ -5095,7 +5217,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5095
5217
|
* method: 'GET',
|
|
5096
5218
|
* [EnableHydration]: true
|
|
5097
5219
|
* });
|
|
5220
|
+
* ```
|
|
5098
5221
|
*
|
|
5222
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
5223
|
+
* reactive documents when hydration is enabled.
|
|
5099
5224
|
*/
|
|
5100
5225
|
const CacheHandler = { request(context, next) {
|
|
5101
5226
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -5268,14 +5393,12 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
5268
5393
|
}] });
|
|
5269
5394
|
}
|
|
5270
5395
|
|
|
5271
|
-
|
|
5272
|
-
//#region src/store/-private/utils/is-non-empty-string.ts
|
|
5396
|
+
// src/store/-private/utils/is-non-empty-string.ts
|
|
5273
5397
|
function isNonEmptyString(str) {
|
|
5274
5398
|
return Boolean(str && typeof str === "string");
|
|
5275
5399
|
}
|
|
5276
5400
|
|
|
5277
|
-
|
|
5278
|
-
//#region src/store/-private/utils/construct-resource.ts
|
|
5401
|
+
// src/store/-private/utils/construct-resource.ts
|
|
5279
5402
|
/**
|
|
5280
5403
|
* Given an existing resource identifier object (or a {@link ResourceKey}),
|
|
5281
5404
|
* returns it unchanged aside from coercing its `id`, if present, to a string.
|
|
@@ -5347,8 +5470,7 @@ function constructResource(type, id, lid) {
|
|
|
5347
5470
|
}
|
|
5348
5471
|
}
|
|
5349
5472
|
|
|
5350
|
-
|
|
5351
|
-
//#region src/store/-private/record-arrays/legacy-many-array.ts
|
|
5473
|
+
// src/store/-private/record-arrays/legacy-many-array.ts
|
|
5352
5474
|
/**
|
|
5353
5475
|
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
5354
5476
|
relationship.
|
|
@@ -5389,6 +5511,7 @@ the has-many.
|
|
|
5389
5511
|
We call the record to which a relationship belongs-to the
|
|
5390
5512
|
relationship's _owner_.
|
|
5391
5513
|
|
|
5514
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
5392
5515
|
@public
|
|
5393
5516
|
*/
|
|
5394
5517
|
/**
|
|
@@ -5420,7 +5543,7 @@ function createLegacyManyArray(options) {
|
|
|
5420
5543
|
isAsync: options.isAsync,
|
|
5421
5544
|
isPolymorphic: options.isPolymorphic,
|
|
5422
5545
|
identifier: options.identifier,
|
|
5423
|
-
key: options.field.name,
|
|
5546
|
+
key: options.field.sourceKey ?? options.field.name,
|
|
5424
5547
|
reload,
|
|
5425
5548
|
createRecord,
|
|
5426
5549
|
notify
|
|
@@ -5666,8 +5789,7 @@ function mutate(collection, mutation, _SIGNAL) {
|
|
|
5666
5789
|
notifyInternalSignal(_SIGNAL);
|
|
5667
5790
|
}
|
|
5668
5791
|
|
|
5669
|
-
|
|
5670
|
-
//#region src/reactive/-private/kind/alias-field.ts
|
|
5792
|
+
// src/reactive/-private/kind/alias-field.ts
|
|
5671
5793
|
function getAliasField(context) {
|
|
5672
5794
|
((test) => {
|
|
5673
5795
|
if (!test) throw new Error(`Alias field access is not implemented`);
|
|
@@ -5680,8 +5802,7 @@ function setAliasField(context) {
|
|
|
5680
5802
|
return false;
|
|
5681
5803
|
}
|
|
5682
5804
|
|
|
5683
|
-
|
|
5684
|
-
//#region src/reactive/-private/fields/managed-array.ts
|
|
5805
|
+
// src/reactive/-private/fields/managed-array.ts
|
|
5685
5806
|
const ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([
|
|
5686
5807
|
Symbol.iterator,
|
|
5687
5808
|
"concat",
|
|
@@ -5781,31 +5902,11 @@ var ManagedArray = class {
|
|
|
5781
5902
|
if (field.type) return schema.transformation(field).hydrate(rawValue, field.options ?? null, self.owner);
|
|
5782
5903
|
return rawValue;
|
|
5783
5904
|
}
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
let objectType;
|
|
5790
|
-
if (field.options?.polymorphic) {
|
|
5791
|
-
const typePath = field.options.type ?? "type";
|
|
5792
|
-
if (typePath === "@hash") {
|
|
5793
|
-
((test) => {
|
|
5794
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
5795
|
-
})(field.type);
|
|
5796
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
5797
|
-
} else {
|
|
5798
|
-
objectType = rawValue[typePath];
|
|
5799
|
-
((test) => {
|
|
5800
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
5801
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
5802
|
-
}
|
|
5803
|
-
} else {
|
|
5804
|
-
((test) => {
|
|
5805
|
-
if (!test) throw new Error(`A non-polymorphic SchemaArrayField must provide a SchemaObject type in its definition`);
|
|
5806
|
-
})(field.type);
|
|
5807
|
-
objectType = field.type;
|
|
5808
|
-
}
|
|
5905
|
+
const identity = fieldValueIdentity(schema, field, rawValue);
|
|
5906
|
+
((test) => {
|
|
5907
|
+
if (!test) throw new Error(`Expected a schema-array element to resolve to a schema-object identity`);
|
|
5908
|
+
})(identity !== null);
|
|
5909
|
+
const { type: objectType, hash } = identity;
|
|
5809
5910
|
/**
|
|
5810
5911
|
* When KeyMode=@hash the ReactiveResource is keyed into
|
|
5811
5912
|
* ManagedRecordRefs by the return value of @hash on the rawValue.
|
|
@@ -5815,8 +5916,10 @@ var ManagedArray = class {
|
|
|
5815
5916
|
*/
|
|
5816
5917
|
let schemaObjectKeyValue;
|
|
5817
5918
|
if (KeyMode === "@hash") {
|
|
5818
|
-
|
|
5819
|
-
|
|
5919
|
+
((test) => {
|
|
5920
|
+
if (!test) throw new Error(`Expected the '${objectType}' schema to declare an identity hash for key: '@hash'`);
|
|
5921
|
+
})(hash !== null);
|
|
5922
|
+
schemaObjectKeyValue = hash;
|
|
5820
5923
|
} else {
|
|
5821
5924
|
if (KeyMode !== "@identity" && KeyMode !== "@index") {
|
|
5822
5925
|
((test) => {
|
|
@@ -5963,8 +6066,7 @@ Object.defineProperty(ManagedArray.prototype, "[]", {
|
|
|
5963
6066
|
}
|
|
5964
6067
|
});
|
|
5965
6068
|
|
|
5966
|
-
|
|
5967
|
-
//#region src/reactive/-private/kind/array-field.ts
|
|
6069
|
+
// src/reactive/-private/kind/array-field.ts
|
|
5968
6070
|
function getArrayField(context) {
|
|
5969
6071
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5970
6072
|
const { record } = context;
|
|
@@ -6010,8 +6112,7 @@ function setArrayField(context) {
|
|
|
6010
6112
|
return true;
|
|
6011
6113
|
}
|
|
6012
6114
|
|
|
6013
|
-
|
|
6014
|
-
//#region src/reactive/-private/kind/attribute-field.ts
|
|
6115
|
+
// src/reactive/-private/kind/attribute-field.ts
|
|
6015
6116
|
function getAttributeField(context) {
|
|
6016
6117
|
entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6017
6118
|
const { cache } = context.store;
|
|
@@ -6022,8 +6123,7 @@ function setAttributeField(context) {
|
|
|
6022
6123
|
return true;
|
|
6023
6124
|
}
|
|
6024
6125
|
|
|
6025
|
-
|
|
6026
|
-
//#region src/reactive/-private/fields/get-field-key.ts
|
|
6126
|
+
// src/reactive/-private/fields/get-field-key.ts
|
|
6027
6127
|
const InvalidKinds = [
|
|
6028
6128
|
"alias",
|
|
6029
6129
|
"derived",
|
|
@@ -6042,8 +6142,7 @@ function getFieldCacheKey(field) {
|
|
|
6042
6142
|
return "sourceKey" in field && field.sourceKey ? field.sourceKey : field.name;
|
|
6043
6143
|
}
|
|
6044
6144
|
|
|
6045
|
-
|
|
6046
|
-
//#region src/reactive/-private/kind/belongs-to-field.ts
|
|
6145
|
+
// src/reactive/-private/kind/belongs-to-field.ts
|
|
6047
6146
|
function getBelongsToField(context) {
|
|
6048
6147
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6049
6148
|
const { field, resourceKey, store } = context;
|
|
@@ -6086,8 +6185,7 @@ function getResourceKey(record) {
|
|
|
6086
6185
|
return recordIdentifierFor(record);
|
|
6087
6186
|
}
|
|
6088
6187
|
|
|
6089
|
-
|
|
6090
|
-
//#region src/reactive/-private/kind/collection-field.ts
|
|
6188
|
+
// src/reactive/-private/kind/collection-field.ts
|
|
6091
6189
|
function getCollectionField(context) {
|
|
6092
6190
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6093
6191
|
((test) => {
|
|
@@ -6101,8 +6199,7 @@ function setCollectionField(context) {
|
|
|
6101
6199
|
return false;
|
|
6102
6200
|
}
|
|
6103
6201
|
|
|
6104
|
-
|
|
6105
|
-
//#region src/reactive/-private/kind/derived-field.ts
|
|
6202
|
+
// src/reactive/-private/kind/derived-field.ts
|
|
6106
6203
|
function getDerivedField(context) {
|
|
6107
6204
|
const { schema } = context.store;
|
|
6108
6205
|
return schema.derivation(context.field)(context.record, context.field.options ?? null, context.field.name);
|
|
@@ -6114,8 +6211,7 @@ function setDerivedField(context) {
|
|
|
6114
6211
|
return false;
|
|
6115
6212
|
}
|
|
6116
6213
|
|
|
6117
|
-
|
|
6118
|
-
//#region src/reactive/-private/kind/generic-field.ts
|
|
6214
|
+
// src/reactive/-private/kind/generic-field.ts
|
|
6119
6215
|
function getGenericField(context) {
|
|
6120
6216
|
const signal = entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6121
6217
|
signal.isStale = false;
|
|
@@ -6137,8 +6233,7 @@ function setGenericField(context) {
|
|
|
6137
6233
|
return true;
|
|
6138
6234
|
}
|
|
6139
6235
|
|
|
6140
|
-
|
|
6141
|
-
//#region src/reactive/-private/fields/many-array-manager.ts
|
|
6236
|
+
// src/reactive/-private/fields/many-array-manager.ts
|
|
6142
6237
|
var ManyArrayManager = class {
|
|
6143
6238
|
constructor(record, editable) {
|
|
6144
6239
|
const context = record[Context];
|
|
@@ -6200,8 +6295,7 @@ function extractCacheOptions(options) {
|
|
|
6200
6295
|
return cacheOptions;
|
|
6201
6296
|
}
|
|
6202
6297
|
|
|
6203
|
-
|
|
6204
|
-
//#region src/reactive/-private/kind/has-many-field.ts
|
|
6298
|
+
// src/reactive/-private/kind/has-many-field.ts
|
|
6205
6299
|
function getHasManyField(context) {
|
|
6206
6300
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6207
6301
|
const { store, field } = context;
|
|
@@ -6247,8 +6341,7 @@ function setHasManyField(context) {
|
|
|
6247
6341
|
return true;
|
|
6248
6342
|
}
|
|
6249
6343
|
|
|
6250
|
-
|
|
6251
|
-
//#region src/reactive/-private/kind/hash-field.ts
|
|
6344
|
+
// src/reactive/-private/kind/hash-field.ts
|
|
6252
6345
|
function getHashField(context) {
|
|
6253
6346
|
const { field, path, resourceKey } = context;
|
|
6254
6347
|
const { schema, cache } = context.store;
|
|
@@ -6266,8 +6359,7 @@ function setHashField(context) {
|
|
|
6266
6359
|
return false;
|
|
6267
6360
|
}
|
|
6268
6361
|
|
|
6269
|
-
|
|
6270
|
-
//#region src/reactive/-private/kind/identity-field.ts
|
|
6362
|
+
// src/reactive/-private/kind/identity-field.ts
|
|
6271
6363
|
function getIdentityField(context) {
|
|
6272
6364
|
entangleSignal(context.signals, context.record, "@identity", null);
|
|
6273
6365
|
return context.resourceKey.id;
|
|
@@ -6289,8 +6381,7 @@ function setIdentityField(context) {
|
|
|
6289
6381
|
return true;
|
|
6290
6382
|
}
|
|
6291
6383
|
|
|
6292
|
-
|
|
6293
|
-
//#region src/reactive/-private/kind/local-field.ts
|
|
6384
|
+
// src/reactive/-private/kind/local-field.ts
|
|
6294
6385
|
function getLocalField(context) {
|
|
6295
6386
|
const { field } = context;
|
|
6296
6387
|
const signal = getOrCreateInternalSignal(context.signals, context.record, field.name, field.options?.defaultValue ?? null);
|
|
@@ -6307,8 +6398,7 @@ function setLocalField(context) {
|
|
|
6307
6398
|
return true;
|
|
6308
6399
|
}
|
|
6309
6400
|
|
|
6310
|
-
|
|
6311
|
-
//#region src/reactive/-private/fields/managed-object.ts
|
|
6401
|
+
// src/reactive/-private/fields/managed-object.ts
|
|
6312
6402
|
const ObjectSymbols = /* @__PURE__ */ new Set([
|
|
6313
6403
|
OBJECT_SIGNAL,
|
|
6314
6404
|
Context,
|
|
@@ -6392,8 +6482,7 @@ function peekManagedObject(record, field) {
|
|
|
6392
6482
|
if (managedObjectMapForRecord) return managedObjectMapForRecord.get(field.name);
|
|
6393
6483
|
}
|
|
6394
6484
|
|
|
6395
|
-
|
|
6396
|
-
//#region src/reactive/-private/kind/object-field.ts
|
|
6485
|
+
// src/reactive/-private/kind/object-field.ts
|
|
6397
6486
|
function getObjectField(context) {
|
|
6398
6487
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6399
6488
|
const { record, field } = context;
|
|
@@ -6449,8 +6538,7 @@ function setObjectField(context) {
|
|
|
6449
6538
|
return true;
|
|
6450
6539
|
}
|
|
6451
6540
|
|
|
6452
|
-
|
|
6453
|
-
//#region src/reactive/-private/kind/resource-field.ts
|
|
6541
|
+
// src/reactive/-private/kind/resource-field.ts
|
|
6454
6542
|
var ResourceRelationship = class {
|
|
6455
6543
|
constructor(context) {
|
|
6456
6544
|
const { store, resourceKey } = context;
|
|
@@ -6493,8 +6581,7 @@ function setResourceField(context) {
|
|
|
6493
6581
|
return false;
|
|
6494
6582
|
}
|
|
6495
6583
|
|
|
6496
|
-
|
|
6497
|
-
//#region src/reactive/-private/kind/schema-array-field.ts
|
|
6584
|
+
// src/reactive/-private/kind/schema-array-field.ts
|
|
6498
6585
|
function setSchemaArrayField(context) {
|
|
6499
6586
|
const arrayValue = context.value === null ? null : context.value?.slice();
|
|
6500
6587
|
const fieldSignal = peekInternalSignal(context.signals, context.path.at(-1));
|
|
@@ -6511,8 +6598,7 @@ function setSchemaArrayField(context) {
|
|
|
6511
6598
|
return true;
|
|
6512
6599
|
}
|
|
6513
6600
|
|
|
6514
|
-
|
|
6515
|
-
//#region src/reactive/-private/kind/schema-object-field.ts
|
|
6601
|
+
// src/reactive/-private/kind/schema-object-field.ts
|
|
6516
6602
|
function getSchemaObjectField(context) {
|
|
6517
6603
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6518
6604
|
const { store, resourceKey, path, field } = context;
|
|
@@ -6529,29 +6615,12 @@ function getSchemaObjectField(context) {
|
|
|
6529
6615
|
}
|
|
6530
6616
|
return null;
|
|
6531
6617
|
}
|
|
6532
|
-
const
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
6539
|
-
})(field.type);
|
|
6540
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
6541
|
-
} else {
|
|
6542
|
-
objectType = rawValue[typePath];
|
|
6543
|
-
((test) => {
|
|
6544
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
6545
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
6546
|
-
}
|
|
6547
|
-
} else {
|
|
6548
|
-
((test) => {
|
|
6549
|
-
if (!test) throw new Error(`A non-polymorphic SchemaObjectField must provide a SchemaObject type in its definition`);
|
|
6550
|
-
})(field.type);
|
|
6551
|
-
objectType = field.type;
|
|
6552
|
-
}
|
|
6553
|
-
const hashField = schema.resource({ type: objectType }).identity;
|
|
6554
|
-
const identity = hashField ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : field.name;
|
|
6618
|
+
const resolved = fieldValueIdentity(store.schema, field, rawValue);
|
|
6619
|
+
((test) => {
|
|
6620
|
+
if (!test) throw new Error(`Expected a schema-object value to resolve to a schema-object identity`);
|
|
6621
|
+
})(resolved !== null);
|
|
6622
|
+
const { type: objectType, hash } = resolved;
|
|
6623
|
+
const identity = hash ?? field.name;
|
|
6555
6624
|
const cachedSchemaObject = signal.value;
|
|
6556
6625
|
if (cachedSchemaObject) {
|
|
6557
6626
|
if (cachedSchemaObject.type === objectType && cachedSchemaObject.identity === identity) return cachedSchemaObject.value;
|
|
@@ -6596,8 +6665,7 @@ function setSchemaObjectField(context) {
|
|
|
6596
6665
|
return true;
|
|
6597
6666
|
}
|
|
6598
6667
|
|
|
6599
|
-
|
|
6600
|
-
//#region src/reactive/-private/default-mode.ts
|
|
6668
|
+
// src/reactive/-private/default-mode.ts
|
|
6601
6669
|
/**
|
|
6602
6670
|
* A ReactiveResource context object passed to
|
|
6603
6671
|
* the get/set functions of a field kind implementation.
|
|
@@ -6713,14 +6781,15 @@ const DefaultMode = {
|
|
|
6713
6781
|
}
|
|
6714
6782
|
};
|
|
6715
6783
|
|
|
6716
|
-
|
|
6717
|
-
//#region src/reactive/-private/record.ts
|
|
6784
|
+
// src/reactive/-private/record.ts
|
|
6718
6785
|
const IgnoredGlobalFields = /* @__PURE__ */ new Set([
|
|
6719
6786
|
"length",
|
|
6720
6787
|
"nodeType",
|
|
6721
6788
|
"then",
|
|
6722
6789
|
"setInterval",
|
|
6723
6790
|
"document",
|
|
6791
|
+
"unknownProperty",
|
|
6792
|
+
"size",
|
|
6724
6793
|
STRUCTURED
|
|
6725
6794
|
]);
|
|
6726
6795
|
const RecordSymbols = /* @__PURE__ */ new Set([
|
|
@@ -6745,10 +6814,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
6745
6814
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
6746
6815
|
* object.
|
|
6747
6816
|
*
|
|
6817
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
6818
|
+
* define the schema it reads.
|
|
6819
|
+
*
|
|
6748
6820
|
* This class is not directly instantiable. To use it, you should
|
|
6749
6821
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
6750
6822
|
* with the matching hooks provided by this package.
|
|
6751
6823
|
*
|
|
6824
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
6752
6825
|
* @hideconstructor
|
|
6753
6826
|
* @public
|
|
6754
6827
|
*/
|
|
@@ -7202,6 +7275,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
7202
7275
|
* Edits to editable resources will be automatically committed if a new
|
|
7203
7276
|
* payload from the cache matches their existing value.
|
|
7204
7277
|
*
|
|
7278
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
7279
|
+
* changed locally.
|
|
7205
7280
|
* @public
|
|
7206
7281
|
*
|
|
7207
7282
|
* @returns a promise that resolves to the editable resource
|
|
@@ -7218,14 +7293,15 @@ function checkout(resource) {
|
|
|
7218
7293
|
* approach is for either the API or a Handler to reflect saved
|
|
7219
7294
|
* changes back to update the cache.
|
|
7220
7295
|
*
|
|
7296
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
7297
|
+
* bypassing a save round-trip.
|
|
7221
7298
|
* @public
|
|
7222
7299
|
*/
|
|
7223
7300
|
function commit(record) {
|
|
7224
7301
|
return record[Commit]();
|
|
7225
7302
|
}
|
|
7226
7303
|
|
|
7227
|
-
|
|
7228
|
-
//#region src/reactive/-private/hooks.ts
|
|
7304
|
+
// src/reactive/-private/hooks.ts
|
|
7229
7305
|
/**
|
|
7230
7306
|
* The store's default `instantiateRecord` hook implementation, which
|
|
7231
7307
|
* produces a {@link ReactiveResource} for `identifier` using the resource
|
|
@@ -7235,6 +7311,8 @@ function commit(record) {
|
|
|
7235
7311
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
7236
7312
|
* properties when creating a new legacy record.
|
|
7237
7313
|
*
|
|
7314
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
7315
|
+
* from its registered schema.
|
|
7238
7316
|
* @public
|
|
7239
7317
|
*/
|
|
7240
7318
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -7267,6 +7345,8 @@ function assertReactiveResource(record) {
|
|
|
7267
7345
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
7268
7346
|
* behavior.
|
|
7269
7347
|
*
|
|
7348
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
7349
|
+
* releases it.
|
|
7270
7350
|
* @public
|
|
7271
7351
|
*/
|
|
7272
7352
|
function teardownRecord(record) {
|
|
@@ -7274,8 +7354,7 @@ function teardownRecord(record) {
|
|
|
7274
7354
|
record[Destroy]();
|
|
7275
7355
|
}
|
|
7276
7356
|
|
|
7277
|
-
|
|
7278
|
-
//#region src/reactive/-private/schema.ts
|
|
7357
|
+
// src/reactive/-private/schema.ts
|
|
7279
7358
|
const Support = getOrSetGlobal("Support", /* @__PURE__ */ new WeakMap());
|
|
7280
7359
|
const ConstructorField = {
|
|
7281
7360
|
type: "@constructor",
|
|
@@ -7321,16 +7400,25 @@ _constructor[Type] = "@constructor";
|
|
|
7321
7400
|
* This should only be used for temporary migration purposes
|
|
7322
7401
|
* to the new schema system when migrating from either Model
|
|
7323
7402
|
* or ModelFragments.
|
|
7403
|
+
*
|
|
7404
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
7405
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
7324
7406
|
*/
|
|
7325
7407
|
/**
|
|
7326
7408
|
* Describes one feature added to a resource by a schema extension, as
|
|
7327
7409
|
* classified by {@link processExtension} from the property descriptor it
|
|
7328
7410
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
7411
|
+
*
|
|
7412
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
7413
|
+
* mutable value, or a getter/setter accessor.
|
|
7329
7414
|
*/
|
|
7330
7415
|
/**
|
|
7331
7416
|
* The result of {@link processExtension} normalizing a
|
|
7332
7417
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
7333
7418
|
* by name.
|
|
7419
|
+
*
|
|
7420
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
7421
|
+
* keyed by property name.
|
|
7334
7422
|
*/
|
|
7335
7423
|
const BannedKeys = ["constructor", "__proto__"];
|
|
7336
7424
|
function processExtension(extension) {
|
|
@@ -7430,14 +7518,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
7430
7518
|
* Utility for constructing a ResourceSchema with the recommended
|
|
7431
7519
|
* fields for the PolarisMode experience.
|
|
7432
7520
|
*
|
|
7521
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7522
|
+
* create a schema with it.
|
|
7523
|
+
*
|
|
7433
7524
|
* Using this requires registering the PolarisMode derivations
|
|
7434
7525
|
*
|
|
7435
7526
|
* ```ts
|
|
7436
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
7527
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
7437
7528
|
*
|
|
7438
7529
|
* registerDerivations(schema);
|
|
7439
7530
|
* ```
|
|
7440
7531
|
*
|
|
7532
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
7533
|
+
* PolarisMode resource schema.
|
|
7441
7534
|
* @public
|
|
7442
7535
|
* @param schema
|
|
7443
7536
|
* @return {PolarisResourceSchema}
|
|
@@ -7468,6 +7561,8 @@ function withDefaults(schema) {
|
|
|
7468
7561
|
*
|
|
7469
7562
|
* `^` returns the entire identifier object.
|
|
7470
7563
|
*
|
|
7564
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
7565
|
+
* for use in derived fields.
|
|
7471
7566
|
* @public
|
|
7472
7567
|
*/
|
|
7473
7568
|
const fromIdentity = (record, options, key) => {
|
|
@@ -7491,9 +7586,14 @@ fromIdentity[Type] = "@identity";
|
|
|
7491
7586
|
* to use the PolarisMode defaults provided by
|
|
7492
7587
|
*
|
|
7493
7588
|
* ```ts
|
|
7494
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
7589
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
7495
7590
|
* ```
|
|
7496
7591
|
*
|
|
7592
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
7593
|
+
* guide explains when you need to call it.
|
|
7594
|
+
*
|
|
7595
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
7596
|
+
* `withDefaults` depend on.
|
|
7497
7597
|
* @public
|
|
7498
7598
|
*/
|
|
7499
7599
|
function registerDerivations(schema) {
|
|
@@ -7569,6 +7669,9 @@ function assertConsistentAbstractFieldShape(abstractType, fieldName, existing, i
|
|
|
7569
7669
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
7570
7670
|
* between the raw value `T` stored in the cache and the presentation value
|
|
7571
7671
|
* `PT` exposed on the record.
|
|
7672
|
+
*
|
|
7673
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
7674
|
+
* record, with optional default.
|
|
7572
7675
|
*/
|
|
7573
7676
|
/**
|
|
7574
7677
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -7591,6 +7694,12 @@ function makeCachedDerivation(derivation) {
|
|
|
7591
7694
|
/**
|
|
7592
7695
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
7593
7696
|
*
|
|
7697
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
7698
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
7699
|
+
* shows how to give a store one.
|
|
7700
|
+
*
|
|
7701
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
7702
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
7594
7703
|
* @public
|
|
7595
7704
|
*/
|
|
7596
7705
|
var SchemaService = class {
|
|
@@ -7996,284 +8105,7 @@ function mergeMap(base, toApply) {
|
|
|
7996
8105
|
for (const [key, value] of toApply) base.set(key, value);
|
|
7997
8106
|
}
|
|
7998
8107
|
|
|
7999
|
-
|
|
8000
|
-
//#region src/reactive.ts
|
|
8001
|
-
/**
|
|
8002
|
-
* # About
|
|
8003
|
-
*
|
|
8004
|
-
* This module provides an implementation of reactive objects that a Store may use for creating
|
|
8005
|
-
* reactive representations of the raw data for requests, resources and their relationships
|
|
8006
|
-
* stored in the cache.
|
|
8007
|
-
*
|
|
8008
|
-
* - For configuring the store to use these reactive objects, see [The Setup Guide](/guides/configuration/)
|
|
8009
|
-
* - For defining resource schemas, see [The Schema Guide](/guides/the-manual/schemas/)
|
|
8010
|
-
*
|
|
8011
|
-
* Any method that returns a record instance will use the `instantiateRecord`
|
|
8012
|
-
* hook configured above to instantiate a ReactiveResource once this is in place.
|
|
8013
|
-
* After that, its up to you what ReactiveResource can do.
|
|
8014
|
-
*
|
|
8015
|
-
* ## Modes
|
|
8016
|
-
*
|
|
8017
|
-
* ReactiveResource has two modes: `legacy` and `polaris`.
|
|
8018
|
-
*
|
|
8019
|
-
* **LegacyMode** can be used to emulate the behaviors and capabilities of WarpDrive's `Model` class,
|
|
8020
|
-
* and because there is little distinction between Model and a ReactiveResource in LegacyMode we refer
|
|
8021
|
-
* to both of these approaches as LegacyMode. This mode is the default experience in V5.
|
|
8022
|
-
*
|
|
8023
|
-
* In LegacyMode:
|
|
8024
|
-
*
|
|
8025
|
-
* - records are mutable
|
|
8026
|
-
* - local changes immediately reflect app wide
|
|
8027
|
-
* - records have all the APIs of Model (references, state props, currentState, methods etc)
|
|
8028
|
-
* - the continued use of `@warp-drive-mirror/legacy` is required (though most imports from it can be removed)
|
|
8029
|
-
* - `async: true` relationships are supported (but not recommended outside of [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8030
|
-
*
|
|
8031
|
-
* ---
|
|
8032
|
-
*
|
|
8033
|
-
* **PolarisMode** is an upcoming suite of features that will become the default experience in V6.
|
|
8034
|
-
*
|
|
8035
|
-
* In PolarisMode:
|
|
8036
|
-
*
|
|
8037
|
-
* - records are immutable, unless creating a new resource or explicitly checking out a record for editing
|
|
8038
|
-
* - local changes are isolated until committed, displaying only via the editable version of the record
|
|
8039
|
-
* - records have a more limited API, focused on only what is in their schema.
|
|
8040
|
-
* - some common operations may have more friction to perform because intended utilities are not yet available
|
|
8041
|
-
* - `async: true` relationships are not supported (see [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8042
|
-
* - The `@warp-drive-mirror/legacy` package is not required
|
|
8043
|
-
*
|
|
8044
|
-
* These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
|
|
8045
|
-
* a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
|
|
8046
|
-
* a ReactiveResource or a Model.
|
|
8047
|
-
*
|
|
8048
|
-
* ---
|
|
8049
|
-
*
|
|
8050
|
-
* ## Basic Usage
|
|
8051
|
-
*
|
|
8052
|
-
* ReactiveResource is a reactive object that transforms raw data from an associated
|
|
8053
|
-
* cache into reactive data backed by Signals.
|
|
8054
|
-
*
|
|
8055
|
-
* The shape of the object and the transformation of raw cache data into its
|
|
8056
|
-
* reactive form is controlled by a resource schema.
|
|
8057
|
-
*
|
|
8058
|
-
* For instance, lets say your API is a [{json:api}](https://jsonapi.org) and your store is using
|
|
8059
|
-
* the Cache provided by {@link @warp-drive-mirror/json-api! | @warp-drive-mirror/json-api}, and a request
|
|
8060
|
-
* returns the following raw data:
|
|
8061
|
-
*
|
|
8062
|
-
* ```ts
|
|
8063
|
-
* {
|
|
8064
|
-
* data: {
|
|
8065
|
-
* type: 'user',
|
|
8066
|
-
* id: '1',
|
|
8067
|
-
* attributes: { firstName: 'Chris', lastName: 'Thoburn' },
|
|
8068
|
-
* relationships: { pets: { data: [{ type: 'dog', id: '1' }] }}
|
|
8069
|
-
* },
|
|
8070
|
-
* included: [
|
|
8071
|
-
* {
|
|
8072
|
-
* type: 'dog',
|
|
8073
|
-
* id: '1',
|
|
8074
|
-
* attributes: { name: 'Rey' },
|
|
8075
|
-
* relationships: { owner: { data: { type: 'user', id: '1' }}}
|
|
8076
|
-
* }
|
|
8077
|
-
* ]
|
|
8078
|
-
* }
|
|
8079
|
-
* ```
|
|
8080
|
-
*
|
|
8081
|
-
* We could describe the `'user'` and `'dog'` resources in the above payload
|
|
8082
|
-
* with the following schemas:
|
|
8083
|
-
*
|
|
8084
|
-
* ```ts
|
|
8085
|
-
* store.schema.registerResources([
|
|
8086
|
-
* {
|
|
8087
|
-
* type: 'user',
|
|
8088
|
-
* identity: { type: '@id', name: 'id' },
|
|
8089
|
-
* fields: [
|
|
8090
|
-
* {
|
|
8091
|
-
* type: '@identity',
|
|
8092
|
-
* name: '$type',
|
|
8093
|
-
* kind: 'derived',
|
|
8094
|
-
* options: { key: 'type' },
|
|
8095
|
-
* },
|
|
8096
|
-
* { kind: 'field', name: 'firstName' },
|
|
8097
|
-
* { kind: 'field', name: 'lastName' },
|
|
8098
|
-
* {
|
|
8099
|
-
* kind: 'derived',
|
|
8100
|
-
* name: 'name',
|
|
8101
|
-
* type: 'concat',
|
|
8102
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8103
|
-
* },
|
|
8104
|
-
* {
|
|
8105
|
-
* kind: 'hasMany',
|
|
8106
|
-
* name: 'pets',
|
|
8107
|
-
* type: 'pet',
|
|
8108
|
-
* options: {
|
|
8109
|
-
* async: false,
|
|
8110
|
-
* inverse: 'owner',
|
|
8111
|
-
* polymorphic: true,
|
|
8112
|
-
* linksMode: true,
|
|
8113
|
-
* }
|
|
8114
|
-
* }
|
|
8115
|
-
* ]
|
|
8116
|
-
* },
|
|
8117
|
-
* {
|
|
8118
|
-
* type: 'dog',
|
|
8119
|
-
* identity: { type: '@id', name: 'id' },
|
|
8120
|
-
* fields: [
|
|
8121
|
-
* {
|
|
8122
|
-
* type: '@identity',
|
|
8123
|
-
* name: '$type',
|
|
8124
|
-
* kind: 'derived',
|
|
8125
|
-
* options: { key: 'type' },
|
|
8126
|
-
* },
|
|
8127
|
-
* { kind: 'field', name: 'name' },
|
|
8128
|
-
* {
|
|
8129
|
-
* kind: 'belongsTo',
|
|
8130
|
-
* name: 'owner',
|
|
8131
|
-
* type: 'user',
|
|
8132
|
-
* options: {
|
|
8133
|
-
* async: false,
|
|
8134
|
-
* inverse: 'pets',
|
|
8135
|
-
* as: 'pet',
|
|
8136
|
-
* linksMode: true,
|
|
8137
|
-
* }
|
|
8138
|
-
* }
|
|
8139
|
-
* ]
|
|
8140
|
-
* }
|
|
8141
|
-
* ]);
|
|
8142
|
-
* ```
|
|
8143
|
-
*
|
|
8144
|
-
* With these schemas in place, the reactive objects that the store would
|
|
8145
|
-
* provide us whenever we encountered a `'user'` or a `'dog'` would be:
|
|
8146
|
-
*
|
|
8147
|
-
* ```ts
|
|
8148
|
-
* interface Pet {
|
|
8149
|
-
* readonly id: string;
|
|
8150
|
-
* readonly owner: User;
|
|
8151
|
-
* }
|
|
8152
|
-
*
|
|
8153
|
-
* interface Dog extends Pet {
|
|
8154
|
-
* readonly $type: 'dog';
|
|
8155
|
-
* readonly name: string;
|
|
8156
|
-
* }
|
|
8157
|
-
*
|
|
8158
|
-
* interface EditableUser {
|
|
8159
|
-
* readonly $type: 'user';
|
|
8160
|
-
* readonly id: string;
|
|
8161
|
-
* firstName: string;
|
|
8162
|
-
* lastName: string;
|
|
8163
|
-
* readonly name: string;
|
|
8164
|
-
* pets: Array<Dog | Pet>;
|
|
8165
|
-
* }
|
|
8166
|
-
*
|
|
8167
|
-
* interface User {
|
|
8168
|
-
* readonly $type: 'user';
|
|
8169
|
-
* readonly id: string;
|
|
8170
|
-
* readonly firstName: string;
|
|
8171
|
-
* readonly lastName: string;
|
|
8172
|
-
* readonly name: string;
|
|
8173
|
-
* readonly pets: Readonly<Array<Dog | Pet>>;
|
|
8174
|
-
* [Checkout](): Promise<EditableUser>
|
|
8175
|
-
* }>
|
|
8176
|
-
* ```
|
|
8177
|
-
*
|
|
8178
|
-
* Note how based on the schema the reactive object we receive is able to produce
|
|
8179
|
-
* `name` on user (despite no name field being in the cache), provide `$type`
|
|
8180
|
-
* pulled from the identity of the resource, and flatten the individual attributes
|
|
8181
|
-
* and relationships onto the record for easier use.
|
|
8182
|
-
*
|
|
8183
|
-
* Notice also how we typed this object with `readonly`. This is because while
|
|
8184
|
-
* ReactiveResource instances are ***deeply reactive***, they are also ***immutable***.
|
|
8185
|
-
*
|
|
8186
|
-
* We can mutate a ReactiveResource only be explicitly asking permission to do so, and
|
|
8187
|
-
* in the process gaining access to an editable copy. The immutable version will
|
|
8188
|
-
* not show any in-process edits made to this editable copy.
|
|
8189
|
-
*
|
|
8190
|
-
* ```ts
|
|
8191
|
-
* import { Checkout } from '@warp-drive-mirror/schema-record';
|
|
8192
|
-
*
|
|
8193
|
-
* const editable = await user[Checkout]();
|
|
8194
|
-
* ```
|
|
8195
|
-
*
|
|
8196
|
-
* ## Utilities
|
|
8197
|
-
*
|
|
8198
|
-
* ReactiveResource provides a schema builder that simplifies setting up a couple of
|
|
8199
|
-
* conventional fields like identity and `$type`. We can rewrite the schema
|
|
8200
|
-
* definition above using this utility like so:
|
|
8201
|
-
*
|
|
8202
|
-
* ```ts
|
|
8203
|
-
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
8204
|
-
*
|
|
8205
|
-
* store.schema.registerResources([
|
|
8206
|
-
* withDefaults({
|
|
8207
|
-
* type: 'user',
|
|
8208
|
-
* fields: [
|
|
8209
|
-
* { kind: 'field', name: 'firstName' },
|
|
8210
|
-
* { kind: 'field', name: 'lastName' },
|
|
8211
|
-
* {
|
|
8212
|
-
* kind: 'derived',
|
|
8213
|
-
* name: 'name',
|
|
8214
|
-
* type: 'concat',
|
|
8215
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8216
|
-
* },
|
|
8217
|
-
* {
|
|
8218
|
-
* kind: 'hasMany',
|
|
8219
|
-
* name: 'pets',
|
|
8220
|
-
* type: 'pet',
|
|
8221
|
-
* options: {
|
|
8222
|
-
* async: false,
|
|
8223
|
-
* inverse: 'owner',
|
|
8224
|
-
* polymorphic: true,
|
|
8225
|
-
* linksMode: true,
|
|
8226
|
-
* resetOnRemoteUpdate: false,
|
|
8227
|
-
* }
|
|
8228
|
-
* }
|
|
8229
|
-
* ]
|
|
8230
|
-
* }),
|
|
8231
|
-
* withDefaults({
|
|
8232
|
-
* type: 'dog',
|
|
8233
|
-
* fields: [
|
|
8234
|
-
* { kind: 'field', name: 'name' },
|
|
8235
|
-
* {
|
|
8236
|
-
* kind: 'belongsTo',
|
|
8237
|
-
* name: 'owner',
|
|
8238
|
-
* type: 'user',
|
|
8239
|
-
* options: {
|
|
8240
|
-
* async: false,
|
|
8241
|
-
* inverse: 'pets',
|
|
8242
|
-
* as: 'pet',
|
|
8243
|
-
* linksMode: true,
|
|
8244
|
-
* resetOnRemoteUpdate: false,
|
|
8245
|
-
* }
|
|
8246
|
-
* }
|
|
8247
|
-
* ]
|
|
8248
|
-
* })
|
|
8249
|
-
* ]);
|
|
8250
|
-
* ```
|
|
8251
|
-
*
|
|
8252
|
-
* ## Type Support
|
|
8253
|
-
*
|
|
8254
|
-
* ### Resource Schemas
|
|
8255
|
-
*
|
|
8256
|
-
* - {@link PolarisResourceSchema}
|
|
8257
|
-
* - {@link LegacyResourceSchema}
|
|
8258
|
-
* - {@link ObjectSchema}
|
|
8259
|
-
*
|
|
8260
|
-
* ### Resource Schema Type Utils
|
|
8261
|
-
*
|
|
8262
|
-
* - {@link resourceSchema}
|
|
8263
|
-
* - {@link objectSchema}
|
|
8264
|
-
* - {@link isResourceSchema}
|
|
8265
|
-
* - {@link isLegacyResourceSchema}
|
|
8266
|
-
*
|
|
8267
|
-
* ### Field Schemas
|
|
8268
|
-
*
|
|
8269
|
-
* - {@link LegacyModeFieldSchema}
|
|
8270
|
-
* - {@link PolarisModeFieldSchema}
|
|
8271
|
-
*
|
|
8272
|
-
* @module
|
|
8273
|
-
*/
|
|
8274
|
-
|
|
8275
|
-
//#endregion
|
|
8276
|
-
//#region src/request/-private/fetch.ts
|
|
8108
|
+
// src/request/-private/fetch.ts
|
|
8277
8109
|
const _fetch = typeof fetch !== "undefined" ? (...args) => fetch(...args) : typeof FastBoot !== "undefined" ? (...args) => FastBoot.require("node-fetch")(...args) : () => {
|
|
8278
8110
|
throw new Error("No Fetch Implementation Found");
|
|
8279
8111
|
};
|
|
@@ -8351,6 +8183,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
8351
8183
|
* A basic Fetch Handler which converts a request into a
|
|
8352
8184
|
* `fetch` call presuming the response to be `json`.
|
|
8353
8185
|
*
|
|
8186
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
8187
|
+
* guide shows where it sits in the handler chain.
|
|
8188
|
+
*
|
|
8354
8189
|
* ```ts
|
|
8355
8190
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
8356
8191
|
*
|
|
@@ -8358,6 +8193,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
8358
8193
|
* .use([Fetch]);
|
|
8359
8194
|
* ```
|
|
8360
8195
|
*
|
|
8196
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
8197
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
8361
8198
|
* @public
|
|
8362
8199
|
* @badge Handler
|
|
8363
8200
|
*/
|
|
@@ -8478,8 +8315,7 @@ function isDict(v) {
|
|
|
8478
8315
|
return v !== null && typeof v === "object";
|
|
8479
8316
|
}
|
|
8480
8317
|
|
|
8481
|
-
|
|
8482
|
-
//#region src/request/-private/manager.ts
|
|
8318
|
+
// src/request/-private/manager.ts
|
|
8483
8319
|
/**
|
|
8484
8320
|
* ## Import
|
|
8485
8321
|
*
|
|
@@ -8487,7 +8323,8 @@ function isDict(v) {
|
|
|
8487
8323
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
8488
8324
|
* ```
|
|
8489
8325
|
*
|
|
8490
|
-
* For complete usage guide see
|
|
8326
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
8327
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
8491
8328
|
*
|
|
8492
8329
|
* ## How It Works
|
|
8493
8330
|
*
|
|
@@ -8510,11 +8347,28 @@ function isDict(v) {
|
|
|
8510
8347
|
* ```ts [Setup.ts]
|
|
8511
8348
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
8512
8349
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
8513
|
-
* import
|
|
8350
|
+
* import { AuthHandler } from './auth-handler';
|
|
8514
8351
|
*
|
|
8515
8352
|
* // ... create manager
|
|
8516
8353
|
* const manager = new RequestManager()
|
|
8517
|
-
* .use([
|
|
8354
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
8355
|
+
* ```
|
|
8356
|
+
*
|
|
8357
|
+
* ```ts [auth-handler.ts]
|
|
8358
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
8359
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
8360
|
+
*
|
|
8361
|
+
* const token = '<token>';
|
|
8362
|
+
*
|
|
8363
|
+
* // adds a bearer token to every request, then passes it along
|
|
8364
|
+
* export const AuthHandler: Handler = {
|
|
8365
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
8366
|
+
* const headers = new Headers(context.request.headers);
|
|
8367
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
8368
|
+
*
|
|
8369
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
8370
|
+
* },
|
|
8371
|
+
* };
|
|
8518
8372
|
* ```
|
|
8519
8373
|
*
|
|
8520
8374
|
* ```ts [Usage.ts]
|
|
@@ -8530,6 +8384,20 @@ function isDict(v) {
|
|
|
8530
8384
|
*
|
|
8531
8385
|
* :::
|
|
8532
8386
|
*
|
|
8387
|
+
* ### RequestManager vs {@link Store.request}
|
|
8388
|
+
*
|
|
8389
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
8390
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
8391
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
8392
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
8393
|
+
*
|
|
8394
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
8395
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
8396
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
8397
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
8398
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
8399
|
+
* `StructuredDocument`.
|
|
8400
|
+
*
|
|
8533
8401
|
* ### Futures
|
|
8534
8402
|
*
|
|
8535
8403
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -8568,6 +8436,7 @@ function isDict(v) {
|
|
|
8568
8436
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
8569
8437
|
* ```
|
|
8570
8438
|
*
|
|
8439
|
+
* @summary Runs each request through a chain of handlers that can fulfill, modify, or pass it along, and returns a `Future` for the response.
|
|
8571
8440
|
* @public
|
|
8572
8441
|
*/
|
|
8573
8442
|
var RequestManager = class {
|
|
@@ -8627,7 +8496,23 @@ var RequestManager = class {
|
|
|
8627
8496
|
/**
|
|
8628
8497
|
* Issue a Request.
|
|
8629
8498
|
*
|
|
8630
|
-
*
|
|
8499
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
8500
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
8501
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
8502
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
8503
|
+
* `RequestManager` created on its own has neither.
|
|
8504
|
+
*
|
|
8505
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
8506
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
8507
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
8508
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
8509
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
8510
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
8511
|
+
*
|
|
8512
|
+
* @example
|
|
8513
|
+
* ```ts
|
|
8514
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
8515
|
+
* ```
|
|
8631
8516
|
*
|
|
8632
8517
|
* @public
|
|
8633
8518
|
*/
|
|
@@ -8708,9 +8593,10 @@ var RequestManager = class {
|
|
|
8708
8593
|
*
|
|
8709
8594
|
* @private
|
|
8710
8595
|
*/
|
|
8711
|
-
|
|
8712
|
-
//#region src/index.ts
|
|
8596
|
+
// src/index.ts
|
|
8713
8597
|
/**
|
|
8598
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
8599
|
+
* `useRecommendedStore` for building a configured store.
|
|
8714
8600
|
* @module
|
|
8715
8601
|
* @mergeModuleWith <project>
|
|
8716
8602
|
*/
|
|
@@ -8719,11 +8605,17 @@ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
|
8719
8605
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
8720
8606
|
/**
|
|
8721
8607
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
8608
|
+
*
|
|
8609
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
8610
|
+
* `useRecommendedStore` wires into a Store class.
|
|
8722
8611
|
*/
|
|
8723
8612
|
/**
|
|
8724
8613
|
* Creates a configured Store class with recommended defaults
|
|
8725
8614
|
* for schema handling, reactivity, caching, and request management.
|
|
8726
8615
|
*
|
|
8616
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
8617
|
+
* configuring the store with it.
|
|
8618
|
+
*
|
|
8727
8619
|
* ```ts
|
|
8728
8620
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
8729
8621
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -8826,6 +8718,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
8826
8718
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
8827
8719
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
8828
8720
|
* `LoggingHandler` does above).
|
|
8721
|
+
*
|
|
8722
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
8723
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
8829
8724
|
*/
|
|
8830
8725
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
8831
8726
|
return class AppStore extends StoreKlass {
|
|
@@ -8879,6 +8774,5 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
8879
8774
|
};
|
|
8880
8775
|
}
|
|
8881
8776
|
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
//# sourceMappingURL=src-DXwW-R57.js.map
|
|
8777
|
+
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 };
|
|
8778
|
+
//# sourceMappingURL=src-jHpowq3S.js.map
|