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