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