@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-CvZfrDZl.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-CxtnNIIp.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
9
|
import { RecordStore, Type } from "./types/symbols.js";
|
|
10
10
|
import { isResourceSchema } from "./types/schema/fields.js";
|
|
11
|
-
import { t as DefaultCachePolicy } from "./store-
|
|
11
|
+
import { t as DefaultCachePolicy } from "./store-C8iKKtQK.js";
|
|
12
12
|
import { dependencySatisfies, getGlobalConfig, importSync, macroCondition } from "@embroider/macros";
|
|
13
13
|
import { deprecate, warn } from "@ember/debug";
|
|
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
|
*
|
|
@@ -445,8 +447,7 @@ function ensureStringId(id) {
|
|
|
445
447
|
return normalized;
|
|
446
448
|
}
|
|
447
449
|
|
|
448
|
-
|
|
449
|
-
//#region src/store/-private/utils/normalize-model-name.ts
|
|
450
|
+
// src/store/-private/utils/normalize-model-name.ts
|
|
450
451
|
/**
|
|
451
452
|
* Normalizes a resource `type` to its dasherized form, e.g. `myClass` to
|
|
452
453
|
* `my-class`. Re-exported elsewhere as `_deprecatingNormalize`.
|
|
@@ -474,8 +475,7 @@ function normalizeModelName(type) {
|
|
|
474
475
|
return type;
|
|
475
476
|
}
|
|
476
477
|
|
|
477
|
-
|
|
478
|
-
//#region src/store/-private/utils/uuid-polyfill.ts
|
|
478
|
+
// src/store/-private/utils/uuid-polyfill.ts
|
|
479
479
|
function installPolyfill() {
|
|
480
480
|
const isFastBoot = typeof FastBoot !== "undefined";
|
|
481
481
|
const CRYPTO = isFastBoot ? FastBoot.require("crypto") : globalThis.crypto;
|
|
@@ -521,8 +521,7 @@ function installPolyfill() {
|
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
|
|
525
|
-
//#region src/store/-private/managers/cache-key-manager.ts
|
|
524
|
+
// src/store/-private/managers/cache-key-manager.ts
|
|
526
525
|
/**
|
|
527
526
|
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
528
527
|
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
@@ -539,6 +538,57 @@ function isRequestKey(identifier) {
|
|
|
539
538
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) return !!identifier && typeof identifier === "object" && "type" in identifier && !("id" in identifier) && identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
540
539
|
else return identifier.type === "@document" && identifier[CACHE_OWNER] !== void 0;
|
|
541
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
543
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
544
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
545
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
546
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
547
|
+
*/
|
|
548
|
+
/**
|
|
549
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
550
|
+
*
|
|
551
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
552
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
553
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
554
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
555
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
556
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
557
|
+
*
|
|
558
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
559
|
+
* returns `null`.
|
|
560
|
+
*/
|
|
561
|
+
function fieldValueIdentity(schema, field, value) {
|
|
562
|
+
if (field.kind !== "schema-object" && field.kind !== "schema-array") return null;
|
|
563
|
+
if (!value || typeof value !== "object") return null;
|
|
564
|
+
const rawValue = value;
|
|
565
|
+
let type;
|
|
566
|
+
if (field.options?.polymorphic) {
|
|
567
|
+
const typePath = field.options.type ?? "type";
|
|
568
|
+
if (typePath === "@hash") {
|
|
569
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
570
|
+
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
571
|
+
})(field.type);
|
|
572
|
+
type = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
573
|
+
} else {
|
|
574
|
+
type = rawValue[typePath];
|
|
575
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
576
|
+
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
577
|
+
})(typePath && type && typeof type === "string");
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
581
|
+
if (!test) throw new Error(`A non-polymorphic ${field.kind} field must provide a SchemaObject type in its definition`);
|
|
582
|
+
})(field.type);
|
|
583
|
+
type = field.type;
|
|
584
|
+
}
|
|
585
|
+
const hashField = schema.resource({ type }).identity;
|
|
586
|
+
const hash = hashField && hashField.kind === "@hash" ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : null;
|
|
587
|
+
return {
|
|
588
|
+
type,
|
|
589
|
+
hash
|
|
590
|
+
};
|
|
591
|
+
}
|
|
542
592
|
const _crypto = typeof FastBoot !== "undefined" ? FastBoot.require("crypto") : globalThis.crypto;
|
|
543
593
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.polyfillUUID)) installPolyfill();
|
|
544
594
|
function uuidv4() {
|
|
@@ -620,6 +670,8 @@ implement this hook.
|
|
|
620
670
|
|
|
621
671
|
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
622
672
|
|
|
673
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
674
|
+
before the store is created.
|
|
623
675
|
@public
|
|
624
676
|
*/
|
|
625
677
|
function setIdentifierGenerationMethod(method) {
|
|
@@ -654,6 +706,8 @@ prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
|
654
706
|
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
655
707
|
without providing an `id` when one is missing will throw an error.
|
|
656
708
|
|
|
709
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
710
|
+
own secondary lookup tables.
|
|
657
711
|
@public
|
|
658
712
|
*/
|
|
659
713
|
function setIdentifierUpdateMethod(method) {
|
|
@@ -671,6 +725,8 @@ import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
|
671
725
|
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
672
726
|
from any secondary lookup tables or caches that the user has populated for it.
|
|
673
727
|
|
|
728
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
729
|
+
lookup tables.
|
|
674
730
|
@public
|
|
675
731
|
*/
|
|
676
732
|
function setIdentifierForgetMethod(method) {
|
|
@@ -690,6 +746,8 @@ Takes a method which can expect to be called when the parent application is dest
|
|
|
690
746
|
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
691
747
|
to the application instance, you may not need to implement the `resetMethod`.
|
|
692
748
|
|
|
749
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
750
|
+
key-generation state.
|
|
693
751
|
@public
|
|
694
752
|
*/
|
|
695
753
|
function setIdentifierResetMethod(method) {
|
|
@@ -708,6 +766,8 @@ This configuration MUST occur prior to the store instance being created.
|
|
|
708
766
|
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
709
767
|
```
|
|
710
768
|
|
|
769
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
770
|
+
must be set before the store is created.
|
|
711
771
|
@public
|
|
712
772
|
*/
|
|
713
773
|
function setKeyInfoForResource(method) {
|
|
@@ -1191,8 +1251,7 @@ function addResourceToCache(cache, identifier) {
|
|
|
1191
1251
|
if (identifier.id) typeSet.id.set(identifier.id, identifier);
|
|
1192
1252
|
}
|
|
1193
1253
|
|
|
1194
|
-
|
|
1195
|
-
//#region src/store/-private/managers/cache-capabilities-manager.ts
|
|
1254
|
+
// src/store/-private/managers/cache-capabilities-manager.ts
|
|
1196
1255
|
var CacheCapabilitiesManager = class {
|
|
1197
1256
|
/** @internal */
|
|
1198
1257
|
/** @internal */
|
|
@@ -1300,8 +1359,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
1300
1359
|
*/
|
|
1301
1360
|
function assertPrivateCapabilities(manager) {}
|
|
1302
1361
|
|
|
1303
|
-
|
|
1304
|
-
//#region src/store/-private/caches/instance-cache.ts
|
|
1362
|
+
// src/store/-private/caches/instance-cache.ts
|
|
1305
1363
|
function isDestroyable(record) {
|
|
1306
1364
|
return Boolean(record && typeof record === "object" && typeof record.destroy === "function");
|
|
1307
1365
|
}
|
|
@@ -1323,6 +1381,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
1323
1381
|
const { id, type, lid } = identifier;
|
|
1324
1382
|
```
|
|
1325
1383
|
|
|
1384
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
1326
1385
|
@public
|
|
1327
1386
|
@param record a record instance previously obstained from the store.
|
|
1328
1387
|
*/
|
|
@@ -1608,8 +1667,7 @@ function unloadRecord(instances, identifier) {
|
|
|
1608
1667
|
}
|
|
1609
1668
|
}
|
|
1610
1669
|
|
|
1611
|
-
|
|
1612
|
-
//#region src/store/-private/managers/cache-manager.ts
|
|
1670
|
+
// src/store/-private/managers/cache-manager.ts
|
|
1613
1671
|
/**
|
|
1614
1672
|
* The CacheManager wraps a Cache enforcing that only
|
|
1615
1673
|
* the public API surface area is exposed.
|
|
@@ -1693,7 +1751,8 @@ var CacheManager = class {
|
|
|
1693
1751
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
1694
1752
|
*
|
|
1695
1753
|
* @public
|
|
1696
|
-
* @return
|
|
1754
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
1755
|
+
* this push changed, or `undefined` when none did. Otherwise `void`.
|
|
1697
1756
|
*/
|
|
1698
1757
|
upsert(key, data, hasRecord) {
|
|
1699
1758
|
return this.___cache.upsert(key, data, hasRecord);
|
|
@@ -1995,13 +2054,18 @@ var CacheManager = class {
|
|
|
1995
2054
|
}
|
|
1996
2055
|
};
|
|
1997
2056
|
|
|
1998
|
-
|
|
1999
|
-
//#region src/store/-private/managers/notification-manager.ts
|
|
2057
|
+
// src/store/-private/managers/notification-manager.ts
|
|
2000
2058
|
/**
|
|
2001
2059
|
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
2060
|
+
*
|
|
2061
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
2062
|
+
* or `state`.
|
|
2002
2063
|
*/
|
|
2003
2064
|
/**
|
|
2004
2065
|
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
2066
|
+
*
|
|
2067
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
2068
|
+
* `invalidated`.
|
|
2005
2069
|
*/
|
|
2006
2070
|
function isCacheOperationValue(value) {
|
|
2007
2071
|
return value === "added" || value === "state" || value === "updated" || value === "removed" || value === "invalidated";
|
|
@@ -2009,6 +2073,9 @@ function isCacheOperationValue(value) {
|
|
|
2009
2073
|
/**
|
|
2010
2074
|
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
2011
2075
|
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
2076
|
+
*
|
|
2077
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
2078
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
2012
2079
|
*/
|
|
2013
2080
|
/**
|
|
2014
2081
|
* The shape accepted by {@link NotificationManager.notify} and
|
|
@@ -2016,6 +2083,8 @@ function isCacheOperationValue(value) {
|
|
|
2016
2083
|
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
2017
2084
|
* instead of once per key.
|
|
2018
2085
|
*
|
|
2086
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
2087
|
+
* `relationships` changes in one call.
|
|
2019
2088
|
* @since 5.9.0
|
|
2020
2089
|
* @public
|
|
2021
2090
|
*/
|
|
@@ -2050,6 +2119,8 @@ function isCacheOperationValue(value) {
|
|
|
2050
2119
|
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
2051
2120
|
* have no local/remote duality.
|
|
2052
2121
|
*
|
|
2122
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
2123
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
2053
2124
|
* @public
|
|
2054
2125
|
*/
|
|
2055
2126
|
/**
|
|
@@ -2188,6 +2259,8 @@ function _unsubscribe(token, cache) {
|
|
|
2188
2259
|
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2189
2260
|
* work with any framework or change-notification system.
|
|
2190
2261
|
*
|
|
2262
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
2263
|
+
* cached resources and request documents.
|
|
2191
2264
|
* @hideconstructor
|
|
2192
2265
|
* @public
|
|
2193
2266
|
*/
|
|
@@ -2414,8 +2487,7 @@ function hasSubscribers(cache, cacheKey, value) {
|
|
|
2414
2487
|
return Boolean(callbackMap?.length);
|
|
2415
2488
|
}
|
|
2416
2489
|
|
|
2417
|
-
|
|
2418
|
-
//#region src/store/-private/record-arrays/-utils.ts
|
|
2490
|
+
// src/store/-private/record-arrays/-utils.ts
|
|
2419
2491
|
/**
|
|
2420
2492
|
* LegacyArrays have the capability of updating via `array.update()`
|
|
2421
2493
|
* and saving each contained record individually via `array.save()`
|
|
@@ -2494,8 +2566,7 @@ function safeForEach$1(instance, arr, store, callback, target) {
|
|
|
2494
2566
|
return instance;
|
|
2495
2567
|
}
|
|
2496
2568
|
|
|
2497
|
-
|
|
2498
|
-
//#region src/reactive/-private/fields/extension.ts
|
|
2569
|
+
// src/reactive/-private/fields/extension.ts
|
|
2499
2570
|
function expectNever(value) {}
|
|
2500
2571
|
function isExtensionProp(extensions, prop) {
|
|
2501
2572
|
return Boolean(extensions && typeof prop !== "number" && extensions.has(prop));
|
|
@@ -2583,8 +2654,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2583
2654
|
}
|
|
2584
2655
|
}
|
|
2585
2656
|
|
|
2586
|
-
|
|
2587
|
-
//#region src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2657
|
+
// src/store/-private/record-arrays/native-proxy-type-fix.ts
|
|
2588
2658
|
/**
|
|
2589
2659
|
* The global `Proxy` constructor, retyped with the corrected
|
|
2590
2660
|
* {@link ProxyConstructor} signature above so that `target` and `receiver`
|
|
@@ -2594,8 +2664,7 @@ function performArrayExtensionGet(receiver, extensions, signals, prop, _SIGNAL,
|
|
|
2594
2664
|
*/
|
|
2595
2665
|
const NativeProxy = Proxy;
|
|
2596
2666
|
|
|
2597
|
-
|
|
2598
|
-
//#region src/store/-private/record-arrays/resource-array.ts
|
|
2667
|
+
// src/store/-private/record-arrays/resource-array.ts
|
|
2599
2668
|
const IS_COLLECTION = getOrSetGlobal("IS_COLLECTION", Symbol.for("Collection"));
|
|
2600
2669
|
function isContextProp(prop) {
|
|
2601
2670
|
return prop === "destroy" || prop === "isDestroying" || prop === "isDestroyed";
|
|
@@ -2622,10 +2691,15 @@ const MUTABLE_PROPS = [
|
|
|
2622
2691
|
* as the base for relationship and legacy record-array types such as
|
|
2623
2692
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
2624
2693
|
*
|
|
2694
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
2695
|
+
* how it relates to resources.
|
|
2696
|
+
*
|
|
2625
2697
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
2626
2698
|
* both report `true`. The array stays in sync with the cache, updating
|
|
2627
2699
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
2628
2700
|
*
|
|
2701
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
2702
|
+
* and underlying relationship and legacy record arrays.
|
|
2629
2703
|
* @public
|
|
2630
2704
|
*/
|
|
2631
2705
|
/**
|
|
@@ -2884,8 +2958,7 @@ function createRequestCollection(config) {
|
|
|
2884
2958
|
});
|
|
2885
2959
|
}
|
|
2886
2960
|
|
|
2887
|
-
|
|
2888
|
-
//#region src/store/-private/record-arrays/legacy-live-array.ts
|
|
2961
|
+
// src/store/-private/record-arrays/legacy-live-array.ts
|
|
2889
2962
|
/**
|
|
2890
2963
|
* LiveArrays contain all the known records for a given `ResourceType`.
|
|
2891
2964
|
*
|
|
@@ -2946,6 +3019,8 @@ function createRequestCollection(config) {
|
|
|
2946
3019
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
2947
3020
|
* would be empty.
|
|
2948
3021
|
*
|
|
3022
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
3023
|
+
* `store.findAll`.
|
|
2949
3024
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
2950
3025
|
*/
|
|
2951
3026
|
/**
|
|
@@ -2989,8 +3064,7 @@ function _updateLiveArray() {
|
|
|
2989
3064
|
return context.store.findAll(this.modelName, { reload: true });
|
|
2990
3065
|
}
|
|
2991
3066
|
|
|
2992
|
-
|
|
2993
|
-
//#region src/store/-private/record-arrays/legacy-query.ts
|
|
3067
|
+
// src/store/-private/record-arrays/legacy-query.ts
|
|
2994
3068
|
/**
|
|
2995
3069
|
* QueryArrays contain the primary records returned when querying
|
|
2996
3070
|
* for records by `ResourceType`.
|
|
@@ -3061,6 +3135,8 @@ function _updateLiveArray() {
|
|
|
3061
3135
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
3062
3136
|
* from the store for book-keeping.
|
|
3063
3137
|
*
|
|
3138
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
3139
|
+
* `update()` and released with `destroy()`.
|
|
3064
3140
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
3065
3141
|
*/
|
|
3066
3142
|
/**
|
|
@@ -3123,8 +3199,7 @@ function destroyCollection(clear) {
|
|
|
3123
3199
|
manager._pending.delete(this);
|
|
3124
3200
|
}
|
|
3125
3201
|
|
|
3126
|
-
|
|
3127
|
-
//#region src/store/-private/managers/record-array-manager.ts
|
|
3202
|
+
// src/store/-private/managers/record-array-manager.ts
|
|
3128
3203
|
const FAKE_ARR = getOrSetGlobal("FAKE_ARR", {});
|
|
3129
3204
|
const SLICE_BATCH_SIZE = 4761;
|
|
3130
3205
|
/**
|
|
@@ -3543,8 +3618,7 @@ function isLegacyLiveArray(array) {
|
|
|
3543
3618
|
return context.features !== null && context.features.DEPRECATED_CLASS_NAME === "LiveArray";
|
|
3544
3619
|
}
|
|
3545
3620
|
|
|
3546
|
-
|
|
3547
|
-
//#region src/store/-private/network/request-cache.ts
|
|
3621
|
+
// src/store/-private/network/request-cache.ts
|
|
3548
3622
|
const Touching = getOrSetGlobal("Touching", Symbol("touching"));
|
|
3549
3623
|
const RequestPromise = getOrSetGlobal("RequestPromise", Symbol("promise"));
|
|
3550
3624
|
const EMPTY_ARR = macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) ? Object.freeze([]) : [];
|
|
@@ -3755,8 +3829,7 @@ var RequestStateService = class {
|
|
|
3755
3829
|
*
|
|
3756
3830
|
* @private
|
|
3757
3831
|
*/
|
|
3758
|
-
|
|
3759
|
-
//#region src/store/-private/store-service.ts
|
|
3832
|
+
// src/store/-private/store-service.ts
|
|
3760
3833
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
3761
3834
|
globalThis.setWarpDriveLogging = setLogging;
|
|
3762
3835
|
globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
|
|
@@ -3883,6 +3956,10 @@ const app = new EmberApp(defaults, {
|
|
|
3883
3956
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
3884
3957
|
* requests for data with schemas, caching and reactivity.
|
|
3885
3958
|
*
|
|
3959
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
3960
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
3961
|
+
* through it.
|
|
3962
|
+
*
|
|
3886
3963
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
3887
3964
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
3888
3965
|
* even when you aren't sure yet.
|
|
@@ -3890,6 +3967,7 @@ const app = new EmberApp(defaults, {
|
|
|
3890
3967
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
3891
3968
|
* is possible.
|
|
3892
3969
|
*
|
|
3970
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
3893
3971
|
* @public
|
|
3894
3972
|
* @hideconstructor
|
|
3895
3973
|
*/
|
|
@@ -4104,12 +4182,25 @@ var Store = class extends BaseClass {
|
|
|
4104
4182
|
}
|
|
4105
4183
|
}
|
|
4106
4184
|
/**
|
|
4107
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
4185
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
4108
4186
|
* :::
|
|
4109
4187
|
*
|
|
4110
4188
|
* Issue a request via the configured {@link RequestManager},
|
|
4111
4189
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
4112
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
4190
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
4191
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
4192
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
4193
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
4194
|
+
* {@link StructuredDocument}.
|
|
4195
|
+
*
|
|
4196
|
+
* #### Building Requests
|
|
4197
|
+
*
|
|
4198
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
4199
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
4200
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
4201
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
4202
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
4203
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
4113
4204
|
*
|
|
4114
4205
|
* #### Request Cache Keys
|
|
4115
4206
|
*
|
|
@@ -4154,6 +4245,29 @@ var Store = class extends BaseClass {
|
|
|
4154
4245
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
4155
4246
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
4156
4247
|
*
|
|
4248
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
4249
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
4250
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
4251
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
4252
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
4253
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
4254
|
+
*
|
|
4255
|
+
* #### Typing The Response
|
|
4256
|
+
*
|
|
4257
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
4258
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
4259
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
4260
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
4261
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
4262
|
+
*
|
|
4263
|
+
* @example
|
|
4264
|
+
* ```ts
|
|
4265
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
4266
|
+
*
|
|
4267
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
4268
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
4269
|
+
* ```
|
|
4270
|
+
*
|
|
4157
4271
|
* @public
|
|
4158
4272
|
*/
|
|
4159
4273
|
request(requestConfig) {
|
|
@@ -4744,8 +4858,7 @@ function extractIdentifierFromRecord$1(recordOrPromiseRecord) {
|
|
|
4744
4858
|
return recordIdentifierFor(recordOrPromiseRecord);
|
|
4745
4859
|
}
|
|
4746
4860
|
|
|
4747
|
-
|
|
4748
|
-
//#region src/store/deprecated/-private.ts
|
|
4861
|
+
// src/store/deprecated/-private.ts
|
|
4749
4862
|
function preloadData(store, identifier, preload) {
|
|
4750
4863
|
const jsonPayload = {};
|
|
4751
4864
|
const fields = store.schema.fields(identifier);
|
|
@@ -4792,6 +4905,8 @@ function _convertPreloadRelationshipToJSON(value, type) {
|
|
|
4792
4905
|
* for @warp-drive-mirror/legacy/model or when wrapping schema for legacy
|
|
4793
4906
|
* Adapters/Serializers.
|
|
4794
4907
|
*
|
|
4908
|
+
* @summary Legacy shape of a Model class's static schema API (fields, attributes, relationships, iterators) used
|
|
4909
|
+
* by the legacy schema service and Adapters/Serializers.
|
|
4795
4910
|
*/
|
|
4796
4911
|
function _resourceIsFullDeleted(identifier, cache) {
|
|
4797
4912
|
return cache.isDeletionCommitted(identifier) || cache.isNew(identifier) && cache.isDeleted(identifier);
|
|
@@ -5022,15 +5137,14 @@ var ShimModelClass = class {
|
|
|
5022
5137
|
}
|
|
5023
5138
|
};
|
|
5024
5139
|
|
|
5025
|
-
|
|
5026
|
-
//#region src/store/deprecated/store.ts
|
|
5140
|
+
// src/store/deprecated/store.ts
|
|
5027
5141
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_REQUEST_METHODS)) {
|
|
5028
5142
|
Store.prototype.findRecord = function(resource, id, options) {
|
|
5029
5143
|
deprecate(`store.findRecord is deprecated. Use store.request instead.`, false, {
|
|
5030
5144
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5031
5145
|
until: "6.0",
|
|
5032
5146
|
for: "@warp-drive-mirror/core",
|
|
5033
|
-
url: "https://
|
|
5147
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5034
5148
|
since: {
|
|
5035
5149
|
enabled: "5.7",
|
|
5036
5150
|
available: "5.7"
|
|
@@ -5075,7 +5189,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5075
5189
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5076
5190
|
until: "6.0",
|
|
5077
5191
|
for: "@warp-drive-mirror/core",
|
|
5078
|
-
url: "https://
|
|
5192
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5079
5193
|
since: {
|
|
5080
5194
|
enabled: "5.7",
|
|
5081
5195
|
available: "5.7"
|
|
@@ -5104,7 +5218,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5104
5218
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5105
5219
|
until: "6.0",
|
|
5106
5220
|
for: "@warp-drive-mirror/core",
|
|
5107
|
-
url: "https://
|
|
5221
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5108
5222
|
since: {
|
|
5109
5223
|
enabled: "5.7",
|
|
5110
5224
|
available: "5.7"
|
|
@@ -5137,7 +5251,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5137
5251
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5138
5252
|
until: "6.0",
|
|
5139
5253
|
for: "@warp-drive-mirror/core",
|
|
5140
|
-
url: "https://
|
|
5254
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5141
5255
|
since: {
|
|
5142
5256
|
enabled: "5.7",
|
|
5143
5257
|
available: "5.7"
|
|
@@ -5170,7 +5284,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5170
5284
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5171
5285
|
until: "6.0",
|
|
5172
5286
|
for: "@warp-drive-mirror/core",
|
|
5173
|
-
url: "https://
|
|
5287
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5174
5288
|
since: {
|
|
5175
5289
|
enabled: "5.7",
|
|
5176
5290
|
available: "5.7"
|
|
@@ -5203,7 +5317,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5203
5317
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5204
5318
|
until: "6.0",
|
|
5205
5319
|
for: "@warp-drive-mirror/core",
|
|
5206
|
-
url: "https://
|
|
5320
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5207
5321
|
since: {
|
|
5208
5322
|
enabled: "5.7",
|
|
5209
5323
|
available: "5.7"
|
|
@@ -5225,7 +5339,7 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.deprecations.ENABLE_LEGACY_
|
|
|
5225
5339
|
id: "warp-drive:deprecate-legacy-request-methods",
|
|
5226
5340
|
until: "6.0",
|
|
5227
5341
|
for: "@warp-drive-mirror/core",
|
|
5228
|
-
url: "https://
|
|
5342
|
+
url: "https://warp-drive.io/api/@warp-drive-mirror/core/build-config/deprecations/variables/ENABLE_LEGACY_REQUEST_METHODS",
|
|
5229
5343
|
since: {
|
|
5230
5344
|
enabled: "5.7",
|
|
5231
5345
|
available: "5.7"
|
|
@@ -5266,8 +5380,7 @@ function upgradeInstanceCaches(cache) {
|
|
|
5266
5380
|
return withReferences;
|
|
5267
5381
|
}
|
|
5268
5382
|
|
|
5269
|
-
|
|
5270
|
-
//#region src/store/-private/cache-handler/utils.ts
|
|
5383
|
+
// src/store/-private/cache-handler/utils.ts
|
|
5271
5384
|
const MUTATION_OPS$1 = /* @__PURE__ */ new Set([
|
|
5272
5385
|
"createRecord",
|
|
5273
5386
|
"updateRecord",
|
|
@@ -5307,15 +5420,20 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5307
5420
|
return priority;
|
|
5308
5421
|
}
|
|
5309
5422
|
|
|
5310
|
-
|
|
5311
|
-
//#region src/store/-private/cache-handler/handler.ts
|
|
5423
|
+
// src/store/-private/cache-handler/handler.ts
|
|
5312
5424
|
/**
|
|
5313
5425
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
5314
5426
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
5427
|
+
*
|
|
5428
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
5429
|
+
* form with plain `records` and `headers`.
|
|
5315
5430
|
*/
|
|
5316
5431
|
/**
|
|
5317
5432
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
5318
5433
|
*
|
|
5434
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
5435
|
+
* request can use the cache.
|
|
5436
|
+
*
|
|
5319
5437
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
5320
5438
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
5321
5439
|
* attached to the request.
|
|
@@ -5351,7 +5469,10 @@ function getPriority(identifier, deduped, priority) {
|
|
|
5351
5469
|
* method: 'GET',
|
|
5352
5470
|
* [EnableHydration]: true
|
|
5353
5471
|
* });
|
|
5472
|
+
* ```
|
|
5354
5473
|
*
|
|
5474
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
5475
|
+
* reactive documents when hydration is enabled.
|
|
5355
5476
|
*/
|
|
5356
5477
|
const CacheHandler = { request(context, next) {
|
|
5357
5478
|
if (!context.request.store || context.request.cacheOptions?.[SkipCache]) return next(context.request);
|
|
@@ -5532,14 +5653,12 @@ function fetchContentAndHydrate(next, context, identifier, priority) {
|
|
|
5532
5653
|
}] });
|
|
5533
5654
|
}
|
|
5534
5655
|
|
|
5535
|
-
|
|
5536
|
-
//#region src/store/-private/utils/is-non-empty-string.ts
|
|
5656
|
+
// src/store/-private/utils/is-non-empty-string.ts
|
|
5537
5657
|
function isNonEmptyString(str) {
|
|
5538
5658
|
return Boolean(str && typeof str === "string");
|
|
5539
5659
|
}
|
|
5540
5660
|
|
|
5541
|
-
|
|
5542
|
-
//#region src/store/-private/utils/construct-resource.ts
|
|
5661
|
+
// src/store/-private/utils/construct-resource.ts
|
|
5543
5662
|
/**
|
|
5544
5663
|
* Given an existing resource identifier object (or a {@link ResourceKey}),
|
|
5545
5664
|
* returns it unchanged aside from coercing its `id`, if present, to a string.
|
|
@@ -5611,8 +5730,7 @@ function constructResource(type, id, lid) {
|
|
|
5611
5730
|
}
|
|
5612
5731
|
}
|
|
5613
5732
|
|
|
5614
|
-
|
|
5615
|
-
//#region src/store/-private/record-arrays/legacy-many-array.ts
|
|
5733
|
+
// src/store/-private/record-arrays/legacy-many-array.ts
|
|
5616
5734
|
/**
|
|
5617
5735
|
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
5618
5736
|
relationship.
|
|
@@ -5653,6 +5771,7 @@ the has-many.
|
|
|
5653
5771
|
We call the record to which a relationship belongs-to the
|
|
5654
5772
|
relationship's _owner_.
|
|
5655
5773
|
|
|
5774
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
5656
5775
|
@public
|
|
5657
5776
|
*/
|
|
5658
5777
|
/**
|
|
@@ -5684,7 +5803,7 @@ function createLegacyManyArray(options) {
|
|
|
5684
5803
|
isAsync: options.isAsync,
|
|
5685
5804
|
isPolymorphic: options.isPolymorphic,
|
|
5686
5805
|
identifier: options.identifier,
|
|
5687
|
-
key: options.field.name,
|
|
5806
|
+
key: options.field.sourceKey ?? options.field.name,
|
|
5688
5807
|
reload,
|
|
5689
5808
|
createRecord,
|
|
5690
5809
|
notify
|
|
@@ -5961,8 +6080,7 @@ function mutate(collection, mutation, _SIGNAL) {
|
|
|
5961
6080
|
notifyInternalSignal(_SIGNAL);
|
|
5962
6081
|
}
|
|
5963
6082
|
|
|
5964
|
-
|
|
5965
|
-
//#region src/reactive/-private/kind/alias-field.ts
|
|
6083
|
+
// src/reactive/-private/kind/alias-field.ts
|
|
5966
6084
|
function getAliasField(context) {
|
|
5967
6085
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
5968
6086
|
if (!test) throw new Error(`Alias field access is not implemented`);
|
|
@@ -5975,8 +6093,7 @@ function setAliasField(context) {
|
|
|
5975
6093
|
return false;
|
|
5976
6094
|
}
|
|
5977
6095
|
|
|
5978
|
-
|
|
5979
|
-
//#region src/reactive/-private/fields/managed-array.ts
|
|
6096
|
+
// src/reactive/-private/fields/managed-array.ts
|
|
5980
6097
|
const ARRAY_GETTER_METHODS = /* @__PURE__ */ new Set([
|
|
5981
6098
|
Symbol.iterator,
|
|
5982
6099
|
"concat",
|
|
@@ -6076,31 +6193,11 @@ var ManagedArray = class {
|
|
|
6076
6193
|
if (field.type) return schema.transformation(field).hydrate(rawValue, field.options ?? null, self.owner);
|
|
6077
6194
|
return rawValue;
|
|
6078
6195
|
}
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
let objectType;
|
|
6085
|
-
if (field.options?.polymorphic) {
|
|
6086
|
-
const typePath = field.options.type ?? "type";
|
|
6087
|
-
if (typePath === "@hash") {
|
|
6088
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6089
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
6090
|
-
})(field.type);
|
|
6091
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
6092
|
-
} else {
|
|
6093
|
-
objectType = rawValue[typePath];
|
|
6094
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6095
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
6096
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
6097
|
-
}
|
|
6098
|
-
} else {
|
|
6099
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6100
|
-
if (!test) throw new Error(`A non-polymorphic SchemaArrayField must provide a SchemaObject type in its definition`);
|
|
6101
|
-
})(field.type);
|
|
6102
|
-
objectType = field.type;
|
|
6103
|
-
}
|
|
6196
|
+
const identity = fieldValueIdentity(schema, field, rawValue);
|
|
6197
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6198
|
+
if (!test) throw new Error(`Expected a schema-array element to resolve to a schema-object identity`);
|
|
6199
|
+
})(identity !== null);
|
|
6200
|
+
const { type: objectType, hash } = identity;
|
|
6104
6201
|
/**
|
|
6105
6202
|
* When KeyMode=@hash the ReactiveResource is keyed into
|
|
6106
6203
|
* ManagedRecordRefs by the return value of @hash on the rawValue.
|
|
@@ -6110,8 +6207,10 @@ var ManagedArray = class {
|
|
|
6110
6207
|
*/
|
|
6111
6208
|
let schemaObjectKeyValue;
|
|
6112
6209
|
if (KeyMode === "@hash") {
|
|
6113
|
-
|
|
6114
|
-
|
|
6210
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6211
|
+
if (!test) throw new Error(`Expected the '${objectType}' schema to declare an identity hash for key: '@hash'`);
|
|
6212
|
+
})(hash !== null);
|
|
6213
|
+
schemaObjectKeyValue = hash;
|
|
6115
6214
|
} else {
|
|
6116
6215
|
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
6117
6216
|
if (KeyMode !== "@identity" && KeyMode !== "@index") {
|
|
@@ -6260,8 +6359,7 @@ Object.defineProperty(ManagedArray.prototype, "[]", {
|
|
|
6260
6359
|
}
|
|
6261
6360
|
});
|
|
6262
6361
|
|
|
6263
|
-
|
|
6264
|
-
//#region src/reactive/-private/kind/array-field.ts
|
|
6362
|
+
// src/reactive/-private/kind/array-field.ts
|
|
6265
6363
|
function getArrayField(context) {
|
|
6266
6364
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6267
6365
|
const { record } = context;
|
|
@@ -6307,8 +6405,7 @@ function setArrayField(context) {
|
|
|
6307
6405
|
return true;
|
|
6308
6406
|
}
|
|
6309
6407
|
|
|
6310
|
-
|
|
6311
|
-
//#region src/reactive/-private/kind/attribute-field.ts
|
|
6408
|
+
// src/reactive/-private/kind/attribute-field.ts
|
|
6312
6409
|
function getAttributeField(context) {
|
|
6313
6410
|
entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6314
6411
|
const { cache } = context.store;
|
|
@@ -6319,8 +6416,7 @@ function setAttributeField(context) {
|
|
|
6319
6416
|
return true;
|
|
6320
6417
|
}
|
|
6321
6418
|
|
|
6322
|
-
|
|
6323
|
-
//#region src/reactive/-private/fields/get-field-key.ts
|
|
6419
|
+
// src/reactive/-private/fields/get-field-key.ts
|
|
6324
6420
|
const InvalidKinds = [
|
|
6325
6421
|
"alias",
|
|
6326
6422
|
"derived",
|
|
@@ -6339,8 +6435,7 @@ function getFieldCacheKey(field) {
|
|
|
6339
6435
|
return "sourceKey" in field && field.sourceKey ? field.sourceKey : field.name;
|
|
6340
6436
|
}
|
|
6341
6437
|
|
|
6342
|
-
|
|
6343
|
-
//#region src/reactive/-private/kind/belongs-to-field.ts
|
|
6438
|
+
// src/reactive/-private/kind/belongs-to-field.ts
|
|
6344
6439
|
function getBelongsToField(context) {
|
|
6345
6440
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6346
6441
|
const { field, resourceKey, store } = context;
|
|
@@ -6383,8 +6478,7 @@ function getResourceKey(record) {
|
|
|
6383
6478
|
return recordIdentifierFor(record);
|
|
6384
6479
|
}
|
|
6385
6480
|
|
|
6386
|
-
|
|
6387
|
-
//#region src/reactive/-private/kind/collection-field.ts
|
|
6481
|
+
// src/reactive/-private/kind/collection-field.ts
|
|
6388
6482
|
function getCollectionField(context) {
|
|
6389
6483
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6390
6484
|
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
@@ -6398,8 +6492,7 @@ function setCollectionField(context) {
|
|
|
6398
6492
|
return false;
|
|
6399
6493
|
}
|
|
6400
6494
|
|
|
6401
|
-
|
|
6402
|
-
//#region src/reactive/-private/kind/derived-field.ts
|
|
6495
|
+
// src/reactive/-private/kind/derived-field.ts
|
|
6403
6496
|
function getDerivedField(context) {
|
|
6404
6497
|
const { schema } = context.store;
|
|
6405
6498
|
return schema.derivation(context.field)(context.record, context.field.options ?? null, context.field.name);
|
|
@@ -6411,8 +6504,7 @@ function setDerivedField(context) {
|
|
|
6411
6504
|
return false;
|
|
6412
6505
|
}
|
|
6413
6506
|
|
|
6414
|
-
|
|
6415
|
-
//#region src/reactive/-private/kind/generic-field.ts
|
|
6507
|
+
// src/reactive/-private/kind/generic-field.ts
|
|
6416
6508
|
function getGenericField(context) {
|
|
6417
6509
|
const signal = entangleInitiallyStaleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6418
6510
|
signal.isStale = false;
|
|
@@ -6434,8 +6526,7 @@ function setGenericField(context) {
|
|
|
6434
6526
|
return true;
|
|
6435
6527
|
}
|
|
6436
6528
|
|
|
6437
|
-
|
|
6438
|
-
//#region src/reactive/-private/fields/many-array-manager.ts
|
|
6529
|
+
// src/reactive/-private/fields/many-array-manager.ts
|
|
6439
6530
|
var ManyArrayManager = class {
|
|
6440
6531
|
constructor(record, editable) {
|
|
6441
6532
|
const context = record[Context];
|
|
@@ -6497,8 +6588,7 @@ function extractCacheOptions(options) {
|
|
|
6497
6588
|
return cacheOptions;
|
|
6498
6589
|
}
|
|
6499
6590
|
|
|
6500
|
-
|
|
6501
|
-
//#region src/reactive/-private/kind/has-many-field.ts
|
|
6591
|
+
// src/reactive/-private/kind/has-many-field.ts
|
|
6502
6592
|
function getHasManyField(context) {
|
|
6503
6593
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6504
6594
|
const { store, field } = context;
|
|
@@ -6544,8 +6634,7 @@ function setHasManyField(context) {
|
|
|
6544
6634
|
return true;
|
|
6545
6635
|
}
|
|
6546
6636
|
|
|
6547
|
-
|
|
6548
|
-
//#region src/reactive/-private/kind/hash-field.ts
|
|
6637
|
+
// src/reactive/-private/kind/hash-field.ts
|
|
6549
6638
|
function getHashField(context) {
|
|
6550
6639
|
const { field, path, resourceKey } = context;
|
|
6551
6640
|
const { schema, cache } = context.store;
|
|
@@ -6563,8 +6652,7 @@ function setHashField(context) {
|
|
|
6563
6652
|
return false;
|
|
6564
6653
|
}
|
|
6565
6654
|
|
|
6566
|
-
|
|
6567
|
-
//#region src/reactive/-private/kind/identity-field.ts
|
|
6655
|
+
// src/reactive/-private/kind/identity-field.ts
|
|
6568
6656
|
function getIdentityField(context) {
|
|
6569
6657
|
entangleSignal(context.signals, context.record, "@identity", null);
|
|
6570
6658
|
return context.resourceKey.id;
|
|
@@ -6586,8 +6674,7 @@ function setIdentityField(context) {
|
|
|
6586
6674
|
return true;
|
|
6587
6675
|
}
|
|
6588
6676
|
|
|
6589
|
-
|
|
6590
|
-
//#region src/reactive/-private/kind/local-field.ts
|
|
6677
|
+
// src/reactive/-private/kind/local-field.ts
|
|
6591
6678
|
function getLocalField(context) {
|
|
6592
6679
|
const { field } = context;
|
|
6593
6680
|
const signal = getOrCreateInternalSignal(context.signals, context.record, field.name, field.options?.defaultValue ?? null);
|
|
@@ -6604,8 +6691,7 @@ function setLocalField(context) {
|
|
|
6604
6691
|
return true;
|
|
6605
6692
|
}
|
|
6606
6693
|
|
|
6607
|
-
|
|
6608
|
-
//#region src/reactive/-private/fields/managed-object.ts
|
|
6694
|
+
// src/reactive/-private/fields/managed-object.ts
|
|
6609
6695
|
const ObjectSymbols = /* @__PURE__ */ new Set([
|
|
6610
6696
|
OBJECT_SIGNAL,
|
|
6611
6697
|
Context,
|
|
@@ -6689,8 +6775,7 @@ function peekManagedObject(record, field) {
|
|
|
6689
6775
|
if (managedObjectMapForRecord) return managedObjectMapForRecord.get(field.name);
|
|
6690
6776
|
}
|
|
6691
6777
|
|
|
6692
|
-
|
|
6693
|
-
//#region src/reactive/-private/kind/object-field.ts
|
|
6778
|
+
// src/reactive/-private/kind/object-field.ts
|
|
6694
6779
|
function getObjectField(context) {
|
|
6695
6780
|
entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6696
6781
|
const { record, field } = context;
|
|
@@ -6746,8 +6831,7 @@ function setObjectField(context) {
|
|
|
6746
6831
|
return true;
|
|
6747
6832
|
}
|
|
6748
6833
|
|
|
6749
|
-
|
|
6750
|
-
//#region src/reactive/-private/kind/resource-field.ts
|
|
6834
|
+
// src/reactive/-private/kind/resource-field.ts
|
|
6751
6835
|
var ResourceRelationship = class {
|
|
6752
6836
|
constructor(context) {
|
|
6753
6837
|
const { store, resourceKey } = context;
|
|
@@ -6795,8 +6879,7 @@ function setResourceField(context) {
|
|
|
6795
6879
|
return false;
|
|
6796
6880
|
}
|
|
6797
6881
|
|
|
6798
|
-
|
|
6799
|
-
//#region src/reactive/-private/kind/schema-array-field.ts
|
|
6882
|
+
// src/reactive/-private/kind/schema-array-field.ts
|
|
6800
6883
|
function setSchemaArrayField(context) {
|
|
6801
6884
|
const arrayValue = context.value === null ? null : context.value?.slice();
|
|
6802
6885
|
const fieldSignal = peekInternalSignal(context.signals, context.path.at(-1));
|
|
@@ -6813,8 +6896,7 @@ function setSchemaArrayField(context) {
|
|
|
6813
6896
|
return true;
|
|
6814
6897
|
}
|
|
6815
6898
|
|
|
6816
|
-
|
|
6817
|
-
//#region src/reactive/-private/kind/schema-object-field.ts
|
|
6899
|
+
// src/reactive/-private/kind/schema-object-field.ts
|
|
6818
6900
|
function getSchemaObjectField(context) {
|
|
6819
6901
|
const signal = entangleSignal(context.signals, context.record, context.path.at(-1), null);
|
|
6820
6902
|
const { store, resourceKey, path, field } = context;
|
|
@@ -6831,29 +6913,12 @@ function getSchemaObjectField(context) {
|
|
|
6831
6913
|
}
|
|
6832
6914
|
return null;
|
|
6833
6915
|
}
|
|
6834
|
-
const
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
if (!test) throw new Error(`Expected the field to define a hashFn as its type`);
|
|
6841
|
-
})(field.type);
|
|
6842
|
-
objectType = schema.hashFn({ type: field.type })(rawValue, null, null);
|
|
6843
|
-
} else {
|
|
6844
|
-
objectType = rawValue[typePath];
|
|
6845
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6846
|
-
if (!test) throw new Error(`Expected the type path for the field to be a value on the raw object`);
|
|
6847
|
-
})(typePath && objectType && typeof objectType === "string");
|
|
6848
|
-
}
|
|
6849
|
-
} else {
|
|
6850
|
-
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6851
|
-
if (!test) throw new Error(`A non-polymorphic SchemaObjectField must provide a SchemaObject type in its definition`);
|
|
6852
|
-
})(field.type);
|
|
6853
|
-
objectType = field.type;
|
|
6854
|
-
}
|
|
6855
|
-
const hashField = schema.resource({ type: objectType }).identity;
|
|
6856
|
-
const identity = hashField ? schema.hashFn(hashField)(rawValue, hashField.options ?? null, hashField.name) : field.name;
|
|
6916
|
+
const resolved = fieldValueIdentity(store.schema, field, rawValue);
|
|
6917
|
+
macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG) && ((test) => {
|
|
6918
|
+
if (!test) throw new Error(`Expected a schema-object value to resolve to a schema-object identity`);
|
|
6919
|
+
})(resolved !== null);
|
|
6920
|
+
const { type: objectType, hash } = resolved;
|
|
6921
|
+
const identity = hash ?? field.name;
|
|
6857
6922
|
const cachedSchemaObject = signal.value;
|
|
6858
6923
|
if (cachedSchemaObject) {
|
|
6859
6924
|
if (cachedSchemaObject.type === objectType && cachedSchemaObject.identity === identity) return cachedSchemaObject.value;
|
|
@@ -6898,8 +6963,7 @@ function setSchemaObjectField(context) {
|
|
|
6898
6963
|
return true;
|
|
6899
6964
|
}
|
|
6900
6965
|
|
|
6901
|
-
|
|
6902
|
-
//#region src/reactive/-private/default-mode.ts
|
|
6966
|
+
// src/reactive/-private/default-mode.ts
|
|
6903
6967
|
/**
|
|
6904
6968
|
* A ReactiveResource context object passed to
|
|
6905
6969
|
* the get/set functions of a field kind implementation.
|
|
@@ -7015,14 +7079,15 @@ const DefaultMode = {
|
|
|
7015
7079
|
}
|
|
7016
7080
|
};
|
|
7017
7081
|
|
|
7018
|
-
|
|
7019
|
-
//#region src/reactive/-private/record.ts
|
|
7082
|
+
// src/reactive/-private/record.ts
|
|
7020
7083
|
const IgnoredGlobalFields = /* @__PURE__ */ new Set([
|
|
7021
7084
|
"length",
|
|
7022
7085
|
"nodeType",
|
|
7023
7086
|
"then",
|
|
7024
7087
|
"setInterval",
|
|
7025
7088
|
"document",
|
|
7089
|
+
"unknownProperty",
|
|
7090
|
+
"size",
|
|
7026
7091
|
STRUCTURED
|
|
7027
7092
|
]);
|
|
7028
7093
|
const RecordSymbols = /* @__PURE__ */ new Set([
|
|
@@ -7047,10 +7112,14 @@ const Editables = /* @__PURE__ */ new Map();
|
|
|
7047
7112
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
7048
7113
|
* object.
|
|
7049
7114
|
*
|
|
7115
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7116
|
+
* define the schema it reads.
|
|
7117
|
+
*
|
|
7050
7118
|
* This class is not directly instantiable. To use it, you should
|
|
7051
7119
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
7052
7120
|
* with the matching hooks provided by this package.
|
|
7053
7121
|
*
|
|
7122
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
7054
7123
|
* @hideconstructor
|
|
7055
7124
|
* @public
|
|
7056
7125
|
*/
|
|
@@ -7504,6 +7573,8 @@ function assertNeverField(identifier, field, path) {
|
|
|
7504
7573
|
* Edits to editable resources will be automatically committed if a new
|
|
7505
7574
|
* payload from the cache matches their existing value.
|
|
7506
7575
|
*
|
|
7576
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
7577
|
+
* changed locally.
|
|
7507
7578
|
* @public
|
|
7508
7579
|
*
|
|
7509
7580
|
* @returns a promise that resolves to the editable resource
|
|
@@ -7520,14 +7591,15 @@ function checkout(resource) {
|
|
|
7520
7591
|
* approach is for either the API or a Handler to reflect saved
|
|
7521
7592
|
* changes back to update the cache.
|
|
7522
7593
|
*
|
|
7594
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
7595
|
+
* bypassing a save round-trip.
|
|
7523
7596
|
* @public
|
|
7524
7597
|
*/
|
|
7525
7598
|
function commit(record) {
|
|
7526
7599
|
return record[Commit]();
|
|
7527
7600
|
}
|
|
7528
7601
|
|
|
7529
|
-
|
|
7530
|
-
//#region src/reactive/-private/hooks.ts
|
|
7602
|
+
// src/reactive/-private/hooks.ts
|
|
7531
7603
|
/**
|
|
7532
7604
|
* The store's default `instantiateRecord` hook implementation, which
|
|
7533
7605
|
* produces a {@link ReactiveResource} for `identifier` using the resource
|
|
@@ -7537,6 +7609,8 @@ function commit(record) {
|
|
|
7537
7609
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
7538
7610
|
* properties when creating a new legacy record.
|
|
7539
7611
|
*
|
|
7612
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
7613
|
+
* from its registered schema.
|
|
7540
7614
|
* @public
|
|
7541
7615
|
*/
|
|
7542
7616
|
function instantiateRecord(store, identifier, createArgs) {
|
|
@@ -7569,6 +7643,8 @@ function assertReactiveResource(record) {
|
|
|
7569
7643
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
7570
7644
|
* behavior.
|
|
7571
7645
|
*
|
|
7646
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
7647
|
+
* releases it.
|
|
7572
7648
|
* @public
|
|
7573
7649
|
*/
|
|
7574
7650
|
function teardownRecord(record) {
|
|
@@ -7576,8 +7652,7 @@ function teardownRecord(record) {
|
|
|
7576
7652
|
record[Destroy]();
|
|
7577
7653
|
}
|
|
7578
7654
|
|
|
7579
|
-
|
|
7580
|
-
//#region src/reactive/-private/schema.ts
|
|
7655
|
+
// src/reactive/-private/schema.ts
|
|
7581
7656
|
const Support = getOrSetGlobal("Support", /* @__PURE__ */ new WeakMap());
|
|
7582
7657
|
const ConstructorField = {
|
|
7583
7658
|
type: "@constructor",
|
|
@@ -7623,16 +7698,25 @@ _constructor[Type] = "@constructor";
|
|
|
7623
7698
|
* This should only be used for temporary migration purposes
|
|
7624
7699
|
* to the new schema system when migrating from either Model
|
|
7625
7700
|
* or ModelFragments.
|
|
7701
|
+
*
|
|
7702
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
7703
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
7626
7704
|
*/
|
|
7627
7705
|
/**
|
|
7628
7706
|
* Describes one feature added to a resource by a schema extension, as
|
|
7629
7707
|
* classified by {@link processExtension} from the property descriptor it
|
|
7630
7708
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
7709
|
+
*
|
|
7710
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
7711
|
+
* mutable value, or a getter/setter accessor.
|
|
7631
7712
|
*/
|
|
7632
7713
|
/**
|
|
7633
7714
|
* The result of {@link processExtension} normalizing a
|
|
7634
7715
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
7635
7716
|
* by name.
|
|
7717
|
+
*
|
|
7718
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
7719
|
+
* keyed by property name.
|
|
7636
7720
|
*/
|
|
7637
7721
|
const BannedKeys = ["constructor", "__proto__"];
|
|
7638
7722
|
function processExtension(extension) {
|
|
@@ -7732,14 +7816,19 @@ function processExtensions(schema, field, scenario, resolvedType) {
|
|
|
7732
7816
|
* Utility for constructing a ResourceSchema with the recommended
|
|
7733
7817
|
* fields for the PolarisMode experience.
|
|
7734
7818
|
*
|
|
7819
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7820
|
+
* create a schema with it.
|
|
7821
|
+
*
|
|
7735
7822
|
* Using this requires registering the PolarisMode derivations
|
|
7736
7823
|
*
|
|
7737
7824
|
* ```ts
|
|
7738
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
7825
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
7739
7826
|
*
|
|
7740
7827
|
* registerDerivations(schema);
|
|
7741
7828
|
* ```
|
|
7742
7829
|
*
|
|
7830
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
7831
|
+
* PolarisMode resource schema.
|
|
7743
7832
|
* @public
|
|
7744
7833
|
* @param schema
|
|
7745
7834
|
* @return {PolarisResourceSchema}
|
|
@@ -7770,6 +7859,8 @@ function withDefaults(schema) {
|
|
|
7770
7859
|
*
|
|
7771
7860
|
* `^` returns the entire identifier object.
|
|
7772
7861
|
*
|
|
7862
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
7863
|
+
* for use in derived fields.
|
|
7773
7864
|
* @public
|
|
7774
7865
|
*/
|
|
7775
7866
|
const fromIdentity = (record, options, key) => {
|
|
@@ -7793,9 +7884,14 @@ fromIdentity[Type] = "@identity";
|
|
|
7793
7884
|
* to use the PolarisMode defaults provided by
|
|
7794
7885
|
*
|
|
7795
7886
|
* ```ts
|
|
7796
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
7887
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
7797
7888
|
* ```
|
|
7798
7889
|
*
|
|
7890
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
7891
|
+
* guide explains when you need to call it.
|
|
7892
|
+
*
|
|
7893
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
7894
|
+
* `withDefaults` depend on.
|
|
7799
7895
|
* @public
|
|
7800
7896
|
*/
|
|
7801
7897
|
function registerDerivations(schema) {
|
|
@@ -7871,6 +7967,9 @@ function assertConsistentAbstractFieldShape(abstractType, fieldName, existing, i
|
|
|
7871
7967
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
7872
7968
|
* between the raw value `T` stored in the cache and the presentation value
|
|
7873
7969
|
* `PT` exposed on the record.
|
|
7970
|
+
*
|
|
7971
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
7972
|
+
* record, with optional default.
|
|
7874
7973
|
*/
|
|
7875
7974
|
/**
|
|
7876
7975
|
* Wraps a derivation in a new function with Derivation signature but that looks
|
|
@@ -7893,6 +7992,12 @@ function makeCachedDerivation(derivation) {
|
|
|
7893
7992
|
/**
|
|
7894
7993
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
7895
7994
|
*
|
|
7995
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
7996
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
7997
|
+
* shows how to give a store one.
|
|
7998
|
+
*
|
|
7999
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
8000
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
7896
8001
|
* @public
|
|
7897
8002
|
*/
|
|
7898
8003
|
var SchemaService = class {
|
|
@@ -8329,284 +8434,7 @@ function mergeMap(base, toApply) {
|
|
|
8329
8434
|
for (const [key, value] of toApply) base.set(key, value);
|
|
8330
8435
|
}
|
|
8331
8436
|
|
|
8332
|
-
|
|
8333
|
-
//#region src/reactive.ts
|
|
8334
|
-
/**
|
|
8335
|
-
* # About
|
|
8336
|
-
*
|
|
8337
|
-
* This module provides an implementation of reactive objects that a Store may use for creating
|
|
8338
|
-
* reactive representations of the raw data for requests, resources and their relationships
|
|
8339
|
-
* stored in the cache.
|
|
8340
|
-
*
|
|
8341
|
-
* - For configuring the store to use these reactive objects, see [The Setup Guide](/guides/configuration/)
|
|
8342
|
-
* - For defining resource schemas, see [The Schema Guide](/guides/the-manual/schemas/)
|
|
8343
|
-
*
|
|
8344
|
-
* Any method that returns a record instance will use the `instantiateRecord`
|
|
8345
|
-
* hook configured above to instantiate a ReactiveResource once this is in place.
|
|
8346
|
-
* After that, its up to you what ReactiveResource can do.
|
|
8347
|
-
*
|
|
8348
|
-
* ## Modes
|
|
8349
|
-
*
|
|
8350
|
-
* ReactiveResource has two modes: `legacy` and `polaris`.
|
|
8351
|
-
*
|
|
8352
|
-
* **LegacyMode** can be used to emulate the behaviors and capabilities of WarpDrive's `Model` class,
|
|
8353
|
-
* and because there is little distinction between Model and a ReactiveResource in LegacyMode we refer
|
|
8354
|
-
* to both of these approaches as LegacyMode. This mode is the default experience in V5.
|
|
8355
|
-
*
|
|
8356
|
-
* In LegacyMode:
|
|
8357
|
-
*
|
|
8358
|
-
* - records are mutable
|
|
8359
|
-
* - local changes immediately reflect app wide
|
|
8360
|
-
* - records have all the APIs of Model (references, state props, currentState, methods etc)
|
|
8361
|
-
* - the continued use of `@warp-drive-mirror/legacy` is required (though most imports from it can be removed)
|
|
8362
|
-
* - `async: true` relationships are supported (but not recommended outside of [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8363
|
-
*
|
|
8364
|
-
* ---
|
|
8365
|
-
*
|
|
8366
|
-
* **PolarisMode** is an upcoming suite of features that will become the default experience in V6.
|
|
8367
|
-
*
|
|
8368
|
-
* In PolarisMode:
|
|
8369
|
-
*
|
|
8370
|
-
* - records are immutable, unless creating a new resource or explicitly checking out a record for editing
|
|
8371
|
-
* - local changes are isolated until committed, displaying only via the editable version of the record
|
|
8372
|
-
* - records have a more limited API, focused on only what is in their schema.
|
|
8373
|
-
* - some common operations may have more friction to perform because intended utilities are not yet available
|
|
8374
|
-
* - `async: true` relationships are not supported (see [LinksMode](/guides/the-manual/misc/links-mode.md))
|
|
8375
|
-
* - The `@warp-drive-mirror/legacy` package is not required
|
|
8376
|
-
*
|
|
8377
|
-
* These modes are interopable. The reactive object (record) for a resource in PolarisMode can relate to
|
|
8378
|
-
* a record in LegacyMode and vice-versa. This interopability is true whether the record in LegacyMode is
|
|
8379
|
-
* a ReactiveResource or a Model.
|
|
8380
|
-
*
|
|
8381
|
-
* ---
|
|
8382
|
-
*
|
|
8383
|
-
* ## Basic Usage
|
|
8384
|
-
*
|
|
8385
|
-
* ReactiveResource is a reactive object that transforms raw data from an associated
|
|
8386
|
-
* cache into reactive data backed by Signals.
|
|
8387
|
-
*
|
|
8388
|
-
* The shape of the object and the transformation of raw cache data into its
|
|
8389
|
-
* reactive form is controlled by a resource schema.
|
|
8390
|
-
*
|
|
8391
|
-
* For instance, lets say your API is a [{json:api}](https://jsonapi.org) and your store is using
|
|
8392
|
-
* the Cache provided by {@link @warp-drive-mirror/json-api! | @warp-drive-mirror/json-api}, and a request
|
|
8393
|
-
* returns the following raw data:
|
|
8394
|
-
*
|
|
8395
|
-
* ```ts
|
|
8396
|
-
* {
|
|
8397
|
-
* data: {
|
|
8398
|
-
* type: 'user',
|
|
8399
|
-
* id: '1',
|
|
8400
|
-
* attributes: { firstName: 'Chris', lastName: 'Thoburn' },
|
|
8401
|
-
* relationships: { pets: { data: [{ type: 'dog', id: '1' }] }}
|
|
8402
|
-
* },
|
|
8403
|
-
* included: [
|
|
8404
|
-
* {
|
|
8405
|
-
* type: 'dog',
|
|
8406
|
-
* id: '1',
|
|
8407
|
-
* attributes: { name: 'Rey' },
|
|
8408
|
-
* relationships: { owner: { data: { type: 'user', id: '1' }}}
|
|
8409
|
-
* }
|
|
8410
|
-
* ]
|
|
8411
|
-
* }
|
|
8412
|
-
* ```
|
|
8413
|
-
*
|
|
8414
|
-
* We could describe the `'user'` and `'dog'` resources in the above payload
|
|
8415
|
-
* with the following schemas:
|
|
8416
|
-
*
|
|
8417
|
-
* ```ts
|
|
8418
|
-
* store.schema.registerResources([
|
|
8419
|
-
* {
|
|
8420
|
-
* type: 'user',
|
|
8421
|
-
* identity: { type: '@id', name: 'id' },
|
|
8422
|
-
* fields: [
|
|
8423
|
-
* {
|
|
8424
|
-
* type: '@identity',
|
|
8425
|
-
* name: '$type',
|
|
8426
|
-
* kind: 'derived',
|
|
8427
|
-
* options: { key: 'type' },
|
|
8428
|
-
* },
|
|
8429
|
-
* { kind: 'field', name: 'firstName' },
|
|
8430
|
-
* { kind: 'field', name: 'lastName' },
|
|
8431
|
-
* {
|
|
8432
|
-
* kind: 'derived',
|
|
8433
|
-
* name: 'name',
|
|
8434
|
-
* type: 'concat',
|
|
8435
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8436
|
-
* },
|
|
8437
|
-
* {
|
|
8438
|
-
* kind: 'hasMany',
|
|
8439
|
-
* name: 'pets',
|
|
8440
|
-
* type: 'pet',
|
|
8441
|
-
* options: {
|
|
8442
|
-
* async: false,
|
|
8443
|
-
* inverse: 'owner',
|
|
8444
|
-
* polymorphic: true,
|
|
8445
|
-
* linksMode: true,
|
|
8446
|
-
* }
|
|
8447
|
-
* }
|
|
8448
|
-
* ]
|
|
8449
|
-
* },
|
|
8450
|
-
* {
|
|
8451
|
-
* type: 'dog',
|
|
8452
|
-
* identity: { type: '@id', name: 'id' },
|
|
8453
|
-
* fields: [
|
|
8454
|
-
* {
|
|
8455
|
-
* type: '@identity',
|
|
8456
|
-
* name: '$type',
|
|
8457
|
-
* kind: 'derived',
|
|
8458
|
-
* options: { key: 'type' },
|
|
8459
|
-
* },
|
|
8460
|
-
* { kind: 'field', name: 'name' },
|
|
8461
|
-
* {
|
|
8462
|
-
* kind: 'belongsTo',
|
|
8463
|
-
* name: 'owner',
|
|
8464
|
-
* type: 'user',
|
|
8465
|
-
* options: {
|
|
8466
|
-
* async: false,
|
|
8467
|
-
* inverse: 'pets',
|
|
8468
|
-
* as: 'pet',
|
|
8469
|
-
* linksMode: true,
|
|
8470
|
-
* }
|
|
8471
|
-
* }
|
|
8472
|
-
* ]
|
|
8473
|
-
* }
|
|
8474
|
-
* ]);
|
|
8475
|
-
* ```
|
|
8476
|
-
*
|
|
8477
|
-
* With these schemas in place, the reactive objects that the store would
|
|
8478
|
-
* provide us whenever we encountered a `'user'` or a `'dog'` would be:
|
|
8479
|
-
*
|
|
8480
|
-
* ```ts
|
|
8481
|
-
* interface Pet {
|
|
8482
|
-
* readonly id: string;
|
|
8483
|
-
* readonly owner: User;
|
|
8484
|
-
* }
|
|
8485
|
-
*
|
|
8486
|
-
* interface Dog extends Pet {
|
|
8487
|
-
* readonly $type: 'dog';
|
|
8488
|
-
* readonly name: string;
|
|
8489
|
-
* }
|
|
8490
|
-
*
|
|
8491
|
-
* interface EditableUser {
|
|
8492
|
-
* readonly $type: 'user';
|
|
8493
|
-
* readonly id: string;
|
|
8494
|
-
* firstName: string;
|
|
8495
|
-
* lastName: string;
|
|
8496
|
-
* readonly name: string;
|
|
8497
|
-
* pets: Array<Dog | Pet>;
|
|
8498
|
-
* }
|
|
8499
|
-
*
|
|
8500
|
-
* interface User {
|
|
8501
|
-
* readonly $type: 'user';
|
|
8502
|
-
* readonly id: string;
|
|
8503
|
-
* readonly firstName: string;
|
|
8504
|
-
* readonly lastName: string;
|
|
8505
|
-
* readonly name: string;
|
|
8506
|
-
* readonly pets: Readonly<Array<Dog | Pet>>;
|
|
8507
|
-
* [Checkout](): Promise<EditableUser>
|
|
8508
|
-
* }>
|
|
8509
|
-
* ```
|
|
8510
|
-
*
|
|
8511
|
-
* Note how based on the schema the reactive object we receive is able to produce
|
|
8512
|
-
* `name` on user (despite no name field being in the cache), provide `$type`
|
|
8513
|
-
* pulled from the identity of the resource, and flatten the individual attributes
|
|
8514
|
-
* and relationships onto the record for easier use.
|
|
8515
|
-
*
|
|
8516
|
-
* Notice also how we typed this object with `readonly`. This is because while
|
|
8517
|
-
* ReactiveResource instances are ***deeply reactive***, they are also ***immutable***.
|
|
8518
|
-
*
|
|
8519
|
-
* We can mutate a ReactiveResource only be explicitly asking permission to do so, and
|
|
8520
|
-
* in the process gaining access to an editable copy. The immutable version will
|
|
8521
|
-
* not show any in-process edits made to this editable copy.
|
|
8522
|
-
*
|
|
8523
|
-
* ```ts
|
|
8524
|
-
* import { Checkout } from '@warp-drive-mirror/schema-record';
|
|
8525
|
-
*
|
|
8526
|
-
* const editable = await user[Checkout]();
|
|
8527
|
-
* ```
|
|
8528
|
-
*
|
|
8529
|
-
* ## Utilities
|
|
8530
|
-
*
|
|
8531
|
-
* ReactiveResource provides a schema builder that simplifies setting up a couple of
|
|
8532
|
-
* conventional fields like identity and `$type`. We can rewrite the schema
|
|
8533
|
-
* definition above using this utility like so:
|
|
8534
|
-
*
|
|
8535
|
-
* ```ts
|
|
8536
|
-
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
8537
|
-
*
|
|
8538
|
-
* store.schema.registerResources([
|
|
8539
|
-
* withDefaults({
|
|
8540
|
-
* type: 'user',
|
|
8541
|
-
* fields: [
|
|
8542
|
-
* { kind: 'field', name: 'firstName' },
|
|
8543
|
-
* { kind: 'field', name: 'lastName' },
|
|
8544
|
-
* {
|
|
8545
|
-
* kind: 'derived',
|
|
8546
|
-
* name: 'name',
|
|
8547
|
-
* type: 'concat',
|
|
8548
|
-
* options: { fields: ['firstName', 'lastName'], separator: ' ' }
|
|
8549
|
-
* },
|
|
8550
|
-
* {
|
|
8551
|
-
* kind: 'hasMany',
|
|
8552
|
-
* name: 'pets',
|
|
8553
|
-
* type: 'pet',
|
|
8554
|
-
* options: {
|
|
8555
|
-
* async: false,
|
|
8556
|
-
* inverse: 'owner',
|
|
8557
|
-
* polymorphic: true,
|
|
8558
|
-
* linksMode: true,
|
|
8559
|
-
* resetOnRemoteUpdate: false,
|
|
8560
|
-
* }
|
|
8561
|
-
* }
|
|
8562
|
-
* ]
|
|
8563
|
-
* }),
|
|
8564
|
-
* withDefaults({
|
|
8565
|
-
* type: 'dog',
|
|
8566
|
-
* fields: [
|
|
8567
|
-
* { kind: 'field', name: 'name' },
|
|
8568
|
-
* {
|
|
8569
|
-
* kind: 'belongsTo',
|
|
8570
|
-
* name: 'owner',
|
|
8571
|
-
* type: 'user',
|
|
8572
|
-
* options: {
|
|
8573
|
-
* async: false,
|
|
8574
|
-
* inverse: 'pets',
|
|
8575
|
-
* as: 'pet',
|
|
8576
|
-
* linksMode: true,
|
|
8577
|
-
* resetOnRemoteUpdate: false,
|
|
8578
|
-
* }
|
|
8579
|
-
* }
|
|
8580
|
-
* ]
|
|
8581
|
-
* })
|
|
8582
|
-
* ]);
|
|
8583
|
-
* ```
|
|
8584
|
-
*
|
|
8585
|
-
* ## Type Support
|
|
8586
|
-
*
|
|
8587
|
-
* ### Resource Schemas
|
|
8588
|
-
*
|
|
8589
|
-
* - {@link PolarisResourceSchema}
|
|
8590
|
-
* - {@link LegacyResourceSchema}
|
|
8591
|
-
* - {@link ObjectSchema}
|
|
8592
|
-
*
|
|
8593
|
-
* ### Resource Schema Type Utils
|
|
8594
|
-
*
|
|
8595
|
-
* - {@link resourceSchema}
|
|
8596
|
-
* - {@link objectSchema}
|
|
8597
|
-
* - {@link isResourceSchema}
|
|
8598
|
-
* - {@link isLegacyResourceSchema}
|
|
8599
|
-
*
|
|
8600
|
-
* ### Field Schemas
|
|
8601
|
-
*
|
|
8602
|
-
* - {@link LegacyModeFieldSchema}
|
|
8603
|
-
* - {@link PolarisModeFieldSchema}
|
|
8604
|
-
*
|
|
8605
|
-
* @module
|
|
8606
|
-
*/
|
|
8607
|
-
|
|
8608
|
-
//#endregion
|
|
8609
|
-
//#region src/request/-private/fetch.ts
|
|
8437
|
+
// src/request/-private/fetch.ts
|
|
8610
8438
|
const _fetch = typeof fetch !== "undefined" ? (...args) => fetch(...args) : typeof FastBoot !== "undefined" ? (...args) => FastBoot.require("node-fetch")(...args) : () => {
|
|
8611
8439
|
throw new Error("No Fetch Implementation Found");
|
|
8612
8440
|
};
|
|
@@ -8684,6 +8512,9 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
8684
8512
|
* A basic Fetch Handler which converts a request into a
|
|
8685
8513
|
* `fetch` call presuming the response to be `json`.
|
|
8686
8514
|
*
|
|
8515
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
8516
|
+
* guide shows where it sits in the handler chain.
|
|
8517
|
+
*
|
|
8687
8518
|
* ```ts
|
|
8688
8519
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
8689
8520
|
*
|
|
@@ -8691,6 +8522,8 @@ const ERROR_STATUS_CODE_FOR = /* @__PURE__ */ new Map([
|
|
|
8691
8522
|
* .use([Fetch]);
|
|
8692
8523
|
* ```
|
|
8693
8524
|
*
|
|
8525
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
8526
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
8694
8527
|
* @public
|
|
8695
8528
|
* @badge Handler
|
|
8696
8529
|
*/
|
|
@@ -8811,8 +8644,7 @@ function isDict(v) {
|
|
|
8811
8644
|
return v !== null && typeof v === "object";
|
|
8812
8645
|
}
|
|
8813
8646
|
|
|
8814
|
-
|
|
8815
|
-
//#region src/request/-private/manager.ts
|
|
8647
|
+
// src/request/-private/manager.ts
|
|
8816
8648
|
/**
|
|
8817
8649
|
* ## Import
|
|
8818
8650
|
*
|
|
@@ -8820,7 +8652,8 @@ function isDict(v) {
|
|
|
8820
8652
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
8821
8653
|
* ```
|
|
8822
8654
|
*
|
|
8823
|
-
* For complete usage guide see
|
|
8655
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
8656
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
8824
8657
|
*
|
|
8825
8658
|
* ## How It Works
|
|
8826
8659
|
*
|
|
@@ -8843,11 +8676,28 @@ function isDict(v) {
|
|
|
8843
8676
|
* ```ts [Setup.ts]
|
|
8844
8677
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
8845
8678
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
8846
|
-
* import
|
|
8679
|
+
* import { AuthHandler } from './auth-handler';
|
|
8847
8680
|
*
|
|
8848
8681
|
* // ... create manager
|
|
8849
8682
|
* const manager = new RequestManager()
|
|
8850
|
-
* .use([
|
|
8683
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
8684
|
+
* ```
|
|
8685
|
+
*
|
|
8686
|
+
* ```ts [auth-handler.ts]
|
|
8687
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
8688
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
8689
|
+
*
|
|
8690
|
+
* const token = '<token>';
|
|
8691
|
+
*
|
|
8692
|
+
* // adds a bearer token to every request, then passes it along
|
|
8693
|
+
* export const AuthHandler: Handler = {
|
|
8694
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
8695
|
+
* const headers = new Headers(context.request.headers);
|
|
8696
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
8697
|
+
*
|
|
8698
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
8699
|
+
* },
|
|
8700
|
+
* };
|
|
8851
8701
|
* ```
|
|
8852
8702
|
*
|
|
8853
8703
|
* ```ts [Usage.ts]
|
|
@@ -8863,6 +8713,20 @@ function isDict(v) {
|
|
|
8863
8713
|
*
|
|
8864
8714
|
* :::
|
|
8865
8715
|
*
|
|
8716
|
+
* ### RequestManager vs {@link Store.request}
|
|
8717
|
+
*
|
|
8718
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
8719
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
8720
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
8721
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
8722
|
+
*
|
|
8723
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
8724
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
8725
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
8726
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
8727
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
8728
|
+
* `StructuredDocument`.
|
|
8729
|
+
*
|
|
8866
8730
|
* ### Futures
|
|
8867
8731
|
*
|
|
8868
8732
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -8901,6 +8765,7 @@ function isDict(v) {
|
|
|
8901
8765
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
8902
8766
|
* ```
|
|
8903
8767
|
*
|
|
8768
|
+
* @summary Runs each request through a chain of handlers that can fulfill, modify, or pass it along, and returns a `Future` for the response.
|
|
8904
8769
|
* @public
|
|
8905
8770
|
*/
|
|
8906
8771
|
var RequestManager = class {
|
|
@@ -8964,7 +8829,23 @@ var RequestManager = class {
|
|
|
8964
8829
|
/**
|
|
8965
8830
|
* Issue a Request.
|
|
8966
8831
|
*
|
|
8967
|
-
*
|
|
8832
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
8833
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
8834
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
8835
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
8836
|
+
* `RequestManager` created on its own has neither.
|
|
8837
|
+
*
|
|
8838
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
8839
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
8840
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
8841
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
8842
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
8843
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
8844
|
+
*
|
|
8845
|
+
* @example
|
|
8846
|
+
* ```ts
|
|
8847
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
8848
|
+
* ```
|
|
8968
8849
|
*
|
|
8969
8850
|
* @public
|
|
8970
8851
|
*/
|
|
@@ -9049,9 +8930,10 @@ var RequestManager = class {
|
|
|
9049
8930
|
*
|
|
9050
8931
|
* @private
|
|
9051
8932
|
*/
|
|
9052
|
-
|
|
9053
|
-
//#region src/index.ts
|
|
8933
|
+
// src/index.ts
|
|
9054
8934
|
/**
|
|
8935
|
+
* @summary Main entry point for WarpDrive: the `Store`, `RequestManager`, `Fetch` handler, `CacheHandler`, and
|
|
8936
|
+
* `useRecommendedStore` for building a configured store.
|
|
9055
8937
|
* @module
|
|
9056
8938
|
* @mergeModuleWith <project>
|
|
9057
8939
|
*/
|
|
@@ -9062,11 +8944,17 @@ if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
|
9062
8944
|
globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
9063
8945
|
/**
|
|
9064
8946
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
8947
|
+
*
|
|
8948
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
8949
|
+
* `useRecommendedStore` wires into a Store class.
|
|
9065
8950
|
*/
|
|
9066
8951
|
/**
|
|
9067
8952
|
* Creates a configured Store class with recommended defaults
|
|
9068
8953
|
* for schema handling, reactivity, caching, and request management.
|
|
9069
8954
|
*
|
|
8955
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
8956
|
+
* configuring the store with it.
|
|
8957
|
+
*
|
|
9070
8958
|
* ```ts
|
|
9071
8959
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
9072
8960
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -9169,6 +9057,9 @@ globalThis.setWarpDriveIsMaybeMirage = setIsMaybeMirage;
|
|
|
9169
9057
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
9170
9058
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
9171
9059
|
* `LoggingHandler` does above).
|
|
9060
|
+
*
|
|
9061
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
9062
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
9172
9063
|
*/
|
|
9173
9064
|
function useRecommendedStore(options, StoreKlass = Store) {
|
|
9174
9065
|
return class AppStore extends StoreKlass {
|
|
@@ -9222,6 +9113,5 @@ function useRecommendedStore(options, StoreKlass = Store) {
|
|
|
9222
9113
|
};
|
|
9223
9114
|
}
|
|
9224
9115
|
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
//# sourceMappingURL=src-C-xK8l3f.js.map
|
|
9116
|
+
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 };
|
|
9117
|
+
//# sourceMappingURL=src-BTF6QRQ3.js.map
|