@warp-drive-mirror/core 5.10.0-alpha.2 → 5.10.0-alpha.20
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-BE5B0ZXl.d.ts} +1526 -1133
- package/dist/internal-BE5B0ZXl.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-BTF6QRQ3.js} +346 -456
- package/dist/src-BTF6QRQ3.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-Dt1O1Pw1.js} +335 -444
- package/dist/unpkg/dev/src-Dt1O1Pw1.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-B5QlMjHe.js} +340 -450
- package/dist/unpkg/dev-deprecated/src-B5QlMjHe.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-evv7LXnE.js} +307 -414
- package/dist/unpkg/prod/src-evv7LXnE.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-D6BqG5K8.js} +312 -420
- package/dist/unpkg/prod-deprecated/src-D6BqG5K8.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,17 +1,17 @@
|
|
|
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, 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-CrUi_3E_.js";
|
|
3
3
|
import { EnableHydration, STRUCTURED, SkipCache } from "./types/request.js";
|
|
4
|
-
import { a as upgradePromise, c as executeNextHandler, d as getRequestResult, f as setPromiseResult, l as clearRequestResult, o as DOMError, p as cloneResponseProperties, s as IS_CACHE_HANDLER, t as withBrand } from "./request-
|
|
5
|
-
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-
|
|
4
|
+
import { a as upgradePromise, c as executeNextHandler, d as getRequestResult, f as setPromiseResult, l as clearRequestResult, o as DOMError, p as cloneResponseProperties, s as IS_CACHE_HANDLER, t as withBrand } from "./request-Cgw3j6Dx.js";
|
|
5
|
+
import { a as SOURCE, i as Destroy, n as Commit, r as Context, t as Checkout } from "./-private-BiuED7nc.js";
|
|
6
6
|
import { CACHE_OWNER } from "./types/identifier.js";
|
|
7
7
|
import { dasherize } from "./utils/string.js";
|
|
8
8
|
import { RecordStore, Type } from "./types/symbols.js";
|
|
9
9
|
import { isResourceSchema } from "./types/schema/fields.js";
|
|
10
|
-
import { t as DefaultCachePolicy } from "./store-
|
|
10
|
+
import { t as DefaultCachePolicy } from "./store-Bz9R5hGB.js";
|
|
11
11
|
import { setIsMaybeMirage } from "./types/runtime.js";
|
|
12
12
|
import * as _importSync20 from "@ember/object";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// src/reactive/-private/document.ts
|
|
15
15
|
function urlFromLink(link) {
|
|
16
16
|
if (typeof link === "string") return link;
|
|
17
17
|
return link.href;
|
|
@@ -21,10 +21,15 @@ function urlFromLink(link) {
|
|
|
21
21
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
22
22
|
* ReactiveResource instances.
|
|
23
23
|
*
|
|
24
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
25
|
+
* shows when a request's content is a ReactiveDocument.
|
|
26
|
+
*
|
|
24
27
|
* It is not directly instantiated by the user, and its properties should not
|
|
25
28
|
* be directly modified. Whether individual properties are mutable or not is
|
|
26
29
|
* determined by the record instance itself.
|
|
27
30
|
*
|
|
31
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
32
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
28
33
|
* @public
|
|
29
34
|
*/
|
|
30
35
|
const ReactiveDocumentProto = {
|
|
@@ -124,8 +129,7 @@ function createReactiveDocument(store, cacheKey, localCache) {
|
|
|
124
129
|
return doc;
|
|
125
130
|
}
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
//#region src/store/-private/managers/cache-capabilities-manager.ts
|
|
132
|
+
// src/store/-private/managers/cache-capabilities-manager.ts
|
|
129
133
|
var CacheCapabilitiesManager = class {
|
|
130
134
|
/** @internal */
|
|
131
135
|
/** @internal */
|
|
@@ -214,8 +218,7 @@ CacheCapabilitiesManager.prototype.getSchemaDefinitionService = function() {
|
|
|
214
218
|
*/
|
|
215
219
|
function assertPrivateCapabilities(manager) {}
|
|
216
220
|
|
|
217
|
-
|
|
218
|
-
//#region src/store/-private/caches/instance-cache.ts
|
|
221
|
+
// src/store/-private/caches/instance-cache.ts
|
|
219
222
|
const RecordCache = getOrSetGlobal("RecordCache", /* @__PURE__ */ new Map());
|
|
220
223
|
function peekResourceKey(record) {
|
|
221
224
|
return RecordCache.get(record);
|
|
@@ -234,6 +237,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
234
237
|
const { id, type, lid } = identifier;
|
|
235
238
|
```
|
|
236
239
|
|
|
240
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
237
241
|
@public
|
|
238
242
|
@param record a record instance previously obstained from the store.
|
|
239
243
|
*/
|
|
@@ -450,8 +454,7 @@ function unloadRecord(instances, identifier) {
|
|
|
450
454
|
instances.store._requestCache._clearEntries(identifier);
|
|
451
455
|
}
|
|
452
456
|
|
|
453
|
-
|
|
454
|
-
//#region src/store/-private/caches/resource-utils.ts
|
|
457
|
+
// src/store/-private/caches/resource-utils.ts
|
|
455
458
|
function isResource(resource) {
|
|
456
459
|
return Boolean(resource && typeof resource === "object");
|
|
457
460
|
}
|
|
@@ -468,8 +471,7 @@ function hasType(resource) {
|
|
|
468
471
|
return hasProp(resource, "type");
|
|
469
472
|
}
|
|
470
473
|
|
|
471
|
-
|
|
472
|
-
//#region src/store/-private/utils/coerce-id.ts
|
|
474
|
+
// src/store/-private/utils/coerce-id.ts
|
|
473
475
|
/**
|
|
474
476
|
* Normalizes a resource `id` entering the store to a string (or `null`).
|
|
475
477
|
*
|
|
@@ -504,8 +506,7 @@ function ensureStringId(id) {
|
|
|
504
506
|
return normalized;
|
|
505
507
|
}
|
|
506
508
|
|
|
507
|
-
|
|
508
|
-
//#region src/store/-private/utils/normalize-model-name.ts
|
|
509
|
+
// src/store/-private/utils/normalize-model-name.ts
|
|
509
510
|
/**
|
|
510
511
|
* Normalizes a resource `type` to its dasherized form, e.g. `myClass` to
|
|
511
512
|
* `my-class`. Re-exported elsewhere as `_deprecatingNormalize`.
|
|
@@ -520,8 +521,7 @@ function normalizeModelName(type) {
|
|
|
520
521
|
return dasherize(type);
|
|
521
522
|
}
|
|
522
523
|
|
|
523
|
-
|
|
524
|
-
//#region src/store/-private/managers/cache-key-manager.ts
|
|
524
|
+
// src/store/-private/managers/cache-key-manager.ts
|
|
525
525
|
/**
|
|
526
526
|
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
527
527
|
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
@@ -536,6 +536,43 @@ function isResourceKey(identifier) {
|
|
|
536
536
|
function isRequestKey(identifier) {
|
|
537
537
|
return identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
538
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
541
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
542
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
543
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
544
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
545
|
+
*/
|
|
546
|
+
/**
|
|
547
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
548
|
+
*
|
|
549
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
550
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
551
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
552
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
553
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
554
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
555
|
+
*
|
|
556
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
557
|
+
* returns `null`.
|
|
558
|
+
*/
|
|
559
|
+
function fieldValueIdentity(schema, field, value) {
|
|
560
|
+
if (field.kind !== "schema-object" && field.kind !== "schema-array") return null;
|
|
561
|
+
if (!value || typeof value !== "object") return null;
|
|
562
|
+
const rawValue = value;
|
|
563
|
+
let type;
|
|
564
|
+
if (field.options?.polymorphic) {
|
|
565
|
+
const typePath = field.options.type ?? "type";
|
|
566
|
+
if (typePath === "@hash") type = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
567
|
+
else type = rawValue[typePath];
|
|
568
|
+
} else type = field.type;
|
|
569
|
+
const hashField = schema.resource({ type }).identity;
|
|
570
|
+
const hash = hashField && hashField.kind === "@hash" ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : null;
|
|
571
|
+
return {
|
|
572
|
+
type,
|
|
573
|
+
hash
|
|
574
|
+
};
|
|
575
|
+
}
|
|
539
576
|
const _crypto = typeof FastBoot !== "undefined" ? FastBoot.require("crypto") : globalThis.crypto;
|
|
540
577
|
function uuidv4() {
|
|
541
578
|
return _crypto.randomUUID();
|
|
@@ -609,6 +646,8 @@ implement this hook.
|
|
|
609
646
|
|
|
610
647
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
611
648
|
|
|
649
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
650
|
+
before the store is created.
|
|
612
651
|
@public
|
|
613
652
|
*/
|
|
614
653
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -643,6 +682,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
643
682
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
644
683
|
without providing an `id` when one is missing will throw an error.
|
|
645
684
|
|
|
685
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
686
|
+
own secondary lookup tables.
|
|
646
687
|
@public
|
|
647
688
|
*/
|
|
648
689
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -660,6 +701,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
660
701
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
661
702
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
662
703
|
|
|
704
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
705
|
+
lookup tables.
|
|
663
706
|
@public
|
|
664
707
|
*/
|
|
665
708
|
function setIdentifierForgetMethod(method) {
|
|
@@ -679,6 +722,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
679
722
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
680
723
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
681
724
|
|
|
725
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
726
|
+
key-generation state.
|
|
682
727
|
@public
|
|
683
728
|
*/
|
|
684
729
|
function setIdentifierResetMethod(method) {
|
|
@@ -697,6 +742,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
697
742
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
698
743
|
```
|
|
699
744
|
|
|
745
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
746
|
+
must be set before the store is created.
|
|
700
747
|
@public
|
|
701
748
|
*/
|
|
702
749
|
function setKeyInfoForResource(method) {
|
|
@@ -1041,13 +1088,18 @@ function addResourceToCache(cache, identifier) {
|
|
|
1041
1088
|
if (identifier.id) typeSet.id.set(identifier.id, identifier);
|
|
1042
1089
|
}
|
|
1043
1090
|
|
|
1044
|
-
|
|
1045
|
-
//#region src/store/-private/managers/notification-manager.ts
|
|
1091
|
+
// src/store/-private/managers/notification-manager.ts
|
|
1046
1092
|
/**
|
|
1047
1093
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1094
|
+
*
|
|
1095
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
1096
|
+
* or `state`.
|
|
1048
1097
|
*/
|
|
1049
1098
|
/**
|
|
1050
1099
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1100
|
+
*
|
|
1101
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
1102
|
+
* `invalidated`.
|
|
1051
1103
|
*/
|
|
1052
1104
|
function isCacheOperationValue(value) {
|
|
1053
1105
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -1055,6 +1107,9 @@ function isCacheOperationValue(value) {
|
|
|
1055
1107
|
/**
|
|
1056
1108
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1057
1109
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1110
|
+
*
|
|
1111
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
1112
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
1058
1113
|
*/
|
|
1059
1114
|
/**
|
|
1060
1115
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -1062,6 +1117,8 @@ function isCacheOperationValue(value) {
|
|
|
1062
1117
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1063
1118
|
* instead of once per key.
|
|
1064
1119
|
*
|
|
1120
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
1121
|
+
* `relationships` changes in one call.
|
|
1065
1122
|
* @since 5.9.0
|
|
1066
1123
|
* @public
|
|
1067
1124
|
*/
|
|
@@ -1096,6 +1153,8 @@ function isCacheOperationValue(value) {
|
|
|
1096
1153
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1097
1154
|
* have no local/remote duality.
|
|
1098
1155
|
*
|
|
1156
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
1157
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
1099
1158
|
* @public
|
|
1100
1159
|
*/
|
|
1101
1160
|
/**
|
|
@@ -1206,6 +1265,8 @@ function _unsubscribe(token, cache) {
|
|
|
1206
1265
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
1207
1266
|
* work with any framework or change-notification system.
|
|
1208
1267
|
*
|
|
1268
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
1269
|
+
* cached resources and request documents.
|
|
1209
1270
|
* @hideconstructor
|
|
1210
1271
|
* @public
|
|
1211
1272
|
*/
|
|
@@ -1392,8 +1453,7 @@ function hasSubscribers(cache, cacheKey, value) {
|
|
|
1392
1453
|
return Boolean(callbackMap?.length);
|
|
1393
1454
|
}
|
|
1394
1455
|
|
|
1395
|
-
|
|
1396
|
-
//#region src/store/-private/record-arrays/-utils.ts
|
|
1456
|
+
// src/store/-private/record-arrays/-utils.ts
|
|
1397
1457
|
/**
|
|
1398
1458
|
* LegacyArrays have the capability of updating via `array.update()`
|
|
1399
1459
|
* and saving each contained record individually via `array.save()`
|
|
@@ -1469,8 +1529,7 @@ function safeForEach$1(instance, arr, store, callback, target) {
|
|
|
1469
1529
|
return instance;
|
|
1470
1530
|
}
|
|
1471
1531
|
|
|
1472
|
-
|
|
1473
|
-
//#region src/reactive/-private/fields/extension.ts
|
|
1532
|
+
// src/reactive/-private/fields/extension.ts
|
|
1474
1533
|
function expectNever(value) {}
|
|
1475
1534
|
function isExtensionProp(extensions, prop) {
|
|
1476
1535
|
return Boolean(extensions && typeof prop !== "number" && extensions.has(prop));
|
|
@@ -1537,8 +1596,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
1537
1596
|
}
|
|
1538
1597
|
}
|
|
1539
1598
|
|
|
1540
|
-
|
|
1541
|
-
//#region src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
1599
|
+
// src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
1542
1600
|
/**
|
|
1543
1601
|
* The global `Proxy` constructor, retyped with the corrected
|
|
1544
1602
|
* {@link ProxyConstructor} signature above so that `target` and `receiver`
|
|
@@ -1548,8 +1606,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
1548
1606
|
*/
|
|
1549
1607
|
const NativeProxy = Proxy;
|
|
1550
1608
|
|
|
1551
|
-
|
|
1552
|
-
//#region src/store/-private/record-arrays/resource-array.ts
|
|
1609
|
+
// src/store/-private/record-arrays/resource-array.ts
|
|
1553
1610
|
const IS_COLLECTION = getOrSetGlobal("IS_COLLECTION", Symbol.for("Collection"));
|
|
1554
1611
|
function isContextProp(prop) {
|
|
1555
1612
|
return prop === "destroy" || prop === "isDestroying" || prop === "isDestroyed";
|
|
@@ -1576,10 +1633,15 @@ const MUTABLE_PROPS = [
|
|
|
1576
1633
|
* as the base for relationship and legacy record-array types such as
|
|
1577
1634
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
1578
1635
|
*
|
|
1636
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
1637
|
+
* how it relates to resources.
|
|
1638
|
+
*
|
|
1579
1639
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
1580
1640
|
* both report `true`. The array stays in sync with the cache, updating
|
|
1581
1641
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
1582
1642
|
*
|
|
1643
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
1644
|
+
* and underlying relationship and legacy record arrays.
|
|
1583
1645
|
* @public
|
|
1584
1646
|
*/
|
|
1585
1647
|
/**
|
|
@@ -1790,8 +1852,7 @@ function createRequestCollection(config) {
|
|
|
1790
1852
|
});
|
|
1791
1853
|
}
|
|
1792
1854
|
|
|
1793
|
-
|
|
1794
|
-
//#region src/store/-private/record-arrays/legacy-live-array.ts
|
|
1855
|
+
// src/store/-private/record-arrays/legacy-live-array.ts
|
|
1795
1856
|
/**
|
|
1796
1857
|
* LiveArrays contain all the known records for a given `ResourceType`.
|
|
1797
1858
|
*
|
|
@@ -1852,6 +1913,8 @@ function createRequestCollection(config) {
|
|
|
1852
1913
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
1853
1914
|
* would be empty.
|
|
1854
1915
|
*
|
|
1916
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
1917
|
+
* `store.findAll`.
|
|
1855
1918
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
1856
1919
|
*/
|
|
1857
1920
|
/**
|
|
@@ -1891,8 +1954,7 @@ function _updateLiveArray() {
|
|
|
1891
1954
|
return this[Context].store.findAll(this.modelName, { reload: true });
|
|
1892
1955
|
}
|
|
1893
1956
|
|
|
1894
|
-
|
|
1895
|
-
//#region src/store/-private/record-arrays/legacy-query.ts
|
|
1957
|
+
// src/store/-private/record-arrays/legacy-query.ts
|
|
1896
1958
|
/**
|
|
1897
1959
|
* QueryArrays contain the primary records returned when querying
|
|
1898
1960
|
* for records by `ResourceType`.
|
|
@@ -1963,6 +2025,8 @@ function _updateLiveArray() {
|
|
|
1963
2025
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
1964
2026
|
* from the store for book-keeping.
|
|
1965
2027
|
*
|
|
2028
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
2029
|
+
* `update()` and released with `destroy()`.
|
|
1966
2030
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
1967
2031
|
*/
|
|
1968
2032
|
/**
|
|
@@ -2019,8 +2083,7 @@ function destroyCollection(clear) {
|
|
|
2019
2083
|
manager._pending.delete(this);
|
|
2020
2084
|
}
|
|
2021
2085
|
|
|
2022
|
-
|
|
2023
|
-
//#region src/store/-private/managers/record-array-manager.ts
|
|
2086
|
+
// src/store/-private/managers/record-array-manager.ts
|
|
2024
2087
|
const FAKE_ARR = getOrSetGlobal("FAKE_ARR", {});
|
|
2025
2088
|
const SLICE_BATCH_SIZE = 4761;
|
|
2026
2089
|
/**
|
|
@@ -2433,8 +2496,7 @@ function isLegacyLiveArray(array) {
|
|
|
2433
2496
|
return context.features !== null && context.features.DEPRECATED_CLASS_NAME === "LiveArray";
|
|
2434
2497
|
}
|
|
2435
2498
|
|
|
2436
|
-
|
|
2437
|
-
//#region src/store/-private/network/request-cache.ts
|
|
2499
|
+
// src/store/-private/network/request-cache.ts
|
|
2438
2500
|
const Touching = getOrSetGlobal("Touching", Symbol("touching"));
|
|
2439
2501
|
const RequestPromise = getOrSetGlobal("RequestPromise", Symbol("promise"));
|
|
2440
2502
|
const EMPTY_ARR = [];
|
|
@@ -2642,8 +2704,7 @@ var RequestStateService = class {
|
|
|
2642
2704
|
*
|
|
2643
2705
|
* @private
|
|
2644
2706
|
*/
|
|
2645
|
-
|
|
2646
|
-
//#region ../../node_modules/.pnpm/@embroider+macros@1.20.7/node_modules/@embroider/macros/src/addon/es-compat2.js
|
|
2707
|
+
// ../../node_modules/.pnpm/@embroider+macros@1.21.4/node_modules/@embroider/macros/src/addon/es-compat2.js
|
|
2647
2708
|
function esCompat(m) {
|
|
2648
2709
|
return m?.__esModule ? m : {
|
|
2649
2710
|
default: m,
|
|
@@ -2651,8 +2712,7 @@ function esCompat(m) {
|
|
|
2651
2712
|
};
|
|
2652
2713
|
}
|
|
2653
2714
|
|
|
2654
|
-
|
|
2655
|
-
//#region src/store/-private/store-service.ts
|
|
2715
|
+
// src/store/-private/store-service.ts
|
|
2656
2716
|
const _BaseClass = esCompat(_importSync20);
|
|
2657
2717
|
const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
|
|
2658
2718
|
/**
|
|
@@ -2663,6 +2723,10 @@ const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
|
|
|
2663
2723
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
2664
2724
|
* requests for data with schemas, caching and reactivity.
|
|
2665
2725
|
*
|
|
2726
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
2727
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
2728
|
+
* through it.
|
|
2729
|
+
*
|
|
2666
2730
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
2667
2731
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
2668
2732
|
* even when you aren't sure yet.
|
|
@@ -2670,6 +2734,7 @@ const BaseClass = _BaseClass.default ? _BaseClass.default : _BaseClass;
|
|
|
2670
2734
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
2671
2735
|
* is possible.
|
|
2672
2736
|
*
|
|
2737
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
2673
2738
|
* @public
|
|
2674
2739
|
* @hideconstructor
|
|
2675
2740
|
*/
|
|
@@ -2854,12 +2919,25 @@ var Store = class extends BaseClass {
|
|
|
2854
2919
|
/** @internal */
|
|
2855
2920
|
_getAllPending() {}
|
|
2856
2921
|
/**
|
|
2857
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
2922
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
2858
2923
|
* :::
|
|
2859
2924
|
*
|
|
2860
2925
|
* Issue a request via the configured {@link RequestManager},
|
|
2861
2926
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
2862
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
2927
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
2928
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
2929
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
2930
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
2931
|
+
* {@link StructuredDocument}.
|
|
2932
|
+
*
|
|
2933
|
+
* #### Building Requests
|
|
2934
|
+
*
|
|
2935
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
2936
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
2937
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
2938
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
2939
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
2940
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
2863
2941
|
*
|
|
2864
2942
|
* #### Request Cache Keys
|
|
2865
2943
|
*
|
|
@@ -2904,6 +2982,29 @@ var Store = class extends BaseClass {
|
|
|
2904
2982
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
2905
2983
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
2906
2984
|
*
|
|
2985
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
2986
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
2987
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
2988
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
2989
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
2990
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
2991
|
+
*
|
|
2992
|
+
* #### Typing The Response
|
|
2993
|
+
*
|
|
2994
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
2995
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
2996
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
2997
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
2998
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
2999
|
+
*
|
|
3000
|
+
* @example
|
|
3001
|
+
* ```ts
|
|
3002
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
3003
|
+
*
|
|
3004
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
3005
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
3006
|
+
* ```
|
|
3007
|
+
*
|
|
2907
3008
|
* @public
|
|
2908
3009
|
*/
|
|
2909
3010
|
request(requestConfig) {
|
|
@@ -3364,8 +3465,7 @@ function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
|
|
|
3364
3465
|
return recordIdentifierFor(recordOrPromiseRecord);
|
|
3365
3466
|
}
|
|
3366
3467
|
|
|
3367
|
-
|
|
3368
|
-
//#region src/store/deprecated/-private.ts
|
|
3468
|
+
// src/store/deprecated/-private.ts
|
|
3369
3469
|
function preloadData(store, identifier, preload) {
|
|
3370
3470
|
const jsonPayload = {};
|
|
3371
3471
|
const fields = store.schema.fields(identifier);
|
|
@@ -3404,6 +3504,8 @@ function _convertPreloadRelationshipToJSON(value, type) {
|
|
|
3404
3504
|
* for @warp-drive-mirror/legacy/model or when wrapping schema for legacy
|
|
3405
3505
|
* Adapters/Serializers.
|
|
3406
3506
|
*
|
|
3507
|
+
* @summary Legacy shape of a Model class's static schema API (fields, attributes, relationships, iterators) used
|
|
3508
|
+
* by the legacy schema service and Adapters/Serializers.
|
|
3407
3509
|
*/
|
|
3408
3510
|
function _resourceIsFullDeleted(identifier, cache) {
|
|
3409
3511
|
return cache.isDeletionCommitted(identifier) || cache.isNew(identifier) && cache.isDeleted(identifier);
|
|
@@ -3628,8 +3730,7 @@ var ShimModelClass = class {
|
|
|
3628
3730
|
}
|
|
3629
3731
|
};
|
|
3630
3732
|
|
|
3631
|
-
|
|
3632
|
-
//#region src/store/deprecated/store.ts
|
|
3733
|
+
// src/store/deprecated/store.ts
|
|
3633
3734
|
Store.prototype.findRecord = function(resource, id, options) {
|
|
3634
3735
|
if (isMaybeIdentifier(resource)) options = id;
|
|
3635
3736
|
else {
|
|
@@ -3734,8 +3835,7 @@ function upgradeInstanceCaches(cache) {
|
|
|
3734
3835
|
return withReferences;
|
|
3735
3836
|
}
|
|
3736
3837
|
|
|
3737
|
-
|
|
3738
|
-
//#region src/store/-private/cache-handler/utils.ts
|
|
3838
|
+
// src/store/-private/cache-handler/utils.ts
|
|
3739
3839
|
const MUTATION_OPS$1 = /* @__PURE__ */ new Set([
|
|
3740
3840
|
"createRecord",
|
|
3741
3841
|
"updateRecord",
|
|
@@ -3775,15 +3875,20 @@ function getPriority(identifier, deduped, priority) {
|
|
|
3775
3875
|
return priority;
|
|
3776
3876
|
}
|
|
3777
3877
|
|
|
3778
|
-
|
|
3779
|
-
//#region src/store/-private/cache-handler/handler.ts
|
|
3878
|
+
// src/store/-private/cache-handler/handler.ts
|
|
3780
3879
|
/**
|
|
3781
3880
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
3782
3881
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
3882
|
+
*
|
|
3883
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
3884
|
+
* form with plain `records` and `headers`.
|
|
3783
3885
|
*/
|
|
3784
3886
|
/**
|
|
3785
3887
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
3786
3888
|
*
|
|
3889
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
3890
|
+
* request can use the cache.
|
|
3891
|
+
*
|
|
3787
3892
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
3788
3893
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
3789
3894
|
* attached to the request.
|
|
@@ -3819,7 +3924,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
3819
3924
|
* method: 'GET',
|
|
3820
3925
|
* [EnableHydration]: true
|
|
3821
3926
|
* });
|
|
3927
|
+
* ```
|
|
3822
3928
|
*
|
|
3929
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
3930
|
+
* reactive documents when hydration is enabled.
|
|
3823
3931
|
*/
|
|
3824
3932
|
const CacheHandler = { request(context, next) {
|
|
3825
3933
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -3974,14 +4082,12 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
3974
4082
|
}] });
|
|
3975
4083
|
}
|
|
3976
4084
|
|
|
3977
|
-
|
|
3978
|
-
//#region src/store/-private/utils/is-non-empty-string.ts
|
|
4085
|
+
// src/store/-private/utils/is-non-empty-string.ts
|
|
3979
4086
|
function isNonEmptyString(str) {
|
|
3980
4087
|
return Boolean(str && typeof str === "string");
|
|
3981
4088
|
}
|
|
3982
4089
|
|
|
3983
|
-
|
|
3984
|
-
//#region src/store/-private/utils/construct-resource.ts
|
|
4090
|
+
// src/store/-private/utils/construct-resource.ts
|
|
3985
4091
|
/**
|
|
3986
4092
|
* Given an existing resource identifier object (or a {@link ResourceKey}),
|
|
3987
4093
|
* returns it unchanged aside from coercing its `id`, if present, to a string.
|
|
@@ -4044,8 +4150,7 @@ function constructResource(type, id, lid) {
|
|
|
4044
4150
|
}
|
|
4045
4151
|
}
|
|
4046
4152
|
|
|
4047
|
-
|
|
4048
|
-
//#region src/store/-private/record-arrays/legacy-many-array.ts
|
|
4153
|
+
// src/store/-private/record-arrays/legacy-many-array.ts
|
|
4049
4154
|
/**
|
|
4050
4155
|
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
4051
4156
|
relationship.
|
|
@@ -4086,6 +4191,7 @@ the has-many.
|
|
|
4086
4191
|
We call the record to which a relationship belongs-to the
|
|
4087
4192
|
relationship's _owner_.
|
|
4088
4193
|
|
|
4194
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
4089
4195
|
@public
|
|
4090
4196
|
*/
|
|
4091
4197
|
/**
|
|
@@ -4117,7 +4223,7 @@ function createLegacyManyArray(options) {
|
|
|
4117
4223
|
isAsync: options.isAsync,
|
|
4118
4224
|
isPolymorphic: options.isPolymorphic,
|
|
4119
4225
|
identifier: options.identifier,
|
|
4120
|
-
key: options.field.name,
|
|
4226
|
+
key: options.field.sourceKey ?? options.field.name,
|
|
4121
4227
|
reload,
|
|
4122
4228
|
createRecord,
|
|
4123
4229
|
notify
|
|
@@ -4335,8 +4441,7 @@ function mutate(collection, mutation, _SIGNAL) {
|
|
|
4335
4441
|
notifyInternalSignal(_SIGNAL);
|
|
4336
4442
|
}
|
|
4337
4443
|
|
|
4338
|
-
|
|
4339
|
-
//#region src/store/-private/debug/utils.ts
|
|
4444
|
+
// src/store/-private/debug/utils.ts
|
|
4340
4445
|
const TEXT_COLORS = {
|
|
4341
4446
|
TEXT: "inherit",
|
|
4342
4447
|
notify: [
|
|
@@ -4565,15 +4670,13 @@ function _log(scope, prefix, subScop1, subScop2, subScop3, subScop4) {
|
|
|
4565
4670
|
return [];
|
|
4566
4671
|
}
|
|
4567
4672
|
|
|
4568
|
-
|
|
4569
|
-
//#region src/reactive/-private/kind/alias-field.ts
|
|
4673
|
+
// src/reactive/-private/kind/alias-field.ts
|
|
4570
4674
|
function getAliasField(context) {}
|
|
4571
4675
|
function setAliasField(context) {
|
|
4572
4676
|
return false;
|
|
4573
4677
|
}
|
|
4574
4678
|
|
|
4575
|
-
|
|
4576
|
-
//#region src/reactive/-private/fields/managed-array.ts
|
|
4679
|
+
// src/reactive/-private/fields/managed-array.ts
|
|
4577
4680
|
const ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([
|
|
4578
4681
|
Symbol.iterator,
|
|
4579
4682
|
"concat",
|
|
@@ -4670,17 +4773,7 @@ var ManagedArray = class {
|
|
|
4670
4773
|
if (field.type) return schema.transformation(field).hydrate(rawValue, field.options ?? null, self.owner);
|
|
4671
4774
|
return rawValue;
|
|
4672
4775
|
}
|
|
4673
|
-
|
|
4674
|
-
* When the array is polymorphic, we need to determine the real type
|
|
4675
|
-
* in order to apply the correct identity as schema-object identity
|
|
4676
|
-
* is only required to be unique by type
|
|
4677
|
-
*/
|
|
4678
|
-
let objectType;
|
|
4679
|
-
if (field.options?.polymorphic) {
|
|
4680
|
-
const typePath = field.options.type ?? "type";
|
|
4681
|
-
if (typePath === "@hash") objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
4682
|
-
else objectType = rawValue[typePath];
|
|
4683
|
-
} else objectType = field.type;
|
|
4776
|
+
const { type: objectType, hash } = fieldValueIdentity(schema, field, rawValue);
|
|
4684
4777
|
/**
|
|
4685
4778
|
* When KeyMode=@hash the ReactiveResource is keyed into
|
|
4686
4779
|
* ManagedRecordRefs by the return value of @hash on the rawValue.
|
|
@@ -4689,10 +4782,8 @@ var ManagedArray = class {
|
|
|
4689
4782
|
* when ARRAY_SIGNAL is dirty if hash performance becomes a bottleneck.
|
|
4690
4783
|
*/
|
|
4691
4784
|
let schemaObjectKeyValue;
|
|
4692
|
-
if (KeyMode === "@hash")
|
|
4693
|
-
|
|
4694
|
-
schemaObjectKeyValue = schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name);
|
|
4695
|
-
} else schemaObjectKeyValue = KeyMode === "@identity" ? rawValue : KeyMode === "@index" ? index : rawValue[KeyMode];
|
|
4785
|
+
if (KeyMode === "@hash") schemaObjectKeyValue = hash;
|
|
4786
|
+
else schemaObjectKeyValue = KeyMode === "@identity" ? rawValue : KeyMode === "@index" ? index : rawValue[KeyMode];
|
|
4696
4787
|
if (!schemaObjectKeyValue && schemaObjectKeyValue !== 0) return;
|
|
4697
4788
|
const recordRef = ManagedRecordRefs.get(schemaObjectKeyValue);
|
|
4698
4789
|
const record = recordRef?.value.deref();
|
|
@@ -4816,8 +4907,7 @@ Object.defineProperty(ManagedArray.prototype, "[]", {
|
|
|
4816
4907
|
}
|
|
4817
4908
|
});
|
|
4818
4909
|
|
|
4819
|
-
|
|
4820
|
-
//#region src/reactive/-private/kind/array-field.ts
|
|
4910
|
+
// src/reactive/-private/kind/array-field.ts
|
|
4821
4911
|
function getArrayField(context) {
|
|
4822
4912
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
4823
4913
|
const { record } = context;
|
|
@@ -4860,8 +4950,7 @@ function setArrayField(context) {
|
|
|
4860
4950
|
return true;
|
|
4861
4951
|
}
|
|
4862
4952
|
|
|
4863
|
-
|
|
4864
|
-
//#region src/reactive/-private/kind/attribute-field.ts
|
|
4953
|
+
// src/reactive/-private/kind/attribute-field.ts
|
|
4865
4954
|
function getAttributeField(context) {
|
|
4866
4955
|
entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
4867
4956
|
const { cache } = context.store;
|
|
@@ -4872,8 +4961,7 @@ function setAttributeField(context) {
|
|
|
4872
4961
|
return true;
|
|
4873
4962
|
}
|
|
4874
4963
|
|
|
4875
|
-
|
|
4876
|
-
//#region src/reactive/-private/fields/get-field-key.ts
|
|
4964
|
+
// src/reactive/-private/fields/get-field-key.ts
|
|
4877
4965
|
const InvalidKinds = [
|
|
4878
4966
|
"alias",
|
|
4879
4967
|
"derived",
|
|
@@ -4892,8 +4980,7 @@ function getFieldCacheKey(field) {
|
|
|
4892
4980
|
return "sourceKey" in field && field.sourceKey ? field.sourceKey : field.name;
|
|
4893
4981
|
}
|
|
4894
4982
|
|
|
4895
|
-
|
|
4896
|
-
//#region src/reactive/-private/kind/belongs-to-field.ts
|
|
4983
|
+
// src/reactive/-private/kind/belongs-to-field.ts
|
|
4897
4984
|
function getBelongsToField(context) {
|
|
4898
4985
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
4899
4986
|
const { field, resourceKey, store } = context;
|
|
@@ -4930,8 +5017,7 @@ function getResourceKey(record) {
|
|
|
4930
5017
|
return recordIdentifierFor(record);
|
|
4931
5018
|
}
|
|
4932
5019
|
|
|
4933
|
-
|
|
4934
|
-
//#region src/reactive/-private/kind/collection-field.ts
|
|
5020
|
+
// src/reactive/-private/kind/collection-field.ts
|
|
4935
5021
|
function getCollectionField(context) {
|
|
4936
5022
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
4937
5023
|
}
|
|
@@ -4939,8 +5025,7 @@ function setCollectionField(context) {
|
|
|
4939
5025
|
return false;
|
|
4940
5026
|
}
|
|
4941
5027
|
|
|
4942
|
-
|
|
4943
|
-
//#region src/reactive/-private/kind/derived-field.ts
|
|
5028
|
+
// src/reactive/-private/kind/derived-field.ts
|
|
4944
5029
|
function getDerivedField(context) {
|
|
4945
5030
|
const { schema } = context.store;
|
|
4946
5031
|
return schema.derivation(context.field)(context.record, context.field.options ?? null, context.field.name);
|
|
@@ -4949,8 +5034,7 @@ function setDerivedField(context) {
|
|
|
4949
5034
|
return false;
|
|
4950
5035
|
}
|
|
4951
5036
|
|
|
4952
|
-
|
|
4953
|
-
//#region src/reactive/-private/kind/generic-field.ts
|
|
5037
|
+
// src/reactive/-private/kind/generic-field.ts
|
|
4954
5038
|
function getGenericField(context) {
|
|
4955
5039
|
const signal = entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
4956
5040
|
signal.isStale = false;
|
|
@@ -4972,8 +5056,7 @@ function setGenericField(context) {
|
|
|
4972
5056
|
return true;
|
|
4973
5057
|
}
|
|
4974
5058
|
|
|
4975
|
-
|
|
4976
|
-
//#region src/reactive/-private/fields/many-array-manager.ts
|
|
5059
|
+
// src/reactive/-private/fields/many-array-manager.ts
|
|
4977
5060
|
var ManyArrayManager = class {
|
|
4978
5061
|
constructor(record, editable) {
|
|
4979
5062
|
const context = record[Context];
|
|
@@ -5029,8 +5112,7 @@ function extractCacheOptions(options) {
|
|
|
5029
5112
|
return cacheOptions;
|
|
5030
5113
|
}
|
|
5031
5114
|
|
|
5032
|
-
|
|
5033
|
-
//#region src/reactive/-private/kind/has-many-field.ts
|
|
5115
|
+
// src/reactive/-private/kind/has-many-field.ts
|
|
5034
5116
|
function getHasManyField(context) {
|
|
5035
5117
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5036
5118
|
const { store, field } = context;
|
|
@@ -5067,8 +5149,7 @@ function setHasManyField(context) {
|
|
|
5067
5149
|
return true;
|
|
5068
5150
|
}
|
|
5069
5151
|
|
|
5070
|
-
|
|
5071
|
-
//#region src/reactive/-private/kind/hash-field.ts
|
|
5152
|
+
// src/reactive/-private/kind/hash-field.ts
|
|
5072
5153
|
function getHashField(context) {
|
|
5073
5154
|
const { field, path, resourceKey } = context;
|
|
5074
5155
|
const { schema, cache } = context.store;
|
|
@@ -5080,8 +5161,7 @@ function setHashField(context) {
|
|
|
5080
5161
|
return false;
|
|
5081
5162
|
}
|
|
5082
5163
|
|
|
5083
|
-
|
|
5084
|
-
//#region src/reactive/-private/kind/identity-field.ts
|
|
5164
|
+
// src/reactive/-private/kind/identity-field.ts
|
|
5085
5165
|
function getIdentityField(context) {
|
|
5086
5166
|
entangleSignal(context.signals, context.record, "@identity", null);
|
|
5087
5167
|
return context.resourceKey.id;
|
|
@@ -5097,8 +5177,7 @@ function setIdentityField(context) {
|
|
|
5097
5177
|
return true;
|
|
5098
5178
|
}
|
|
5099
5179
|
|
|
5100
|
-
|
|
5101
|
-
//#region src/reactive/-private/kind/local-field.ts
|
|
5180
|
+
// src/reactive/-private/kind/local-field.ts
|
|
5102
5181
|
function getLocalField(context) {
|
|
5103
5182
|
const { field } = context;
|
|
5104
5183
|
const signal = getOrCreateInternalSignal(context.signals, context.record, field.name, field.options?.defaultValue ?? null);
|
|
@@ -5115,8 +5194,7 @@ function setLocalField(context) {
|
|
|
5115
5194
|
return true;
|
|
5116
5195
|
}
|
|
5117
5196
|
|
|
5118
|
-
|
|
5119
|
-
//#region src/reactive/-private/fields/managed-object.ts
|
|
5197
|
+
// src/reactive/-private/fields/managed-object.ts
|
|
5120
5198
|
const ObjectSymbols = /* @__PURE__ */ new Set([
|
|
5121
5199
|
OBJECT_SIGNAL,
|
|
5122
5200
|
Context,
|
|
@@ -5197,8 +5275,7 @@ function peekManagedObject(record, field) {
|
|
|
5197
5275
|
if (managedObjectMapForRecord) return managedObjectMapForRecord.get(field.name);
|
|
5198
5276
|
}
|
|
5199
5277
|
|
|
5200
|
-
|
|
5201
|
-
//#region src/reactive/-private/kind/object-field.ts
|
|
5278
|
+
// src/reactive/-private/kind/object-field.ts
|
|
5202
5279
|
function getObjectField(context) {
|
|
5203
5280
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5204
5281
|
const { record, field } = context;
|
|
@@ -5254,8 +5331,7 @@ function setObjectField(context) {
|
|
|
5254
5331
|
return true;
|
|
5255
5332
|
}
|
|
5256
5333
|
|
|
5257
|
-
|
|
5258
|
-
//#region src/reactive/-private/kind/resource-field.ts
|
|
5334
|
+
// src/reactive/-private/kind/resource-field.ts
|
|
5259
5335
|
var ResourceRelationship = class {
|
|
5260
5336
|
constructor(context) {
|
|
5261
5337
|
const { store, resourceKey } = context;
|
|
@@ -5295,8 +5371,7 @@ function setResourceField(context) {
|
|
|
5295
5371
|
return false;
|
|
5296
5372
|
}
|
|
5297
5373
|
|
|
5298
|
-
|
|
5299
|
-
//#region src/reactive/-private/kind/schema-array-field.ts
|
|
5374
|
+
// src/reactive/-private/kind/schema-array-field.ts
|
|
5300
5375
|
function setSchemaArrayField(context) {
|
|
5301
5376
|
const arrayValue = context.value === null ? null : context.value?.slice();
|
|
5302
5377
|
const fieldSignal = peekInternalSignal(context.signals, context.path.at(-1));
|
|
@@ -5310,8 +5385,7 @@ function setSchemaArrayField(context) {
|
|
|
5310
5385
|
return true;
|
|
5311
5386
|
}
|
|
5312
5387
|
|
|
5313
|
-
|
|
5314
|
-
//#region src/reactive/-private/kind/schema-object-field.ts
|
|
5388
|
+
// src/reactive/-private/kind/schema-object-field.ts
|
|
5315
5389
|
function getSchemaObjectField(context) {
|
|
5316
5390
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
5317
5391
|
const { store, resourceKey, path, field } = context;
|
|
@@ -5328,15 +5402,8 @@ function getSchemaObjectField(context) {
|
|
|
5328
5402
|
}
|
|
5329
5403
|
return null;
|
|
5330
5404
|
}
|
|
5331
|
-
const {
|
|
5332
|
-
|
|
5333
|
-
if (field.options?.polymorphic) {
|
|
5334
|
-
const typePath = field.options.type ?? "type";
|
|
5335
|
-
if (typePath === "@hash") objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
5336
|
-
else objectType = rawValue[typePath];
|
|
5337
|
-
} else objectType = field.type;
|
|
5338
|
-
const hashField = schema.resource({ type: objectType }).identity;
|
|
5339
|
-
const identity = hashField ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : field.name;
|
|
5405
|
+
const { type: objectType, hash } = fieldValueIdentity(store.schema, field, rawValue);
|
|
5406
|
+
const identity = hash ?? field.name;
|
|
5340
5407
|
const cachedSchemaObject = signal.value;
|
|
5341
5408
|
if (cachedSchemaObject) {
|
|
5342
5409
|
if (cachedSchemaObject.type === objectType && cachedSchemaObject.identity === identity) return cachedSchemaObject.value;
|
|
@@ -5373,8 +5440,7 @@ function setSchemaObjectField(context) {
|
|
|
5373
5440
|
return true;
|
|
5374
5441
|
}
|
|
5375
5442
|
|
|
5376
|
-
|
|
5377
|
-
//#region src/reactive/-private/default-mode.ts
|
|
5443
|
+
// src/reactive/-private/default-mode.ts
|
|
5378
5444
|
/**
|
|
5379
5445
|
* A ReactiveResource context object passed to
|
|
5380
5446
|
* the get/set functions of a field kind implementation.
|
|
@@ -5490,14 +5556,15 @@ const DefaultMode = {
|
|
|
5490
5556
|
}
|
|
5491
5557
|
};
|
|
5492
5558
|
|
|
5493
|
-
|
|
5494
|
-
//#region src/reactive/-private/record.ts
|
|
5559
|
+
// src/reactive/-private/record.ts
|
|
5495
5560
|
const IgnoredGlobalFields = /* @__PURE__ */ new Set([
|
|
5496
5561
|
"length",
|
|
5497
5562
|
"nodeType",
|
|
5498
5563
|
"then",
|
|
5499
5564
|
"setInterval",
|
|
5500
5565
|
"document",
|
|
5566
|
+
"unknownProperty",
|
|
5567
|
+
"size",
|
|
5501
5568
|
STRUCTURED
|
|
5502
5569
|
]);
|
|
5503
5570
|
const RecordSymbols = /* @__PURE__ */ new Set([
|
|
@@ -5522,10 +5589,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
5522
5589
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
5523
5590
|
* object.
|
|
5524
5591
|
*
|
|
5592
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
5593
|
+
* define the schema it reads.
|
|
5594
|
+
*
|
|
5525
5595
|
* This class is not directly instantiable. To use it, you should
|
|
5526
5596
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
5527
5597
|
* with the matching hooks provided by this package.
|
|
5528
5598
|
*
|
|
5599
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
5529
5600
|
* @hideconstructor
|
|
5530
5601
|
* @public
|
|
5531
5602
|
*/
|
|
@@ -5921,6 +5992,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
5921
5992
|
* Edits to editable resources will be automatically committed if a new
|
|
5922
5993
|
* payload from the cache matches their existing value.
|
|
5923
5994
|
*
|
|
5995
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
5996
|
+
* changed locally.
|
|
5924
5997
|
* @public
|
|
5925
5998
|
*
|
|
5926
5999
|
* @returns a promise that resolves to the editable resource
|
|
@@ -5937,14 +6010,15 @@ function checkout(resource) {
|
|
|
5937
6010
|
* approach is for either the API or a Handler to reflect saved
|
|
5938
6011
|
* changes back to update the cache.
|
|
5939
6012
|
*
|
|
6013
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
6014
|
+
* bypassing a save round-trip.
|
|
5940
6015
|
* @public
|
|
5941
6016
|
*/
|
|
5942
6017
|
function commit(record) {
|
|
5943
6018
|
return record[Commit]();
|
|
5944
6019
|
}
|
|
5945
6020
|
|
|
5946
|
-
|
|
5947
|
-
//#region src/reactive/-private/hooks.ts
|
|
6021
|
+
// src/reactive/-private/hooks.ts
|
|
5948
6022
|
/**
|
|
5949
6023
|
* The store's default `instantiateRecord` hook implementation, which
|
|
5950
6024
|
* produces a {@link ReactiveResource} for `identifier` using the resource
|
|
@@ -5954,6 +6028,8 @@ function commit(record) {
|
|
|
5954
6028
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
5955
6029
|
* properties when creating a new legacy record.
|
|
5956
6030
|
*
|
|
6031
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
6032
|
+
* from its registered schema.
|
|
5957
6033
|
* @public
|
|
5958
6034
|
*/
|
|
5959
6035
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -5977,14 +6053,15 @@ function instantiateRecord(store, identifier, createArgs) {
|
|
|
5977
6053
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
5978
6054
|
* behavior.
|
|
5979
6055
|
*
|
|
6056
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
6057
|
+
* releases it.
|
|
5980
6058
|
* @public
|
|
5981
6059
|
*/
|
|
5982
6060
|
function teardownRecord(record) {
|
|
5983
6061
|
record[Destroy]();
|
|
5984
6062
|
}
|
|
5985
6063
|
|
|
5986
|
-
|
|
5987
|
-
//#region src/reactive/-private/schema.ts
|
|
6064
|
+
// src/reactive/-private/schema.ts
|
|
5988
6065
|
const Support = getOrSetGlobal("Support", /* @__PURE__ */ new WeakMap());
|
|
5989
6066
|
const ConstructorField = {
|
|
5990
6067
|
type: "@constructor",
|
|
@@ -6026,16 +6103,25 @@ _constructor[Type] = "@constructor";
|
|
|
6026
6103
|
* This should only be used for temporary migration purposes
|
|
6027
6104
|
* to the new schema system when migrating from either Model
|
|
6028
6105
|
* or ModelFragments.
|
|
6106
|
+
*
|
|
6107
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
6108
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
6029
6109
|
*/
|
|
6030
6110
|
/**
|
|
6031
6111
|
* Describes one feature added to a resource by a schema extension, as
|
|
6032
6112
|
* classified by {@link processExtension} from the property descriptor it
|
|
6033
6113
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
6114
|
+
*
|
|
6115
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
6116
|
+
* mutable value, or a getter/setter accessor.
|
|
6034
6117
|
*/
|
|
6035
6118
|
/**
|
|
6036
6119
|
* The result of {@link processExtension} normalizing a
|
|
6037
6120
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
6038
6121
|
* by name.
|
|
6122
|
+
*
|
|
6123
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
6124
|
+
* keyed by property name.
|
|
6039
6125
|
*/
|
|
6040
6126
|
const BannedKeys = ["constructor", "__proto__"];
|
|
6041
6127
|
function processExtension(extension) {
|
|
@@ -6125,14 +6211,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
6125
6211
|
* Utility for constructing a ResourceSchema with the recommended
|
|
6126
6212
|
* fields for the PolarisMode experience.
|
|
6127
6213
|
*
|
|
6214
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
6215
|
+
* create a schema with it.
|
|
6216
|
+
*
|
|
6128
6217
|
* Using this requires registering the PolarisMode derivations
|
|
6129
6218
|
*
|
|
6130
6219
|
* ```ts
|
|
6131
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
6220
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
6132
6221
|
*
|
|
6133
6222
|
* registerDerivations(schema);
|
|
6134
6223
|
* ```
|
|
6135
6224
|
*
|
|
6225
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
6226
|
+
* PolarisMode resource schema.
|
|
6136
6227
|
* @public
|
|
6137
6228
|
* @param schema
|
|
6138
6229
|
* @return {PolarisResourceSchema}
|
|
@@ -6163,6 +6254,8 @@ function withDefaults(schema) {
|
|
|
6163
6254
|
*
|
|
6164
6255
|
* `^` returns the entire identifier object.
|
|
6165
6256
|
*
|
|
6257
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
6258
|
+
* for use in derived fields.
|
|
6166
6259
|
* @public
|
|
6167
6260
|
*/
|
|
6168
6261
|
const fromIdentity = (record, options, key) => {
|
|
@@ -6175,9 +6268,14 @@ fromIdentity[Type] = "@identity";
|
|
|
6175
6268
|
* to use the PolarisMode defaults provided by
|
|
6176
6269
|
*
|
|
6177
6270
|
* ```ts
|
|
6178
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
6271
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
6179
6272
|
* ```
|
|
6180
6273
|
*
|
|
6274
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
6275
|
+
* guide explains when you need to call it.
|
|
6276
|
+
*
|
|
6277
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
6278
|
+
* `withDefaults` depend on.
|
|
6181
6279
|
* @public
|
|
6182
6280
|
*/
|
|
6183
6281
|
function registerDerivations(schema) {
|
|
@@ -6188,6 +6286,9 @@ function registerDerivations(schema) {
|
|
|
6188
6286
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
6189
6287
|
* between the raw value `T` stored in the cache and the presentation value
|
|
6190
6288
|
* `PT` exposed on the record.
|
|
6289
|
+
*
|
|
6290
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
6291
|
+
* record, with optional default.
|
|
6191
6292
|
*/
|
|
6192
6293
|
/**
|
|
6193
6294
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -6210,6 +6311,12 @@ function makeCachedDerivation(derivation) {
|
|
|
6210
6311
|
/**
|
|
6211
6312
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
6212
6313
|
*
|
|
6314
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
6315
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
6316
|
+
* shows how to give a store one.
|
|
6317
|
+
*
|
|
6318
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
6319
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
6213
6320
|
* @public
|
|
6214
6321
|
*/
|
|
6215
6322
|
var SchemaService = class {
|
|
@@ -6528,284 +6635,7 @@ function mergeMap(base, toApply) {
|
|
|
6528
6635
|
for (const [key, value] of toApply) base.set(key, value);
|
|
6529
6636
|
}
|
|
6530
6637
|
|
|
6531
|
-
|
|
6532
|
-
//#region src/reactive.ts
|
|
6533
|
-
/**
|
|
6534
|
-
* # About
|
|
6535
|
-
*
|
|
6536
|
-
* This module provides an implementation of reactive objects that a Store may use for creating
|
|
6537
|
-
* reactive representations of the raw data for requests, resources and their relationships
|
|
6538
|
-
* stored in the cache.
|
|
6539
|
-
*
|
|
6540
|
-
* - For configuring the store to use these reactive objects, see [The Setup Guide](/guides/configuration/)
|
|
6541
|
-
* - For defining resource schemas, see [The Schema Guide](/guides/the-manual/schemas/)
|
|
6542
|
-
*
|
|
6543
|
-
* Any method that returns a record instance will use the `instantiateRecord`
|
|
6544
|
-
* hook configured above to instantiate a ReactiveResource once this is in place.
|
|
6545
|
-
* After that, its up to you what ReactiveResource can do.
|
|
6546
|
-
*
|
|
6547
|
-
* ## Modes
|
|
6548
|
-
*
|
|
6549
|
-
* ReactiveResource has two modes: `legacy` and `polaris`.
|
|
6550
|
-
*
|
|
6551
|
-
* **LegacyMode** can be used to emulate the behaviors and capabilities of WarpDrive's `Model` class,
|
|
6552
|
-
* and because there is little distinction between Model and a ReactiveResource in LegacyMode we refer
|
|
6553
|
-
* to both of these approaches as LegacyMode. This mode is the default experience in V5.
|
|
6554
|
-
*
|
|
6555
|
-
* In LegacyMode:
|
|
6556
|
-
*
|
|
6557
|
-
* - records are mutable
|
|
6558
|
-
* - local changes immediately reflect app wide
|
|
6559
|
-
* - records have all the APIs of Model (references, state props, currentState, methods etc)
|
|
6560
|
-
* - the continued use of `@warp-drive-mirror/legacy` is required (though most imports from it can be removed)
|
|
6561
|
-
* - `async: true` relationships are supported (but not recommended outside of [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
6562
|
-
*
|
|
6563
|
-
* ---
|
|
6564
|
-
*
|
|
6565
|
-
* **PolarisMode** is an upcoming suite of features that will become the default experience in V6.
|
|
6566
|
-
*
|
|
6567
|
-
* In PolarisMode:
|
|
6568
|
-
*
|
|
6569
|
-
* - records are immutable, unless creating a new resource or explicitly checking out a record for editing
|
|
6570
|
-
* - local changes are isolated until committed, displaying only via the editable version of the record
|
|
6571
|
-
* - records have a more limited API, focused on only what is in their schema.
|
|
6572
|
-
* - some common operations may have more friction to perform because intended utilities are not yet available
|
|
6573
|
-
* - `async: true` relationships are not supported (see [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
6574
|
-
* - The `@warp-drive-mirror/legacy` package is not required
|
|
6575
|
-
*
|
|
6576
|
-
* These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
|
|
6577
|
-
* a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
|
|
6578
|
-
* a ReactiveResource or a Model.
|
|
6579
|
-
*
|
|
6580
|
-
* ---
|
|
6581
|
-
*
|
|
6582
|
-
* ## Basic Usage
|
|
6583
|
-
*
|
|
6584
|
-
* ReactiveResource is a reactive object that transforms raw data from an associated
|
|
6585
|
-
* cache into reactive data backed by Signals.
|
|
6586
|
-
*
|
|
6587
|
-
* The shape of the object and the transformation of raw cache data into its
|
|
6588
|
-
* reactive form is controlled by a resource schema.
|
|
6589
|
-
*
|
|
6590
|
-
* For instance, lets say your API is a [{json:api}](https://jsonapi.org) and your store is using
|
|
6591
|
-
* the Cache provided by {@link @warp-drive-mirror/json-api! | @warp-drive-mirror/json-api}, and a request
|
|
6592
|
-
* returns the following raw data:
|
|
6593
|
-
*
|
|
6594
|
-
* ```ts
|
|
6595
|
-
* {
|
|
6596
|
-
* data: {
|
|
6597
|
-
* type: 'user',
|
|
6598
|
-
* id: '1',
|
|
6599
|
-
* attributes: { firstName: 'Chris', lastName: 'Thoburn' },
|
|
6600
|
-
* relationships: { pets: { data: [{ type: 'dog', id: '1' }] }}
|
|
6601
|
-
* },
|
|
6602
|
-
* included: [
|
|
6603
|
-
* {
|
|
6604
|
-
* type: 'dog',
|
|
6605
|
-
* id: '1',
|
|
6606
|
-
* attributes: { name: 'Rey' },
|
|
6607
|
-
* relationships: { owner: { data: { type: 'user', id: '1' }}}
|
|
6608
|
-
* }
|
|
6609
|
-
* ]
|
|
6610
|
-
* }
|
|
6611
|
-
* ```
|
|
6612
|
-
*
|
|
6613
|
-
* We could describe the `'user'` and `'dog'` resources in the above payload
|
|
6614
|
-
* with the following schemas:
|
|
6615
|
-
*
|
|
6616
|
-
* ```ts
|
|
6617
|
-
* store.schema.registerResources([
|
|
6618
|
-
* {
|
|
6619
|
-
* type: 'user',
|
|
6620
|
-
* identity: { type: '@id', name: 'id' },
|
|
6621
|
-
* fields: [
|
|
6622
|
-
* {
|
|
6623
|
-
* type: '@identity',
|
|
6624
|
-
* name: '$type',
|
|
6625
|
-
* kind: 'derived',
|
|
6626
|
-
* options: { key: 'type' },
|
|
6627
|
-
* },
|
|
6628
|
-
* { kind: 'field', name: 'firstName' },
|
|
6629
|
-
* { kind: 'field', name: 'lastName' },
|
|
6630
|
-
* {
|
|
6631
|
-
* kind: 'derived',
|
|
6632
|
-
* name: 'name',
|
|
6633
|
-
* type: 'concat',
|
|
6634
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
6635
|
-
* },
|
|
6636
|
-
* {
|
|
6637
|
-
* kind: 'hasMany',
|
|
6638
|
-
* name: 'pets',
|
|
6639
|
-
* type: 'pet',
|
|
6640
|
-
* options: {
|
|
6641
|
-
* async: false,
|
|
6642
|
-
* inverse: 'owner',
|
|
6643
|
-
* polymorphic: true,
|
|
6644
|
-
* linksMode: true,
|
|
6645
|
-
* }
|
|
6646
|
-
* }
|
|
6647
|
-
* ]
|
|
6648
|
-
* },
|
|
6649
|
-
* {
|
|
6650
|
-
* type: 'dog',
|
|
6651
|
-
* identity: { type: '@id', name: 'id' },
|
|
6652
|
-
* fields: [
|
|
6653
|
-
* {
|
|
6654
|
-
* type: '@identity',
|
|
6655
|
-
* name: '$type',
|
|
6656
|
-
* kind: 'derived',
|
|
6657
|
-
* options: { key: 'type' },
|
|
6658
|
-
* },
|
|
6659
|
-
* { kind: 'field', name: 'name' },
|
|
6660
|
-
* {
|
|
6661
|
-
* kind: 'belongsTo',
|
|
6662
|
-
* name: 'owner',
|
|
6663
|
-
* type: 'user',
|
|
6664
|
-
* options: {
|
|
6665
|
-
* async: false,
|
|
6666
|
-
* inverse: 'pets',
|
|
6667
|
-
* as: 'pet',
|
|
6668
|
-
* linksMode: true,
|
|
6669
|
-
* }
|
|
6670
|
-
* }
|
|
6671
|
-
* ]
|
|
6672
|
-
* }
|
|
6673
|
-
* ]);
|
|
6674
|
-
* ```
|
|
6675
|
-
*
|
|
6676
|
-
* With these schemas in place, the reactive objects that the store would
|
|
6677
|
-
* provide us whenever we encountered a `'user'` or a `'dog'` would be:
|
|
6678
|
-
*
|
|
6679
|
-
* ```ts
|
|
6680
|
-
* interface Pet {
|
|
6681
|
-
* readonly id: string;
|
|
6682
|
-
* readonly owner: User;
|
|
6683
|
-
* }
|
|
6684
|
-
*
|
|
6685
|
-
* interface Dog extends Pet {
|
|
6686
|
-
* readonly $type: 'dog';
|
|
6687
|
-
* readonly name: string;
|
|
6688
|
-
* }
|
|
6689
|
-
*
|
|
6690
|
-
* interface EditableUser {
|
|
6691
|
-
* readonly $type: 'user';
|
|
6692
|
-
* readonly id: string;
|
|
6693
|
-
* firstName: string;
|
|
6694
|
-
* lastName: string;
|
|
6695
|
-
* readonly name: string;
|
|
6696
|
-
* pets: Array<Dog | Pet>;
|
|
6697
|
-
* }
|
|
6698
|
-
*
|
|
6699
|
-
* interface User {
|
|
6700
|
-
* readonly $type: 'user';
|
|
6701
|
-
* readonly id: string;
|
|
6702
|
-
* readonly firstName: string;
|
|
6703
|
-
* readonly lastName: string;
|
|
6704
|
-
* readonly name: string;
|
|
6705
|
-
* readonly pets: Readonly<Array<Dog | Pet>>;
|
|
6706
|
-
* [Checkout](): Promise<EditableUser>
|
|
6707
|
-
* }>
|
|
6708
|
-
* ```
|
|
6709
|
-
*
|
|
6710
|
-
* Note how based on the schema the reactive object we receive is able to produce
|
|
6711
|
-
* `name` on user (despite no name field being in the cache), provide `$type`
|
|
6712
|
-
* pulled from the identity of the resource, and flatten the individual attributes
|
|
6713
|
-
* and relationships onto the record for easier use.
|
|
6714
|
-
*
|
|
6715
|
-
* Notice also how we typed this object with `readonly`. This is because while
|
|
6716
|
-
* ReactiveResource instances are ***deeply reactive***, they are also ***immutable***.
|
|
6717
|
-
*
|
|
6718
|
-
* We can mutate a ReactiveResource only be explicitly asking permission to do so, and
|
|
6719
|
-
* in the process gaining access to an editable copy. The immutable version will
|
|
6720
|
-
* not show any in-process edits made to this editable copy.
|
|
6721
|
-
*
|
|
6722
|
-
* ```ts
|
|
6723
|
-
* import { Checkout } from '@warp-drive-mirror/schema-record';
|
|
6724
|
-
*
|
|
6725
|
-
* const editable = await user[Checkout]();
|
|
6726
|
-
* ```
|
|
6727
|
-
*
|
|
6728
|
-
* ## Utilities
|
|
6729
|
-
*
|
|
6730
|
-
* ReactiveResource provides a schema builder that simplifies setting up a couple of
|
|
6731
|
-
* conventional fields like identity and `$type`. We can rewrite the schema
|
|
6732
|
-
* definition above using this utility like so:
|
|
6733
|
-
*
|
|
6734
|
-
* ```ts
|
|
6735
|
-
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
6736
|
-
*
|
|
6737
|
-
* store.schema.registerResources([
|
|
6738
|
-
* withDefaults({
|
|
6739
|
-
* type: 'user',
|
|
6740
|
-
* fields: [
|
|
6741
|
-
* { kind: 'field', name: 'firstName' },
|
|
6742
|
-
* { kind: 'field', name: 'lastName' },
|
|
6743
|
-
* {
|
|
6744
|
-
* kind: 'derived',
|
|
6745
|
-
* name: 'name',
|
|
6746
|
-
* type: 'concat',
|
|
6747
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
6748
|
-
* },
|
|
6749
|
-
* {
|
|
6750
|
-
* kind: 'hasMany',
|
|
6751
|
-
* name: 'pets',
|
|
6752
|
-
* type: 'pet',
|
|
6753
|
-
* options: {
|
|
6754
|
-
* async: false,
|
|
6755
|
-
* inverse: 'owner',
|
|
6756
|
-
* polymorphic: true,
|
|
6757
|
-
* linksMode: true,
|
|
6758
|
-
* resetOnRemoteUpdate: false,
|
|
6759
|
-
* }
|
|
6760
|
-
* }
|
|
6761
|
-
* ]
|
|
6762
|
-
* }),
|
|
6763
|
-
* withDefaults({
|
|
6764
|
-
* type: 'dog',
|
|
6765
|
-
* fields: [
|
|
6766
|
-
* { kind: 'field', name: 'name' },
|
|
6767
|
-
* {
|
|
6768
|
-
* kind: 'belongsTo',
|
|
6769
|
-
* name: 'owner',
|
|
6770
|
-
* type: 'user',
|
|
6771
|
-
* options: {
|
|
6772
|
-
* async: false,
|
|
6773
|
-
* inverse: 'pets',
|
|
6774
|
-
* as: 'pet',
|
|
6775
|
-
* linksMode: true,
|
|
6776
|
-
* resetOnRemoteUpdate: false,
|
|
6777
|
-
* }
|
|
6778
|
-
* }
|
|
6779
|
-
* ]
|
|
6780
|
-
* })
|
|
6781
|
-
* ]);
|
|
6782
|
-
* ```
|
|
6783
|
-
*
|
|
6784
|
-
* ## Type Support
|
|
6785
|
-
*
|
|
6786
|
-
* ### Resource Schemas
|
|
6787
|
-
*
|
|
6788
|
-
* - {@link PolarisResourceSchema}
|
|
6789
|
-
* - {@link LegacyResourceSchema}
|
|
6790
|
-
* - {@link ObjectSchema}
|
|
6791
|
-
*
|
|
6792
|
-
* ### Resource Schema Type Utils
|
|
6793
|
-
*
|
|
6794
|
-
* - {@link resourceSchema}
|
|
6795
|
-
* - {@link objectSchema}
|
|
6796
|
-
* - {@link isResourceSchema}
|
|
6797
|
-
* - {@link isLegacyResourceSchema}
|
|
6798
|
-
*
|
|
6799
|
-
* ### Field Schemas
|
|
6800
|
-
*
|
|
6801
|
-
* - {@link LegacyModeFieldSchema}
|
|
6802
|
-
* - {@link PolarisModeFieldSchema}
|
|
6803
|
-
*
|
|
6804
|
-
* @module
|
|
6805
|
-
*/
|
|
6806
|
-
|
|
6807
|
-
//#endregion
|
|
6808
|
-
//#region src/request/-private/fetch.ts
|
|
6638
|
+
// src/request/-private/fetch.ts
|
|
6809
6639
|
const _fetch = typeof fetch !== "undefined" ? (...args) => fetch(...args) : typeof FastBoot !== "undefined" ? (...args) => FastBoot.require("node-fetch")(...args) : () => {
|
|
6810
6640
|
throw new Error("No Fetch Implementation Found");
|
|
6811
6641
|
};
|
|
@@ -6878,6 +6708,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
6878
6708
|
* A basic Fetch Handler which converts a request into a
|
|
6879
6709
|
* `fetch` call presuming the response to be `json`.
|
|
6880
6710
|
*
|
|
6711
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
6712
|
+
* guide shows where it sits in the handler chain.
|
|
6713
|
+
*
|
|
6881
6714
|
* ```ts
|
|
6882
6715
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
6883
6716
|
*
|
|
@@ -6885,6 +6718,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
6885
6718
|
* .use([Fetch]);
|
|
6886
6719
|
* ```
|
|
6887
6720
|
*
|
|
6721
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
6722
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
6888
6723
|
* @public
|
|
6889
6724
|
* @badge Handler
|
|
6890
6725
|
*/
|
|
@@ -7002,8 +6837,7 @@ function isDict(v) {
|
|
|
7002
6837
|
return v !== null && typeof v === "object";
|
|
7003
6838
|
}
|
|
7004
6839
|
|
|
7005
|
-
|
|
7006
|
-
//#region src/request/-private/manager.ts
|
|
6840
|
+
// src/request/-private/manager.ts
|
|
7007
6841
|
/**
|
|
7008
6842
|
* ## Import
|
|
7009
6843
|
*
|
|
@@ -7011,7 +6845,8 @@ function isDict(v) {
|
|
|
7011
6845
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
7012
6846
|
* ```
|
|
7013
6847
|
*
|
|
7014
|
-
* For complete usage guide see
|
|
6848
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
6849
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
7015
6850
|
*
|
|
7016
6851
|
* ## How It Works
|
|
7017
6852
|
*
|
|
@@ -7034,11 +6869,28 @@ function isDict(v) {
|
|
|
7034
6869
|
* ```ts [Setup.ts]
|
|
7035
6870
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7036
6871
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
7037
|
-
* import
|
|
6872
|
+
* import { AuthHandler } from './auth-handler';
|
|
7038
6873
|
*
|
|
7039
6874
|
* // ... create manager
|
|
7040
6875
|
* const manager = new RequestManager()
|
|
7041
|
-
* .use([
|
|
6876
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
6877
|
+
* ```
|
|
6878
|
+
*
|
|
6879
|
+
* ```ts [auth-handler.ts]
|
|
6880
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
6881
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
6882
|
+
*
|
|
6883
|
+
* const token = '<token>';
|
|
6884
|
+
*
|
|
6885
|
+
* // adds a bearer token to every request, then passes it along
|
|
6886
|
+
* export const AuthHandler: Handler = {
|
|
6887
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
6888
|
+
* const headers = new Headers(context.request.headers);
|
|
6889
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
6890
|
+
*
|
|
6891
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
6892
|
+
* },
|
|
6893
|
+
* };
|
|
7042
6894
|
* ```
|
|
7043
6895
|
*
|
|
7044
6896
|
* ```ts [Usage.ts]
|
|
@@ -7054,6 +6906,20 @@ function isDict(v) {
|
|
|
7054
6906
|
*
|
|
7055
6907
|
* :::
|
|
7056
6908
|
*
|
|
6909
|
+
* ### RequestManager vs {@link Store.request}
|
|
6910
|
+
*
|
|
6911
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
6912
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
6913
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
6914
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
6915
|
+
*
|
|
6916
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
6917
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
6918
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
6919
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
6920
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
6921
|
+
* `StructuredDocument`.
|
|
6922
|
+
*
|
|
7057
6923
|
* ### Futures
|
|
7058
6924
|
*
|
|
7059
6925
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -7092,6 +6958,7 @@ function isDict(v) {
|
|
|
7092
6958
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
7093
6959
|
* ```
|
|
7094
6960
|
*
|
|
6961
|
+
* @summary Runs each request through a chain of handlers that can fulfill, modify, or pass it along, and returns a `Future` for the response.
|
|
7095
6962
|
* @public
|
|
7096
6963
|
*/
|
|
7097
6964
|
var RequestManager = class {
|
|
@@ -7142,7 +7009,23 @@ var RequestManager = class {
|
|
|
7142
7009
|
/**
|
|
7143
7010
|
* Issue a Request.
|
|
7144
7011
|
*
|
|
7145
|
-
*
|
|
7012
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
7013
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
7014
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
7015
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
7016
|
+
* `RequestManager` created on its own has neither.
|
|
7017
|
+
*
|
|
7018
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
7019
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
7020
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
7021
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
7022
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
7023
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
7024
|
+
*
|
|
7025
|
+
* @example
|
|
7026
|
+
* ```ts
|
|
7027
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
7028
|
+
* ```
|
|
7146
7029
|
*
|
|
7147
7030
|
* @public
|
|
7148
7031
|
*/
|
|
@@ -7201,20 +7084,27 @@ var RequestManager = class {
|
|
|
7201
7084
|
*
|
|
7202
7085
|
* @private
|
|
7203
7086
|
*/
|
|
7204
|
-
|
|
7205
|
-
//#region src/index.ts
|
|
7087
|
+
// src/index.ts
|
|
7206
7088
|
/**
|
|
7089
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
7090
|
+
* `useRecommendedStore` for building a configured store.
|
|
7207
7091
|
* @module
|
|
7208
7092
|
* @mergeModuleWith <project>
|
|
7209
7093
|
*/
|
|
7210
7094
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
7211
7095
|
/**
|
|
7212
7096
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
7097
|
+
*
|
|
7098
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
7099
|
+
* `useRecommendedStore` wires into a Store class.
|
|
7213
7100
|
*/
|
|
7214
7101
|
/**
|
|
7215
7102
|
* Creates a configured Store class with recommended defaults
|
|
7216
7103
|
* for schema handling, reactivity, caching, and request management.
|
|
7217
7104
|
*
|
|
7105
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
7106
|
+
* configuring the store with it.
|
|
7107
|
+
*
|
|
7218
7108
|
* ```ts
|
|
7219
7109
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
7220
7110
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -7317,6 +7207,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
7317
7207
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
7318
7208
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
7319
7209
|
* `LoggingHandler` does above).
|
|
7210
|
+
*
|
|
7211
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
7212
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
7320
7213
|
*/
|
|
7321
7214
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
7322
7215
|
return class AppStore extends StoreKlass {
|
|
@@ -7370,6 +7263,5 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
7370
7263
|
};
|
|
7371
7264
|
}
|
|
7372
7265
|
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
//# sourceMappingURL=src-Bp8ZJctZ.js.map
|
|
7266
|
+
export { normalizeModelName as A, isRequestKey as C, setIdentifierResetMethod as D, setIdentifierGenerationMethod as E, recordIdentifierFor as F, setRecordIdentifier as I, storeFor as L, ensureStringId as M, StoreMap as N, setIdentifierUpdateMethod as O, _clearCaches as P, assertPrivateCapabilities as R, fieldValueIdentity as S, setIdentifierForgetMethod as T, Store as _, fromIdentity as a, RecordArrayManager as b, instantiateRecord as c, commit as d, log as f, CacheHandler as g, constructResource as h, SchemaService as i, coerceId as j, setKeyInfoForResource as k, teardownRecord as l, createLegacyManyArray as m, RequestManager as n, registerDerivations as o, logGroup as p, Fetch as r, withDefaults as s, useRecommendedStore as t, checkout as u, assertPrivateStore as v, isResourceKey as w, fastPush as x, isPrivateStore as y };
|
|
7267
|
+
//# sourceMappingURL=src-D6BqG5K8.js.map
|