@warp-drive-mirror/core 5.10.0-alpha.2 → 5.10.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -6
- package/dist/{-private-ffnwf62T.js → -private-BiuED7nc.js} +5 -4
- package/dist/{-private-ffnwf62T.js.map → -private-BiuED7nc.js.map} +1 -1
- package/dist/{-private-CArItnX4.js → -private-CvZfrDZl.js} +566 -179
- package/dist/-private-CvZfrDZl.js.map +1 -0
- package/dist/{aliases-BWYW5EhX.d.ts → aliases-BG5TxALl.d.ts} +4 -3
- package/dist/aliases-BG5TxALl.d.ts.map +1 -0
- package/dist/{change-C7kqv2kW.d.ts → change-INHMiZ2a.d.ts} +4 -4
- package/dist/change-INHMiZ2a.d.ts.map +1 -0
- package/dist/{concepts-DFldVwEM.d.ts → concepts-vh86nAcd.d.ts} +14 -7
- package/dist/concepts-vh86nAcd.d.ts.map +1 -0
- package/dist/{configure-B_F639tN.d.ts → configure-BfXDuPUb.d.ts} +57 -10
- package/dist/configure-BfXDuPUb.d.ts.map +1 -0
- package/dist/configure.d.ts +2 -2
- package/dist/configure.js +2 -2
- package/dist/{document-Ca4ZZBd9.d.ts → document-B8Fup751.d.ts} +22 -6
- package/dist/document-B8Fup751.d.ts.map +1 -0
- package/dist/{error-0uD6GkNX.d.ts → error-j5n1yL9m.d.ts} +4 -4
- package/dist/error-j5n1yL9m.d.ts.map +1 -0
- package/dist/{fields-FM7peCiM.d.ts → fields-r1rZJB9d.d.ts} +134 -9
- package/dist/fields-r1rZJB9d.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +1 -1
- package/dist/graph/-private.js +25 -40
- package/dist/graph/-private.js.map +1 -1
- package/dist/{graph-DLqYXP2z.d.ts → graph-BqxaFjEb.d.ts} +25 -7
- package/dist/graph-BqxaFjEb.d.ts.map +1 -0
- package/dist/{identifier-DQnqOSJK.d.ts → identifier-DmgDehQK.d.ts} +29 -6
- package/dist/identifier-DmgDehQK.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{internal-BrqYbG_y.d.ts → internal-D_WIXC4r.d.ts} +1524 -1121
- package/dist/internal-D_WIXC4r.d.ts.map +1 -0
- package/dist/{json-api-raw-C5APJHHB.d.ts → json-api-raw-juUdIITO.d.ts} +44 -4
- package/dist/json-api-raw-juUdIITO.d.ts.map +1 -0
- package/dist/{mutations-CqtoGB4t.d.ts → mutations-CA39mior.d.ts} +18 -4
- package/dist/mutations-CA39mior.d.ts.map +1 -0
- package/dist/{operations-D1qA6r0_.d.ts → operations-C1WAEKKq.d.ts} +39 -7
- package/dist/operations-C1WAEKKq.d.ts.map +1 -0
- package/dist/{params-DrEx3bf8.d.ts → params-CNLjCRyH.d.ts} +11 -3
- package/dist/params-CNLjCRyH.d.ts.map +1 -0
- package/dist/{raw-D5hnjiq7.d.ts → raw-adYGuEGM.d.ts} +10 -3
- package/dist/raw-adYGuEGM.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +1 -1
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.d.ts +2 -2
- package/dist/reactive.js +3 -3
- package/dist/{record-D3QQcaIR.d.ts → record-f5-uOgHt.d.ts} +22 -4
- package/dist/record-f5-uOgHt.d.ts.map +1 -0
- package/dist/{relationship-CmHzMPKf.d.ts → relationship-99pc4CaS.d.ts} +10 -5
- package/dist/relationship-99pc4CaS.d.ts.map +1 -0
- package/dist/{request-o_qGAoFV.js → request-CxtnNIIp.js} +52 -23
- package/dist/request-CxtnNIIp.js.map +1 -0
- package/dist/request.d.ts +1 -1
- package/dist/request.js +1 -1
- package/dist/signals/-leaked.d.ts +86 -18
- package/dist/signals/-leaked.d.ts.map +1 -1
- package/dist/signals/-leaked.js +1 -1
- package/dist/{src-C-xK8l3f.js → src-ccp1WKyt.js} +350 -456
- package/dist/src-ccp1WKyt.js.map +1 -0
- package/dist/store/-private.d.ts +2 -2
- package/dist/store/-private.js +2 -2
- package/dist/{store-DNF9Rgoh.js → store-C8iKKtQK.js} +17 -3
- package/dist/store-C8iKKtQK.js.map +1 -0
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/{symbols-DjRDCeX0.d.ts → symbols-DVa1PMFG.d.ts} +10 -3
- package/dist/symbols-DVa1PMFG.d.ts.map +1 -0
- package/dist/types/-private.d.ts +1 -2
- package/dist/types/-private.d.ts.map +1 -1
- package/dist/types/-private.js +115 -2
- package/dist/types/-private.js.map +1 -0
- package/dist/types/cache/aliases.d.ts +1 -1
- package/dist/types/cache/change.d.ts +1 -1
- package/dist/types/cache/mutations.d.ts +1 -1
- package/dist/types/cache/operations.d.ts +1 -1
- package/dist/types/cache/relationship.d.ts +1 -1
- package/dist/types/cache.d.ts +1 -1
- package/dist/types/graph.d.ts +1 -1
- package/dist/types/identifier.d.ts +1 -1
- package/dist/types/identifier.js +34 -5
- package/dist/types/identifier.js.map +1 -1
- package/dist/types/json/raw.d.ts +1 -1
- package/dist/types/params.d.ts +1 -1
- package/dist/types/record.d.ts +1 -1
- package/dist/types/record.js +26 -2
- package/dist/types/record.js.map +1 -1
- package/dist/types/request.d.ts +1 -1
- package/dist/types/request.js +82 -3
- package/dist/types/request.js.map +1 -1
- package/dist/types/runtime.d.ts +10 -7
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/runtime.js +9 -6
- package/dist/types/runtime.js.map +1 -1
- package/dist/types/schema/concepts.d.ts +1 -1
- package/dist/types/schema/fields.d.ts +1 -1
- package/dist/types/schema/fields.js +133 -5
- package/dist/types/schema/fields.js.map +1 -1
- package/dist/types/schema/schema-service.d.ts +1 -1
- package/dist/types/spec/document.d.ts +1 -1
- package/dist/types/spec/error.d.ts +1 -1
- package/dist/types/spec/json-api-raw.d.ts +1 -1
- package/dist/types/symbols.d.ts +1 -1
- package/dist/types/symbols.js +16 -3
- package/dist/types/symbols.js.map +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/unpkg/{dev-deprecated/-private-CM5N2rtZ.js → dev/-private-B4pCmkq-.js} +566 -179
- package/dist/unpkg/dev/-private-B4pCmkq-.js.map +1 -0
- package/dist/unpkg/{prod-deprecated/-private-207KndDu.js → dev/-private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{dev-deprecated/-private-BO-nArRb.js.map → dev/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/dev/configure.js +2 -2
- package/dist/unpkg/dev/graph/-private.js +26 -41
- package/dist/unpkg/dev/graph/-private.js.map +1 -1
- package/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/reactive/-private.js +1 -1
- package/dist/unpkg/dev/reactive.js +3 -3
- package/dist/unpkg/{dev-deprecated/request-DXPAtRhE.js → dev/request-oWpijCPQ.js} +52 -23
- package/dist/unpkg/dev/request-oWpijCPQ.js.map +1 -0
- package/dist/unpkg/dev/request.js +1 -1
- package/dist/unpkg/dev/{runtime-DW881fpw.js → runtime-RYvEtg99.js} +2 -3
- package/dist/unpkg/dev/{runtime-DW881fpw.js.map → runtime-RYvEtg99.js.map} +1 -1
- package/dist/unpkg/dev/signals/-leaked.js +1 -1
- package/dist/unpkg/dev/{src-kn6qfEPI.js → src-C4ET4R1n.js} +339 -444
- package/dist/unpkg/dev/src-C4ET4R1n.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +2 -2
- package/dist/unpkg/{dev-deprecated/store-D-z_1Jxe.js → dev/store-dZViNfMK.js} +18 -4
- package/dist/unpkg/dev/store-dZViNfMK.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -1
- package/dist/unpkg/dev/types/-private.js +106 -2
- package/dist/unpkg/dev/types/-private.js.map +1 -0
- package/dist/unpkg/dev/types/identifier.js +34 -5
- package/dist/unpkg/dev/types/identifier.js.map +1 -1
- package/dist/unpkg/dev/types/record.js +26 -2
- package/dist/unpkg/dev/types/record.js.map +1 -1
- package/dist/unpkg/dev/types/request.js +82 -3
- package/dist/unpkg/dev/types/request.js.map +1 -1
- package/dist/unpkg/dev/types/runtime.js +9 -6
- package/dist/unpkg/dev/types/runtime.js.map +1 -1
- package/dist/unpkg/dev/types/schema/fields.js +133 -5
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev/types/symbols.js +16 -3
- package/dist/unpkg/dev/types/symbols.js.map +1 -1
- package/dist/unpkg/dev/utils/string.js +1 -2
- package/dist/unpkg/{dev/-private-CM5N2rtZ.js → dev-deprecated/-private-B4pCmkq-.js} +566 -179
- package/dist/unpkg/dev-deprecated/-private-B4pCmkq-.js.map +1 -0
- package/dist/unpkg/dev-deprecated/{-private-BO-nArRb.js → -private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{prod/-private-207KndDu.js.map → dev-deprecated/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/configure.js +2 -2
- package/dist/unpkg/dev-deprecated/graph/-private.js +26 -41
- package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/dev-deprecated/reactive.js +3 -3
- package/dist/unpkg/{dev/request-DXPAtRhE.js → dev-deprecated/request-oWpijCPQ.js} +52 -23
- package/dist/unpkg/dev-deprecated/request-oWpijCPQ.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +1 -1
- package/dist/unpkg/dev-deprecated/{runtime-BIra6K31.js → runtime-DZVuMuzL.js} +2 -3
- package/dist/unpkg/dev-deprecated/{runtime-BIra6K31.js.map → runtime-DZVuMuzL.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/dev-deprecated/{src-DXwW-R57.js → src-jHpowq3S.js} +344 -450
- package/dist/unpkg/dev-deprecated/src-jHpowq3S.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +2 -2
- package/dist/unpkg/{dev/store-C0p6sclI.js → dev-deprecated/store-I7YB0_rC.js} +18 -4
- package/dist/unpkg/dev-deprecated/store-I7YB0_rC.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -1
- package/dist/unpkg/dev-deprecated/types/-private.js +106 -2
- package/dist/unpkg/dev-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/identifier.js +34 -5
- package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/record.js +26 -2
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/request.js +82 -3
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/runtime.js +9 -6
- package/dist/unpkg/dev-deprecated/types/runtime.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +133 -5
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/dev-deprecated/types/symbols.js +16 -3
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/dev-deprecated/utils/string.js +1 -2
- package/dist/unpkg/prod/-private-BiuED7nc.js +23 -0
- package/dist/unpkg/{prod-deprecated/-private-207KndDu.js.map → prod/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/{prod-deprecated/-private-CdDed4yB.js → prod/-private-CrUi_3E_.js} +539 -173
- package/dist/unpkg/prod/-private-CrUi_3E_.js.map +1 -0
- package/dist/unpkg/prod/configure.js +2 -2
- package/dist/unpkg/prod/graph/-private.js +24 -35
- package/dist/unpkg/prod/graph/-private.js.map +1 -1
- package/dist/unpkg/prod/index.js +1 -1
- package/dist/unpkg/prod/reactive/-private.js +1 -1
- package/dist/unpkg/prod/reactive.js +3 -3
- package/dist/unpkg/prod/{request-C7WZg-zk.js → request-Cgw3j6Dx.js} +51 -21
- package/dist/unpkg/prod/request-Cgw3j6Dx.js.map +1 -0
- package/dist/unpkg/prod/request.js +1 -1
- package/dist/unpkg/prod/signals/-leaked.js +1 -1
- package/dist/unpkg/prod/{src-B-GfFQcx.js → src-DFmPDGQ6.js} +311 -414
- package/dist/unpkg/prod/src-DFmPDGQ6.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +2 -2
- package/dist/unpkg/prod/{store-BWhmb7Ob.js → store-Bz9R5hGB.js} +17 -3
- package/dist/unpkg/prod/store-Bz9R5hGB.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -1
- package/dist/unpkg/prod/types/-private.js +94 -2
- package/dist/unpkg/prod/types/-private.js.map +1 -0
- package/dist/unpkg/prod/types/identifier.js +34 -5
- package/dist/unpkg/prod/types/identifier.js.map +1 -1
- package/dist/unpkg/prod/types/record.js +26 -2
- package/dist/unpkg/prod/types/record.js.map +1 -1
- package/dist/unpkg/prod/types/request.js +82 -3
- package/dist/unpkg/prod/types/request.js.map +1 -1
- package/dist/unpkg/prod/types/runtime.js +9 -6
- package/dist/unpkg/prod/types/runtime.js.map +1 -1
- package/dist/unpkg/prod/types/schema/fields.js +133 -5
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod/types/symbols.js +16 -3
- package/dist/unpkg/prod/types/symbols.js.map +1 -1
- package/dist/unpkg/prod/utils/string.js +1 -2
- package/dist/unpkg/{dev/-private-BO-nArRb.js → prod-deprecated/-private-BiuED7nc.js} +5 -4
- package/dist/unpkg/{dev/-private-BO-nArRb.js.map → prod-deprecated/-private-BiuED7nc.js.map} +1 -1
- package/dist/unpkg/{prod/-private-CdDed4yB.js → prod-deprecated/-private-CrUi_3E_.js} +539 -173
- package/dist/unpkg/prod-deprecated/-private-CrUi_3E_.js.map +1 -0
- package/dist/unpkg/prod-deprecated/configure.js +2 -2
- package/dist/unpkg/prod-deprecated/graph/-private.js +24 -35
- package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -1
- package/dist/unpkg/prod-deprecated/index.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -1
- package/dist/unpkg/prod-deprecated/reactive.js +3 -3
- package/dist/unpkg/prod-deprecated/{request-C7WZg-zk.js → request-Cgw3j6Dx.js} +51 -21
- package/dist/unpkg/prod-deprecated/request-Cgw3j6Dx.js.map +1 -0
- package/dist/unpkg/prod-deprecated/request.js +1 -1
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -1
- package/dist/unpkg/prod-deprecated/{src-Bp8ZJctZ.js → src-BgQLcshl.js} +316 -420
- package/dist/unpkg/prod-deprecated/src-BgQLcshl.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +2 -2
- package/dist/unpkg/prod-deprecated/{store-BWhmb7Ob.js → store-Bz9R5hGB.js} +17 -3
- package/dist/unpkg/prod-deprecated/store-Bz9R5hGB.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -1
- package/dist/unpkg/prod-deprecated/types/-private.js +94 -2
- package/dist/unpkg/prod-deprecated/types/-private.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/identifier.js +34 -5
- package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/record.js +26 -2
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/request.js +82 -3
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/runtime.js +9 -6
- package/dist/unpkg/prod-deprecated/types/runtime.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +133 -5
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -1
- package/dist/unpkg/prod-deprecated/types/symbols.js +16 -3
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -1
- package/dist/unpkg/prod-deprecated/utils/string.js +1 -2
- package/dist/utils/string.d.ts +0 -2
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +1 -2
- package/dist/{utils-BtURiy8l.d.ts → utils-BVKvrO6e.d.ts} +8 -3
- package/dist/utils-BVKvrO6e.d.ts.map +1 -0
- package/logos/README.md +1 -1
- package/package.json +9 -9
- package/dist/-private-CArItnX4.js.map +0 -1
- package/dist/-private-CWh7qdp_.js +0 -120
- package/dist/-private-CWh7qdp_.js.map +0 -1
- package/dist/aliases-BWYW5EhX.d.ts.map +0 -1
- package/dist/change-C7kqv2kW.d.ts.map +0 -1
- package/dist/concepts-DFldVwEM.d.ts.map +0 -1
- package/dist/configure-B_F639tN.d.ts.map +0 -1
- package/dist/document-Ca4ZZBd9.d.ts.map +0 -1
- package/dist/error-0uD6GkNX.d.ts.map +0 -1
- package/dist/fields-FM7peCiM.d.ts.map +0 -1
- package/dist/graph-DLqYXP2z.d.ts.map +0 -1
- package/dist/identifier-DQnqOSJK.d.ts.map +0 -1
- package/dist/internal-BrqYbG_y.d.ts.map +0 -1
- package/dist/json-api-raw-C5APJHHB.d.ts.map +0 -1
- package/dist/mutations-CqtoGB4t.d.ts.map +0 -1
- package/dist/operations-D1qA6r0_.d.ts.map +0 -1
- package/dist/params-DrEx3bf8.d.ts.map +0 -1
- package/dist/raw-D5hnjiq7.d.ts.map +0 -1
- package/dist/record-D3QQcaIR.d.ts.map +0 -1
- package/dist/relationship-CmHzMPKf.d.ts.map +0 -1
- package/dist/request-o_qGAoFV.js.map +0 -1
- package/dist/src-C-xK8l3f.js.map +0 -1
- package/dist/store-DNF9Rgoh.js.map +0 -1
- package/dist/symbols-DjRDCeX0.d.ts.map +0 -1
- package/dist/types/schema/fields.type-test.d.ts +0 -1
- package/dist/types/schema/fields.type-test.js +0 -79
- package/dist/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev/-private-BP52H-vC.js +0 -111
- package/dist/unpkg/dev/-private-BP52H-vC.js.map +0 -1
- package/dist/unpkg/dev/-private-CM5N2rtZ.js.map +0 -1
- package/dist/unpkg/dev/request-DXPAtRhE.js.map +0 -1
- package/dist/unpkg/dev/src-kn6qfEPI.js.map +0 -1
- package/dist/unpkg/dev/store-C0p6sclI.js.map +0 -1
- package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-BP52H-vC.js +0 -111
- package/dist/unpkg/dev-deprecated/-private-BP52H-vC.js.map +0 -1
- package/dist/unpkg/dev-deprecated/-private-CM5N2rtZ.js.map +0 -1
- package/dist/unpkg/dev-deprecated/request-DXPAtRhE.js.map +0 -1
- package/dist/unpkg/dev-deprecated/src-DXwW-R57.js.map +0 -1
- package/dist/unpkg/dev-deprecated/store-D-z_1Jxe.js.map +0 -1
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod/-private-207KndDu.js +0 -22
- package/dist/unpkg/prod/-private-CdDed4yB.js.map +0 -1
- package/dist/unpkg/prod/-private-JmhZBKGb.js +0 -99
- package/dist/unpkg/prod/-private-JmhZBKGb.js.map +0 -1
- package/dist/unpkg/prod/request-C7WZg-zk.js.map +0 -1
- package/dist/unpkg/prod/src-B-GfFQcx.js.map +0 -1
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod/types/schema/fields.type-test.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-CdDed4yB.js.map +0 -1
- package/dist/unpkg/prod-deprecated/-private-JmhZBKGb.js +0 -99
- package/dist/unpkg/prod-deprecated/-private-JmhZBKGb.js.map +0 -1
- package/dist/unpkg/prod-deprecated/request-C7WZg-zk.js.map +0 -1
- package/dist/unpkg/prod-deprecated/src-Bp8ZJctZ.js.map +0 -1
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +0 -1
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -79
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js.map +0 -1
- package/dist/utils-BtURiy8l.d.ts.map +0 -1
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { c as RequestKey, l as ResourceKey, n as CacheKeyType, s as PersistedResourceKey } from "./identifier-
|
|
2
|
-
import { t as QueryParamsSerializationOptions } from "./params-
|
|
3
|
-
import { a as Type, n as RequestSignature } from "./symbols-
|
|
4
|
-
import { c as TypedRecordInstance, i as OpaqueRecordInstance$1, o as TypeFromInstance, s as TypeFromInstanceOrString } from "./record-
|
|
5
|
-
import { i as Value, n as ObjectValue } from "./raw-
|
|
6
|
-
import { d as Meta, g as ResourceIdentifierObject, i as ExistingResourceIdentifierObject, m as PaginationLinks, r as EmptyResourceDocument, s as JsonApiDocument, t as CollectionResourceDocument, u as Links, y as SingleResourceDocument } from "./json-api-raw-
|
|
7
|
-
import { A as ResourceField, C as ObjectField, F as Trait, M as Schema, N as SchemaArrayField, O as PolarisResourceSchema, P as SchemaObjectField, T as ObjectSchema, a as DerivedField, b as LinksModeHasManyField, c as HashField, d as LegacyAttributeField, f as LegacyBelongsToField, g as LegacyRelationshipField, i as CollectionField, j as ResourceSchema, l as IdentityField, m as LegacyHasManyField, o as FieldSchema, r as CacheableFieldSchema, s as GenericField, t as ArrayField } from "./fields-
|
|
8
|
-
import { n as HashFn, r as Transformation$1, t as Derivation } from "./concepts-
|
|
9
|
-
import { n as WithPartial } from "./utils-
|
|
10
|
-
import { t as ResourceBlob } from "./aliases-
|
|
11
|
-
import { t as Change } from "./change-
|
|
12
|
-
import { n as Mutation } from "./mutations-
|
|
13
|
-
import { r as ResourceRelationship, t as CollectionRelationship } from "./relationship-
|
|
14
|
-
import { i as MergeOperation, o as Operation$1 } from "./operations-
|
|
15
|
-
import { t as ApiError } from "./error-
|
|
16
|
-
import { o as SingleResourceDataDocument, r as ResourceDocument, t as CollectionResourceDataDocument } from "./document-
|
|
17
|
-
import { i as RemoteRelationshipOperation, n as LocalRelationshipOperation, t as DeleteRecordOperation } from "./graph-
|
|
18
|
-
import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-
|
|
19
|
-
//#region src/request/-private/manager.d.ts
|
|
1
|
+
import { c as RequestKey, l as ResourceKey, n as CacheKeyType, s as PersistedResourceKey } from "./identifier-DmgDehQK.js";
|
|
2
|
+
import { t as QueryParamsSerializationOptions } from "./params-CNLjCRyH.js";
|
|
3
|
+
import { a as Type, n as RequestSignature } from "./symbols-DVa1PMFG.js";
|
|
4
|
+
import { c as TypedRecordInstance, i as OpaqueRecordInstance$1, o as TypeFromInstance, s as TypeFromInstanceOrString } from "./record-f5-uOgHt.js";
|
|
5
|
+
import { i as Value, n as ObjectValue } from "./raw-adYGuEGM.js";
|
|
6
|
+
import { a as ExistingResourceObject, d as Meta, g as ResourceIdentifierObject, i as ExistingResourceIdentifierObject, m as PaginationLinks, r as EmptyResourceDocument, s as JsonApiDocument, t as CollectionResourceDocument, u as Links, y as SingleResourceDocument } from "./json-api-raw-juUdIITO.js";
|
|
7
|
+
import { A as ResourceField, C as ObjectField, F as Trait, M as Schema, N as SchemaArrayField, O as PolarisResourceSchema, P as SchemaObjectField, T as ObjectSchema, a as DerivedField, b as LinksModeHasManyField, c as HashField, d as LegacyAttributeField, f as LegacyBelongsToField, g as LegacyRelationshipField, i as CollectionField, j as ResourceSchema, l as IdentityField, m as LegacyHasManyField, o as FieldSchema, r as CacheableFieldSchema, s as GenericField, t as ArrayField } from "./fields-r1rZJB9d.js";
|
|
8
|
+
import { n as HashFn, r as Transformation$1, t as Derivation } from "./concepts-vh86nAcd.js";
|
|
9
|
+
import { n as WithPartial } from "./utils-BVKvrO6e.js";
|
|
10
|
+
import { t as ResourceBlob } from "./aliases-BG5TxALl.js";
|
|
11
|
+
import { t as Change } from "./change-INHMiZ2a.js";
|
|
12
|
+
import { n as Mutation } from "./mutations-CA39mior.js";
|
|
13
|
+
import { r as ResourceRelationship, t as CollectionRelationship } from "./relationship-99pc4CaS.js";
|
|
14
|
+
import { i as MergeOperation, o as Operation$1 } from "./operations-C1WAEKKq.js";
|
|
15
|
+
import { t as ApiError } from "./error-j5n1yL9m.js";
|
|
16
|
+
import { o as SingleResourceDataDocument, r as ResourceDocument, t as CollectionResourceDataDocument } from "./document-B8Fup751.js";
|
|
17
|
+
import { i as RemoteRelationshipOperation, n as LocalRelationshipOperation, t as DeleteRecordOperation } from "./graph-BqxaFjEb.js";
|
|
18
|
+
import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-BfXDuPUb.js";
|
|
20
19
|
/**
|
|
21
20
|
* ## Import
|
|
22
21
|
*
|
|
@@ -24,7 +23,8 @@ import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-B_F639tN.js";
|
|
|
24
23
|
* import { RequestManager } from '@warp-drive-mirror/core';
|
|
25
24
|
* ```
|
|
26
25
|
*
|
|
27
|
-
* For complete usage guide see
|
|
26
|
+
* For a complete usage guide see [Making Requests](/guides/the-manual/requests/), and
|
|
27
|
+
* [Handlers](/guides/the-manual/requests/handlers) for writing the handlers it runs.
|
|
28
28
|
*
|
|
29
29
|
* ## How It Works
|
|
30
30
|
*
|
|
@@ -47,11 +47,28 @@ import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-B_F639tN.js";
|
|
|
47
47
|
* ```ts [Setup.ts]
|
|
48
48
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
49
49
|
* import { AutoCompress } from '@warp-drive-mirror/utilities/handlers';
|
|
50
|
-
* import
|
|
50
|
+
* import { AuthHandler } from './auth-handler';
|
|
51
51
|
*
|
|
52
52
|
* // ... create manager
|
|
53
53
|
* const manager = new RequestManager()
|
|
54
|
-
* .use([
|
|
54
|
+
* .use([AuthHandler, new AutoCompress(), Fetch]); // [!code focus]
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* ```ts [auth-handler.ts]
|
|
58
|
+
* import type { Handler, NextFn } from '@warp-drive-mirror/core/request';
|
|
59
|
+
* import type { RequestContext } from '@warp-drive-mirror/core/types/request';
|
|
60
|
+
*
|
|
61
|
+
* const token = '<token>';
|
|
62
|
+
*
|
|
63
|
+
* // adds a bearer token to every request, then passes it along
|
|
64
|
+
* export const AuthHandler: Handler = {
|
|
65
|
+
* request<T>(context: RequestContext, next: NextFn<T>) {
|
|
66
|
+
* const headers = new Headers(context.request.headers);
|
|
67
|
+
* headers.append('Authorization', `Bearer ${token}`);
|
|
68
|
+
*
|
|
69
|
+
* return next(Object.assign({}, context.request, { headers }));
|
|
70
|
+
* },
|
|
71
|
+
* };
|
|
55
72
|
* ```
|
|
56
73
|
*
|
|
57
74
|
* ```ts [Usage.ts]
|
|
@@ -67,6 +84,20 @@ import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-B_F639tN.js";
|
|
|
67
84
|
*
|
|
68
85
|
* :::
|
|
69
86
|
*
|
|
87
|
+
* ### RequestManager vs {@link Store.request}
|
|
88
|
+
*
|
|
89
|
+
* A bare `RequestManager` is the low-level primitive: it runs a request through the configured
|
|
90
|
+
* {@link Handler | handler chain} and settles with the raw {@link StructuredDocument}. It has no
|
|
91
|
+
* cache and does not hydrate {@link ReactiveDocument | ReactiveDocuments} unless you register a
|
|
92
|
+
* cache handler yourself via {@link RequestManager.useCache} and the request opts in.
|
|
93
|
+
*
|
|
94
|
+
* {@link Store.request} issues requests through this same `RequestManager`, but with the Store's
|
|
95
|
+
* cache handler and hydration already wired up — inserting the response into the Store's cache
|
|
96
|
+
* and resolving with a `ReactiveDocument` instead. Use `store.request` for anything the Store's
|
|
97
|
+
* cache should own, which is nearly all app code. Reach for `requestManager.request` directly
|
|
98
|
+
* only when there is no {@link Store} involved, or you specifically want the unprocessed
|
|
99
|
+
* `StructuredDocument`.
|
|
100
|
+
*
|
|
70
101
|
* ### Futures
|
|
71
102
|
*
|
|
72
103
|
* The return value of `manager.request` is a `Future`, which allows
|
|
@@ -105,6 +136,7 @@ import { i as SignalRef, t as ARRAY_SIGNAL } from "./configure-B_F639tN.js";
|
|
|
105
136
|
* type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument;
|
|
106
137
|
* ```
|
|
107
138
|
*
|
|
139
|
+
* @summary Runs each request through a chain of handlers that can fulfill, modify, or pass it along, and returns a `Future` for the response.
|
|
108
140
|
* @public
|
|
109
141
|
*/
|
|
110
142
|
declare class RequestManager {
|
|
@@ -134,7 +166,23 @@ declare class RequestManager {
|
|
|
134
166
|
/**
|
|
135
167
|
* Issue a Request.
|
|
136
168
|
*
|
|
137
|
-
*
|
|
169
|
+
* Runs `request` through the configured {@link Handler | handler chain} and settles with the
|
|
170
|
+
* {@link StructuredDocument} the chain produces — a plain `{ request, response, content }`
|
|
171
|
+
* object, not a {@link ReactiveDocument}. Caching and hydration only happen if a cache handler
|
|
172
|
+
* has been registered via {@link RequestManager.useCache} and the request opts in; a
|
|
173
|
+
* `RequestManager` created on its own has neither.
|
|
174
|
+
*
|
|
175
|
+
* Most app code should use {@link Store.request} instead, which calls this same method with
|
|
176
|
+
* the Store's cache handler and hydration already configured. Reach for `requestManager.request`
|
|
177
|
+
* directly when there is no {@link Store} involved, or when you want the unprocessed
|
|
178
|
+
* `StructuredDocument`. The `<RT>` generic can be set explicitly or inferred from a request
|
|
179
|
+
* built with {@link withResponseType} or {@link withReactiveResponse} — see
|
|
180
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md).
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* const { content } = await requestManager.request({ url: '/users' });
|
|
185
|
+
* ```
|
|
138
186
|
*
|
|
139
187
|
* @public
|
|
140
188
|
*/
|
|
@@ -171,8 +219,6 @@ interface PrivateRequestManager extends RequestManager {
|
|
|
171
219
|
promise: Promise<unknown>;
|
|
172
220
|
}>;
|
|
173
221
|
}
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/request/-private/types.d.ts
|
|
176
222
|
interface GodContext {
|
|
177
223
|
controller: AbortController;
|
|
178
224
|
response: ResponseInfo | null;
|
|
@@ -187,6 +233,8 @@ interface GodContext {
|
|
|
187
233
|
* allowing the promise to be created before the work that will settle it
|
|
188
234
|
* has begun. See {@link createDeferred}.
|
|
189
235
|
*
|
|
236
|
+
* @summary A promise bundled with the `resolve` and `reject` callbacks that settle it, as returned by
|
|
237
|
+
* `createDeferred`.
|
|
190
238
|
* @public
|
|
191
239
|
*/
|
|
192
240
|
type Deferred<T> = {
|
|
@@ -203,6 +251,8 @@ type Deferred<T> = {
|
|
|
203
251
|
* background reload that other requests may dedupe against without
|
|
204
252
|
* waiting on it.
|
|
205
253
|
*
|
|
254
|
+
* @summary Marks whether a deduped managed request blocks its caller's promise or runs as a
|
|
255
|
+
* non-blocking background reload.
|
|
206
256
|
* @public
|
|
207
257
|
*/
|
|
208
258
|
type ManagedRequestPriority = {
|
|
@@ -221,6 +271,11 @@ type DeferredStream = {
|
|
|
221
271
|
* while providing the ability to {@link Future.abort | abort} the underlying request, and
|
|
222
272
|
* {@link Future.getStream | access the response stream} before the outer promise resolves;
|
|
223
273
|
*
|
|
274
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide shows
|
|
275
|
+
* how to work with one.
|
|
276
|
+
*
|
|
277
|
+
* @summary The promise returned for every request, resolving with the response document and able to
|
|
278
|
+
* abort the request or expose its response stream early.
|
|
224
279
|
* @public
|
|
225
280
|
*/
|
|
226
281
|
interface Future<T> extends Promise<StructuredDataDocument<T>> {
|
|
@@ -278,6 +333,10 @@ interface Future<T> extends Promise<StructuredDataDocument<T>> {
|
|
|
278
333
|
* used to forward a request to the next handler in the chain. Resolves to a
|
|
279
334
|
* {@link Future} carrying the downstream response.
|
|
280
335
|
*
|
|
336
|
+
* The [Handlers](/guides/the-manual/requests/handlers) guide shows a handler calling it.
|
|
337
|
+
*
|
|
338
|
+
* @summary The function a request handler calls to pass a request to the next handler in the chain,
|
|
339
|
+
* returning a `Future` for its response.
|
|
281
340
|
* @public
|
|
282
341
|
*/
|
|
283
342
|
type NextFn<P = unknown> = (req: RequestInfo) => Future<P>;
|
|
@@ -286,6 +345,8 @@ type NextFn<P = unknown> = (req: RequestInfo) => Future<P>;
|
|
|
286
345
|
as well as a `next` function with which to pass along a request to the next
|
|
287
346
|
handler if it so chooses.
|
|
288
347
|
|
|
348
|
+
The [Handlers](/guides/the-manual/requests/handlers) guide walks through writing one.
|
|
349
|
+
|
|
289
350
|
A handler may be any object with a `request` method. This allows both stateful and non-stateful
|
|
290
351
|
handlers to be utilized.
|
|
291
352
|
|
|
@@ -322,7 +383,7 @@ response content before passing along the chunk downstream.
|
|
|
322
383
|
const FetchHandler = {
|
|
323
384
|
async request(context) {
|
|
324
385
|
const response = await fetch(context.request);
|
|
325
|
-
context.setResponse(
|
|
386
|
+
context.setResponse(response);
|
|
326
387
|
context.setStream(response.clone().body);
|
|
327
388
|
|
|
328
389
|
return response.json();
|
|
@@ -388,6 +449,8 @@ const manager = new RequestManager()
|
|
|
388
449
|
|
|
389
450
|
Handlers will be invoked in the order they are registered ("fifo", first-in first-out), and may only be registered up until the first request is made. It is recommended but not required to register all handlers at one time in order to ensure explicitly visible handler ordering.
|
|
390
451
|
|
|
452
|
+
@summary An object with a `request` method that a RequestManager calls to fulfill a request, either
|
|
453
|
+
itself or by calling `next` to pass it along.
|
|
391
454
|
@public
|
|
392
455
|
*/
|
|
393
456
|
interface Handler {
|
|
@@ -408,6 +471,8 @@ interface Handler {
|
|
|
408
471
|
* A RequestManager may only have one CacheHandler, registered via
|
|
409
472
|
* `manager.useCache(CacheHandler)`.
|
|
410
473
|
*
|
|
474
|
+
* @summary The single handler a RequestManager runs before all others via `useCache`, which may return
|
|
475
|
+
* a result synchronously.
|
|
411
476
|
* @public
|
|
412
477
|
*/
|
|
413
478
|
interface CacheHandler$1 {
|
|
@@ -421,8 +486,6 @@ interface CacheHandler$1 {
|
|
|
421
486
|
request<T = unknown>(context: RequestContext, next: NextFn<T>): Promise<T | StructuredDataDocument<T>> | Future<T> | T;
|
|
422
487
|
}
|
|
423
488
|
type GenericCreateArgs = Record<string | symbol, unknown>;
|
|
424
|
-
//#endregion
|
|
425
|
-
//#region src/request/-private/context.d.ts
|
|
426
489
|
declare class ContextOwner {
|
|
427
490
|
hasSetStream: boolean;
|
|
428
491
|
hasSetResponse: boolean;
|
|
@@ -452,6 +515,8 @@ declare class ContextOwner {
|
|
|
452
515
|
* {@link StructuredDataDocument} that will ultimately be returned by the
|
|
453
516
|
* {@link RequestManager}.
|
|
454
517
|
*
|
|
518
|
+
* @summary The per-request object passed to each handler, exposing the immutable request plus methods to
|
|
519
|
+
* set the response, stream, and request key.
|
|
455
520
|
* @public
|
|
456
521
|
*/
|
|
457
522
|
declare class Context$1 {
|
|
@@ -504,8 +569,6 @@ declare class Context$1 {
|
|
|
504
569
|
/** @private */
|
|
505
570
|
_finalize(): void;
|
|
506
571
|
}
|
|
507
|
-
//#endregion
|
|
508
|
-
//#region src/request/-private/utils.d.ts
|
|
509
572
|
declare const IS_CACHE_HANDLER: "___(unique) Symbol(IS_CACHE_HANDLER)";
|
|
510
573
|
/**
|
|
511
574
|
* Additional properties exposed on errors thrown by the
|
|
@@ -517,6 +580,9 @@ declare const IS_CACHE_HANDLER: "___(unique) Symbol(IS_CACHE_HANDLER)";
|
|
|
517
580
|
* Else it extends from {@link AggregateError} if the
|
|
518
581
|
* response includes an array of errors, falling back
|
|
519
582
|
* to {@link Error} as its base.
|
|
583
|
+
*
|
|
584
|
+
* @summary The shape of errors thrown by the Fetch handler for failed, aborted, or network-errored
|
|
585
|
+
* requests, carrying the HTTP `status` and `statusText`.
|
|
520
586
|
*/
|
|
521
587
|
interface FetchError extends DOMException {
|
|
522
588
|
/**
|
|
@@ -556,18 +622,22 @@ interface FetchError extends DOMException {
|
|
|
556
622
|
*/
|
|
557
623
|
isRequestError: true;
|
|
558
624
|
}
|
|
559
|
-
//#endregion
|
|
560
|
-
//#region src/types/request.d.ts
|
|
561
625
|
/**
|
|
562
626
|
* A {@link RequestInfo.cacheOptions | cacheOptions} flag which, when set,
|
|
563
627
|
* signals that a request should never be handled by the cache-manager and
|
|
564
628
|
* thus will never resolve from cache nor update the cache.
|
|
629
|
+
*
|
|
630
|
+
* @summary Symbol key for a request's `cacheOptions` that, when true, makes the request bypass the CacheHandler so it
|
|
631
|
+
* neither resolves from nor updates the cache.
|
|
565
632
|
*/
|
|
566
633
|
declare const SkipCache: "___(unique) Symbol(SkipCache)";
|
|
567
634
|
/**
|
|
568
635
|
* A {@link RequestInfo} flag which, when set, signals to the store's
|
|
569
636
|
* `instantiateRecord` hook that the resolved content should be hydrated
|
|
570
637
|
* into reactive records rather than returned as raw data.
|
|
638
|
+
*
|
|
639
|
+
* @summary Symbol flag on a request that makes the CacheHandler return reactive records instead of raw cache
|
|
640
|
+
* documents; `store.request` sets it automatically.
|
|
571
641
|
*/
|
|
572
642
|
declare const EnableHydration: "___(unique) Symbol(EnableHydration)";
|
|
573
643
|
/**
|
|
@@ -580,12 +650,16 @@ declare const IS_FUTURE: "___(unique) Symbol(IS_FUTURE)";
|
|
|
580
650
|
declare const STRUCTURED: "___(unique) Symbol(DOC)";
|
|
581
651
|
/**
|
|
582
652
|
* The HTTP methods WarpDrive's request layer supports.
|
|
653
|
+
*
|
|
654
|
+
* @summary Union of the HTTP method strings, including `QUERY`, that a WarpDrive request's `method` may be set to.
|
|
583
655
|
*/
|
|
584
656
|
type HTTPMethod = "QUERY" | "GET" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "CONNECT" | "TRACE";
|
|
585
657
|
/**
|
|
586
658
|
* Use these options to adjust {@link CacheHandler} behavior for a request
|
|
587
659
|
* via {@link RequestInfo.cacheOptions}.
|
|
588
660
|
*
|
|
661
|
+
* @summary Per-request settings on `cacheOptions` that control the cache key, forced or background reloads,
|
|
662
|
+
* invalidation by resource type, and cache bypass.
|
|
589
663
|
*/
|
|
590
664
|
interface CacheOptions {
|
|
591
665
|
/**
|
|
@@ -635,6 +709,9 @@ interface CacheOptions {
|
|
|
635
709
|
/**
|
|
636
710
|
* The request shape produced by the `findRecord` request builders, for
|
|
637
711
|
* use with {@link Store.request}.
|
|
712
|
+
*
|
|
713
|
+
* @summary Shape of the `GET` request object that `findRecord` builders return for `store.request`, carrying the url,
|
|
714
|
+
* headers, and requested resource identifier.
|
|
638
715
|
*/
|
|
639
716
|
type FindRecordRequestOptions<RT = unknown, T = unknown> = {
|
|
640
717
|
/**
|
|
@@ -669,6 +746,9 @@ type FindRecordRequestOptions<RT = unknown, T = unknown> = {
|
|
|
669
746
|
/**
|
|
670
747
|
* The request shape produced by the `query` request builders, for
|
|
671
748
|
* use with {@link Store.request}.
|
|
749
|
+
*
|
|
750
|
+
* @summary Shape of the `GET` request object that `query` builders return for `store.request`, carrying the url,
|
|
751
|
+
* headers, and cache options.
|
|
672
752
|
*/
|
|
673
753
|
type QueryRequestOptions<RT = unknown> = {
|
|
674
754
|
/**
|
|
@@ -699,6 +779,9 @@ type QueryRequestOptions<RT = unknown> = {
|
|
|
699
779
|
/**
|
|
700
780
|
* The request shape produced by the `postQuery` request builders, for
|
|
701
781
|
* use with {@link Store.request}.
|
|
782
|
+
*
|
|
783
|
+
* @summary Shape of the `POST` or `QUERY` request object that `postQuery` builders return, with a body and a required
|
|
784
|
+
* cache key since the url cannot serve as one.
|
|
702
785
|
*/
|
|
703
786
|
type PostQueryRequestOptions<RT = unknown> = {
|
|
704
787
|
/**
|
|
@@ -739,6 +822,9 @@ type PostQueryRequestOptions<RT = unknown> = {
|
|
|
739
822
|
/**
|
|
740
823
|
* The request shape produced by the `deleteRecord` request builders, for
|
|
741
824
|
* use with {@link Store.request}.
|
|
825
|
+
*
|
|
826
|
+
* @summary Shape of the `DELETE` request object that `deleteRecord` builders return for `store.request`, identifying
|
|
827
|
+
* the resource being deleted.
|
|
742
828
|
*/
|
|
743
829
|
type DeleteRequestOptions<RT = unknown, T = unknown> = {
|
|
744
830
|
/**
|
|
@@ -786,6 +872,9 @@ type ImmutableRequest<T> = Readonly<T> & {
|
|
|
786
872
|
/**
|
|
787
873
|
* The request shape produced by the `updateRecord` request builders, for
|
|
788
874
|
* use with {@link Store.request}.
|
|
875
|
+
*
|
|
876
|
+
* @summary Shape of the `PATCH` or `PUT` request object that `updateRecord` builders return for `store.request`,
|
|
877
|
+
* identifying the resource being saved.
|
|
789
878
|
*/
|
|
790
879
|
type UpdateRequestOptions<RT = unknown, T = unknown> = {
|
|
791
880
|
/**
|
|
@@ -829,6 +918,9 @@ type UpdateRequestOptions<RT = unknown, T = unknown> = {
|
|
|
829
918
|
/**
|
|
830
919
|
* The request shape produced by the `createRecord` request builders, for
|
|
831
920
|
* use with {@link Store.request}.
|
|
921
|
+
*
|
|
922
|
+
* @summary Shape of the `POST` request object that `createRecord` builders return for `store.request`, identifying the
|
|
923
|
+
* new resource being saved.
|
|
832
924
|
*/
|
|
833
925
|
type CreateRequestOptions<RT = unknown, T = unknown> = {
|
|
834
926
|
/**
|
|
@@ -871,19 +963,31 @@ type CreateRequestOptions<RT = unknown, T = unknown> = {
|
|
|
871
963
|
};
|
|
872
964
|
/**
|
|
873
965
|
* The immutable, handler-facing form of {@link DeleteRequestOptions}.
|
|
966
|
+
*
|
|
967
|
+
* @summary Read-only view of a `deleteRecord` request as a handler receives it, with immutable headers and `records`
|
|
968
|
+
* as resource keys.
|
|
874
969
|
*/
|
|
875
970
|
type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;
|
|
876
971
|
/**
|
|
877
972
|
* The immutable, handler-facing form of {@link UpdateRequestOptions}.
|
|
973
|
+
*
|
|
974
|
+
* @summary Read-only view of an `updateRecord` request as a handler receives it, with immutable headers and `records`
|
|
975
|
+
* as resource keys.
|
|
878
976
|
*/
|
|
879
977
|
type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;
|
|
880
978
|
/**
|
|
881
979
|
* The immutable, handler-facing form of {@link CreateRequestOptions}.
|
|
980
|
+
*
|
|
981
|
+
* @summary Read-only view of a `createRecord` request as a handler receives it, with immutable headers and `records`
|
|
982
|
+
* as resource keys.
|
|
882
983
|
*/
|
|
883
984
|
type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;
|
|
884
985
|
/**
|
|
885
986
|
* A minimal reference to a resource sufficient to build a URL for it,
|
|
886
987
|
* as accepted by the request builders.
|
|
988
|
+
*
|
|
989
|
+
* @summary A resource reference with a persisted `id` and `type` and an optional `lid`, which is enough for request
|
|
990
|
+
* builders to construct its url.
|
|
887
991
|
*/
|
|
888
992
|
type RemotelyAccessibleIdentifier<T extends string = string> = {
|
|
889
993
|
/**
|
|
@@ -902,6 +1006,9 @@ type RemotelyAccessibleIdentifier<T extends string = string> = {
|
|
|
902
1006
|
/**
|
|
903
1007
|
* Options accepted by the request builders for constraining how a
|
|
904
1008
|
* request's url is constructed and how the request interacts with the cache.
|
|
1009
|
+
*
|
|
1010
|
+
* @summary Options the request builders accept to set reload behavior and override the url's host, namespace, resource
|
|
1011
|
+
* path, and query param serialization.
|
|
905
1012
|
*/
|
|
906
1013
|
interface ConstrainedRequestOptions {
|
|
907
1014
|
/**
|
|
@@ -936,6 +1043,9 @@ interface ConstrainedRequestOptions {
|
|
|
936
1043
|
}
|
|
937
1044
|
/**
|
|
938
1045
|
* Options accepted by the `findRecord` request builders.
|
|
1046
|
+
*
|
|
1047
|
+
* @summary Options the `findRecord` request builders accept: the shared url and reload options plus the relationship
|
|
1048
|
+
* paths to `include`.
|
|
939
1049
|
*/
|
|
940
1050
|
interface FindRecordOptions$2 extends ConstrainedRequestOptions {
|
|
941
1051
|
/**
|
|
@@ -948,6 +1058,9 @@ interface FindRecordOptions$2 extends ConstrainedRequestOptions {
|
|
|
948
1058
|
* containing the original {@link RequestInfo | request},
|
|
949
1059
|
* the {@link Response | response} set by the handler chain (if any), and
|
|
950
1060
|
* the processed content.
|
|
1061
|
+
*
|
|
1062
|
+
* @summary The `{ request, response, content }` object that a request's `Future` resolves with when the request
|
|
1063
|
+
* succeeds.
|
|
951
1064
|
*/
|
|
952
1065
|
interface StructuredDataDocument<T> {
|
|
953
1066
|
/**
|
|
@@ -975,6 +1088,9 @@ interface StructuredDataDocument<T> {
|
|
|
975
1088
|
*
|
|
976
1089
|
* If using the error originates from the {@link Fetch | Fetch Handler}
|
|
977
1090
|
* the error will be a {@link FetchError}
|
|
1091
|
+
*
|
|
1092
|
+
* @summary The Error a request's `Future` rejects with when the request fails, carrying the `request`, `response`,
|
|
1093
|
+
* `error`, and any `content` received.
|
|
978
1094
|
*/
|
|
979
1095
|
interface StructuredErrorDocument<T = unknown> extends Error {
|
|
980
1096
|
/**
|
|
@@ -1002,11 +1118,16 @@ interface StructuredErrorDocument<T = unknown> extends Error {
|
|
|
1002
1118
|
* A union of the resolve/reject data types for the {@link Future}
|
|
1003
1119
|
* returned by {@link Store.request | request}
|
|
1004
1120
|
*
|
|
1121
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide shows
|
|
1122
|
+
* how to read one.
|
|
1123
|
+
*
|
|
1005
1124
|
* See also the docs for:
|
|
1006
1125
|
*
|
|
1007
1126
|
* - {@link Future}
|
|
1008
1127
|
* - {@link StructuredDataDocument} (resolved/successful requests)
|
|
1009
1128
|
* - {@link StructuredErrorDocument} (rejected/failed requests)
|
|
1129
|
+
*
|
|
1130
|
+
* @summary Union of the success and error documents that a request's `Future` resolves or rejects with.
|
|
1010
1131
|
*/
|
|
1011
1132
|
type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;
|
|
1012
1133
|
/**
|
|
@@ -1082,6 +1203,9 @@ interface NativeRequestInit {
|
|
|
1082
1203
|
/**
|
|
1083
1204
|
* A read-only {@link Headers} instance, as passed to {@link Handler | Handlers}
|
|
1084
1205
|
* via {@link ImmutableRequestInfo.headers}.
|
|
1206
|
+
*
|
|
1207
|
+
* @summary Read-only `Headers` that handlers see on a request, adding `toJSON` to serialize them as `[key, value]`
|
|
1208
|
+
* pairs and an optional mutable `clone`.
|
|
1085
1209
|
*/
|
|
1086
1210
|
interface ImmutableHeaders extends Headers {
|
|
1087
1211
|
/**
|
|
@@ -1100,6 +1224,11 @@ interface ImmutableHeaders extends Headers {
|
|
|
1100
1224
|
* This interface is used to define the shape of a request that can be made via
|
|
1101
1225
|
* either the {@link RequestManager.request} or {@link Store.request} methods.
|
|
1102
1226
|
*
|
|
1227
|
+
* The [Making Requests](/guides/the-manual/requests/#request-options) guide explains
|
|
1228
|
+
* its options.
|
|
1229
|
+
*
|
|
1230
|
+
* @summary Describes a request for `store.request` or `RequestManager.request`: native fetch options plus cache
|
|
1231
|
+
* options, operation name, records, data, and the store.
|
|
1103
1232
|
* @privateRemarks
|
|
1104
1233
|
* - [MDN Reference (fetch)](https://developer.mozilla.org/docs/Web/API/Window/fetch)
|
|
1105
1234
|
* - [MDN Reference (RequestInit)](https://developer.mozilla.org/en-US/docs/Web/API/RequestInit)
|
|
@@ -1191,6 +1320,8 @@ interface RequestInfo<RT = unknown> extends NativeRequestInit {
|
|
|
1191
1320
|
/**
|
|
1192
1321
|
* Immutable version of {@link RequestInfo}. This is what is passed to handlers.
|
|
1193
1322
|
*
|
|
1323
|
+
* @summary Read-only form of a request as handlers receive it, with frozen headers, data, options, and cache options
|
|
1324
|
+
* and no `controller`.
|
|
1194
1325
|
*/
|
|
1195
1326
|
type ImmutableRequestInfo<RT = unknown> = Readonly<Omit<RequestInfo<RT>, "controller">> & {
|
|
1196
1327
|
/**
|
|
@@ -1216,6 +1347,9 @@ type ImmutableRequestInfo<RT = unknown> = Readonly<Omit<RequestInfo<RT>, "contro
|
|
|
1216
1347
|
/**
|
|
1217
1348
|
* An immutable, JSON-serializable subset of the native {@link Response}
|
|
1218
1349
|
* interface.
|
|
1350
|
+
*
|
|
1351
|
+
* @summary Immutable, JSON-serializable snapshot of a fetch `Response`'s headers, status, url, and type, usable in
|
|
1352
|
+
* place of a `Response` in request results.
|
|
1219
1353
|
*/
|
|
1220
1354
|
interface ResponseInfo {
|
|
1221
1355
|
/**
|
|
@@ -1251,6 +1385,11 @@ interface ResponseInfo {
|
|
|
1251
1385
|
* The object a {@link Handler} uses to fulfill a request: it provides a
|
|
1252
1386
|
* readonly view of the {@link RequestContext.request | request} and methods
|
|
1253
1387
|
* for supplying the {@link Future}'s stream and final response.
|
|
1388
|
+
*
|
|
1389
|
+
* The [Handlers](/guides/the-manual/requests/handlers) guide shows a handler using it.
|
|
1390
|
+
*
|
|
1391
|
+
* @summary Object passed to each request handler with the immutable request, a request id, and methods for setting the
|
|
1392
|
+
* response stream and the response.
|
|
1254
1393
|
*/
|
|
1255
1394
|
interface RequestContext {
|
|
1256
1395
|
/**
|
|
@@ -1271,8 +1410,6 @@ interface RequestContext {
|
|
|
1271
1410
|
*/
|
|
1272
1411
|
setResponse(response: Response | ResponseInfo | null): void;
|
|
1273
1412
|
}
|
|
1274
|
-
//#endregion
|
|
1275
|
-
//#region src/store/-types/q/identifier.d.ts
|
|
1276
1413
|
interface GenerationMethod {
|
|
1277
1414
|
(data: ImmutableRequestInfo, bucket: "document"): string | null;
|
|
1278
1415
|
(data: unknown | {
|
|
@@ -1294,498 +1431,281 @@ type KeyInfo = {
|
|
|
1294
1431
|
type: string;
|
|
1295
1432
|
};
|
|
1296
1433
|
type KeyInfoMethod = (resource: unknown, known: ResourceKey | null) => KeyInfo;
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? PersistedResourceKey<TypeFromIdentifier<T>> : ResourceKey;
|
|
1303
|
-
/**
|
|
1304
|
-
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
1305
|
-
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
1306
|
-
*/
|
|
1307
|
-
declare function isResourceKey(identifier: unknown): identifier is ResourceKey;
|
|
1308
|
-
/**
|
|
1309
|
-
* Type-guard that returns `true` if the given value is a stable {@link RequestKey}
|
|
1310
|
-
* (as opposed to a {@link ResourceKey} or arbitrary, not-yet-stabilized data).
|
|
1311
|
-
*/
|
|
1312
|
-
declare function isRequestKey(identifier: unknown): identifier is RequestKey;
|
|
1313
|
-
interface KeyOptions {
|
|
1314
|
-
lid: IdentifierMap;
|
|
1315
|
-
id: IdentifierMap;
|
|
1434
|
+
interface BaseFinderOptions$1 {
|
|
1435
|
+
reload?: boolean;
|
|
1436
|
+
backgroundReload?: boolean;
|
|
1437
|
+
include?: string | string[];
|
|
1438
|
+
adapterOptions?: Record<string, unknown>;
|
|
1316
1439
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1440
|
+
interface FindRecordOptions$1 extends BaseFinderOptions$1 {
|
|
1441
|
+
/**
|
|
1442
|
+
* Data to preload into the store before the request is made.
|
|
1443
|
+
* This feature is *highly* discouraged and has no corresponding
|
|
1444
|
+
* feature when using builders and handlers.
|
|
1445
|
+
*
|
|
1446
|
+
* Excepting relationships: the data should be in the form of a
|
|
1447
|
+
* JSON object where the keys are fields on the record and the value
|
|
1448
|
+
* is the raw value to be added to the cache.
|
|
1449
|
+
*
|
|
1450
|
+
* Relationships can either be provided as string IDs from which
|
|
1451
|
+
* an identifier will be built base upon the relationship's expected
|
|
1452
|
+
* resource type, or be record instances from which the identifier
|
|
1453
|
+
* will be extracted.
|
|
1454
|
+
*
|
|
1455
|
+
*/
|
|
1456
|
+
preload?: Record<string, Value>;
|
|
1457
|
+
}
|
|
1458
|
+
type QueryOptions$1 = { [K in string | "adapterOptions"]?: K extends "adapterOptions" ? Record<string, unknown> : unknown; };
|
|
1459
|
+
type FindAllOptions$1 = BaseFinderOptions$1;
|
|
1460
|
+
type LegacyResourceQuery$1 = {
|
|
1461
|
+
include?: string | string[];
|
|
1462
|
+
[key: string]: Value | undefined;
|
|
1326
1463
|
};
|
|
1327
|
-
type
|
|
1464
|
+
type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
|
|
1328
1465
|
/**
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1466
|
+
* Minimum subset of static schema methods and properties on the
|
|
1467
|
+
* "model" class.
|
|
1468
|
+
*
|
|
1469
|
+
* Only used when using the legacy schema-service implementation
|
|
1470
|
+
* for @warp-drive-mirror/legacy/model or when wrapping schema for legacy
|
|
1471
|
+
* Adapters/Serializers.
|
|
1472
|
+
*
|
|
1473
|
+
* @summary Legacy shape of a Model class's static schema API (fields, attributes, relationships, iterators) used
|
|
1474
|
+
* by the legacy schema service and Adapters/Serializers.
|
|
1475
|
+
*/
|
|
1476
|
+
interface ModelSchema<T = unknown> {
|
|
1477
|
+
/**
|
|
1478
|
+
* The resource type (model name) that this schema describes.
|
|
1479
|
+
*/
|
|
1480
|
+
modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
|
|
1481
|
+
/**
|
|
1482
|
+
* A map of every field defined on this resource type to its kind
|
|
1483
|
+
* (`'attribute'`, `'belongsTo'`, or `'hasMany'`).
|
|
1484
|
+
*/
|
|
1485
|
+
fields: Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
|
|
1486
|
+
/**
|
|
1487
|
+
* A map of every attribute field defined on this resource type, keyed by
|
|
1488
|
+
* attribute name.
|
|
1489
|
+
*/
|
|
1490
|
+
attributes: Map<KeyOrString<T>, LegacyAttributeField>;
|
|
1491
|
+
/**
|
|
1492
|
+
* A map of every relationship (`belongsTo`/`hasMany`) field defined on this
|
|
1493
|
+
* resource type, keyed by relationship name.
|
|
1494
|
+
*/
|
|
1495
|
+
relationshipsByName: Map<KeyOrString<T>, LegacyRelationshipField>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Invokes `callback` once for each attribute field defined on this resource
|
|
1498
|
+
* type, passing the attribute's key and schema.
|
|
1499
|
+
*/
|
|
1500
|
+
eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
|
|
1501
|
+
/**
|
|
1502
|
+
* Invokes `callback` once for each relationship field defined on this
|
|
1503
|
+
* resource type, passing the relationship's key and schema.
|
|
1504
|
+
*/
|
|
1505
|
+
eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
|
|
1506
|
+
/**
|
|
1507
|
+
* Invokes `callback` once for each attribute field defined on this resource
|
|
1508
|
+
* type that has a transform (a `type`), passing the attribute's key and the
|
|
1509
|
+
* name of the transform to apply.
|
|
1510
|
+
*/
|
|
1511
|
+
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
|
|
1365
1512
|
}
|
|
1366
|
-
|
|
1367
|
-
export default {
|
|
1368
|
-
name: 'configure-ember-data-identifiers',
|
|
1369
|
-
initialize
|
|
1370
|
-
};
|
|
1371
|
-
```
|
|
1372
|
-
|
|
1373
|
-
### Document Identity
|
|
1374
|
-
|
|
1375
|
-
If the bucket is `document` the method will receive the associated
|
|
1376
|
-
immutable `request` passed to `store.request` as its first argument
|
|
1377
|
-
and should return a unique string for the given request if the document
|
|
1378
|
-
should be cached, and `null` if it should not be cached.
|
|
1379
|
-
|
|
1380
|
-
Note, the request result will still be passed to the cache via `Cache.put`,
|
|
1381
|
-
but caches should take this as a signal that the document should not itself
|
|
1382
|
-
be cached, while its contents may still be used to update other cache state.
|
|
1383
|
-
|
|
1384
|
-
The presence of `cacheOptions.key` on the request will take precedence
|
|
1385
|
-
for the document cache key, and this method will not be called if it is
|
|
1386
|
-
present.
|
|
1387
|
-
|
|
1388
|
-
The default method implementation for this bucket is to return `null`
|
|
1389
|
-
for all requests whose method is not `GET`, and to return the `url` for
|
|
1390
|
-
those where it is.
|
|
1391
|
-
|
|
1392
|
-
This means that queries via `POST` MUST provide `cacheOptions.key` or
|
|
1393
|
-
implement this hook.
|
|
1394
|
-
|
|
1395
|
-
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
1396
|
-
|
|
1397
|
-
@public
|
|
1398
|
-
*/
|
|
1399
|
-
declare function setIdentifierGenerationMethod(method: GenerationMethod | null): void;
|
|
1400
1513
|
/**
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1405
|
-
|
|
1406
|
-
```js
|
|
1407
|
-
import { setIdentifierUpdateMethod } from '@warp-drive-mirror/core';
|
|
1408
|
-
```
|
|
1409
|
-
|
|
1410
|
-
Takes a method which can expect to receive an existing `Identifier` alongside
|
|
1411
|
-
some new data to consider as a second argument. This is an opportunity
|
|
1412
|
-
for secondary lookup tables and caches associated with the identifier
|
|
1413
|
-
to be amended.
|
|
1414
|
-
|
|
1415
|
-
This method is called everytime `updateRecordIdentifier` is called and
|
|
1416
|
-
with the same arguments. It provides the opportunity to update secondary
|
|
1417
|
-
lookup tables for existing identifiers.
|
|
1418
|
-
|
|
1419
|
-
It will always be called after an identifier created with `createIdentifierForNewRecord`
|
|
1420
|
-
has been committed, or after an update to the `record` a `RecordIdentifier`
|
|
1421
|
-
is assigned to has been committed. Committed here meaning that the server
|
|
1422
|
-
has acknowledged the update (for instance after a call to `.save()`)
|
|
1423
|
-
|
|
1424
|
-
If `id` has not previously existed, it will be assigned to the `Identifier`
|
|
1425
|
-
prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
1426
|
-
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
1427
|
-
without providing an `id` when one is missing will throw an error.
|
|
1514
|
+
A `RecordReference` is a low-level API that allows users and
|
|
1515
|
+
addon authors to perform meta-operations on a record.
|
|
1428
1516
|
|
|
1517
|
+
@hideconstructor
|
|
1429
1518
|
@public
|
|
1430
1519
|
*/
|
|
1431
|
-
declare
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1436
|
-
|
|
1437
|
-
```js
|
|
1438
|
-
import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
1439
|
-
```
|
|
1440
|
-
|
|
1441
|
-
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
1442
|
-
from any secondary lookup tables or caches that the user has populated for it.
|
|
1443
|
-
|
|
1444
|
-
@public
|
|
1445
|
-
*/
|
|
1446
|
-
declare function setIdentifierForgetMethod(method: ForgetMethod | null): void;
|
|
1447
|
-
/**
|
|
1448
|
-
Configure a callback for when the identifier cache is being torn down.
|
|
1449
|
-
|
|
1450
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1451
|
-
|
|
1452
|
-
```js
|
|
1453
|
-
import { setIdentifierResetMethod } from '@warp-drive-mirror/core';
|
|
1454
|
-
```
|
|
1455
|
-
|
|
1456
|
-
Takes a method which can expect to be called when the parent application is destroyed.
|
|
1457
|
-
|
|
1458
|
-
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
1459
|
-
to the application instance, you may not need to implement the `resetMethod`.
|
|
1460
|
-
|
|
1461
|
-
@public
|
|
1462
|
-
*/
|
|
1463
|
-
declare function setIdentifierResetMethod(method: ResetMethod | null): void;
|
|
1464
|
-
/**
|
|
1465
|
-
Configure a callback for when the identifier cache is generating a new
|
|
1466
|
-
ResourceKey for a resource.
|
|
1467
|
-
|
|
1468
|
-
This method controls the `type` and `id` that will be assigned to the
|
|
1469
|
-
`ResourceKey` that is created.
|
|
1470
|
-
|
|
1471
|
-
This configuration MUST occur prior to the store instance being created.
|
|
1472
|
-
|
|
1473
|
-
```js
|
|
1474
|
-
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
1475
|
-
```
|
|
1476
|
-
|
|
1477
|
-
@public
|
|
1478
|
-
*/
|
|
1479
|
-
declare function setKeyInfoForResource(method: KeyInfoMethod | null): void;
|
|
1480
|
-
/**
|
|
1481
|
-
* Each instance of {@link Store} receives a unique instance of a CacheKeyManager.
|
|
1482
|
-
*
|
|
1483
|
-
* This cache is responsible for assigning or retrieving the unique identify
|
|
1484
|
-
* for arbitrary resource data encountered by the store. Data representing
|
|
1485
|
-
* a unique resource or record should always be represented by the same
|
|
1486
|
-
* identifier.
|
|
1487
|
-
*
|
|
1488
|
-
* It can be configured by consuming applications.
|
|
1489
|
-
*
|
|
1490
|
-
* @hideconstructor
|
|
1491
|
-
* @public
|
|
1492
|
-
*/
|
|
1493
|
-
declare class CacheKeyManager {
|
|
1494
|
-
constructor();
|
|
1520
|
+
declare class RecordReference {
|
|
1521
|
+
constructor(store: Store$1, identifier: ResourceKey);
|
|
1522
|
+
get type(): string;
|
|
1495
1523
|
/**
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1524
|
+
The `id` of the record that this reference refers to.
|
|
1525
|
+
|
|
1526
|
+
Together, the `type` and `id` properties form a composite key for
|
|
1527
|
+
the identity map.
|
|
1528
|
+
|
|
1529
|
+
Example
|
|
1530
|
+
|
|
1531
|
+
```javascript
|
|
1532
|
+
let userRef = store.getReference('user', 1);
|
|
1533
|
+
|
|
1534
|
+
userRef.id(); // '1'
|
|
1535
|
+
```
|
|
1536
|
+
|
|
1537
|
+
@public
|
|
1538
|
+
@return The id of the record.
|
|
1539
|
+
*/
|
|
1540
|
+
id(): string | null;
|
|
1503
1541
|
/**
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1542
|
+
The `identifier` of the record that this reference refers to.
|
|
1543
|
+
|
|
1544
|
+
Together, the `type` and `id` properties form a composite key for
|
|
1545
|
+
the identity map.
|
|
1546
|
+
|
|
1547
|
+
Example
|
|
1548
|
+
|
|
1549
|
+
```javascript
|
|
1550
|
+
let userRef = store.getReference('user', 1);
|
|
1551
|
+
|
|
1552
|
+
userRef.identifier(); // '1'
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
@public
|
|
1556
|
+
@return The identifier of the record.
|
|
1557
|
+
*/
|
|
1558
|
+
identifier(): ResourceKey;
|
|
1510
1559
|
/**
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
*/
|
|
1527
|
-
getOrCreateDocumentIdentifier(request: RequestInfo): RequestKey | null;
|
|
1560
|
+
How the reference will be looked up when it is loaded. Currently
|
|
1561
|
+
this always returns `identity` to signify that a record will be
|
|
1562
|
+
loaded by its `type` and `id`.
|
|
1563
|
+
|
|
1564
|
+
Example
|
|
1565
|
+
|
|
1566
|
+
```javascript
|
|
1567
|
+
const userRef = store.getReference('user', 1);
|
|
1568
|
+
|
|
1569
|
+
userRef.remoteType(); // 'identity'
|
|
1570
|
+
```
|
|
1571
|
+
|
|
1572
|
+
@public
|
|
1573
|
+
*/
|
|
1574
|
+
remoteType(): "identity";
|
|
1528
1575
|
/**
|
|
1529
|
-
|
|
1576
|
+
This API allows you to provide a reference with new data. The
|
|
1577
|
+
simplest usage of this API is similar to `store.push`: you provide a
|
|
1578
|
+
normalized hash of data and the object represented by the reference
|
|
1579
|
+
will update.
|
|
1530
1580
|
|
|
1531
|
-
|
|
1581
|
+
If you pass a promise to `push`, WarpDrive will not ask the adapter
|
|
1582
|
+
for the data if another attempt to fetch it is made in the
|
|
1583
|
+
interim. When the promise resolves, the underlying object is updated
|
|
1584
|
+
with the new data, and the promise returned by *this function* is resolved
|
|
1585
|
+
with that object.
|
|
1532
1586
|
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1587
|
+
For example, `recordReference.push(promise)` will be resolved with a
|
|
1588
|
+
record.
|
|
1589
|
+
|
|
1590
|
+
Example
|
|
1591
|
+
|
|
1592
|
+
```javascript
|
|
1593
|
+
let userRef = store.getReference('user', 1);
|
|
1594
|
+
|
|
1595
|
+
// provide data for reference
|
|
1596
|
+
userRef.push({
|
|
1597
|
+
data: {
|
|
1598
|
+
id: "1",
|
|
1599
|
+
type: "user",
|
|
1600
|
+
attributes: {
|
|
1601
|
+
username: "@user"
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}).then(function(user) {
|
|
1605
|
+
userRef.value() === user;
|
|
1606
|
+
});
|
|
1607
|
+
```
|
|
1537
1608
|
|
|
1538
1609
|
@public
|
|
1610
|
+
@param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one
|
|
1611
|
+
@return a promise for the value (record or relationship)
|
|
1539
1612
|
*/
|
|
1540
|
-
|
|
1613
|
+
push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance$1>;
|
|
1541
1614
|
/**
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1615
|
+
If the entity referred to by the reference is already loaded, it is
|
|
1616
|
+
present as `reference.value`. Otherwise the value returned by this function
|
|
1617
|
+
is `null`.
|
|
1545
1618
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1619
|
+
Example
|
|
1620
|
+
|
|
1621
|
+
```javascript
|
|
1622
|
+
let userRef = store.getReference('user', 1);
|
|
1623
|
+
|
|
1624
|
+
userRef.value(); // user
|
|
1625
|
+
```
|
|
1548
1626
|
|
|
1549
1627
|
@public
|
|
1628
|
+
@return the record for this RecordReference
|
|
1550
1629
|
*/
|
|
1551
|
-
|
|
1552
|
-
type: string;
|
|
1553
|
-
id?: string | null;
|
|
1554
|
-
lid?: string;
|
|
1555
|
-
}): ResourceKey;
|
|
1630
|
+
value(): OpaqueRecordInstance$1 | null;
|
|
1556
1631
|
/**
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
committed.
|
|
1632
|
+
Triggers a fetch for the backing entity based on its `remoteType`
|
|
1633
|
+
(see `remoteType` definitions per reference type).
|
|
1560
1634
|
|
|
1561
|
-
|
|
1562
|
-
attempting to change the `id` or calling update without providing an `id` when
|
|
1563
|
-
one is missing will throw an error.
|
|
1635
|
+
Example
|
|
1564
1636
|
|
|
1565
|
-
|
|
1566
|
-
|
|
1637
|
+
```javascript
|
|
1638
|
+
let userRef = store.getReference('user', 1);
|
|
1567
1639
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1640
|
+
// load user (via store.find)
|
|
1641
|
+
userRef.load().then(...)
|
|
1642
|
+
```
|
|
1571
1643
|
|
|
1572
1644
|
@public
|
|
1645
|
+
@return the record for this RecordReference
|
|
1573
1646
|
*/
|
|
1574
|
-
|
|
1647
|
+
load(): Promise<unknown>;
|
|
1575
1648
|
/**
|
|
1576
|
-
|
|
1577
|
-
|
|
1649
|
+
Reloads the record if it is already loaded. If the record is not
|
|
1650
|
+
loaded it will load the record via `store.findRecord`
|
|
1578
1651
|
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1652
|
+
Example
|
|
1653
|
+
|
|
1654
|
+
```javascript
|
|
1655
|
+
let userRef = store.getReference('user', 1);
|
|
1656
|
+
|
|
1657
|
+
// or trigger a reload
|
|
1658
|
+
userRef.reload().then(...)
|
|
1659
|
+
```
|
|
1582
1660
|
|
|
1583
1661
|
@public
|
|
1662
|
+
@return the record for this RecordReference
|
|
1584
1663
|
*/
|
|
1585
|
-
|
|
1664
|
+
reload(): Promise<unknown>;
|
|
1586
1665
|
}
|
|
1587
1666
|
/**
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1667
|
+
* Options shared by {@link FindRecordOptions} and {@link FindAllOptions}
|
|
1668
|
+
* for controlling reload behavior and adapter/serializer specific
|
|
1669
|
+
* configuration when using the legacy Adapter/Serializer network layer.
|
|
1591
1670
|
*
|
|
1592
|
-
* @
|
|
1671
|
+
* @summary Legacy reload, background-reload, include, and adapterOptions settings shared by `store.findRecord` and
|
|
1672
|
+
* `store.findAll`.
|
|
1593
1673
|
*/
|
|
1594
|
-
interface
|
|
1595
|
-
_cache: StableCache;
|
|
1674
|
+
interface BaseFinderOptions {
|
|
1596
1675
|
/**
|
|
1597
|
-
*
|
|
1598
|
-
*
|
|
1599
|
-
*
|
|
1600
|
-
*
|
|
1601
|
-
*/
|
|
1602
|
-
|
|
1603
|
-
_mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
|
|
1604
|
-
destroy(): void;
|
|
1605
|
-
}
|
|
1606
|
-
//#endregion
|
|
1607
|
-
//#region src/store/-private/managers/notification-manager.d.ts
|
|
1608
|
-
type UnsubscribeToken$1 = object;
|
|
1609
|
-
/**
|
|
1610
|
-
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
1611
|
-
*/
|
|
1612
|
-
type CacheOperation$1 = "added" | "removed" | "updated" | "state";
|
|
1613
|
-
/**
|
|
1614
|
-
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
1615
|
-
*/
|
|
1616
|
-
type DocumentCacheOperation$1 = "invalidated" | "added" | "removed" | "updated" | "state";
|
|
1617
|
-
/**
|
|
1618
|
-
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
1619
|
-
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
1620
|
-
*/
|
|
1621
|
-
type NotificationType = "attributes" | "relationships" | "identity" | "errors" | "meta" | CacheOperation$1;
|
|
1622
|
-
/**
|
|
1623
|
-
* The shape accepted by {@link NotificationManager.notify} and
|
|
1624
|
-
* {@link CacheCapabilitiesManager.notifyChange} for delivering many keys for
|
|
1625
|
-
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
1626
|
-
* instead of once per key.
|
|
1627
|
-
*
|
|
1628
|
-
* @since 5.9.0
|
|
1629
|
-
* @public
|
|
1630
|
-
*/
|
|
1631
|
-
type NotifyKeys = Set<string>;
|
|
1632
|
-
/**
|
|
1633
|
-
* A change to a resource's `attributes` or `relationships` can be relevant to
|
|
1634
|
-
* a "local" view of the resource (its mutable/editable state), a "remote" view
|
|
1635
|
-
* (its last-known-persisted state), or both.
|
|
1636
|
-
*
|
|
1637
|
-
* Each view subscribes to its own channel and, when notified, re-pulls its own
|
|
1638
|
-
* projection of the data: a remote-only reader (e.g. PolarisMode's default
|
|
1639
|
-
* immutable record) subscribes `'remote'` and re-reads remote state; an
|
|
1640
|
-
* editable/reconciled reader (a legacy record, or an editable checkout)
|
|
1641
|
-
* subscribes `'local'` (the same as omitting the channel) and re-reads local
|
|
1642
|
-
* state. A notifier that knows which projection changed tags the notification
|
|
1643
|
-
* with that channel; each tag is delivered only to that channel's subscribers.
|
|
1644
|
-
* A change affecting both projections is either notified unscoped or once per
|
|
1645
|
-
* channel. An unscoped notify cannot guarantee which view changed, so it
|
|
1646
|
-
* reaches every subscriber -- this keeps every pre-channel `notify` callsite
|
|
1647
|
-
* (and any custom cache that doesn't know about channels) fully compatible.
|
|
1648
|
-
*
|
|
1649
|
-
* The full delivery matrix:
|
|
1650
|
-
*
|
|
1651
|
-
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
1652
|
-
* | -------------------- | --------- | ---------- | --------------------- |
|
|
1653
|
-
* | `'local'` | ✅ | ❌ | ✅ |
|
|
1654
|
-
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
1655
|
-
* | omitted | ✅ | ✅ | ✅ |
|
|
1656
|
-
*
|
|
1657
|
-
* Channel only applies to the `'attributes'` and `'relationships'`
|
|
1658
|
-
* notification types. All other types (`'errors'`,
|
|
1659
|
-
* `'identity'`, `'state'`, and the various `CacheOperation`/
|
|
1660
|
-
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
1661
|
-
* have no local/remote duality.
|
|
1662
|
-
*
|
|
1663
|
-
* @public
|
|
1664
|
-
*/
|
|
1665
|
-
type NotificationChannel = "local" | "remote";
|
|
1666
|
-
interface NotificationCallback$1 {
|
|
1667
|
-
(cacheKey: ResourceKey, notificationType: "attributes" | "relationships", key?: string): void;
|
|
1668
|
-
(cacheKey: ResourceKey, notificationType: "errors" | "meta" | "identity" | "state"): void;
|
|
1669
|
-
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
1670
|
-
}
|
|
1671
|
-
interface ResourceOperationCallback$1 {
|
|
1672
|
-
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
1673
|
-
}
|
|
1674
|
-
interface DocumentOperationCallback$1 {
|
|
1675
|
-
(cacheKey: RequestKey, notificationType: DocumentCacheOperation$1): void;
|
|
1676
|
-
}
|
|
1677
|
-
/**
|
|
1678
|
-
* The NotificationManager provides the ability to subscribe to
|
|
1679
|
-
* changes to Cache state.
|
|
1680
|
-
*
|
|
1681
|
-
* This Feature is what allows WarpDrive to create subscriptions that
|
|
1682
|
-
* work with any framework or change-notification system.
|
|
1683
|
-
*
|
|
1684
|
-
* @hideconstructor
|
|
1685
|
-
* @public
|
|
1686
|
-
*/
|
|
1687
|
-
declare class NotificationManager$1 {
|
|
1688
|
-
constructor(store: Store$1);
|
|
1676
|
+
* If `true`, forces the request to go to the adapter even if a cached
|
|
1677
|
+
* copy of the requested resource(s) already exists in the store. If
|
|
1678
|
+
* omitted, the adapter's `shouldReloadRecord`/`shouldReloadAll` hook
|
|
1679
|
+
* decides whether to reload.
|
|
1680
|
+
*/
|
|
1681
|
+
reload?: boolean;
|
|
1689
1682
|
/**
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1694
|
-
* export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
|
|
1695
|
-
*
|
|
1696
|
-
* export interface NotificationCallback {
|
|
1697
|
-
* (cacheKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;
|
|
1698
|
-
* (cacheKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
|
|
1699
|
-
* (cacheKey: ResourceKey, notificationType: NotificationType, key?: string): void;
|
|
1700
|
-
* }
|
|
1701
|
-
* export interface ResourceOperationCallback {
|
|
1702
|
-
* // resource updates
|
|
1703
|
-
* (cacheKey: ResourceKey, notificationType: CacheOperation): void;
|
|
1704
|
-
* }
|
|
1705
|
-
* export interface DocumentOperationCallback {
|
|
1706
|
-
* // document updates
|
|
1707
|
-
* (cacheKey: RequestKey, notificationType: CacheOperation): void;
|
|
1708
|
-
* }
|
|
1709
|
-
* ```
|
|
1710
|
-
*
|
|
1711
|
-
* A `channel` may be provided when subscribing to a `ResourceKey`. Its
|
|
1712
|
-
* effect is that the subscription skips `'attributes'`/`'relationships'`
|
|
1713
|
-
* notifications explicitly tagged with the *other* channel; unscoped
|
|
1714
|
-
* notifications, and notifications for all other notification types, always
|
|
1715
|
-
* reach the subscriber. Subscribing `'local'` and omitting the channel are
|
|
1716
|
-
* the same thing. See {@link NotificationChannel}.
|
|
1717
|
-
*
|
|
1718
|
-
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
1719
|
-
* | -------------------- | --------- | ---------- | --------------------- |
|
|
1720
|
-
* | `'local'` | ✅ | ❌ | ✅ |
|
|
1721
|
-
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
1722
|
-
* | omitted | ✅ | ✅ | ✅ |
|
|
1723
|
-
*
|
|
1724
|
-
* @public
|
|
1725
|
-
* @return an opaque token to be used with unsubscribe
|
|
1683
|
+
* If `true` or `false`, forces or prevents a background reload of the
|
|
1684
|
+
* cached resource(s) after resolving with the cached data. If omitted,
|
|
1685
|
+
* the adapter's `shouldBackgroundReloadRecord`/`shouldBackgroundReloadAll`
|
|
1686
|
+
* hook decides whether to reload in the background.
|
|
1726
1687
|
*/
|
|
1727
|
-
|
|
1728
|
-
subscribe(cacheKey: "resource", callback: ResourceOperationCallback$1): UnsubscribeToken$1;
|
|
1729
|
-
subscribe(cacheKey: "document" | RequestKey, callback: DocumentOperationCallback$1): UnsubscribeToken$1;
|
|
1688
|
+
backgroundReload?: boolean;
|
|
1730
1689
|
/**
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1733
|
-
*
|
|
1690
|
+
* The names of relationships to load along with this request, used to
|
|
1691
|
+
* build the `include` query parameter for adapters (such as the
|
|
1692
|
+
* JSON:API adapter) that support it.
|
|
1734
1693
|
*/
|
|
1735
|
-
|
|
1694
|
+
include?: string | string[];
|
|
1736
1695
|
/**
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1740
|
-
* same `cacheKey` at once (for instance, when a bulk update to a single
|
|
1741
|
-
* record touches many fields) `key` may be supplied as a `Set<string>`
|
|
1742
|
-
* instead of being called once per key. The `Set` is iterated as-is (it is
|
|
1743
|
-
* never converted to or from an array internally). This delivers the
|
|
1744
|
-
* exact same sequence of individual notifications to subscribers (each
|
|
1745
|
-
* subscriber callback is still invoked once per key, in order) while
|
|
1746
|
-
* paying the per-call overhead (validity checks, subscriber lookups,
|
|
1747
|
-
* buffer/flush scheduling) only once for the whole batch instead of once
|
|
1748
|
-
* per key.
|
|
1749
|
-
*
|
|
1750
|
-
* A `channel` may be supplied for the `'attributes'`/`'relationships'`
|
|
1751
|
-
* namespaces. Tagging a notification `'local'` declares "only the local
|
|
1752
|
-
* (reconciled/editable) view changed"; tagging it `'remote'` declares "only
|
|
1753
|
-
* the remote view changed". Each tag is delivered only to that channel's
|
|
1754
|
-
* subscribers. Omitting the channel reaches every subscriber regardless of
|
|
1755
|
-
* its channel. See {@link NotificationChannel}.
|
|
1756
|
-
*
|
|
1757
|
-
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
1758
|
-
* | -------------------- | --------- | ---------- | --------------------- |
|
|
1759
|
-
* | `'local'` | ✅ | ❌ | ✅ |
|
|
1760
|
-
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
1761
|
-
* | omitted | ✅ | ✅ | ✅ |
|
|
1762
|
-
*
|
|
1763
|
-
* @private
|
|
1696
|
+
* Arbitrary options made available to the adapter via the request's
|
|
1697
|
+
* snapshot (`snapshot.adapterOptions`). The store does not interpret
|
|
1698
|
+
* this value itself.
|
|
1764
1699
|
*/
|
|
1765
|
-
|
|
1766
|
-
notify(cacheKey: ResourceKey, value: "errors" | "meta" | "identity" | "state", key?: null): boolean;
|
|
1767
|
-
notify(cacheKey: ResourceKey, value: CacheOperation$1, key?: null): boolean;
|
|
1768
|
-
notify(cacheKey: RequestKey, value: DocumentCacheOperation$1, key?: null): boolean;
|
|
1700
|
+
adapterOptions?: Record<string, unknown>;
|
|
1769
1701
|
}
|
|
1770
1702
|
/**
|
|
1771
|
-
*
|
|
1772
|
-
* where intimate contracts still exist either for
|
|
1773
|
-
* the Test Suite or for Legacy code.
|
|
1703
|
+
* Options for `store.findRecord()`.
|
|
1774
1704
|
*
|
|
1775
|
-
* @
|
|
1705
|
+
* @summary Legacy options for `store.findRecord`, adding a discouraged `preload` of field values to the shared
|
|
1706
|
+
* reload and adapter settings.
|
|
1776
1707
|
*/
|
|
1777
|
-
interface
|
|
1778
|
-
_flush(): void;
|
|
1779
|
-
}
|
|
1780
|
-
//#endregion
|
|
1781
|
-
//#region src/store/deprecated/-private.d.ts
|
|
1782
|
-
interface BaseFinderOptions$1 {
|
|
1783
|
-
reload?: boolean;
|
|
1784
|
-
backgroundReload?: boolean;
|
|
1785
|
-
include?: string | string[];
|
|
1786
|
-
adapterOptions?: Record<string, unknown>;
|
|
1787
|
-
}
|
|
1788
|
-
interface FindRecordOptions$1 extends BaseFinderOptions$1 {
|
|
1708
|
+
interface FindRecordOptions extends BaseFinderOptions {
|
|
1789
1709
|
/**
|
|
1790
1710
|
* Data to preload into the store before the request is made.
|
|
1791
1711
|
* This feature is *highly* discouraged and has no corresponding
|
|
@@ -1803,315 +1723,62 @@ interface FindRecordOptions$1 extends BaseFinderOptions$1 {
|
|
|
1803
1723
|
*/
|
|
1804
1724
|
preload?: Record<string, Value>;
|
|
1805
1725
|
}
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1726
|
+
/**
|
|
1727
|
+
* Options for `store.query()` and `store.queryRecord()`. Unlike
|
|
1728
|
+
* {@link LegacyResourceQuery}, these options are not sent to the server;
|
|
1729
|
+
* only `adapterOptions` is recognized by the store, and it is passed
|
|
1730
|
+
* through to `adapter.query`/`adapter.queryRecord` via the request snapshot.
|
|
1731
|
+
*
|
|
1732
|
+
* @summary Legacy options for `store.query` and `store.queryRecord`, of which only `adapterOptions` is used, passed
|
|
1733
|
+
* to the adapter rather than the server.
|
|
1734
|
+
*/
|
|
1735
|
+
type QueryOptions = { [K in string | "adapterOptions"]?: K extends "adapterOptions" ? Record<string, unknown> : unknown; };
|
|
1736
|
+
/**
|
|
1737
|
+
* Options for `store.findAll()`.
|
|
1738
|
+
*
|
|
1739
|
+
* @summary Legacy reload, background-reload, include, and adapterOptions settings for `store.findAll`.
|
|
1740
|
+
*/
|
|
1741
|
+
type FindAllOptions = BaseFinderOptions;
|
|
1742
|
+
/**
|
|
1743
|
+
* An opaque query object for `store.query()` and `store.queryRecord()`
|
|
1744
|
+
* that is passed as-is to the adapter, which is responsible for turning
|
|
1745
|
+
* it into request query parameters.
|
|
1746
|
+
*
|
|
1747
|
+
* @summary Legacy query object for `store.query` and `store.queryRecord` that the adapter turns into request query
|
|
1748
|
+
* params, with an optional `include`.
|
|
1749
|
+
*/
|
|
1750
|
+
type LegacyResourceQuery = {
|
|
1751
|
+
/**
|
|
1752
|
+
* The names of relationships to load along with this query, used to
|
|
1753
|
+
* build the `include` query parameter for adapters (such as the
|
|
1754
|
+
* JSON:API adapter) that support it.
|
|
1755
|
+
*/
|
|
1809
1756
|
include?: string | string[];
|
|
1810
1757
|
[key: string]: Value | undefined;
|
|
1811
1758
|
};
|
|
1812
|
-
type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
|
|
1813
1759
|
/**
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
1760
|
+
* Extensions allow providing non-schema driven behaviors to
|
|
1761
|
+
* ReactiveResources, ReactiveArrays, and ReactiveObjects.
|
|
1816
1762
|
*
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1819
|
-
*
|
|
1763
|
+
* This should only be used for temporary migration purposes
|
|
1764
|
+
* to the new schema system when migrating from either Model
|
|
1765
|
+
* or ModelFragments.
|
|
1820
1766
|
*
|
|
1767
|
+
* @summary Registers named methods, getters, and values to add to ReactiveResources, ReactiveObjects,
|
|
1768
|
+
* or ReactiveArrays; meant only as a temporary aid when migrating from Model or ModelFragments.
|
|
1821
1769
|
*/
|
|
1822
|
-
interface
|
|
1823
|
-
/**
|
|
1824
|
-
* The resource type (model name) that this schema describes.
|
|
1825
|
-
*/
|
|
1826
|
-
modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
|
|
1827
|
-
/**
|
|
1828
|
-
* A map of every field defined on this resource type to its kind
|
|
1829
|
-
* (`'attribute'`, `'belongsTo'`, or `'hasMany'`).
|
|
1830
|
-
*/
|
|
1831
|
-
fields: Map<KeyOrString<T>, "attribute" | "belongsTo" | "hasMany">;
|
|
1770
|
+
interface CAUTION_MEGA_DANGER_ZONE_Extension {
|
|
1832
1771
|
/**
|
|
1833
|
-
*
|
|
1834
|
-
*
|
|
1772
|
+
* Whether this extension extends the behaviors of objects
|
|
1773
|
+
* (both ReactiveObjects and ReactiveResources) or of arrays.
|
|
1835
1774
|
*/
|
|
1836
|
-
|
|
1775
|
+
kind: "object" | "array";
|
|
1837
1776
|
/**
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1777
|
+
* The name of the extension, to be used when specifying
|
|
1778
|
+
* either `objectExtensions` or `arrayExtensions` on the
|
|
1779
|
+
* field, ResourceSchema or ObjectSchema
|
|
1840
1780
|
*/
|
|
1841
|
-
|
|
1842
|
-
/**
|
|
1843
|
-
* Invokes `callback` once for each attribute field defined on this resource
|
|
1844
|
-
* type, passing the attribute's key and schema.
|
|
1845
|
-
*/
|
|
1846
|
-
eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: LegacyAttributeField) => void, binding?: T): void;
|
|
1847
|
-
/**
|
|
1848
|
-
* Invokes `callback` once for each relationship field defined on this
|
|
1849
|
-
* resource type, passing the relationship's key and schema.
|
|
1850
|
-
*/
|
|
1851
|
-
eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
|
|
1852
|
-
/**
|
|
1853
|
-
* Invokes `callback` once for each attribute field defined on this resource
|
|
1854
|
-
* type that has a transform (a `type`), passing the attribute's key and the
|
|
1855
|
-
* name of the transform to apply.
|
|
1856
|
-
*/
|
|
1857
|
-
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
|
|
1858
|
-
}
|
|
1859
|
-
/**
|
|
1860
|
-
A `RecordReference` is a low-level API that allows users and
|
|
1861
|
-
addon authors to perform meta-operations on a record.
|
|
1862
|
-
|
|
1863
|
-
@hideconstructor
|
|
1864
|
-
@public
|
|
1865
|
-
*/
|
|
1866
|
-
declare class RecordReference {
|
|
1867
|
-
constructor(store: Store$1, identifier: ResourceKey);
|
|
1868
|
-
get type(): string;
|
|
1869
|
-
/**
|
|
1870
|
-
The `id` of the record that this reference refers to.
|
|
1871
|
-
|
|
1872
|
-
Together, the `type` and `id` properties form a composite key for
|
|
1873
|
-
the identity map.
|
|
1874
|
-
|
|
1875
|
-
Example
|
|
1876
|
-
|
|
1877
|
-
```javascript
|
|
1878
|
-
let userRef = store.getReference('user', 1);
|
|
1879
|
-
|
|
1880
|
-
userRef.id(); // '1'
|
|
1881
|
-
```
|
|
1882
|
-
|
|
1883
|
-
@public
|
|
1884
|
-
@return The id of the record.
|
|
1885
|
-
*/
|
|
1886
|
-
id(): string | null;
|
|
1887
|
-
/**
|
|
1888
|
-
The `identifier` of the record that this reference refers to.
|
|
1889
|
-
|
|
1890
|
-
Together, the `type` and `id` properties form a composite key for
|
|
1891
|
-
the identity map.
|
|
1892
|
-
|
|
1893
|
-
Example
|
|
1894
|
-
|
|
1895
|
-
```javascript
|
|
1896
|
-
let userRef = store.getReference('user', 1);
|
|
1897
|
-
|
|
1898
|
-
userRef.identifier(); // '1'
|
|
1899
|
-
```
|
|
1900
|
-
|
|
1901
|
-
@public
|
|
1902
|
-
@return The identifier of the record.
|
|
1903
|
-
*/
|
|
1904
|
-
identifier(): ResourceKey;
|
|
1905
|
-
/**
|
|
1906
|
-
How the reference will be looked up when it is loaded. Currently
|
|
1907
|
-
this always returns `identity` to signify that a record will be
|
|
1908
|
-
loaded by its `type` and `id`.
|
|
1909
|
-
|
|
1910
|
-
Example
|
|
1911
|
-
|
|
1912
|
-
```javascript
|
|
1913
|
-
const userRef = store.getReference('user', 1);
|
|
1914
|
-
|
|
1915
|
-
userRef.remoteType(); // 'identity'
|
|
1916
|
-
```
|
|
1917
|
-
|
|
1918
|
-
@public
|
|
1919
|
-
*/
|
|
1920
|
-
remoteType(): "identity";
|
|
1921
|
-
/**
|
|
1922
|
-
This API allows you to provide a reference with new data. The
|
|
1923
|
-
simplest usage of this API is similar to `store.push`: you provide a
|
|
1924
|
-
normalized hash of data and the object represented by the reference
|
|
1925
|
-
will update.
|
|
1926
|
-
|
|
1927
|
-
If you pass a promise to `push`, WarpDrive will not ask the adapter
|
|
1928
|
-
for the data if another attempt to fetch it is made in the
|
|
1929
|
-
interim. When the promise resolves, the underlying object is updated
|
|
1930
|
-
with the new data, and the promise returned by *this function* is resolved
|
|
1931
|
-
with that object.
|
|
1932
|
-
|
|
1933
|
-
For example, `recordReference.push(promise)` will be resolved with a
|
|
1934
|
-
record.
|
|
1935
|
-
|
|
1936
|
-
Example
|
|
1937
|
-
|
|
1938
|
-
```javascript
|
|
1939
|
-
let userRef = store.getReference('user', 1);
|
|
1940
|
-
|
|
1941
|
-
// provide data for reference
|
|
1942
|
-
userRef.push({
|
|
1943
|
-
data: {
|
|
1944
|
-
id: "1",
|
|
1945
|
-
type: "user",
|
|
1946
|
-
attributes: {
|
|
1947
|
-
username: "@user"
|
|
1948
|
-
}
|
|
1949
|
-
}
|
|
1950
|
-
}).then(function(user) {
|
|
1951
|
-
userRef.value() === user;
|
|
1952
|
-
});
|
|
1953
|
-
```
|
|
1954
|
-
|
|
1955
|
-
@public
|
|
1956
|
-
@param objectOrPromise a JSON:API ResourceDocument or a promise resolving to one
|
|
1957
|
-
@return a promise for the value (record or relationship)
|
|
1958
|
-
*/
|
|
1959
|
-
push(objectOrPromise: SingleResourceDocument | Promise<SingleResourceDocument>): Promise<OpaqueRecordInstance$1>;
|
|
1960
|
-
/**
|
|
1961
|
-
If the entity referred to by the reference is already loaded, it is
|
|
1962
|
-
present as `reference.value`. Otherwise the value returned by this function
|
|
1963
|
-
is `null`.
|
|
1964
|
-
|
|
1965
|
-
Example
|
|
1966
|
-
|
|
1967
|
-
```javascript
|
|
1968
|
-
let userRef = store.getReference('user', 1);
|
|
1969
|
-
|
|
1970
|
-
userRef.value(); // user
|
|
1971
|
-
```
|
|
1972
|
-
|
|
1973
|
-
@public
|
|
1974
|
-
@return the record for this RecordReference
|
|
1975
|
-
*/
|
|
1976
|
-
value(): OpaqueRecordInstance$1 | null;
|
|
1977
|
-
/**
|
|
1978
|
-
Triggers a fetch for the backing entity based on its `remoteType`
|
|
1979
|
-
(see `remoteType` definitions per reference type).
|
|
1980
|
-
|
|
1981
|
-
Example
|
|
1982
|
-
|
|
1983
|
-
```javascript
|
|
1984
|
-
let userRef = store.getReference('user', 1);
|
|
1985
|
-
|
|
1986
|
-
// load user (via store.find)
|
|
1987
|
-
userRef.load().then(...)
|
|
1988
|
-
```
|
|
1989
|
-
|
|
1990
|
-
@public
|
|
1991
|
-
@return the record for this RecordReference
|
|
1992
|
-
*/
|
|
1993
|
-
load(): Promise<unknown>;
|
|
1994
|
-
/**
|
|
1995
|
-
Reloads the record if it is already loaded. If the record is not
|
|
1996
|
-
loaded it will load the record via `store.findRecord`
|
|
1997
|
-
|
|
1998
|
-
Example
|
|
1999
|
-
|
|
2000
|
-
```javascript
|
|
2001
|
-
let userRef = store.getReference('user', 1);
|
|
2002
|
-
|
|
2003
|
-
// or trigger a reload
|
|
2004
|
-
userRef.reload().then(...)
|
|
2005
|
-
```
|
|
2006
|
-
|
|
2007
|
-
@public
|
|
2008
|
-
@return the record for this RecordReference
|
|
2009
|
-
*/
|
|
2010
|
-
reload(): Promise<unknown>;
|
|
2011
|
-
}
|
|
2012
|
-
//#endregion
|
|
2013
|
-
//#region src/store/-types/q/store.d.ts
|
|
2014
|
-
/**
|
|
2015
|
-
* Options shared by {@link FindRecordOptions} and {@link FindAllOptions}
|
|
2016
|
-
* for controlling reload behavior and adapter/serializer specific
|
|
2017
|
-
* configuration when using the legacy Adapter/Serializer network layer.
|
|
2018
|
-
*/
|
|
2019
|
-
interface BaseFinderOptions {
|
|
2020
|
-
/**
|
|
2021
|
-
* If `true`, forces the request to go to the adapter even if a cached
|
|
2022
|
-
* copy of the requested resource(s) already exists in the store. If
|
|
2023
|
-
* omitted, the adapter's `shouldReloadRecord`/`shouldReloadAll` hook
|
|
2024
|
-
* decides whether to reload.
|
|
2025
|
-
*/
|
|
2026
|
-
reload?: boolean;
|
|
2027
|
-
/**
|
|
2028
|
-
* If `true` or `false`, forces or prevents a background reload of the
|
|
2029
|
-
* cached resource(s) after resolving with the cached data. If omitted,
|
|
2030
|
-
* the adapter's `shouldBackgroundReloadRecord`/`shouldBackgroundReloadAll`
|
|
2031
|
-
* hook decides whether to reload in the background.
|
|
2032
|
-
*/
|
|
2033
|
-
backgroundReload?: boolean;
|
|
2034
|
-
/**
|
|
2035
|
-
* The names of relationships to load along with this request, used to
|
|
2036
|
-
* build the `include` query parameter for adapters (such as the
|
|
2037
|
-
* JSON:API adapter) that support it.
|
|
2038
|
-
*/
|
|
2039
|
-
include?: string | string[];
|
|
2040
|
-
/**
|
|
2041
|
-
* Arbitrary options made available to the adapter via the request's
|
|
2042
|
-
* snapshot (`snapshot.adapterOptions`). The store does not interpret
|
|
2043
|
-
* this value itself.
|
|
2044
|
-
*/
|
|
2045
|
-
adapterOptions?: Record<string, unknown>;
|
|
2046
|
-
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Options for `store.findRecord()`.
|
|
2049
|
-
*/
|
|
2050
|
-
interface FindRecordOptions extends BaseFinderOptions {
|
|
2051
|
-
/**
|
|
2052
|
-
* Data to preload into the store before the request is made.
|
|
2053
|
-
* This feature is *highly* discouraged and has no corresponding
|
|
2054
|
-
* feature when using builders and handlers.
|
|
2055
|
-
*
|
|
2056
|
-
* Excepting relationships: the data should be in the form of a
|
|
2057
|
-
* JSON object where the keys are fields on the record and the value
|
|
2058
|
-
* is the raw value to be added to the cache.
|
|
2059
|
-
*
|
|
2060
|
-
* Relationships can either be provided as string IDs from which
|
|
2061
|
-
* an identifier will be built base upon the relationship's expected
|
|
2062
|
-
* resource type, or be record instances from which the identifier
|
|
2063
|
-
* will be extracted.
|
|
2064
|
-
*
|
|
2065
|
-
*/
|
|
2066
|
-
preload?: Record<string, Value>;
|
|
2067
|
-
}
|
|
2068
|
-
/**
|
|
2069
|
-
* Options for `store.query()` and `store.queryRecord()`. Unlike
|
|
2070
|
-
* {@link LegacyResourceQuery}, these options are not sent to the server;
|
|
2071
|
-
* only `adapterOptions` is recognized by the store, and it is passed
|
|
2072
|
-
* through to `adapter.query`/`adapter.queryRecord` via the request snapshot.
|
|
2073
|
-
*/
|
|
2074
|
-
type QueryOptions = { [K in string | "adapterOptions"]?: K extends "adapterOptions" ? Record<string, unknown> : unknown; };
|
|
2075
|
-
/**
|
|
2076
|
-
* Options for `store.findAll()`.
|
|
2077
|
-
*/
|
|
2078
|
-
type FindAllOptions = BaseFinderOptions;
|
|
2079
|
-
/**
|
|
2080
|
-
* An opaque query object for `store.query()` and `store.queryRecord()`
|
|
2081
|
-
* that is passed as-is to the adapter, which is responsible for turning
|
|
2082
|
-
* it into request query parameters.
|
|
2083
|
-
*/
|
|
2084
|
-
type LegacyResourceQuery = {
|
|
2085
|
-
/**
|
|
2086
|
-
* The names of relationships to load along with this query, used to
|
|
2087
|
-
* build the `include` query parameter for adapters (such as the
|
|
2088
|
-
* JSON:API adapter) that support it.
|
|
2089
|
-
*/
|
|
2090
|
-
include?: string | string[];
|
|
2091
|
-
[key: string]: Value | undefined;
|
|
2092
|
-
};
|
|
2093
|
-
//#endregion
|
|
2094
|
-
//#region src/reactive/-private/schema.d.ts
|
|
2095
|
-
/**
|
|
2096
|
-
* Extensions allow providing non-schema driven behaviors to
|
|
2097
|
-
* ReactiveResources, ReactiveArrays, and ReactiveObjects.
|
|
2098
|
-
*
|
|
2099
|
-
* This should only be used for temporary migration purposes
|
|
2100
|
-
* to the new schema system when migrating from either Model
|
|
2101
|
-
* or ModelFragments.
|
|
2102
|
-
*/
|
|
2103
|
-
interface CAUTION_MEGA_DANGER_ZONE_Extension {
|
|
2104
|
-
/**
|
|
2105
|
-
* Whether this extension extends the behaviors of objects
|
|
2106
|
-
* (both ReactiveObjects and ReactiveResources) or of arrays.
|
|
2107
|
-
*/
|
|
2108
|
-
kind: "object" | "array";
|
|
2109
|
-
/**
|
|
2110
|
-
* The name of the extension, to be used when specifying
|
|
2111
|
-
* either `objectExtensions` or `arrayExtensions` on the
|
|
2112
|
-
* field, ResourceSchema or ObjectSchema
|
|
2113
|
-
*/
|
|
2114
|
-
name: string;
|
|
1781
|
+
name: string;
|
|
2115
1782
|
/**
|
|
2116
1783
|
* An object with iterable keys whose values are the getters
|
|
2117
1784
|
* or methods to expose on the object or array.
|
|
@@ -2195,6 +1862,9 @@ interface CAUTION_MEGA_DANGER_ZONE_Extension {
|
|
|
2195
1862
|
* Describes one feature added to a resource by a schema extension, as
|
|
2196
1863
|
* classified by {@link processExtension} from the property descriptor it
|
|
2197
1864
|
* was declared with (a method, a plain value, or a getter/setter pair).
|
|
1865
|
+
*
|
|
1866
|
+
* @summary One normalized feature of a schema extension, tagged by kind as a method, a readonly or
|
|
1867
|
+
* mutable value, or a getter/setter accessor.
|
|
2198
1868
|
*/
|
|
2199
1869
|
type ExtensionDef = {
|
|
2200
1870
|
/** A callable feature, installed as a method. */
|
|
@@ -2233,6 +1903,9 @@ type ExtensionDef = {
|
|
|
2233
1903
|
* The result of {@link processExtension} normalizing a
|
|
2234
1904
|
* {@link CAUTION_MEGA_DANGER_ZONE_Extension} into a lookup of its features
|
|
2235
1905
|
* by name.
|
|
1906
|
+
*
|
|
1907
|
+
* @summary A registered schema extension normalized into its kind, name, and a map of its features
|
|
1908
|
+
* keyed by property name.
|
|
2236
1909
|
*/
|
|
2237
1910
|
interface ProcessedExtension {
|
|
2238
1911
|
/** Whether this extension applies to objects/resources or to arrays. */
|
|
@@ -2262,14 +1935,19 @@ interface ExtensibleField {
|
|
|
2262
1935
|
* Utility for constructing a ResourceSchema with the recommended
|
|
2263
1936
|
* fields for the PolarisMode experience.
|
|
2264
1937
|
*
|
|
1938
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
1939
|
+
* create a schema with it.
|
|
1940
|
+
*
|
|
2265
1941
|
* Using this requires registering the PolarisMode derivations
|
|
2266
1942
|
*
|
|
2267
1943
|
* ```ts
|
|
2268
|
-
* import { registerDerivations } from '@warp-drive-mirror/
|
|
1944
|
+
* import { registerDerivations } from '@warp-drive-mirror/core/reactive';
|
|
2269
1945
|
*
|
|
2270
1946
|
* registerDerivations(schema);
|
|
2271
1947
|
* ```
|
|
2272
1948
|
*
|
|
1949
|
+
* @summary Adds the default `id` identity plus `$key`, `$type`, and `constructor` derived fields to a
|
|
1950
|
+
* PolarisMode resource schema.
|
|
2273
1951
|
* @public
|
|
2274
1952
|
* @param schema
|
|
2275
1953
|
* @return {PolarisResourceSchema}
|
|
@@ -2312,6 +1990,8 @@ interface FromIdentityDerivation {
|
|
|
2312
1990
|
*
|
|
2313
1991
|
* `^` returns the entire identifier object.
|
|
2314
1992
|
*
|
|
1993
|
+
* @summary The `@identity` derivation, which reads a record's `id`, `lid`, `type`, or whole resource key
|
|
1994
|
+
* for use in derived fields.
|
|
2315
1995
|
* @public
|
|
2316
1996
|
*/
|
|
2317
1997
|
declare const fromIdentity: FromIdentityDerivation;
|
|
@@ -2320,9 +2000,14 @@ declare const fromIdentity: FromIdentityDerivation;
|
|
|
2320
2000
|
* to use the PolarisMode defaults provided by
|
|
2321
2001
|
*
|
|
2322
2002
|
* ```ts
|
|
2323
|
-
* import { withDefaults } from '@warp-drive-mirror/
|
|
2003
|
+
* import { withDefaults } from '@warp-drive-mirror/core/reactive';
|
|
2324
2004
|
* ```
|
|
2325
2005
|
*
|
|
2006
|
+
* The [Derivations](/guides/the-manual/schemas/derivations#about-built-in-derivations)
|
|
2007
|
+
* guide explains when you need to call it.
|
|
2008
|
+
*
|
|
2009
|
+
* @summary Registers the `@identity` and `@constructor` derivations that schemas built with
|
|
2010
|
+
* `withDefaults` depend on.
|
|
2326
2011
|
* @public
|
|
2327
2012
|
*/
|
|
2328
2013
|
declare function registerDerivations(schema: SchemaService): void;
|
|
@@ -2339,6 +2024,9 @@ interface InternalSchema {
|
|
|
2339
2024
|
* Defines how to convert a `GenericField`, `ObjectField`, or `ArrayField`
|
|
2340
2025
|
* between the raw value `T` stored in the cache and the presentation value
|
|
2341
2026
|
* `PT` exposed on the record.
|
|
2027
|
+
*
|
|
2028
|
+
* @summary A registered converter between a field's raw cache value and the value exposed on the
|
|
2029
|
+
* record, with optional default.
|
|
2342
2030
|
*/
|
|
2343
2031
|
type Transformation<T extends Value = Value, PT = unknown> = {
|
|
2344
2032
|
/** Converts the presentation value into the raw value to store in the cache. */
|
|
@@ -2362,6 +2050,12 @@ interface SchemaService$1 {
|
|
|
2362
2050
|
/**
|
|
2363
2051
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
2364
2052
|
*
|
|
2053
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
2054
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
2055
|
+
* shows how to give a store one.
|
|
2056
|
+
*
|
|
2057
|
+
* @summary The default schema service, which stores resource and object schemas, traits, derivations,
|
|
2058
|
+
* transformations, hash functions and extensions registered at runtime.
|
|
2365
2059
|
* @public
|
|
2366
2060
|
*/
|
|
2367
2061
|
declare class SchemaService$1 implements SchemaService {
|
|
@@ -2443,13 +2137,13 @@ declare class SchemaService$1 implements SchemaService {
|
|
|
2443
2137
|
type: string;
|
|
2444
2138
|
}): boolean;
|
|
2445
2139
|
}
|
|
2446
|
-
//#endregion
|
|
2447
|
-
//#region src/types/schema/schema-service.d.ts
|
|
2448
2140
|
/**
|
|
2449
2141
|
* A dictionary of {@link LegacyAttributeField} definitions keyed by
|
|
2450
2142
|
* attribute name, as returned by the deprecated
|
|
2451
2143
|
* {@link SchemaService.attributesDefinitionFor | attributesDefinitionFor} hook.
|
|
2452
2144
|
*
|
|
2145
|
+
* @summary Legacy attribute field definitions keyed by attribute name, returned by the deprecated
|
|
2146
|
+
* `attributesDefinitionFor` schema hook.
|
|
2453
2147
|
* @public
|
|
2454
2148
|
*/
|
|
2455
2149
|
type AttributesSchema = Record<string, LegacyAttributeField>;
|
|
@@ -2458,6 +2152,8 @@ type AttributesSchema = Record<string, LegacyAttributeField>;
|
|
|
2458
2152
|
* relationship name, as returned by the deprecated
|
|
2459
2153
|
* {@link SchemaService.relationshipsDefinitionFor | relationshipsDefinitionFor} hook.
|
|
2460
2154
|
*
|
|
2155
|
+
* @summary Legacy relationship field definitions keyed by relationship name, returned by the deprecated
|
|
2156
|
+
* `relationshipsDefinitionFor` schema hook.
|
|
2461
2157
|
* @public
|
|
2462
2158
|
*/
|
|
2463
2159
|
type RelationshipsSchema = Record<string, LegacyRelationshipField>;
|
|
@@ -2468,6 +2164,10 @@ interface ObjectWithStringTypeProperty {
|
|
|
2468
2164
|
* The SchemaService provides the ability to query for information about the structure
|
|
2469
2165
|
* of any resource type.
|
|
2470
2166
|
*
|
|
2167
|
+
* The [Schemas](/guides/the-manual/schemas/) guide shows how to register schemas
|
|
2168
|
+
* with it, and [Advanced Store Configuration](/guides/configuration/advanced#add-a-source-for-schema-for-your-data)
|
|
2169
|
+
* shows how to give a store one.
|
|
2170
|
+
*
|
|
2471
2171
|
* Applications can provide any implementation of the SchemaService they please so long
|
|
2472
2172
|
* as it conforms to this interface.
|
|
2473
2173
|
*
|
|
@@ -2512,6 +2212,8 @@ interface ObjectWithStringTypeProperty {
|
|
|
2512
2212
|
* }
|
|
2513
2213
|
* ```
|
|
2514
2214
|
*
|
|
2215
|
+
* @summary The contract a store's schema service implements to answer which resource types, traits, fields,
|
|
2216
|
+
* transformations, and derivations exist.
|
|
2515
2217
|
* @public
|
|
2516
2218
|
*/
|
|
2517
2219
|
interface SchemaService {
|
|
@@ -2535,301 +2237,828 @@ interface SchemaService {
|
|
|
2535
2237
|
*
|
|
2536
2238
|
* @public
|
|
2537
2239
|
*/
|
|
2538
|
-
hasTrait(type: string): boolean;
|
|
2240
|
+
hasTrait(type: string): boolean;
|
|
2241
|
+
/**
|
|
2242
|
+
* Queries whether the given resource has the given trait
|
|
2243
|
+
*
|
|
2244
|
+
* @public
|
|
2245
|
+
*/
|
|
2246
|
+
resourceHasTrait(resource: ObjectWithStringTypeProperty | ResourceKey, trait: string): boolean;
|
|
2247
|
+
/**
|
|
2248
|
+
* Queries for the fields of a given resource type or resource identity.
|
|
2249
|
+
*
|
|
2250
|
+
* Should error if the resource type is not recognized.
|
|
2251
|
+
*
|
|
2252
|
+
* @public
|
|
2253
|
+
*/
|
|
2254
|
+
fields(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, FieldSchema>;
|
|
2255
|
+
/**
|
|
2256
|
+
* Queries for the fields of a given resource type or resource identity.
|
|
2257
|
+
*
|
|
2258
|
+
* Should error if the resource type is not recognized.
|
|
2259
|
+
*
|
|
2260
|
+
* @public
|
|
2261
|
+
*/
|
|
2262
|
+
cacheFields?(resource: ObjectWithStringTypeProperty | ResourceKey): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
2263
|
+
/**
|
|
2264
|
+
* Returns the transformation registered with the name provided
|
|
2265
|
+
* by `field.type`. Validates that the field is a valid transformable.
|
|
2266
|
+
*
|
|
2267
|
+
* @public
|
|
2268
|
+
*/
|
|
2269
|
+
transformation(field: GenericField | ObjectField | ArrayField | ObjectWithStringTypeProperty): Transformation$1;
|
|
2270
|
+
/**
|
|
2271
|
+
* Returns the hash function registered with the name provided
|
|
2272
|
+
* by `field.type`. Validates that the field is a valid HashField.
|
|
2273
|
+
*
|
|
2274
|
+
* @public
|
|
2275
|
+
*/
|
|
2276
|
+
hashFn(field: HashField | ObjectWithStringTypeProperty): HashFn;
|
|
2277
|
+
/**
|
|
2278
|
+
* Returns the derivation registered with the name provided
|
|
2279
|
+
* by `field.type`. Validates that the field is a valid DerivedField.
|
|
2280
|
+
*
|
|
2281
|
+
* @public
|
|
2282
|
+
*/
|
|
2283
|
+
derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
|
|
2284
|
+
/**
|
|
2285
|
+
* Returns the schema for the provided resource type.
|
|
2286
|
+
*
|
|
2287
|
+
* @public
|
|
2288
|
+
*/
|
|
2289
|
+
resource(resource: ObjectWithStringTypeProperty | ResourceKey): Schema;
|
|
2290
|
+
/**
|
|
2291
|
+
* Enables registration of multiple Schemas at once.
|
|
2292
|
+
*
|
|
2293
|
+
* This can be useful for either pre-loading schema information
|
|
2294
|
+
* or for registering schema information delivered by API calls
|
|
2295
|
+
* or other sources just-in-time.
|
|
2296
|
+
*
|
|
2297
|
+
* @public
|
|
2298
|
+
*/
|
|
2299
|
+
registerResources(schemas: Schema[]): void;
|
|
2300
|
+
/**
|
|
2301
|
+
* Enables registration of a single Schema representing either
|
|
2302
|
+
* a resource in PolarisMode or LegacyMode or an ObjectSchema
|
|
2303
|
+
* representing an embedded structure in other schemas.
|
|
2304
|
+
*
|
|
2305
|
+
* This can be useful for either pre-loading schema information
|
|
2306
|
+
* or for registering schema information delivered by API calls
|
|
2307
|
+
* or other sources just-in-time.
|
|
2308
|
+
*
|
|
2309
|
+
* @public
|
|
2310
|
+
*/
|
|
2311
|
+
registerResource(schema: Schema): void;
|
|
2312
|
+
/**
|
|
2313
|
+
* Enables registration of a transformation.
|
|
2314
|
+
*
|
|
2315
|
+
* The transformation can later be retrieved by the name
|
|
2316
|
+
* attached to it's `[Type]` property.
|
|
2317
|
+
*
|
|
2318
|
+
* @public
|
|
2319
|
+
*/
|
|
2320
|
+
registerTransformation(transform: Transformation$1): void;
|
|
2321
|
+
/**
|
|
2322
|
+
* Enables registration of a derivation.
|
|
2323
|
+
*
|
|
2324
|
+
* The derivation can later be retrieved by the name
|
|
2325
|
+
* attached to it's `[Type]` property.
|
|
2326
|
+
*
|
|
2327
|
+
* @public
|
|
2328
|
+
*/
|
|
2329
|
+
registerDerivation<R, T, FM extends ObjectValue | null>(derivation: Derivation<R, T, FM>): void;
|
|
2330
|
+
/**
|
|
2331
|
+
* Enables registration of a hashing function
|
|
2332
|
+
*
|
|
2333
|
+
* The hashing function can later be retrieved by the name
|
|
2334
|
+
* attached to it's `[Type]` property.
|
|
2335
|
+
*
|
|
2336
|
+
* @public
|
|
2337
|
+
*/
|
|
2338
|
+
registerHashFn(hashFn: HashFn): void;
|
|
2339
|
+
/**
|
|
2340
|
+
* Registers a {@link Trait} for use by resource schemas.
|
|
2341
|
+
*
|
|
2342
|
+
* Traits are re-usable collections of fields that can be composed to
|
|
2343
|
+
* build up a resource schema. Often they represent polymorphic behaviors
|
|
2344
|
+
* a resource should exhibit.
|
|
2345
|
+
*
|
|
2346
|
+
* When we finalize a resource, we walk its traits and apply their fields
|
|
2347
|
+
* to the resource's fields. All specified traits must be registered by
|
|
2348
|
+
* this time or an error will be thrown.
|
|
2349
|
+
*
|
|
2350
|
+
* Traits are applied left-to-right, with traits of traits being applied in the same
|
|
2351
|
+
* way. Thus for the most part, application of traits is a post-order graph traversal
|
|
2352
|
+
* problem.
|
|
2353
|
+
*
|
|
2354
|
+
* A trait is only ever processed once. If multiple traits (A, B, C) have the same
|
|
2355
|
+
* trait (D) as a dependency, D will be included only once when first encountered by
|
|
2356
|
+
* A.
|
|
2357
|
+
*
|
|
2358
|
+
* If a cycle exists such that trait A has trait B which has Trait A, trait A will
|
|
2359
|
+
* be applied *after* trait B in production. In development a cycle error will be thrown.
|
|
2360
|
+
*
|
|
2361
|
+
* Fields are finalized on a "last wins principle". Thus traits appearing higher in
|
|
2362
|
+
* the tree and further to the right of a traits array take precedence, with the
|
|
2363
|
+
* resource's fields always being applied last and winning out.
|
|
2364
|
+
*
|
|
2365
|
+
* @public
|
|
2366
|
+
*/
|
|
2367
|
+
registerTrait?(trait: Trait): void;
|
|
2368
|
+
/**
|
|
2369
|
+
* DEPRECATED - use `fields` instead
|
|
2370
|
+
*
|
|
2371
|
+
* Returns definitions for all properties of the specified resource
|
|
2372
|
+
* that are considered "attributes". Generally these are properties
|
|
2373
|
+
* that are not related to book-keeping state on the client and do
|
|
2374
|
+
* not represent a linkage to another resource.
|
|
2375
|
+
*
|
|
2376
|
+
* The return value should be a dictionary of key:value pairs
|
|
2377
|
+
* where the `key` is the attribute or property's name and `value`
|
|
2378
|
+
* is an object with at least the property `name` which should also
|
|
2379
|
+
* match `key`.
|
|
2380
|
+
*
|
|
2381
|
+
* Optionally, this object may also specify `type`, which should
|
|
2382
|
+
* be a string reference to a `transform`, and `options` which
|
|
2383
|
+
* should be dictionary in which any key:value pairs are permissable.
|
|
2384
|
+
*
|
|
2385
|
+
* For instance, when using `@warp-drive-mirror/legacy/model`, the following attribute
|
|
2386
|
+
* definition:
|
|
2387
|
+
*
|
|
2388
|
+
* ```ts
|
|
2389
|
+
* class extends Model {
|
|
2390
|
+
* @attr('string', { defaultValue: 'hello' }) greeting;
|
|
2391
|
+
* @attr('date') birthday;
|
|
2392
|
+
* @attr firstName;
|
|
2393
|
+
* }
|
|
2394
|
+
* ```
|
|
2395
|
+
*
|
|
2396
|
+
* Would be returned as:
|
|
2397
|
+
*
|
|
2398
|
+
* ```js
|
|
2399
|
+
* {
|
|
2400
|
+
* greeting: { name: 'greeting', type: 'string', options: { defaultValue: 'hello' } },
|
|
2401
|
+
* birthday: { name: 'birthday', type: 'date' },
|
|
2402
|
+
* firstName: { name: 'firstName' }
|
|
2403
|
+
* }
|
|
2404
|
+
* ```
|
|
2405
|
+
*
|
|
2406
|
+
* @public
|
|
2407
|
+
* @deprecated - use {@link SchemaService.fields | fields}
|
|
2408
|
+
*/
|
|
2409
|
+
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
2410
|
+
/**
|
|
2411
|
+
* DEPRECATED - use `fields` instead
|
|
2412
|
+
*
|
|
2413
|
+
* Returns definitions for all properties of the specified resource
|
|
2414
|
+
* that are considered "relationships". Generally these are properties
|
|
2415
|
+
* that represent a linkage to another resource.
|
|
2416
|
+
*
|
|
2417
|
+
* The return value should be a dictionary of key:value pairs
|
|
2418
|
+
* where the `key` is the relationship or property's name and `value`
|
|
2419
|
+
* is an object with at least the following properties:
|
|
2420
|
+
*
|
|
2421
|
+
* - `name` which should also match the `key` used in the dictionary.
|
|
2422
|
+
* - `kind` which should be either `belongsTo` or `hasMany`
|
|
2423
|
+
* - `type` which should be the related resource's string "type"
|
|
2424
|
+
* - `options` which should be a dictionary allowing any key but with
|
|
2425
|
+
* at least the below keys present.
|
|
2426
|
+
*
|
|
2427
|
+
* - `options.async` a boolean representing whether data for this relationship is
|
|
2428
|
+
* typically loaded on-demand.
|
|
2429
|
+
* - `options.inverse` a string or null representing the field name / key of the
|
|
2430
|
+
* corresponding relationship on the inverse resource.
|
|
2431
|
+
*
|
|
2432
|
+
* Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
|
|
2433
|
+
*
|
|
2434
|
+
* - `options.polymorphic` a boolean representing whether multiple resource types
|
|
2435
|
+
* can be used to satisfy this relationship.
|
|
2436
|
+
* - `options.as` a string representing the abstract type that the concrete side of
|
|
2437
|
+
* a relationship must specify when fulfilling a polymorphic inverse.
|
|
2438
|
+
*
|
|
2439
|
+
* For example, the following Model using @warp-drive-mirror/legacy/model would generate this relationships
|
|
2440
|
+
* definition by default:
|
|
2441
|
+
*
|
|
2442
|
+
* ```js
|
|
2443
|
+
* class User extends Model {
|
|
2444
|
+
* @belongsTo('user', { async: false, inverse: null }) bestFriend;
|
|
2445
|
+
* @hasMany('user', { async: true, inverse: 'friends' }) friends;
|
|
2446
|
+
* @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
|
|
2447
|
+
* }
|
|
2448
|
+
* ```
|
|
2449
|
+
*
|
|
2450
|
+
* Which would be returned as
|
|
2451
|
+
*
|
|
2452
|
+
* ```js
|
|
2453
|
+
* {
|
|
2454
|
+
* bestFriend: {
|
|
2455
|
+
* name: 'bestFriend',
|
|
2456
|
+
* kind: 'belongsTo',
|
|
2457
|
+
* type: 'user',
|
|
2458
|
+
* options: {
|
|
2459
|
+
* async: false,
|
|
2460
|
+
* inverse: null
|
|
2461
|
+
* }
|
|
2462
|
+
* },
|
|
2463
|
+
* friends: {
|
|
2464
|
+
* name: 'friends',
|
|
2465
|
+
* kind: 'hasMany',
|
|
2466
|
+
* type: 'user',
|
|
2467
|
+
* options: {
|
|
2468
|
+
* async: true,
|
|
2469
|
+
* inverse: 'friends'
|
|
2470
|
+
* }
|
|
2471
|
+
* },
|
|
2472
|
+
* pets: {
|
|
2473
|
+
* name: 'pets',
|
|
2474
|
+
* kind: 'hasMany',
|
|
2475
|
+
* type: 'pet',
|
|
2476
|
+
* options: {
|
|
2477
|
+
* async: false,
|
|
2478
|
+
* polymorphic: true,
|
|
2479
|
+
* inverse: 'owner'
|
|
2480
|
+
* }
|
|
2481
|
+
* },
|
|
2482
|
+
* }
|
|
2483
|
+
* ```
|
|
2484
|
+
*
|
|
2485
|
+
* @public
|
|
2486
|
+
* @deprecated - use {@link SchemaService.fields | fields}
|
|
2487
|
+
*/
|
|
2488
|
+
relationshipsDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): RelationshipsSchema;
|
|
2539
2489
|
/**
|
|
2540
|
-
*
|
|
2490
|
+
* Returns all known resource types
|
|
2541
2491
|
*
|
|
2542
2492
|
* @public
|
|
2543
2493
|
*/
|
|
2544
|
-
|
|
2494
|
+
resourceTypes(): Readonly<string[]>;
|
|
2545
2495
|
/**
|
|
2546
|
-
*
|
|
2496
|
+
* Register an extension for either objects or arrays
|
|
2547
2497
|
*
|
|
2548
|
-
*
|
|
2498
|
+
* See also {@link CAUTION_MEGA_DANGER_ZONE_Extension}
|
|
2549
2499
|
*
|
|
2550
2500
|
* @public
|
|
2551
2501
|
*/
|
|
2552
|
-
|
|
2502
|
+
CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
2553
2503
|
/**
|
|
2554
|
-
*
|
|
2555
|
-
*
|
|
2556
|
-
* Should error if the resource type is not recognized.
|
|
2504
|
+
* Retrieve the extension map for a resource
|
|
2557
2505
|
*
|
|
2558
2506
|
* @public
|
|
2559
2507
|
*/
|
|
2560
|
-
|
|
2508
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: ResourceKey | {
|
|
2509
|
+
type: string;
|
|
2510
|
+
}): null | ProcessedExtension["features"];
|
|
2561
2511
|
/**
|
|
2562
|
-
*
|
|
2563
|
-
* by `field.type`. Validates that the field is a valid transformable.
|
|
2512
|
+
* Retrieve the extension map for an object field
|
|
2564
2513
|
*
|
|
2565
2514
|
* @public
|
|
2566
2515
|
*/
|
|
2567
|
-
|
|
2516
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
2568
2517
|
/**
|
|
2569
|
-
*
|
|
2570
|
-
* by `field.type`. Validates that the field is a valid HashField.
|
|
2518
|
+
* Retrieve the extension map for an array field
|
|
2571
2519
|
*
|
|
2572
2520
|
* @public
|
|
2573
2521
|
*/
|
|
2574
|
-
|
|
2522
|
+
CAUTION_MEGA_DANGER_ZONE_arrayExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
2575
2523
|
/**
|
|
2576
|
-
*
|
|
2577
|
-
* by `field.type`. Validates that the field is a valid DerivedField.
|
|
2524
|
+
* Check if a specific extension has been registered previously
|
|
2578
2525
|
*
|
|
2579
2526
|
* @public
|
|
2580
2527
|
*/
|
|
2581
|
-
|
|
2528
|
+
CAUTION_MEGA_DANGER_ZONE_hasExtension?(ext: {
|
|
2529
|
+
kind: "object" | "array";
|
|
2530
|
+
name: string;
|
|
2531
|
+
}): boolean;
|
|
2532
|
+
}
|
|
2533
|
+
type TypeFromIdentifier<T> = T extends {
|
|
2534
|
+
type: infer U;
|
|
2535
|
+
} ? U : string;
|
|
2536
|
+
type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? PersistedResourceKey<TypeFromIdentifier<T>> : ResourceKey;
|
|
2537
|
+
/**
|
|
2538
|
+
* Type-guard that returns `true` if the given value is a stable {@link ResourceKey}
|
|
2539
|
+
* (as opposed to a {@link RequestKey} or arbitrary, not-yet-stabilized resource data).
|
|
2540
|
+
*/
|
|
2541
|
+
declare function isResourceKey(identifier: unknown): identifier is ResourceKey;
|
|
2542
|
+
/**
|
|
2543
|
+
* Type-guard that returns `true` if the given value is a stable {@link RequestKey}
|
|
2544
|
+
* (as opposed to a {@link ResourceKey} or arbitrary, not-yet-stabilized data).
|
|
2545
|
+
*/
|
|
2546
|
+
declare function isRequestKey(identifier: unknown): identifier is RequestKey;
|
|
2547
|
+
/**
|
|
2548
|
+
* The identity of a field's value, as returned by {@link fieldValueIdentity}.
|
|
2549
|
+
* Today only schema-object values (a `schema-object` field, or one element of
|
|
2550
|
+
* a `schema-array`) have one: the concrete schema-object type the value
|
|
2551
|
+
* resolves to, and the identity hash that type's `ObjectSchema` declares for
|
|
2552
|
+
* it, or `null` when the schema declares `identity: null`.
|
|
2553
|
+
*/
|
|
2554
|
+
interface FieldValueIdentity {
|
|
2555
|
+
type: string;
|
|
2556
|
+
hash: string | null;
|
|
2557
|
+
}
|
|
2558
|
+
/**
|
|
2559
|
+
* The identity of `value` as a value of `field`, when the field kind has one.
|
|
2560
|
+
*
|
|
2561
|
+
* A `schema-object` value, or one element of a `schema-array`, resolves to its
|
|
2562
|
+
* concrete schema-object type and the identity hash that type's `ObjectSchema`
|
|
2563
|
+
* declares (`null` when the schema declares `identity: null`). A
|
|
2564
|
+
* non-polymorphic field names the type directly; a polymorphic field reads it
|
|
2565
|
+
* off the value at `options.type` (default `'type'`), or computes it with the
|
|
2566
|
+
* hash function named by `field.type` when `options.type` is `'@hash'`.
|
|
2567
|
+
*
|
|
2568
|
+
* Every other field kind, and any non-object value, has no identity and
|
|
2569
|
+
* returns `null`.
|
|
2570
|
+
*/
|
|
2571
|
+
declare function fieldValueIdentity(schema: SchemaService, field: FieldSchema, value: unknown): FieldValueIdentity | null;
|
|
2572
|
+
interface KeyOptions {
|
|
2573
|
+
lid: IdentifierMap;
|
|
2574
|
+
id: IdentifierMap;
|
|
2575
|
+
}
|
|
2576
|
+
type TypeMap = {
|
|
2577
|
+
[key: string]: KeyOptions;
|
|
2578
|
+
};
|
|
2579
|
+
type IdentifierMap = Map<string, ResourceKey>;
|
|
2580
|
+
type StableCache = {
|
|
2581
|
+
resources: IdentifierMap;
|
|
2582
|
+
documents: Map<string, RequestKey>;
|
|
2583
|
+
resourcesByType: TypeMap;
|
|
2584
|
+
polymorphicLidBackMap: Map<string, string[]>;
|
|
2585
|
+
};
|
|
2586
|
+
type MergeMethod = (targetIdentifier: ResourceKey, matchedIdentifier: ResourceKey, resourceData: unknown) => ResourceKey;
|
|
2587
|
+
/**
|
|
2588
|
+
Configures how unique identifier lid strings are generated by @ember-data-mirror/store.
|
|
2589
|
+
|
|
2590
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2591
|
+
|
|
2592
|
+
Takes a method which can expect to receive various data as its first argument
|
|
2593
|
+
and the name of a bucket as its second argument.
|
|
2594
|
+
|
|
2595
|
+
Currently there are two buckets, 'record' and 'document'.
|
|
2596
|
+
|
|
2597
|
+
### Resource (`Record`) Identity
|
|
2598
|
+
|
|
2599
|
+
If the bucket is `record` the method must return a unique (to at-least
|
|
2600
|
+
the given bucket) string identifier for the given data as a string to be
|
|
2601
|
+
used as the `lid` of an `Identifier` token.
|
|
2602
|
+
|
|
2603
|
+
This method will only be called by either `getOrCreateRecordIdentifier` or
|
|
2604
|
+
`createIdentifierForNewRecord` when an identifier for the supplied data
|
|
2605
|
+
is not already known via `lid` or `type + id` combo and one needs to be
|
|
2606
|
+
generated or retrieved from a proprietary cache.
|
|
2607
|
+
|
|
2608
|
+
`data` will be the same data argument provided to `getOrCreateRecordIdentifier`
|
|
2609
|
+
and in the `createIdentifierForNewRecord` case will be an object with
|
|
2610
|
+
only `type` as a key.
|
|
2611
|
+
|
|
2612
|
+
```ts
|
|
2613
|
+
import { setIdentifierGenerationMethod } from '@warp-drive-mirror/core';
|
|
2614
|
+
|
|
2615
|
+
export function initialize(applicationInstance) {
|
|
2616
|
+
// note how `count` here is now scoped to the application instance
|
|
2617
|
+
// for our generation method by being inside the closure provided
|
|
2618
|
+
// by the initialize function
|
|
2619
|
+
let count = 0;
|
|
2620
|
+
|
|
2621
|
+
setIdentifierGenerationMethod((resource, bucket) => {
|
|
2622
|
+
return resource.lid || `my-key-${count++}`;
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
export default {
|
|
2627
|
+
name: 'configure-ember-data-identifiers',
|
|
2628
|
+
initialize
|
|
2629
|
+
};
|
|
2630
|
+
```
|
|
2631
|
+
|
|
2632
|
+
### Document Identity
|
|
2633
|
+
|
|
2634
|
+
If the bucket is `document` the method will receive the associated
|
|
2635
|
+
immutable `request` passed to `store.request` as its first argument
|
|
2636
|
+
and should return a unique string for the given request if the document
|
|
2637
|
+
should be cached, and `null` if it should not be cached.
|
|
2638
|
+
|
|
2639
|
+
Note, the request result will still be passed to the cache via `Cache.put`,
|
|
2640
|
+
but caches should take this as a signal that the document should not itself
|
|
2641
|
+
be cached, while its contents may still be used to update other cache state.
|
|
2642
|
+
|
|
2643
|
+
The presence of `cacheOptions.key` on the request will take precedence
|
|
2644
|
+
for the document cache key, and this method will not be called if it is
|
|
2645
|
+
present.
|
|
2646
|
+
|
|
2647
|
+
The default method implementation for this bucket is to return `null`
|
|
2648
|
+
for all requests whose method is not `GET`, and to return the `url` for
|
|
2649
|
+
those where it is.
|
|
2650
|
+
|
|
2651
|
+
This means that queries via `POST` MUST provide `cacheOptions.key` or
|
|
2652
|
+
implement this hook.
|
|
2653
|
+
|
|
2654
|
+
⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
|
|
2655
|
+
|
|
2656
|
+
@summary Overrides how the store generates `lid` cache keys for resources and documents; must be set
|
|
2657
|
+
before the store is created.
|
|
2658
|
+
@public
|
|
2659
|
+
*/
|
|
2660
|
+
declare function setIdentifierGenerationMethod(method: GenerationMethod | null): void;
|
|
2661
|
+
/**
|
|
2662
|
+
Configure a callback for when the identifier cache encounters new resource
|
|
2663
|
+
data for an existing resource.
|
|
2664
|
+
|
|
2665
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2666
|
+
|
|
2667
|
+
```js
|
|
2668
|
+
import { setIdentifierUpdateMethod } from '@warp-drive-mirror/core';
|
|
2669
|
+
```
|
|
2670
|
+
|
|
2671
|
+
Takes a method which can expect to receive an existing `Identifier` alongside
|
|
2672
|
+
some new data to consider as a second argument. This is an opportunity
|
|
2673
|
+
for secondary lookup tables and caches associated with the identifier
|
|
2674
|
+
to be amended.
|
|
2675
|
+
|
|
2676
|
+
This method is called everytime `updateRecordIdentifier` is called and
|
|
2677
|
+
with the same arguments. It provides the opportunity to update secondary
|
|
2678
|
+
lookup tables for existing identifiers.
|
|
2679
|
+
|
|
2680
|
+
It will always be called after an identifier created with `createIdentifierForNewRecord`
|
|
2681
|
+
has been committed, or after an update to the `record` a `RecordIdentifier`
|
|
2682
|
+
is assigned to has been committed. Committed here meaning that the server
|
|
2683
|
+
has acknowledged the update (for instance after a call to `.save()`)
|
|
2684
|
+
|
|
2685
|
+
If `id` has not previously existed, it will be assigned to the `Identifier`
|
|
2686
|
+
prior to this `UpdateMethod` being called; however, calls to the parent method
|
|
2687
|
+
`updateRecordIdentifier` that attempt to change the `id` or calling update
|
|
2688
|
+
without providing an `id` when one is missing will throw an error.
|
|
2689
|
+
|
|
2690
|
+
@summary Registers a callback run when an existing resource key receives new data, for updating your
|
|
2691
|
+
own secondary lookup tables.
|
|
2692
|
+
@public
|
|
2693
|
+
*/
|
|
2694
|
+
declare function setIdentifierUpdateMethod(method: UpdateMethod | null): void;
|
|
2695
|
+
/**
|
|
2696
|
+
Configure a callback for when the identifier cache is going to release an identifier.
|
|
2697
|
+
|
|
2698
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2699
|
+
|
|
2700
|
+
```js
|
|
2701
|
+
import { setIdentifierForgetMethod } from '@warp-drive-mirror/core';
|
|
2702
|
+
```
|
|
2703
|
+
|
|
2704
|
+
Takes method which can expect to receive an existing `Identifier` that should be eliminated
|
|
2705
|
+
from any secondary lookup tables or caches that the user has populated for it.
|
|
2706
|
+
|
|
2707
|
+
@summary Registers a callback run when the store releases a resource key, for cleaning up your own
|
|
2708
|
+
lookup tables.
|
|
2709
|
+
@public
|
|
2710
|
+
*/
|
|
2711
|
+
declare function setIdentifierForgetMethod(method: ForgetMethod | null): void;
|
|
2712
|
+
/**
|
|
2713
|
+
Configure a callback for when the identifier cache is being torn down.
|
|
2714
|
+
|
|
2715
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2716
|
+
|
|
2717
|
+
```js
|
|
2718
|
+
import { setIdentifierResetMethod } from '@warp-drive-mirror/core';
|
|
2719
|
+
```
|
|
2720
|
+
|
|
2721
|
+
Takes a method which can expect to be called when the parent application is destroyed.
|
|
2722
|
+
|
|
2723
|
+
If you have properly used a WeakMap to encapsulate the state of your customization
|
|
2724
|
+
to the application instance, you may not need to implement the `resetMethod`.
|
|
2725
|
+
|
|
2726
|
+
@summary Registers a callback run when the store's key cache is torn down, for resetting any custom
|
|
2727
|
+
key-generation state.
|
|
2728
|
+
@public
|
|
2729
|
+
*/
|
|
2730
|
+
declare function setIdentifierResetMethod(method: ResetMethod | null): void;
|
|
2731
|
+
/**
|
|
2732
|
+
Configure a callback for when the identifier cache is generating a new
|
|
2733
|
+
ResourceKey for a resource.
|
|
2734
|
+
|
|
2735
|
+
This method controls the `type` and `id` that will be assigned to the
|
|
2736
|
+
`ResourceKey` that is created.
|
|
2737
|
+
|
|
2738
|
+
This configuration MUST occur prior to the store instance being created.
|
|
2739
|
+
|
|
2740
|
+
```js
|
|
2741
|
+
import { setKeyInfoForResource } from '@warp-drive-mirror/core';
|
|
2742
|
+
```
|
|
2743
|
+
|
|
2744
|
+
@summary Overrides how the store derives the `type` and `id` of a new `ResourceKey` from resource data;
|
|
2745
|
+
must be set before the store is created.
|
|
2746
|
+
@public
|
|
2747
|
+
*/
|
|
2748
|
+
declare function setKeyInfoForResource(method: KeyInfoMethod | null): void;
|
|
2749
|
+
/**
|
|
2750
|
+
* Each instance of {@link Store} receives a unique instance of a CacheKeyManager.
|
|
2751
|
+
*
|
|
2752
|
+
* This cache is responsible for assigning or retrieving the unique identify
|
|
2753
|
+
* for arbitrary resource data encountered by the store. Data representing
|
|
2754
|
+
* a unique resource or record should always be represented by the same
|
|
2755
|
+
* identifier.
|
|
2756
|
+
*
|
|
2757
|
+
* It can be configured by consuming applications.
|
|
2758
|
+
*
|
|
2759
|
+
* @hideconstructor
|
|
2760
|
+
* @public
|
|
2761
|
+
*/
|
|
2762
|
+
declare class CacheKeyManager {
|
|
2763
|
+
constructor();
|
|
2582
2764
|
/**
|
|
2583
|
-
*
|
|
2765
|
+
* allows us to peek without generating when needed
|
|
2766
|
+
* useful for the "create" case when we need to see if
|
|
2767
|
+
* we are accidentally overwritting something
|
|
2584
2768
|
*
|
|
2585
|
-
* @
|
|
2769
|
+
* @private
|
|
2586
2770
|
*/
|
|
2587
|
-
|
|
2771
|
+
peekResourceKey(resource: ResourceIdentifierObject): ResourceKey | undefined;
|
|
2588
2772
|
/**
|
|
2589
|
-
*
|
|
2590
|
-
*
|
|
2591
|
-
* This can be useful for either pre-loading schema information
|
|
2592
|
-
* or for registering schema information delivered by API calls
|
|
2593
|
-
* or other sources just-in-time.
|
|
2773
|
+
* Peeks the {@link RequestKey} for the given {@link RequestInfo}, but will not
|
|
2774
|
+
* create one if none has been previously generated.
|
|
2594
2775
|
*
|
|
2595
2776
|
* @public
|
|
2596
2777
|
*/
|
|
2597
|
-
|
|
2778
|
+
peekRequestKey(request: RequestInfo): RequestKey | null;
|
|
2598
2779
|
/**
|
|
2599
|
-
*
|
|
2600
|
-
*
|
|
2601
|
-
*
|
|
2780
|
+
* Returns the {@link RequestKey} for the given {@link RequestInfo} if the request is
|
|
2781
|
+
* considered cacheable. For cacheable requests, this method will create
|
|
2782
|
+
* a RequestKey if none is found.
|
|
2602
2783
|
*
|
|
2603
|
-
*
|
|
2604
|
-
*
|
|
2605
|
-
* or other sources just-in-time.
|
|
2784
|
+
* A `null` response indicates the request cannot/will not be cached,
|
|
2785
|
+
* generally this means either
|
|
2606
2786
|
*
|
|
2607
|
-
* @
|
|
2608
|
-
|
|
2609
|
-
registerResource(schema: Schema): void;
|
|
2610
|
-
/**
|
|
2611
|
-
* Enables registration of a transformation.
|
|
2787
|
+
* - {@link RequestInfo.cacheOptions.key} is not present on the `RequestInfo`
|
|
2788
|
+
* - the request's method is `GET` but it has no `url`
|
|
2612
2789
|
*
|
|
2613
|
-
*
|
|
2614
|
-
*
|
|
2790
|
+
* Generally you should not seek to cache requests that are not idempotent
|
|
2791
|
+
* or have side effects, such as mutations that create, update or delete
|
|
2792
|
+
* a resource.
|
|
2615
2793
|
*
|
|
2616
2794
|
* @public
|
|
2617
2795
|
*/
|
|
2618
|
-
|
|
2796
|
+
getOrCreateDocumentIdentifier(request: RequestInfo): RequestKey | null;
|
|
2619
2797
|
/**
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2798
|
+
Returns the {@link ResourceKey} for the given Resource, creates one if it does not yet exist.
|
|
2799
|
+
|
|
2800
|
+
Specifically this means that we:
|
|
2801
|
+
|
|
2802
|
+
- validate the `id` `type` and `lid` combo against known identifiers
|
|
2803
|
+
- return an object with an `lid` that is stable (repeated calls with the same
|
|
2804
|
+
`id` + `type` or `lid` will return the same `lid` value)
|
|
2805
|
+
- this referential stability of the object itself is guaranteed
|
|
2806
|
+
|
|
2807
|
+
@public
|
|
2808
|
+
*/
|
|
2809
|
+
getOrCreateRecordIdentifier<T>(resource: T): NarrowIdentifierIfPossible<T>;
|
|
2628
2810
|
/**
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2811
|
+
Returns a new Identifier for the supplied data. Call this method to generate
|
|
2812
|
+
an identifier when a new resource is being created local to the client and
|
|
2813
|
+
potentially does not have an `id`.
|
|
2814
|
+
|
|
2815
|
+
Delegates generation to the user supplied `GenerateMethod` if one has been provided
|
|
2816
|
+
with the signature `generateMethod({ type }, 'record')`.
|
|
2817
|
+
|
|
2818
|
+
@public
|
|
2819
|
+
*/
|
|
2820
|
+
createIdentifierForNewRecord(data: {
|
|
2821
|
+
type: string;
|
|
2822
|
+
id?: string | null;
|
|
2823
|
+
lid?: string;
|
|
2824
|
+
}): ResourceKey;
|
|
2637
2825
|
/**
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
* If a cycle exists such that trait A has trait B which has Trait A, trait A will
|
|
2657
|
-
* be applied *after* trait B in production. In development a cycle error will be thrown.
|
|
2658
|
-
*
|
|
2659
|
-
* Fields are finalized on a "last wins principle". Thus traits appearing higher in
|
|
2660
|
-
* the tree and further to the right of a traits array take precedence, with the
|
|
2661
|
-
* resource's fields always being applied last and winning out.
|
|
2662
|
-
*
|
|
2663
|
-
* @public
|
|
2664
|
-
*/
|
|
2665
|
-
registerTrait?(trait: Trait): void;
|
|
2826
|
+
Provides the opportunity to update secondary lookup tables for existing identifiers
|
|
2827
|
+
Called after an identifier created with `createIdentifierForNewRecord` has been
|
|
2828
|
+
committed.
|
|
2829
|
+
|
|
2830
|
+
Assigned `id` to an `Identifier` if `id` has not previously existed; however,
|
|
2831
|
+
attempting to change the `id` or calling update without providing an `id` when
|
|
2832
|
+
one is missing will throw an error.
|
|
2833
|
+
|
|
2834
|
+
- sets `id` (if `id` was previously `null`)
|
|
2835
|
+
- `lid` and `type` MUST NOT be altered post creation
|
|
2836
|
+
|
|
2837
|
+
If a merge occurs, it is possible the returned identifier does not match the originally
|
|
2838
|
+
provided identifier. In this case the abandoned identifier will go through the usual
|
|
2839
|
+
`forgetRecordIdentifier` codepaths.
|
|
2840
|
+
|
|
2841
|
+
@public
|
|
2842
|
+
*/
|
|
2843
|
+
updateRecordIdentifier(identifierObject: ResourceKey, data: unknown): ResourceKey;
|
|
2666
2844
|
/**
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2845
|
+
Provides the opportunity to eliminate an identifier from secondary lookup tables
|
|
2846
|
+
as well as eliminates it from ember-data's own lookup tables and book keeping.
|
|
2847
|
+
|
|
2848
|
+
Useful when a record has been deleted and the deletion has been persisted and
|
|
2849
|
+
we do not care about the record anymore. Especially useful when an `id` of a
|
|
2850
|
+
deleted record might be reused later for a new record.
|
|
2851
|
+
|
|
2852
|
+
@public
|
|
2853
|
+
*/
|
|
2854
|
+
forgetRecordIdentifier(identifierObject: ResourceKey): void;
|
|
2855
|
+
}
|
|
2856
|
+
/**
|
|
2857
|
+
* This type exists for internal use only for
|
|
2858
|
+
* where intimate contracts still exist either for
|
|
2859
|
+
* the Test Suite or for Legacy code.
|
|
2860
|
+
*
|
|
2861
|
+
* @private
|
|
2862
|
+
*/
|
|
2863
|
+
interface PrivateCacheKeyManager extends CacheKeyManager {
|
|
2864
|
+
_cache: StableCache;
|
|
2865
|
+
/**
|
|
2866
|
+
* Internal hook to allow management of merge conflicts with identifiers.
|
|
2682
2867
|
*
|
|
2683
|
-
*
|
|
2684
|
-
*
|
|
2868
|
+
* we allow late binding of this private internal merge so that
|
|
2869
|
+
* the cache can insert itself here to handle elimination of duplicates
|
|
2870
|
+
*/
|
|
2871
|
+
__configureMerge(method: MergeMethod | null): void;
|
|
2872
|
+
_mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: ResourceKey, existingIdentifier: ResourceKey, data: unknown): ResourceKey;
|
|
2873
|
+
destroy(): void;
|
|
2874
|
+
}
|
|
2875
|
+
type UnsubscribeToken$1 = object;
|
|
2876
|
+
/**
|
|
2877
|
+
* The kinds of change notifications the {@link NotificationManager} can emit for a resource.
|
|
2878
|
+
*
|
|
2879
|
+
* @summary The lifecycle notification kinds sent to resource subscribers: `added`, `removed`, `updated`,
|
|
2880
|
+
* or `state`.
|
|
2881
|
+
*/
|
|
2882
|
+
type CacheOperation$1 = "added" | "removed" | "updated" | "state";
|
|
2883
|
+
/**
|
|
2884
|
+
* The kinds of change notifications the {@link NotificationManager} can emit for a request document.
|
|
2885
|
+
*
|
|
2886
|
+
* @summary The notification kinds sent to request document subscribers, such as `updated` or
|
|
2887
|
+
* `invalidated`.
|
|
2888
|
+
*/
|
|
2889
|
+
type DocumentCacheOperation$1 = "invalidated" | "added" | "removed" | "updated" | "state";
|
|
2890
|
+
/**
|
|
2891
|
+
* The full set of notification kinds the {@link NotificationManager} can emit for a resource,
|
|
2892
|
+
* including both {@link CacheOperation}s and finer-grained field-level change notifications.
|
|
2893
|
+
*
|
|
2894
|
+
* @summary Every notification kind a resource subscriber can receive, from lifecycle operations to
|
|
2895
|
+
* `attributes`, `relationships`, `errors`, `meta`, and `identity` changes.
|
|
2896
|
+
*/
|
|
2897
|
+
type NotificationType = "attributes" | "relationships" | "identity" | "errors" | "meta" | CacheOperation$1;
|
|
2898
|
+
/**
|
|
2899
|
+
* The shape accepted by {@link NotificationManager.notify} and
|
|
2900
|
+
* {@link CacheCapabilitiesManager.notifyChange} for delivering many keys for
|
|
2901
|
+
* the `'attributes'` or `'relationships'` namespaces in a single call
|
|
2902
|
+
* instead of once per key.
|
|
2903
|
+
*
|
|
2904
|
+
* @summary A set of field names passed to `notify` or `notifyChange` to report many `attributes` or
|
|
2905
|
+
* `relationships` changes in one call.
|
|
2906
|
+
* @since 5.9.0
|
|
2907
|
+
* @public
|
|
2908
|
+
*/
|
|
2909
|
+
type NotifyKeys = Set<string>;
|
|
2910
|
+
/**
|
|
2911
|
+
* A change to a resource's `attributes` or `relationships` can be relevant to
|
|
2912
|
+
* a "local" view of the resource (its mutable/editable state), a "remote" view
|
|
2913
|
+
* (its last-known-persisted state), or both.
|
|
2914
|
+
*
|
|
2915
|
+
* Each view subscribes to its own channel and, when notified, re-pulls its own
|
|
2916
|
+
* projection of the data: a remote-only reader (e.g. PolarisMode's default
|
|
2917
|
+
* immutable record) subscribes `'remote'` and re-reads remote state; an
|
|
2918
|
+
* editable/reconciled reader (a legacy record, or an editable checkout)
|
|
2919
|
+
* subscribes `'local'` (the same as omitting the channel) and re-reads local
|
|
2920
|
+
* state. A notifier that knows which projection changed tags the notification
|
|
2921
|
+
* with that channel; each tag is delivered only to that channel's subscribers.
|
|
2922
|
+
* A change affecting both projections is either notified unscoped or once per
|
|
2923
|
+
* channel. An unscoped notify cannot guarantee which view changed, so it
|
|
2924
|
+
* reaches every subscriber -- this keeps every pre-channel `notify` callsite
|
|
2925
|
+
* (and any custom cache that doesn't know about channels) fully compatible.
|
|
2926
|
+
*
|
|
2927
|
+
* The full delivery matrix:
|
|
2928
|
+
*
|
|
2929
|
+
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
2930
|
+
* | -------------------- | --------- | ---------- | --------------------- |
|
|
2931
|
+
* | `'local'` | ✅ | ❌ | ✅ |
|
|
2932
|
+
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
2933
|
+
* | omitted | ✅ | ✅ | ✅ |
|
|
2934
|
+
*
|
|
2935
|
+
* Channel only applies to the `'attributes'` and `'relationships'`
|
|
2936
|
+
* notification types. All other types (`'errors'`,
|
|
2937
|
+
* `'identity'`, `'state'`, and the various `CacheOperation`/
|
|
2938
|
+
* `DocumentCacheOperation` values) are never filtered by channel since they
|
|
2939
|
+
* have no local/remote duality.
|
|
2940
|
+
*
|
|
2941
|
+
* @summary Scopes an `attributes` or `relationships` notification to a resource's local (editable) or
|
|
2942
|
+
* remote (persisted) view so only matching subscribers hear it.
|
|
2943
|
+
* @public
|
|
2944
|
+
*/
|
|
2945
|
+
type NotificationChannel = "local" | "remote";
|
|
2946
|
+
interface NotificationCallback$1 {
|
|
2947
|
+
(cacheKey: ResourceKey, notificationType: "attributes" | "relationships", key?: string): void;
|
|
2948
|
+
(cacheKey: ResourceKey, notificationType: "errors" | "meta" | "identity" | "state"): void;
|
|
2949
|
+
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
2950
|
+
}
|
|
2951
|
+
interface ResourceOperationCallback$1 {
|
|
2952
|
+
(cacheKey: ResourceKey, notificationType: CacheOperation$1): void;
|
|
2953
|
+
}
|
|
2954
|
+
interface DocumentOperationCallback$1 {
|
|
2955
|
+
(cacheKey: RequestKey, notificationType: DocumentCacheOperation$1): void;
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* The NotificationManager provides the ability to subscribe to
|
|
2959
|
+
* changes to Cache state.
|
|
2960
|
+
*
|
|
2961
|
+
* This Feature is what allows WarpDrive to create subscriptions that
|
|
2962
|
+
* work with any framework or change-notification system.
|
|
2963
|
+
*
|
|
2964
|
+
* @summary The store service that lets code subscribe to and batch-deliver change notifications for
|
|
2965
|
+
* cached resources and request documents.
|
|
2966
|
+
* @hideconstructor
|
|
2967
|
+
* @public
|
|
2968
|
+
*/
|
|
2969
|
+
declare class NotificationManager$1 {
|
|
2970
|
+
constructor(store: Store$1);
|
|
2971
|
+
/**
|
|
2972
|
+
* Subscribe to changes for a given ResourceKey, RequestKey, or addition/removal of any resource
|
|
2973
|
+
* or document.
|
|
2685
2974
|
*
|
|
2686
2975
|
* ```ts
|
|
2687
|
-
*
|
|
2688
|
-
* @attr('string', { defaultValue: 'hello' }) greeting;
|
|
2689
|
-
* @attr('date') birthday;
|
|
2690
|
-
* @attr firstName;
|
|
2691
|
-
* }
|
|
2692
|
-
* ```
|
|
2693
|
-
*
|
|
2694
|
-
* Would be returned as:
|
|
2976
|
+
* export type CacheOperation = 'added' | 'removed' | 'updated' | 'state';
|
|
2695
2977
|
*
|
|
2696
|
-
*
|
|
2697
|
-
*
|
|
2698
|
-
*
|
|
2699
|
-
*
|
|
2700
|
-
* firstName: { name: 'firstName' }
|
|
2978
|
+
* export interface NotificationCallback {
|
|
2979
|
+
* (cacheKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;
|
|
2980
|
+
* (cacheKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
|
|
2981
|
+
* (cacheKey: ResourceKey, notificationType: NotificationType, key?: string): void;
|
|
2701
2982
|
* }
|
|
2702
|
-
*
|
|
2703
|
-
*
|
|
2704
|
-
*
|
|
2705
|
-
* @deprecated - use {@link SchemaService.fields | fields}
|
|
2706
|
-
*/
|
|
2707
|
-
attributesDefinitionFor?(key: ResourceKey | ObjectWithStringTypeProperty): AttributesSchema;
|
|
2708
|
-
/**
|
|
2709
|
-
* DEPRECATED - use `fields` instead
|
|
2710
|
-
*
|
|
2711
|
-
* Returns definitions for all properties of the specified resource
|
|
2712
|
-
* that are considered "relationships". Generally these are properties
|
|
2713
|
-
* that represent a linkage to another resource.
|
|
2714
|
-
*
|
|
2715
|
-
* The return value should be a dictionary of key:value pairs
|
|
2716
|
-
* where the `key` is the relationship or property's name and `value`
|
|
2717
|
-
* is an object with at least the following properties:
|
|
2718
|
-
*
|
|
2719
|
-
* - `name` which should also match the `key` used in the dictionary.
|
|
2720
|
-
* - `kind` which should be either `belongsTo` or `hasMany`
|
|
2721
|
-
* - `type` which should be the related resource's string "type"
|
|
2722
|
-
* - `options` which should be a dictionary allowing any key but with
|
|
2723
|
-
* at least the below keys present.
|
|
2724
|
-
*
|
|
2725
|
-
* - `options.async` a boolean representing whether data for this relationship is
|
|
2726
|
-
* typically loaded on-demand.
|
|
2727
|
-
* - `options.inverse` a string or null representing the field name / key of the
|
|
2728
|
-
* corresponding relationship on the inverse resource.
|
|
2729
|
-
*
|
|
2730
|
-
* Additionally the following options properties are optional. See [Polymorphic Relationships](https://rfcs.emberjs.com/id/0793-polymporphic-relations-without-inheritance)
|
|
2731
|
-
*
|
|
2732
|
-
* - `options.polymorphic` a boolean representing whether multiple resource types
|
|
2733
|
-
* can be used to satisfy this relationship.
|
|
2734
|
-
* - `options.as` a string representing the abstract type that the concrete side of
|
|
2735
|
-
* a relationship must specify when fulfilling a polymorphic inverse.
|
|
2736
|
-
*
|
|
2737
|
-
* For example, the following Model using @warp-drive-mirror/legacy/model would generate this relationships
|
|
2738
|
-
* definition by default:
|
|
2739
|
-
*
|
|
2740
|
-
* ```js
|
|
2741
|
-
* class User extends Model {
|
|
2742
|
-
* @belongsTo('user', { async: false, inverse: null }) bestFriend;
|
|
2743
|
-
* @hasMany('user', { async: true, inverse: 'friends' }) friends;
|
|
2744
|
-
* @hasMany('pet', { async: false, polymorphic: true, inverse: 'owner' }) pets;
|
|
2983
|
+
* export interface ResourceOperationCallback {
|
|
2984
|
+
* // resource updates
|
|
2985
|
+
* (cacheKey: ResourceKey, notificationType: CacheOperation): void;
|
|
2745
2986
|
* }
|
|
2746
|
-
*
|
|
2747
|
-
*
|
|
2748
|
-
*
|
|
2749
|
-
*
|
|
2750
|
-
* ```js
|
|
2751
|
-
* {
|
|
2752
|
-
* bestFriend: {
|
|
2753
|
-
* name: 'bestFriend',
|
|
2754
|
-
* kind: 'belongsTo',
|
|
2755
|
-
* type: 'user',
|
|
2756
|
-
* options: {
|
|
2757
|
-
* async: false,
|
|
2758
|
-
* inverse: null
|
|
2759
|
-
* }
|
|
2760
|
-
* },
|
|
2761
|
-
* friends: {
|
|
2762
|
-
* name: 'friends',
|
|
2763
|
-
* kind: 'hasMany',
|
|
2764
|
-
* type: 'user',
|
|
2765
|
-
* options: {
|
|
2766
|
-
* async: true,
|
|
2767
|
-
* inverse: 'friends'
|
|
2768
|
-
* }
|
|
2769
|
-
* },
|
|
2770
|
-
* pets: {
|
|
2771
|
-
* name: 'pets',
|
|
2772
|
-
* kind: 'hasMany',
|
|
2773
|
-
* type: 'pet',
|
|
2774
|
-
* options: {
|
|
2775
|
-
* async: false,
|
|
2776
|
-
* polymorphic: true,
|
|
2777
|
-
* inverse: 'owner'
|
|
2778
|
-
* }
|
|
2779
|
-
* },
|
|
2987
|
+
* export interface DocumentOperationCallback {
|
|
2988
|
+
* // document updates
|
|
2989
|
+
* (cacheKey: RequestKey, notificationType: CacheOperation): void;
|
|
2780
2990
|
* }
|
|
2781
2991
|
* ```
|
|
2782
2992
|
*
|
|
2783
|
-
*
|
|
2784
|
-
*
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
*
|
|
2789
|
-
*
|
|
2790
|
-
* @public
|
|
2791
|
-
*/
|
|
2792
|
-
resourceTypes(): Readonly<string[]>;
|
|
2793
|
-
/**
|
|
2794
|
-
* Register an extension for either objects or arrays
|
|
2993
|
+
* A `channel` may be provided when subscribing to a `ResourceKey`. Its
|
|
2994
|
+
* effect is that the subscription skips `'attributes'`/`'relationships'`
|
|
2995
|
+
* notifications explicitly tagged with the *other* channel; unscoped
|
|
2996
|
+
* notifications, and notifications for all other notification types, always
|
|
2997
|
+
* reach the subscriber. Subscribing `'local'` and omitting the channel are
|
|
2998
|
+
* the same thing. See {@link NotificationChannel}.
|
|
2795
2999
|
*
|
|
2796
|
-
*
|
|
3000
|
+
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
3001
|
+
* | -------------------- | --------- | ---------- | --------------------- |
|
|
3002
|
+
* | `'local'` | ✅ | ❌ | ✅ |
|
|
3003
|
+
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
3004
|
+
* | omitted | ✅ | ✅ | ✅ |
|
|
2797
3005
|
*
|
|
2798
3006
|
* @public
|
|
3007
|
+
* @return an opaque token to be used with unsubscribe
|
|
2799
3008
|
*/
|
|
2800
|
-
|
|
3009
|
+
subscribe(cacheKey: ResourceKey, callback: NotificationCallback$1, channel?: NotificationChannel): UnsubscribeToken$1;
|
|
3010
|
+
subscribe(cacheKey: "resource", callback: ResourceOperationCallback$1): UnsubscribeToken$1;
|
|
3011
|
+
subscribe(cacheKey: "document" | RequestKey, callback: DocumentOperationCallback$1): UnsubscribeToken$1;
|
|
2801
3012
|
/**
|
|
2802
|
-
*
|
|
3013
|
+
* remove a previous subscription
|
|
2803
3014
|
*
|
|
2804
3015
|
* @public
|
|
2805
3016
|
*/
|
|
2806
|
-
|
|
2807
|
-
type: string;
|
|
2808
|
-
}): null | ProcessedExtension["features"];
|
|
3017
|
+
unsubscribe(token: UnsubscribeToken$1): void;
|
|
2809
3018
|
/**
|
|
2810
|
-
*
|
|
3019
|
+
* Custom Caches and Application Code should not call this method directly.
|
|
2811
3020
|
*
|
|
2812
|
-
*
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
*
|
|
3021
|
+
* When notifying `'attributes'` or `'relationships'` for many keys on the
|
|
3022
|
+
* same `cacheKey` at once (for instance, when a bulk update to a single
|
|
3023
|
+
* record touches many fields) `key` may be supplied as a `Set<string>`
|
|
3024
|
+
* instead of being called once per key. The `Set` is iterated as-is (it is
|
|
3025
|
+
* never converted to or from an array internally). This delivers the
|
|
3026
|
+
* exact same sequence of individual notifications to subscribers (each
|
|
3027
|
+
* subscriber callback is still invoked once per key, in order) while
|
|
3028
|
+
* paying the per-call overhead (validity checks, subscriber lookups,
|
|
3029
|
+
* buffer/flush scheduling) only once for the whole batch instead of once
|
|
3030
|
+
* per key.
|
|
2817
3031
|
*
|
|
2818
|
-
*
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
*
|
|
3032
|
+
* A `channel` may be supplied for the `'attributes'`/`'relationships'`
|
|
3033
|
+
* namespaces. Tagging a notification `'local'` declares "only the local
|
|
3034
|
+
* (reconciled/editable) view changed"; tagging it `'remote'` declares "only
|
|
3035
|
+
* the remote view changed". Each tag is delivered only to that channel's
|
|
3036
|
+
* subscribers. Omitting the channel reaches every subscriber regardless of
|
|
3037
|
+
* its channel. See {@link NotificationChannel}.
|
|
2823
3038
|
*
|
|
2824
|
-
*
|
|
3039
|
+
* | notify ↓ subscribe → | `'local'` | `'remote'` | omitted (= `'local'`) |
|
|
3040
|
+
* | -------------------- | --------- | ---------- | --------------------- |
|
|
3041
|
+
* | `'local'` | ✅ | ❌ | ✅ |
|
|
3042
|
+
* | `'remote'` | ❌ | ✅ | ❌ |
|
|
3043
|
+
* | omitted | ✅ | ✅ | ✅ |
|
|
3044
|
+
*
|
|
3045
|
+
* @private
|
|
2825
3046
|
*/
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
3047
|
+
notify(cacheKey: ResourceKey, value: "attributes" | "relationships", key?: string | NotifyKeys | null, channel?: NotificationChannel): boolean;
|
|
3048
|
+
notify(cacheKey: ResourceKey, value: "errors" | "meta" | "identity" | "state", key?: null): boolean;
|
|
3049
|
+
notify(cacheKey: ResourceKey, value: CacheOperation$1, key?: null): boolean;
|
|
3050
|
+
notify(cacheKey: RequestKey, value: DocumentCacheOperation$1, key?: null): boolean;
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* This type exists for internal use only for
|
|
3054
|
+
* where intimate contracts still exist either for
|
|
3055
|
+
* the Test Suite or for Legacy code.
|
|
3056
|
+
*
|
|
3057
|
+
* @private
|
|
3058
|
+
*/
|
|
3059
|
+
interface PrivateNotificationManager extends NotificationManager$1 {
|
|
3060
|
+
_flush(): void;
|
|
2830
3061
|
}
|
|
2831
|
-
//#endregion
|
|
2832
|
-
//#region src/store/-types/q/cache-capabilities-manager.d.ts
|
|
2833
3062
|
/**
|
|
2834
3063
|
* CacheCapabilitiesManager provides encapsulated API access to the minimal
|
|
2835
3064
|
* subset of the Store's functionality that Cache implementations
|
|
@@ -2839,6 +3068,8 @@ interface SchemaService {
|
|
|
2839
3068
|
*
|
|
2840
3069
|
* This class cannot be directly instantiated.
|
|
2841
3070
|
*
|
|
3071
|
+
* @summary The narrow slice of Store API handed to a Cache via `createCache`, for key lookup, schema access, record
|
|
3072
|
+
* id updates, and change notifications.
|
|
2842
3073
|
* @public
|
|
2843
3074
|
*/
|
|
2844
3075
|
type CacheCapabilitiesManager$1 = {
|
|
@@ -2970,8 +3201,6 @@ type CacheCapabilitiesManager$1 = {
|
|
|
2970
3201
|
*/
|
|
2971
3202
|
notifyChange(identifier: ResourceKey | RequestKey, namespace: NotificationType | "added" | "removed" | "updated", key: string | NotifyKeys | null, channel?: NotificationChannel): void;
|
|
2972
3203
|
};
|
|
2973
|
-
//#endregion
|
|
2974
|
-
//#region src/store/-types/q/record-instance.d.ts
|
|
2975
3204
|
/**
|
|
2976
3205
|
In WarpDrive, a "record instance" is a class instance used to present the data
|
|
2977
3206
|
for a single resource, transforming the resource's cached raw data into a form
|
|
@@ -2994,18 +3223,20 @@ based on a special symbol prsent on record instances that implement the
|
|
|
2994
3223
|
|
|
2995
3224
|
*/
|
|
2996
3225
|
type OpaqueRecordInstance = unknown;
|
|
2997
|
-
//#endregion
|
|
2998
|
-
//#region src/types/cache.d.ts
|
|
2999
3226
|
/**
|
|
3000
3227
|
* A hash of changed attributes with the key being the attribute name and the value being an
|
|
3001
3228
|
* array of `[oldValue, newValue]`.
|
|
3002
3229
|
*
|
|
3230
|
+
* @summary Map of attribute name to `[oldValue, newValue]` for a resource's uncommitted attribute changes, as
|
|
3231
|
+
* returned by `cache.changedAttrs`.
|
|
3003
3232
|
*/
|
|
3004
3233
|
type ChangedAttributesHash = Record<string, [Value | undefined, Value]>;
|
|
3005
3234
|
/**
|
|
3006
3235
|
* Describes the local (uncommitted) changes to a single relationship,
|
|
3007
3236
|
* as returned by {@link Cache.changedRelationships}.
|
|
3008
3237
|
*
|
|
3238
|
+
* @summary Remote versus local state of one relationship, with additions, removals, and reordering for to-many,
|
|
3239
|
+
* as returned by `cache.changedRelationships`.
|
|
3009
3240
|
* @example
|
|
3010
3241
|
* ```ts
|
|
3011
3242
|
* const diff: RelationshipDiff = {
|
|
@@ -3063,6 +3294,11 @@ type RelationshipDiff = {
|
|
|
3063
3294
|
* A Cache handles in-memory storage of Document and Resource
|
|
3064
3295
|
* data.
|
|
3065
3296
|
*
|
|
3297
|
+
* The [Caching](/guides/the-manual/caching/#how-the-cache-works) guide explains how
|
|
3298
|
+
* the cache stores that data.
|
|
3299
|
+
*
|
|
3300
|
+
* @summary Contract a Cache implementation fulfills to store, patch, mutate, and read document and resource data
|
|
3301
|
+
* for the Store, including local changes, errors, and SSR hydration.
|
|
3066
3302
|
* @public
|
|
3067
3303
|
*/
|
|
3068
3304
|
interface Cache {
|
|
@@ -3203,7 +3439,11 @@ interface Cache {
|
|
|
3203
3439
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
3204
3440
|
*
|
|
3205
3441
|
* @public
|
|
3206
|
-
* @return
|
|
3442
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
3443
|
+
* this push changed, or `undefined` when none did. A key counts as changed when the
|
|
3444
|
+
* value the cache holds for it moved, whether or not a local edit already held the new
|
|
3445
|
+
* value; a value the schema considers equal (for instance, a schema-object with a
|
|
3446
|
+
* matching identity hash) does not count. Otherwise `void`.
|
|
3207
3447
|
*/
|
|
3208
3448
|
upsert(cacheKey: ResourceKey, data: ResourceBlob, hasRecord: boolean): void | string[];
|
|
3209
3449
|
/**
|
|
@@ -3284,7 +3524,7 @@ interface Cache {
|
|
|
3284
3524
|
* @param cacheKey - the primary ResourceKey that was operated on
|
|
3285
3525
|
* @param result - a document in the cache format containing any updated data
|
|
3286
3526
|
*/
|
|
3287
|
-
didCommit(cacheKey: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument
|
|
3527
|
+
didCommit(cacheKey: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
3288
3528
|
/**
|
|
3289
3529
|
* [LIFECYCLE] Signals to the cache that a set of resources
|
|
3290
3530
|
* was successfully updated as part of a save transaction that
|
|
@@ -3294,7 +3534,7 @@ interface Cache {
|
|
|
3294
3534
|
* @param cacheKey - the primary ResourceKeys that were operated on
|
|
3295
3535
|
* @param result - a document in the cache format containing any updated data
|
|
3296
3536
|
*/
|
|
3297
|
-
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument
|
|
3537
|
+
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
3298
3538
|
/**
|
|
3299
3539
|
* [LIFECYCLE] Signals to the cache that a set of resources
|
|
3300
3540
|
* was successfully updated as part of a save transaction that
|
|
@@ -3304,7 +3544,7 @@ interface Cache {
|
|
|
3304
3544
|
* @param cacheKey - the primary ResourceKeys that were operated on
|
|
3305
3545
|
* @param result - a document in the cache format containing any updated data
|
|
3306
3546
|
*/
|
|
3307
|
-
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument
|
|
3547
|
+
didCommit(cacheKey: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument<ExistingResourceObject>> | null): CollectionResourceDataDocument;
|
|
3308
3548
|
/**
|
|
3309
3549
|
* [LIFECYCLE] Signals to the cache that a resource
|
|
3310
3550
|
* was update via a save transaction failed.
|
|
@@ -3450,8 +3690,6 @@ interface Cache {
|
|
|
3450
3690
|
*/
|
|
3451
3691
|
isDeletionCommitted(cacheKey: ResourceKey): boolean;
|
|
3452
3692
|
}
|
|
3453
|
-
//#endregion
|
|
3454
|
-
//#region src/graph/-private/-edge-definition.d.ts
|
|
3455
3693
|
type EdgeCache = Record<string, Record<string, EdgeDefinition | null>>;
|
|
3456
3694
|
type RelationshipField = LegacyBelongsToField | LegacyHasManyField | ResourceField | CollectionField;
|
|
3457
3695
|
type RelationshipFieldKind = RelationshipField["kind"];
|
|
@@ -3589,8 +3827,6 @@ interface EdgeDefinition {
|
|
|
3589
3827
|
*/
|
|
3590
3828
|
isReflexive: boolean;
|
|
3591
3829
|
}
|
|
3592
|
-
//#endregion
|
|
3593
|
-
//#region src/graph/-private/-state.d.ts
|
|
3594
3830
|
interface RelationshipState {
|
|
3595
3831
|
hasReceivedData: boolean;
|
|
3596
3832
|
hasReceivedRemoteData: boolean;
|
|
@@ -3600,8 +3836,6 @@ interface RelationshipState {
|
|
|
3600
3836
|
shouldForceReload: boolean;
|
|
3601
3837
|
hasDematerializedInverse: boolean;
|
|
3602
3838
|
}
|
|
3603
|
-
//#endregion
|
|
3604
|
-
//#region src/graph/-private/edges/collection.d.ts
|
|
3605
3839
|
/**
|
|
3606
3840
|
* Stores the graph's internal state for one side of a collection (`hasMany`) relationship.
|
|
3607
3841
|
*/
|
|
@@ -3655,8 +3889,6 @@ interface CollectionEdge {
|
|
|
3655
3889
|
del: Set<ResourceKey>;
|
|
3656
3890
|
};
|
|
3657
3891
|
}
|
|
3658
|
-
//#endregion
|
|
3659
|
-
//#region src/graph/-private/edges/implicit.d.ts
|
|
3660
3892
|
/**
|
|
3661
3893
|
* The relationship definition (schema metadata) backing an {@link ImplicitEdge}, tagging
|
|
3662
3894
|
* the {@link UpgradedMeta} as belonging to an implicit inverse relationship.
|
|
@@ -3707,8 +3939,6 @@ interface ImplicitEdge {
|
|
|
3707
3939
|
/** Members known to be part of the relationship from remote (server-provided) state. */
|
|
3708
3940
|
remoteMembers: Set<ResourceKey>;
|
|
3709
3941
|
}
|
|
3710
|
-
//#endregion
|
|
3711
|
-
//#region src/graph/-private/edges/resource.d.ts
|
|
3712
3942
|
/**
|
|
3713
3943
|
* Stores the data for one side of a "single" resource relationship.
|
|
3714
3944
|
*
|
|
@@ -3725,8 +3955,6 @@ interface ResourceEdge {
|
|
|
3725
3955
|
transactionRef: number;
|
|
3726
3956
|
accessed: boolean;
|
|
3727
3957
|
}
|
|
3728
|
-
//#endregion
|
|
3729
|
-
//#region src/graph/-private/graph.d.ts
|
|
3730
3958
|
/**
|
|
3731
3959
|
* A single edge (relationship field) tracked by the {@link Graph} for a resource. Which kind of edge
|
|
3732
3960
|
* a field is depends on its relationship definition:
|
|
@@ -3968,30 +4196,24 @@ declare class Graph {
|
|
|
3968
4196
|
*/
|
|
3969
4197
|
destroy(): void;
|
|
3970
4198
|
}
|
|
3971
|
-
//#endregion
|
|
3972
|
-
//#region src/graph/-private/-utils.d.ts
|
|
3973
4199
|
/** A type-guard returning whether the given edge is a `belongsTo` {@link ResourceEdge}. */
|
|
3974
4200
|
declare function isBelongsTo(relationship: GraphEdge): relationship is ResourceEdge;
|
|
3975
|
-
//#endregion
|
|
3976
|
-
//#region src/graph/-private.d.ts
|
|
3977
4201
|
/** Returns the {@link Graph} associated with the given store or capabilities manager, if one has been created. */
|
|
3978
4202
|
declare function peekGraph(store: CacheCapabilitiesManager$1 | Store$1): Graph | undefined;
|
|
3979
4203
|
/** The type of the {@link peekGraph} function. */
|
|
3980
4204
|
type peekGraph = typeof peekGraph;
|
|
3981
4205
|
/** Returns the {@link Graph} for the given store, creating (and caching) one first if it does not yet exist. */
|
|
3982
4206
|
declare function graphFor(store: CacheCapabilitiesManager$1 | Store$1): Graph;
|
|
3983
|
-
//#endregion
|
|
3984
|
-
//#region src/request/-private/future.d.ts
|
|
3985
4207
|
/**
|
|
3986
4208
|
* Create a {@link Deferred}: a promise along with the `resolve`/`reject`
|
|
3987
4209
|
* callbacks that settle it, so the promise can be handed out before the
|
|
3988
4210
|
* work that will settle it has started.
|
|
3989
4211
|
*
|
|
4212
|
+
* @summary Creates a promise together with its `resolve` and `reject` callbacks so it can be handed out
|
|
4213
|
+
* before it is settled.
|
|
3990
4214
|
* @public
|
|
3991
4215
|
*/
|
|
3992
4216
|
declare function createDeferred<T>(): Deferred<T>;
|
|
3993
|
-
//#endregion
|
|
3994
|
-
//#region src/request/-private/promise-cache.d.ts
|
|
3995
4217
|
type CacheResult<T = unknown, E = unknown> = {
|
|
3996
4218
|
isError: true;
|
|
3997
4219
|
result: E;
|
|
@@ -4005,6 +4227,8 @@ type CacheResult<T = unknown, E = unknown> = {
|
|
|
4005
4227
|
* (and by `getPromiseState`). Anything that is at least `then`/`catch`/`finally`
|
|
4006
4228
|
* "shaped" (including a real `Promise` or {@link Future}) satisfies this.
|
|
4007
4229
|
*
|
|
4230
|
+
* @summary Any promise-like value with `then`, `catch`, and `finally`, as accepted by the promise-result
|
|
4231
|
+
* cache and `getPromiseState`.
|
|
4008
4232
|
* @public
|
|
4009
4233
|
*/
|
|
4010
4234
|
type Awaitable<T = unknown, E = unknown> = {
|
|
@@ -4032,6 +4256,8 @@ type Awaitable<T = unknown, E = unknown> = {
|
|
|
4032
4256
|
* outcome can be synchronously read later via {@link getPromiseResult},
|
|
4033
4257
|
* without needing to await it again.
|
|
4034
4258
|
*
|
|
4259
|
+
* @summary Records a promise's settled value or error so it can later be read synchronously with
|
|
4260
|
+
* `getPromiseResult`.
|
|
4035
4261
|
* @public
|
|
4036
4262
|
*/
|
|
4037
4263
|
declare function setPromiseResult(promise: Promise<unknown> | Awaitable, result: CacheResult): void;
|
|
@@ -4039,26 +4265,35 @@ declare function setPromiseResult(promise: Promise<unknown> | Awaitable, result:
|
|
|
4039
4265
|
* Synchronously read the settled result (or error) previously recorded for
|
|
4040
4266
|
* a promise-like value via {@link setPromiseResult}, if any.
|
|
4041
4267
|
*
|
|
4268
|
+
* @summary Synchronously returns the settled value or error previously recorded for a promise, or
|
|
4269
|
+
* `undefined` if none was recorded.
|
|
4042
4270
|
* @public
|
|
4043
4271
|
*/
|
|
4044
4272
|
declare function getPromiseResult<T, E>(promise: Promise<T> | Awaitable<T, E>): CacheResult<T, E> | undefined;
|
|
4045
|
-
//#endregion
|
|
4046
|
-
//#region src/request.d.ts
|
|
4047
4273
|
/**
|
|
4048
4274
|
* Brands the supplied object with the supplied response type.
|
|
4049
4275
|
*
|
|
4276
|
+
* Call it inside a [builder](/guides/the-manual/requests/builders), so the type is part of
|
|
4277
|
+
* the builder's contract and every caller gets it through inference. Calling it inline
|
|
4278
|
+
* where the request is made is a cast. The [Typing Requests](/guides/the-manual/requests/typing-requests)
|
|
4279
|
+
* guide shows how to use it.
|
|
4280
|
+
*
|
|
4050
4281
|
* ```ts
|
|
4051
4282
|
* import type { ReactiveDataDocument } from '@warp-drive-mirror/core/reactive';
|
|
4052
4283
|
* import { withResponseType } from '@warp-drive-mirror/core/request';
|
|
4053
4284
|
* import type { User } from '#/data/user.ts'
|
|
4054
4285
|
*
|
|
4055
|
-
*
|
|
4056
|
-
*
|
|
4057
|
-
*
|
|
4286
|
+
* export function getUser(id: string) {
|
|
4287
|
+
* return withResponseType<ReactiveDataDocument<User>>({ url: `/users/${id}` });
|
|
4288
|
+
* }
|
|
4289
|
+
*
|
|
4290
|
+
* const result = await store.request(getUser('1'));
|
|
4058
4291
|
*
|
|
4059
4292
|
* result.content.data; // will have type User
|
|
4060
4293
|
* ```
|
|
4061
4294
|
*
|
|
4295
|
+
* @summary Types a request object with the response type that `store.request` or `RequestManager.request`
|
|
4296
|
+
* should resolve with; no runtime effect.
|
|
4062
4297
|
*/
|
|
4063
4298
|
declare function withResponseType<T>(obj: RequestInfo): RequestInfo<T> & {
|
|
4064
4299
|
/** The branded response type. Present only at the type level; carries no runtime value. */
|
|
@@ -4069,13 +4304,20 @@ declare function withResponseType<T>(obj: RequestInfo): RequestInfo<T> & {
|
|
|
4069
4304
|
* wrapped in {@link ReactiveDataDocument}. This is a convenience for
|
|
4070
4305
|
* the common case of using {@link withResponseType} with `ReactiveDataDocument`.
|
|
4071
4306
|
*
|
|
4307
|
+
* Like `withResponseType`, call it inside a [builder](/guides/the-manual/requests/builders)
|
|
4308
|
+
* rather than where the request is made. The
|
|
4309
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests#typing-reactive-responses)
|
|
4310
|
+
* guide shows how to use it.
|
|
4311
|
+
*
|
|
4072
4312
|
* ```ts
|
|
4073
4313
|
* import { withReactiveResponse } from '@warp-drive-mirror/core/request';
|
|
4074
4314
|
* import type { User } from '#/data/user.ts'
|
|
4075
4315
|
*
|
|
4076
|
-
*
|
|
4077
|
-
* withReactiveResponse<User>({ url:
|
|
4078
|
-
*
|
|
4316
|
+
* export function getUser(id: string) {
|
|
4317
|
+
* return withReactiveResponse<User>({ url: `/users/${id}` });
|
|
4318
|
+
* }
|
|
4319
|
+
*
|
|
4320
|
+
* const result = await store.request(getUser('1'));
|
|
4079
4321
|
*
|
|
4080
4322
|
* result.content.data; // will have type User
|
|
4081
4323
|
* ```
|
|
@@ -4085,13 +4327,17 @@ declare function withResponseType<T>(obj: RequestInfo): RequestInfo<T> & {
|
|
|
4085
4327
|
* ```ts
|
|
4086
4328
|
* type PageMeta = { page: { limit: number; offset: number }; total?: number };
|
|
4087
4329
|
*
|
|
4088
|
-
*
|
|
4089
|
-
* withReactiveResponse<User[], PageMeta>({ url: '/users' })
|
|
4090
|
-
*
|
|
4330
|
+
* export function getUsers() {
|
|
4331
|
+
* return withReactiveResponse<User[], PageMeta>({ url: '/users' });
|
|
4332
|
+
* }
|
|
4333
|
+
*
|
|
4334
|
+
* const result = await store.request(getUsers());
|
|
4091
4335
|
*
|
|
4092
4336
|
* result.content.meta?.total; // number | undefined
|
|
4093
4337
|
* ```
|
|
4094
4338
|
*
|
|
4339
|
+
* @summary Types a request object so its response resolves as a `ReactiveDataDocument` of the given
|
|
4340
|
+
* data and meta types; no runtime effect.
|
|
4095
4341
|
* @public
|
|
4096
4342
|
*/
|
|
4097
4343
|
declare function withReactiveResponse<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M>(obj: RequestInfo): RequestInfo<ReactiveDataDocument<T, M, E, EM>> & {
|
|
@@ -4099,18 +4345,31 @@ declare function withReactiveResponse<T, M extends Meta | undefined = Meta | und
|
|
|
4099
4345
|
[RequestSignature]: ReactiveDataDocument<T, M, E, EM>;
|
|
4100
4346
|
};
|
|
4101
4347
|
/**
|
|
4348
|
+
* @summary Deprecated alias for `withResponseType`, which types a request object with its expected
|
|
4349
|
+
* response type.
|
|
4102
4350
|
* @deprecated use {@link withResponseType} instead
|
|
4103
4351
|
*/
|
|
4104
4352
|
declare const withBrand: typeof withResponseType;
|
|
4105
|
-
//#endregion
|
|
4106
|
-
//#region src/store/-private/cache-handler/handler.d.ts
|
|
4107
4353
|
type LooseStoreRequestInfo<RT = unknown> = Omit<ImmutableRequestInfo<RT>, "records" | "headers" | typeof RequestSignature> & {
|
|
4108
4354
|
records?: ResourceIdentifierObject[];
|
|
4109
4355
|
headers?: Headers;
|
|
4356
|
+
/**
|
|
4357
|
+
* If provided, used instead of the AbortController auto-configured for each request by the RequestManager.
|
|
4358
|
+
*
|
|
4359
|
+
* Handlers never receive this: the RequestManager removes it before the first handler runs and
|
|
4360
|
+
* exposes its signal as `request.signal` instead, which is why {@link ImmutableRequestInfo} omits it.
|
|
4361
|
+
*/
|
|
4362
|
+
controller?: AbortController;
|
|
4110
4363
|
};
|
|
4111
4364
|
/**
|
|
4112
4365
|
* The request shape accepted by {@link Store.request}, either a fully-formed
|
|
4113
4366
|
* {@link ImmutableRequestInfo} or the looser {@link LooseStoreRequestInfo}.
|
|
4367
|
+
*
|
|
4368
|
+
* Only the looser form accepts `controller`, so a request carrying one, including a builder's
|
|
4369
|
+
* output spread together with a `controller`, resolves to {@link LooseStoreRequestInfo}.
|
|
4370
|
+
*
|
|
4371
|
+
* @summary The request object `store.request` accepts, either a full immutable request info or a looser
|
|
4372
|
+
* form with plain `records` and `headers`.
|
|
4114
4373
|
*/
|
|
4115
4374
|
type StoreRequestInput<RT = unknown> = ImmutableRequestInfo<RT> | LooseStoreRequestInfo<RT>;
|
|
4116
4375
|
interface StoreRequestContext extends RequestContext {
|
|
@@ -4122,6 +4381,9 @@ interface StoreRequestContext extends RequestContext {
|
|
|
4122
4381
|
/**
|
|
4123
4382
|
* A CacheHandler that adds support for using an WarpDrive Cache with a RequestManager.
|
|
4124
4383
|
*
|
|
4384
|
+
* The [Caching](/guides/the-manual/caching/) guide explains how it decides whether a
|
|
4385
|
+
* request can use the cache.
|
|
4386
|
+
*
|
|
4125
4387
|
* This handler will only run when a request has supplied a `store` instance. Requests
|
|
4126
4388
|
* issued by the store via `store.request()` will automatically have the `store` instance
|
|
4127
4389
|
* attached to the request.
|
|
@@ -4157,22 +4419,29 @@ interface StoreRequestContext extends RequestContext {
|
|
|
4157
4419
|
* method: 'GET',
|
|
4158
4420
|
* [EnableHydration]: true
|
|
4159
4421
|
* });
|
|
4422
|
+
* ```
|
|
4160
4423
|
*
|
|
4424
|
+
* @summary The RequestManager cache handler that serves, dedupes, and caches store requests and returns
|
|
4425
|
+
* reactive documents when hydration is enabled.
|
|
4161
4426
|
*/
|
|
4162
4427
|
declare const CacheHandler: CacheHandler$1;
|
|
4163
|
-
//#endregion
|
|
4164
|
-
//#region src/store/-private/cache-handler/types.d.ts
|
|
4165
4428
|
/**
|
|
4166
4429
|
* A service which an application may provide to the store via
|
|
4167
4430
|
* the store's `lifetimes` property to configure the behavior
|
|
4168
4431
|
* of the CacheHandler.
|
|
4169
4432
|
*
|
|
4433
|
+
* The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)
|
|
4434
|
+
* guide shows how to configure one, and [Caching](/guides/the-manual/caching/) explains
|
|
4435
|
+
* where the CacheHandler consults it.
|
|
4436
|
+
*
|
|
4170
4437
|
* The default behavior for request lifetimes is to never expire
|
|
4171
4438
|
* unless manually refreshed via `cacheOptions.reload` or `cacheOptions.backgroundReload`.
|
|
4172
4439
|
*
|
|
4173
4440
|
* Implementing this service allows you to programatically define
|
|
4174
4441
|
* when a request should be considered expired.
|
|
4175
4442
|
*
|
|
4443
|
+
* @summary The interface a store's `lifetimes` service implements to decide when cached requests are
|
|
4444
|
+
* hard or soft expired and should be refetched.
|
|
4176
4445
|
* @public
|
|
4177
4446
|
*/
|
|
4178
4447
|
interface CachePolicy {
|
|
@@ -4243,8 +4512,6 @@ interface CachePolicy {
|
|
|
4243
4512
|
*/
|
|
4244
4513
|
didRequest?(request: ImmutableRequestInfo, response: Response | ResponseInfo | null, identifier: RequestKey | null, store: Store$1): void;
|
|
4245
4514
|
}
|
|
4246
|
-
//#endregion
|
|
4247
|
-
//#region src/reactive/-private/document.d.ts
|
|
4248
4515
|
interface ReactiveDocumentBase<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> {
|
|
4249
4516
|
/**
|
|
4250
4517
|
* The links object for this document, if any
|
|
@@ -4366,6 +4633,8 @@ type DocumentMeta<M extends Meta | undefined> = undefined extends M ? {
|
|
|
4366
4633
|
* The variant of {@link ReactiveDocument} returned for a request whose
|
|
4367
4634
|
* response contained no primary data, e.g. an error response.
|
|
4368
4635
|
*
|
|
4636
|
+
* @summary The shape of a reactive response document that carries `errors` and no primary `data`,
|
|
4637
|
+
* such as the result of a failed request.
|
|
4369
4638
|
* @public
|
|
4370
4639
|
*/
|
|
4371
4640
|
type ReactiveErrorDocument<T, EM extends Meta | undefined = Meta | undefined, E extends object = object, M extends Meta | undefined = EM> = ReactiveDocumentBase<T, M, E, EM> & DocumentMeta<EM> & {
|
|
@@ -4396,6 +4665,8 @@ type ReactiveErrorDocument<T, EM extends Meta | undefined = Meta | undefined, E
|
|
|
4396
4665
|
* The variant of {@link ReactiveDocument} returned for a request whose
|
|
4397
4666
|
* response contained primary data.
|
|
4398
4667
|
*
|
|
4668
|
+
* @summary The shape of a reactive response document whose `data` holds the request's primary
|
|
4669
|
+
* records, with no `errors`.
|
|
4399
4670
|
* @public
|
|
4400
4671
|
*/
|
|
4401
4672
|
type ReactiveDataDocument<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> = ReactiveDocumentBase<T, M, E, EM> & DocumentMeta<M> & {
|
|
@@ -4423,15 +4694,18 @@ type ReactiveDataDocument<T, M extends Meta | undefined = Meta | undefined, E ex
|
|
|
4423
4694
|
* returned by `Cache.put` or `Cache.peek`, converting ResourceKeys into
|
|
4424
4695
|
* ReactiveResource instances.
|
|
4425
4696
|
*
|
|
4697
|
+
* The [Using The Response](/guides/the-manual/requests/using-the-response) guide
|
|
4698
|
+
* shows when a request's content is a ReactiveDocument.
|
|
4699
|
+
*
|
|
4426
4700
|
* It is not directly instantiated by the user, and its properties should not
|
|
4427
4701
|
* be directly modified. Whether individual properties are mutable or not is
|
|
4428
4702
|
* determined by the record instance itself.
|
|
4429
4703
|
*
|
|
4704
|
+
* @summary The reactive wrapper around a request's response document that exposes its data or errors
|
|
4705
|
+
* as live records, plus meta, links, and pagination helpers.
|
|
4430
4706
|
* @public
|
|
4431
4707
|
*/
|
|
4432
4708
|
type ReactiveDocument<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> = ReactiveDataDocument<T, M, E, EM> | ReactiveErrorDocument<T, EM, E, M>;
|
|
4433
|
-
//#endregion
|
|
4434
|
-
//#region src/store/-private/managers/cache-capabilities-manager.d.ts
|
|
4435
4709
|
interface CacheCapabilitiesManager {
|
|
4436
4710
|
/** @deprecated - use {@link CacheCapabilitiesManager.schema} */
|
|
4437
4711
|
getSchemaDefinitionService(): SchemaService;
|
|
@@ -4466,8 +4740,6 @@ interface PrivateCacheCapabilitiesManager extends CacheCapabilitiesManager {
|
|
|
4466
4740
|
* @private
|
|
4467
4741
|
*/
|
|
4468
4742
|
declare function assertPrivateCapabilities(manager: unknown): asserts manager is PrivateCacheCapabilitiesManager;
|
|
4469
|
-
//#endregion
|
|
4470
|
-
//#region src/store/-private/managers/cache-manager.d.ts
|
|
4471
4743
|
/**
|
|
4472
4744
|
* The CacheManager wraps a Cache enforcing that only
|
|
4473
4745
|
* the public API surface area is exposed.
|
|
@@ -4571,7 +4843,8 @@ declare class CacheManager implements Cache {
|
|
|
4571
4843
|
* Push resource data from a remote source into the cache for this ResourceKey
|
|
4572
4844
|
*
|
|
4573
4845
|
* @public
|
|
4574
|
-
* @return
|
|
4846
|
+
* @return when `hasRecord` is true, the names of the attributes whose persisted value
|
|
4847
|
+
* this push changed, or `undefined` when none did. Otherwise `void`.
|
|
4575
4848
|
*/
|
|
4576
4849
|
upsert(key: ResourceKey, data: unknown, hasRecord: boolean): void | string[];
|
|
4577
4850
|
/**
|
|
@@ -4673,9 +4946,9 @@ declare class CacheManager implements Cache {
|
|
|
4673
4946
|
*
|
|
4674
4947
|
* @public
|
|
4675
4948
|
*/
|
|
4676
|
-
didCommit(key: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument
|
|
4677
|
-
didCommit(key: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument
|
|
4678
|
-
didCommit(key: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument
|
|
4949
|
+
didCommit(key: ResourceKey, result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
4950
|
+
didCommit(key: ResourceKey[], result: StructuredDataDocument<SingleResourceDataDocument<ExistingResourceObject, ExistingResourceObject>> | null): SingleResourceDataDocument;
|
|
4951
|
+
didCommit(key: ResourceKey[], result: StructuredDataDocument<CollectionResourceDataDocument<ExistingResourceObject>> | null): CollectionResourceDataDocument;
|
|
4679
4952
|
/**
|
|
4680
4953
|
* [LIFECYCLE] Signals to the cache that a resource
|
|
4681
4954
|
* was update via a save transaction failed.
|
|
@@ -4824,8 +5097,6 @@ declare class CacheManager implements Cache {
|
|
|
4824
5097
|
*/
|
|
4825
5098
|
isDeletionCommitted(key: ResourceKey): boolean;
|
|
4826
5099
|
}
|
|
4827
|
-
//#endregion
|
|
4828
|
-
//#region src/store/-private/caches/instance-cache.d.ts
|
|
4829
5100
|
/**
|
|
4830
5101
|
Retrieves the unique referentially-stable {@link ResourceKey}
|
|
4831
5102
|
assigned to the given record instance.
|
|
@@ -4840,6 +5111,7 @@ const identifier = recordIdentifierFor(record);
|
|
|
4840
5111
|
const { id, type, lid } = identifier;
|
|
4841
5112
|
```
|
|
4842
5113
|
|
|
5114
|
+
@summary Returns the stable `ResourceKey` (type, id, and lid) the store assigned to a record instance.
|
|
4843
5115
|
@public
|
|
4844
5116
|
@param record a record instance previously obstained from the store.
|
|
4845
5117
|
*/
|
|
@@ -4939,8 +5211,6 @@ declare class InstanceCache {
|
|
|
4939
5211
|
* @private
|
|
4940
5212
|
*/
|
|
4941
5213
|
declare function _clearCaches(): void;
|
|
4942
|
-
//#endregion
|
|
4943
|
-
//#region src/store/-private/record-arrays/native-proxy-type-fix.d.ts
|
|
4944
5214
|
interface ProxyConstructor {}
|
|
4945
5215
|
/**
|
|
4946
5216
|
* The global `Proxy` constructor, retyped with the corrected
|
|
@@ -4950,13 +5220,13 @@ interface ProxyConstructor {}
|
|
|
4950
5220
|
* @private
|
|
4951
5221
|
*/
|
|
4952
5222
|
declare const NativeProxy: ProxyConstructor;
|
|
4953
|
-
//#endregion
|
|
4954
|
-
//#region src/reactive/-private/symbols.d.ts
|
|
4955
5223
|
declare const SOURCE: "___(unique) Symbol(SOURCE)";
|
|
4956
5224
|
/**
|
|
4957
5225
|
* Symbol for the method used to request a mutable copy of an otherwise
|
|
4958
5226
|
* immutable {@link ReactiveResource}.
|
|
4959
5227
|
*
|
|
5228
|
+
* @summary Deprecated symbol-keyed method on a ReactiveResource that resolves with an editable copy;
|
|
5229
|
+
* use `checkout` instead.
|
|
4960
5230
|
* @deprecated use the {@link checkout} utility function instead.
|
|
4961
5231
|
*/
|
|
4962
5232
|
declare const Checkout: "___(unique) Symbol(Checkout)";
|
|
@@ -4965,8 +5235,6 @@ declare const Checkout: "___(unique) Symbol(Checkout)";
|
|
|
4965
5235
|
* mutability, etc.) on a {@link ReactiveResource} or reactive field instance.
|
|
4966
5236
|
*/
|
|
4967
5237
|
declare const Context: "___(unique) Symbol(Context)";
|
|
4968
|
-
//#endregion
|
|
4969
|
-
//#region src/reactive/-private/fields/managed-array.d.ts
|
|
4970
5238
|
interface ManagedArray extends Omit<Array<unknown>, "[]"> {
|
|
4971
5239
|
[SOURCE]: unknown[];
|
|
4972
5240
|
identifier: ResourceKey;
|
|
@@ -4978,8 +5246,6 @@ interface ManagedArray extends Omit<Array<unknown>, "[]"> {
|
|
|
4978
5246
|
declare class ManagedArray {
|
|
4979
5247
|
constructor(context: KindContext<SchemaArrayField | ArrayField>, owner: ReactiveResource, data: unknown[]);
|
|
4980
5248
|
}
|
|
4981
|
-
//#endregion
|
|
4982
|
-
//#region src/store/-private/record-arrays/resource-array.d.ts
|
|
4983
5249
|
declare const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
|
|
4984
5250
|
type ProxiedMethod = (...args: unknown[]) => unknown;
|
|
4985
5251
|
interface ReactiveResourceArrayCreateOptions {
|
|
@@ -5010,10 +5276,15 @@ interface ReactiveResourceArrayContext extends ReactiveResourceArrayCreateOption
|
|
|
5010
5276
|
* as the base for relationship and legacy record-array types such as
|
|
5011
5277
|
* {@link LegacyLiveArray}, {@link LegacyQueryArray} and {@link LegacyManyArray}.
|
|
5012
5278
|
*
|
|
5279
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
5280
|
+
* how it relates to resources.
|
|
5281
|
+
*
|
|
5013
5282
|
* Behaves like a native Array: `Array.isArray(arr)` and `arr instanceof Array`
|
|
5014
5283
|
* both report `true`. The array stays in sync with the cache, updating
|
|
5015
5284
|
* reactively as the underlying {@link ResourceKey}s change.
|
|
5016
5285
|
*
|
|
5286
|
+
* @summary Native-Array-compatible reactive list of records backed by cache keys, returned for collection responses
|
|
5287
|
+
* and underlying relationship and legacy record arrays.
|
|
5017
5288
|
* @public
|
|
5018
5289
|
*/
|
|
5019
5290
|
interface ReactiveResourceArray<T = unknown> extends Omit<Array<T>, "[]"> {}
|
|
@@ -5037,8 +5308,6 @@ interface PrivateReactiveResourceArray<T = unknown> extends Omit<Array<T>, "[]">
|
|
|
5037
5308
|
/** @private */
|
|
5038
5309
|
[Context]: ReactiveResourceArrayContext;
|
|
5039
5310
|
}
|
|
5040
|
-
//#endregion
|
|
5041
|
-
//#region src/store/-private/record-arrays/-utils.d.ts
|
|
5042
5311
|
/**
|
|
5043
5312
|
* LegacyArrays have the capability of updating via `array.update()`
|
|
5044
5313
|
* and saving each contained record individually via `array.save()`
|
|
@@ -5104,8 +5373,6 @@ interface MinimumManager {
|
|
|
5104
5373
|
mutate?(mutation: LocalRelationshipOperation): void;
|
|
5105
5374
|
reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<ReactiveResourceArray> | PromiseManyArray<T>;
|
|
5106
5375
|
}
|
|
5107
|
-
//#endregion
|
|
5108
|
-
//#region src/store/-private/record-arrays/legacy-live-array.d.ts
|
|
5109
5376
|
/**
|
|
5110
5377
|
* LiveArrays contain all the known records for a given `ResourceType`.
|
|
5111
5378
|
*
|
|
@@ -5166,6 +5433,8 @@ interface MinimumManager {
|
|
|
5166
5433
|
* and "bmw" will have populated LiveArrays, but the LiveArray for "car"
|
|
5167
5434
|
* would be empty.
|
|
5168
5435
|
*
|
|
5436
|
+
* @summary Legacy reactive array of every record of one type in the store, returned by `store.peekAll` and
|
|
5437
|
+
* `store.findAll`.
|
|
5169
5438
|
* @legacy we recommend againt using LiveArrays. Use {@link Store.request} instead
|
|
5170
5439
|
*/
|
|
5171
5440
|
interface LegacyLiveArray<T = unknown> extends LegacyArray<T> {
|
|
@@ -5190,8 +5459,6 @@ interface LegacyLiveArrayCreateOptions {
|
|
|
5190
5459
|
source: ResourceKey[];
|
|
5191
5460
|
type: string;
|
|
5192
5461
|
}
|
|
5193
|
-
//#endregion
|
|
5194
|
-
//#region src/store/-private/record-arrays/legacy-query.d.ts
|
|
5195
5462
|
/**
|
|
5196
5463
|
* QueryArrays contain the primary records returned when querying
|
|
5197
5464
|
* for records by `ResourceType`.
|
|
@@ -5262,6 +5529,8 @@ interface LegacyLiveArrayCreateOptions {
|
|
|
5262
5529
|
* from the cache, but it does remove the array as well as the overhead it requires
|
|
5263
5530
|
* from the store for book-keeping.
|
|
5264
5531
|
*
|
|
5532
|
+
* @summary Legacy immutable reactive array of the primary records returned by `store.query`, refreshable with
|
|
5533
|
+
* `update()` and released with `destroy()`.
|
|
5265
5534
|
* @legacy we recommend againt using QueryArrays. Use {@link Store.request} instead
|
|
5266
5535
|
*/
|
|
5267
5536
|
interface LegacyQueryArray<T = unknown> extends LegacyLiveArray<T> {
|
|
@@ -5282,8 +5551,6 @@ interface LegacyQueryArray<T = unknown> extends LegacyLiveArray<T> {
|
|
|
5282
5551
|
*/
|
|
5283
5552
|
meta: Meta | null;
|
|
5284
5553
|
}
|
|
5285
|
-
//#endregion
|
|
5286
|
-
//#region src/store/-private/managers/record-array-manager.d.ts
|
|
5287
5554
|
/**
|
|
5288
5555
|
* This is a clever optimization.
|
|
5289
5556
|
*
|
|
@@ -5374,8 +5641,6 @@ interface PrivateRecordArrayManager extends RecordArrayManager {
|
|
|
5374
5641
|
_managed: Set<ReactiveResourceArray>;
|
|
5375
5642
|
clear(isClear?: boolean): void;
|
|
5376
5643
|
}
|
|
5377
|
-
//#endregion
|
|
5378
|
-
//#region src/store/-private/network/request-cache.d.ts
|
|
5379
5644
|
declare const Touching: "___(unique) Symbol(Touching)";
|
|
5380
5645
|
declare const RequestPromise: "___(unique) Symbol(RequestPromise)";
|
|
5381
5646
|
/**
|
|
@@ -5507,8 +5772,6 @@ interface PrivateRequestStateService extends RequestStateService {
|
|
|
5507
5772
|
_clearEntries(identifier: ResourceKey): void;
|
|
5508
5773
|
_enqueue<T>(promise: Promise<T>, queryRequest: Request$1): Promise<T>;
|
|
5509
5774
|
}
|
|
5510
|
-
//#endregion
|
|
5511
|
-
//#region src/store/-private/store-service.d.ts
|
|
5512
5775
|
type EmberObjectKey = "_debugContainerKey" | "_super" | "addObserver" | "cacheFor" | "concatenatedProperties" | "decrementProperty" | "destroy" | "get" | "getProperties" | "incrementProperty" | "init" | "isDestroyed" | "isDestroying" | "mergedProperties" | "notifyPropertyChange" | "removeObserver" | "reopen" | "set" | "setProperties" | "toggleProperty" | "toString" | "willDestroy";
|
|
5513
5776
|
type DSModelKeys = "___(unique) Symbol(Store)" | "___private_notifications" | "___recordState" | "_createSnapshot" | "adapterError" | "attr" | "belongsTo" | "changedAttributes" | "currentState" | "deleteRecord" | "destroyRecord" | "dirtyType" | "eachAttribute" | "eachRelationship" | "errors" | "hasDirtyAttributes" | "hasMany" | "inverseFor" | "isDeleted" | "isEmpty" | "isError" | "isLoaded" | "isLoading" | "isNew" | "isReloading" | "isSaving" | "isValid" | "relationshipFor" | "reload" | "rollbackAttributes" | "save" | "serialize" | "store" | "unloadRecord";
|
|
5514
5777
|
type DownlevelArrays<T> = T extends Array<infer U> ? U[] : T;
|
|
@@ -5560,6 +5823,26 @@ interface Store$1 {
|
|
|
5560
5823
|
* mechanism of presenting cache data to the ui for access
|
|
5561
5824
|
* mutation, and interaction.
|
|
5562
5825
|
*
|
|
5826
|
+
* The Store treats whatever this hook returns as opaque, so a record can be
|
|
5827
|
+
* anything from a fairly simple object to a robust proxy that links together
|
|
5828
|
+
* associated records through relationships.
|
|
5829
|
+
*
|
|
5830
|
+
* That also lets a record implementation separate edit flows from create flows
|
|
5831
|
+
* entirely. A [ReactiveResource](/api/@warp-drive-mirror/core/reactive/types/ReactiveResource)
|
|
5832
|
+
* is not editable by default; calling
|
|
5833
|
+
* [checkout](/api/@warp-drive-mirror/core/reactive/functions/checkout) on it gives access to
|
|
5834
|
+
* an editable copy while the original stays read-only.
|
|
5835
|
+
*
|
|
5836
|
+
* Because records are created here and read their data from the {@link Store.cache | cache},
|
|
5837
|
+
* record implementations should be able to interoperate both with each other and with
|
|
5838
|
+
* any Cache. An app can therefore use more than one record implementation, either to give
|
|
5839
|
+
* only some resource types enhanced features or to migrate from one implementation to
|
|
5840
|
+
* another incrementally. The Store that
|
|
5841
|
+
* [useLegacyStore](/api/@warp-drive-mirror/legacy/functions/useLegacyStore) produces does this:
|
|
5842
|
+
* its hook creates a legacy `Model` for each resource type that only has a Model schema,
|
|
5843
|
+
* and a ReactiveResource for every other type. Each Store creates one Cache, so an
|
|
5844
|
+
* app that needs more than one Cache implementation uses more than one Store.
|
|
5845
|
+
*
|
|
5563
5846
|
* @param identifier - The Resource CacheKey
|
|
5564
5847
|
* @param createRecordArgs - An object containing any properties passed to `store.createRecord`
|
|
5565
5848
|
* @return A record instance
|
|
@@ -6539,6 +6822,10 @@ interface Store$1 {
|
|
|
6539
6822
|
* The `Store` is the central piece of the ***Warp*Drive** experience. It connects
|
|
6540
6823
|
* requests for data with schemas, caching and reactivity.
|
|
6541
6824
|
*
|
|
6825
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide shows how to configure
|
|
6826
|
+
* one, and [Making Requests](/guides/the-manual/requests/) shows how to request data
|
|
6827
|
+
* through it.
|
|
6828
|
+
*
|
|
6542
6829
|
* While it's easy to use ***just*** ***Warp*Drive**'s request management, most projects will find they
|
|
6543
6830
|
* require far more than basic fetch management. For this reason it's often best to start with a `Store`
|
|
6544
6831
|
* even when you aren't sure yet.
|
|
@@ -6546,6 +6833,7 @@ interface Store$1 {
|
|
|
6546
6833
|
* Most projects will only have a single `Store`, though using multiple distinct stores
|
|
6547
6834
|
* is possible.
|
|
6548
6835
|
*
|
|
6836
|
+
* @summary Central coordinator that connects requests for data with schemas, the cache and reactivity.
|
|
6549
6837
|
* @public
|
|
6550
6838
|
* @hideconstructor
|
|
6551
6839
|
*/
|
|
@@ -6654,12 +6942,25 @@ declare class Store$1 extends BaseClass {
|
|
|
6654
6942
|
*/
|
|
6655
6943
|
getRequestStateService(): RequestStateService;
|
|
6656
6944
|
/**
|
|
6657
|
-
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/
|
|
6945
|
+
* ::: tip 💡 For a more complete overview see the [Request Guide](/guides/the-manual/requests/)
|
|
6658
6946
|
* :::
|
|
6659
6947
|
*
|
|
6660
6948
|
* Issue a request via the configured {@link RequestManager},
|
|
6661
6949
|
* inserting the response into the {@link Store.cache | cache} and handing
|
|
6662
|
-
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}
|
|
6950
|
+
* back a {@link Future} which resolves to a {@link ReactiveDocument | ReactiveDocument}.
|
|
6951
|
+
* Use `store.request` for anything the Store's cache should own, which is nearly all app
|
|
6952
|
+
* code; reach for {@link RequestManager.request | requestManager.request} directly only when
|
|
6953
|
+
* there is no `Store` involved, or you specifically want the unprocessed
|
|
6954
|
+
* {@link StructuredDocument}.
|
|
6955
|
+
*
|
|
6956
|
+
* #### Building Requests
|
|
6957
|
+
*
|
|
6958
|
+
* `requestConfig` can be written by hand, but for anything reused more than once prefer a
|
|
6959
|
+
* request builder — a plain function that returns the right shape for `store.request`. This
|
|
6960
|
+
* repo ships builders for common operations (`findRecord`, `query`, `createRecord`, and more)
|
|
6961
|
+
* for {json:api}, REST, and ActiveRecord-style APIs in `@warp-drive-mirror/utilities`; each builder's
|
|
6962
|
+
* return value also carries its own response type, so `RT` below is inferred automatically
|
|
6963
|
+
* instead of being written by hand. See [Builders](/guides/the-manual/requests/builders.md).
|
|
6663
6964
|
*
|
|
6664
6965
|
* #### Request Cache Keys
|
|
6665
6966
|
*
|
|
@@ -6704,6 +7005,29 @@ declare class Store$1 extends BaseClass {
|
|
|
6704
7005
|
* is that `store.request` will convert the response into a {@link ReactiveDocument}
|
|
6705
7006
|
* containing {@link Store.instantiateRecord | ReactiveResources}.
|
|
6706
7007
|
*
|
|
7008
|
+
* A {@link ReactiveDocument} is either a {@link ReactiveDataDocument} (`content.data` holds
|
|
7009
|
+
* the resource(s)) or a {@link ReactiveErrorDocument} (`content.errors` holds the API's error
|
|
7010
|
+
* objects), depending on whether the `Future` resolves or rejects; both carry the response's
|
|
7011
|
+
* `content.meta`. Read either state reactively with {@link getRequestState} or the
|
|
7012
|
+
* `<Request />` component instead of always `await`-ing the `Future` directly — see
|
|
7013
|
+
* [Using the Response](/guides/the-manual/requests/using-the-response.md).
|
|
7014
|
+
*
|
|
7015
|
+
* #### Typing The Response
|
|
7016
|
+
*
|
|
7017
|
+
* `request<RT>` accepts an explicit type argument, but the more common path is to let it be
|
|
7018
|
+
* inferred: build the request with {@link withResponseType} (or {@link withReactiveResponse}
|
|
7019
|
+
* for the common reactive-document case), or with a builder from `@warp-drive-mirror/utilities` as
|
|
7020
|
+
* described above, and `RT` is inferred from the request object itself. See
|
|
7021
|
+
* [Typing Requests](/guides/the-manual/requests/typing-requests.md) for the full mechanism.
|
|
7022
|
+
*
|
|
7023
|
+
* @example
|
|
7024
|
+
* ```ts
|
|
7025
|
+
* import { findRecord } from '@warp-drive-mirror/utilities/json-api';
|
|
7026
|
+
*
|
|
7027
|
+
* const { content } = await store.request(findRecord('user', '1'));
|
|
7028
|
+
* content.data; // ReactiveResource, typed from the builder's response type
|
|
7029
|
+
* ```
|
|
7030
|
+
*
|
|
6707
7031
|
* @public
|
|
6708
7032
|
*/
|
|
6709
7033
|
request<RT>(requestConfig: StoreRequestInput<RT>): Future<RT>;
|
|
@@ -7134,8 +7458,6 @@ declare function assertPrivateStore(store: unknown): asserts store is PrivateSto
|
|
|
7134
7458
|
* @private
|
|
7135
7459
|
*/
|
|
7136
7460
|
declare function isPrivateStore(store: unknown): PrivateStore;
|
|
7137
|
-
//#endregion
|
|
7138
|
-
//#region src/store/-private/utils/construct-resource.d.ts
|
|
7139
7461
|
/**
|
|
7140
7462
|
* Given an existing resource identifier object (or a {@link ResourceKey}),
|
|
7141
7463
|
* returns it unchanged aside from coercing its `id`, if present, to a string.
|
|
@@ -7171,8 +7493,6 @@ declare function constructResource(type: string, id: string, lid?: string | null
|
|
|
7171
7493
|
* @private
|
|
7172
7494
|
*/
|
|
7173
7495
|
declare function constructResource(type: string, id?: string | number | null, lid?: string | null): ResourceIdentifierObject;
|
|
7174
|
-
//#endregion
|
|
7175
|
-
//#region src/store/-private/utils/coerce-id.d.ts
|
|
7176
7496
|
type Coercable = string | number | boolean | null | undefined | symbol;
|
|
7177
7497
|
/**
|
|
7178
7498
|
* Normalizes a resource `id` entering the store to a string (or `null`).
|
|
@@ -7195,8 +7515,6 @@ declare function coerceId(id: unknown): string | null;
|
|
|
7195
7515
|
* @private
|
|
7196
7516
|
*/
|
|
7197
7517
|
declare function ensureStringId(id: Coercable): string;
|
|
7198
|
-
//#endregion
|
|
7199
|
-
//#region src/store/-private/utils/normalize-model-name.d.ts
|
|
7200
7518
|
/**
|
|
7201
7519
|
* Normalizes a resource `type` to its dasherized form, e.g. `myClass` to
|
|
7202
7520
|
* `my-class`. Re-exported elsewhere as `_deprecatingNormalize`.
|
|
@@ -7208,8 +7526,6 @@ declare function ensureStringId(id: Coercable): string;
|
|
|
7208
7526
|
* @private
|
|
7209
7527
|
*/
|
|
7210
7528
|
declare function normalizeModelName(type: string): string;
|
|
7211
|
-
//#endregion
|
|
7212
|
-
//#region src/store/-private/record-arrays/legacy-many-array.d.ts
|
|
7213
7529
|
/**
|
|
7214
7530
|
A `ManyArray` is a `MutableArray` that represents the contents of a has-many
|
|
7215
7531
|
relationship.
|
|
@@ -7250,6 +7566,7 @@ the has-many.
|
|
|
7250
7566
|
We call the record to which a relationship belongs-to the
|
|
7251
7567
|
relationship's _owner_.
|
|
7252
7568
|
|
|
7569
|
+
@summary Legacy mutable reactive array holding the related records of a legacy or linksMode has-many relationship.
|
|
7253
7570
|
@public
|
|
7254
7571
|
*/
|
|
7255
7572
|
interface LegacyManyArray<T = unknown> extends ReactiveResourceArray<T> {
|
|
@@ -7349,8 +7666,6 @@ interface LegacyManyArrayCreateOptions extends LegacyLiveArrayCreateOptions {
|
|
|
7349
7666
|
* @private
|
|
7350
7667
|
*/
|
|
7351
7668
|
declare function createLegacyManyArray<T>(options: LegacyManyArrayCreateOptions): LegacyManyArray<T>;
|
|
7352
|
-
//#endregion
|
|
7353
|
-
//#region src/store/-private/debug/utils.d.ts
|
|
7354
7669
|
/**
|
|
7355
7670
|
* Opens a collapsed console group for a `cache` scoped debug message, using
|
|
7356
7671
|
* `type`/`lid`/`bucket`/`key` to build the colorized group label.
|
|
@@ -7400,8 +7715,6 @@ declare function log(scope: "reactive-ui", prefix: string, type: string, lid: st
|
|
|
7400
7715
|
* @private
|
|
7401
7716
|
*/
|
|
7402
7717
|
declare function log(scope: "notify", prefix: string, type: string, lid: string, bucket: string, key: string): void;
|
|
7403
|
-
//#endregion
|
|
7404
|
-
//#region src/reactive/-private/default-mode.d.ts
|
|
7405
7718
|
type ModeName = "polaris" | "legacy";
|
|
7406
7719
|
interface BaseContext {
|
|
7407
7720
|
/**
|
|
@@ -7480,8 +7793,6 @@ interface KindContext<T extends FieldSchema | IdentityField | HashField> extends
|
|
|
7480
7793
|
*/
|
|
7481
7794
|
signals: SignalStore;
|
|
7482
7795
|
}
|
|
7483
|
-
//#endregion
|
|
7484
|
-
//#region src/reactive/-private/record.d.ts
|
|
7485
7796
|
interface ReactiveResource {
|
|
7486
7797
|
/**
|
|
7487
7798
|
* Create an editable copy of the record
|
|
@@ -7516,10 +7827,14 @@ interface PrivateReactiveResource extends ReactiveResource {
|
|
|
7516
7827
|
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
7517
7828
|
* object.
|
|
7518
7829
|
*
|
|
7830
|
+
* The [ResourceSchemas](/guides/the-manual/schemas/resources/) guide shows how to
|
|
7831
|
+
* define the schema it reads.
|
|
7832
|
+
*
|
|
7519
7833
|
* This class is not directly instantiable. To use it, you should
|
|
7520
7834
|
* configure the store's `instantiateRecord` and `teardownRecord` hooks
|
|
7521
7835
|
* with the matching hooks provided by this package.
|
|
7522
7836
|
*
|
|
7837
|
+
* @summary The rich, reactive record object that presents a resource's cached data through its `ResourceSchema`.
|
|
7523
7838
|
* @hideconstructor
|
|
7524
7839
|
* @public
|
|
7525
7840
|
*/
|
|
@@ -7545,6 +7860,8 @@ declare class ReactiveResource {
|
|
|
7545
7860
|
* Edits to editable resources will be automatically committed if a new
|
|
7546
7861
|
* payload from the cache matches their existing value.
|
|
7547
7862
|
*
|
|
7863
|
+
* @summary Resolves with an editable copy of an immutable `ReactiveResource` so its fields can be
|
|
7864
|
+
* changed locally.
|
|
7548
7865
|
* @public
|
|
7549
7866
|
*
|
|
7550
7867
|
* @returns a promise that resolves to the editable resource
|
|
@@ -7559,11 +7876,11 @@ declare function checkout<T>(resource: unknown): Promise<T & ReactiveResource>;
|
|
|
7559
7876
|
* approach is for either the API or a Handler to reflect saved
|
|
7560
7877
|
* changes back to update the cache.
|
|
7561
7878
|
*
|
|
7879
|
+
* @summary Forcibly makes an editable resource's local changes its new remote (immutable) state,
|
|
7880
|
+
* bypassing a save round-trip.
|
|
7562
7881
|
* @public
|
|
7563
7882
|
*/
|
|
7564
7883
|
declare function commit(record: ReactiveResource): Promise<void>;
|
|
7565
|
-
//#endregion
|
|
7566
|
-
//#region src/reactive/-private/hooks.d.ts
|
|
7567
7884
|
/**
|
|
7568
7885
|
* The store's default `instantiateRecord` hook implementation, which
|
|
7569
7886
|
* produces a {@link ReactiveResource} for `identifier` using the resource
|
|
@@ -7573,6 +7890,8 @@ declare function commit(record: ReactiveResource): Promise<void>;
|
|
|
7573
7890
|
* schema is `legacy`, matching the historical behavior of assigning initial
|
|
7574
7891
|
* properties when creating a new legacy record.
|
|
7575
7892
|
*
|
|
7893
|
+
* @summary Default store `instantiateRecord` hook that creates a `ReactiveResource` for a resource key
|
|
7894
|
+
* from its registered schema.
|
|
7576
7895
|
* @public
|
|
7577
7896
|
*/
|
|
7578
7897
|
declare function instantiateRecord(store: Store$1, identifier: ResourceKey, createArgs?: Record<string, unknown>): ReactiveResource;
|
|
@@ -7581,11 +7900,11 @@ declare function instantiateRecord(store: Store$1, identifier: ResourceKey, crea
|
|
|
7581
7900
|
* that `record` is a {@link ReactiveResource} and invokes its `Destroy`
|
|
7582
7901
|
* behavior.
|
|
7583
7902
|
*
|
|
7903
|
+
* @summary Default store `teardownRecord` hook that destroys a `ReactiveResource` when the store
|
|
7904
|
+
* releases it.
|
|
7584
7905
|
* @public
|
|
7585
7906
|
*/
|
|
7586
7907
|
declare function teardownRecord(record: unknown): void;
|
|
7587
|
-
//#endregion
|
|
7588
|
-
//#region src/request/-private/fetch.d.ts
|
|
7589
7908
|
/**
|
|
7590
7909
|
* ```ts
|
|
7591
7910
|
* import { Fetch } from '@warp-drive-mirror/core';
|
|
@@ -7594,6 +7913,9 @@ declare function teardownRecord(record: unknown): void;
|
|
|
7594
7913
|
* A basic Fetch Handler which converts a request into a
|
|
7595
7914
|
* `fetch` call presuming the response to be `json`.
|
|
7596
7915
|
*
|
|
7916
|
+
* The [Making Requests](/guides/the-manual/requests/#requests-do-not-need-to-use-fetch)
|
|
7917
|
+
* guide shows where it sits in the handler chain.
|
|
7918
|
+
*
|
|
7597
7919
|
* ```ts
|
|
7598
7920
|
* import { RequestManager, Fetch } from '@warp-drive-mirror/core';
|
|
7599
7921
|
*
|
|
@@ -7601,6 +7923,8 @@ declare function teardownRecord(record: unknown): void;
|
|
|
7601
7923
|
* .use([Fetch]);
|
|
7602
7924
|
* ```
|
|
7603
7925
|
*
|
|
7926
|
+
* @summary Terminal request handler that sends the request with native `fetch` and resolves with the
|
|
7927
|
+
* parsed JSON body, turning HTTP failures into errors.
|
|
7604
7928
|
* @public
|
|
7605
7929
|
* @badge Handler
|
|
7606
7930
|
*/
|
|
@@ -7614,8 +7938,6 @@ declare const Fetch: {
|
|
|
7614
7938
|
*/
|
|
7615
7939
|
request<T>(context: Context$1): Promise<T>;
|
|
7616
7940
|
};
|
|
7617
|
-
//#endregion
|
|
7618
|
-
//#region src/store/-private/default-cache-policy.d.ts
|
|
7619
7941
|
type UnsubscribeToken = object;
|
|
7620
7942
|
type CacheOperation = "added" | "removed" | "updated" | "state";
|
|
7621
7943
|
type DocumentCacheOperation = "invalidated" | "added" | "removed" | "updated" | "state";
|
|
@@ -7646,6 +7968,9 @@ type Store = {
|
|
|
7646
7968
|
* Interface of a parsed Cache-Control header value.
|
|
7647
7969
|
*
|
|
7648
7970
|
* - [MDN Cache-Control Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)
|
|
7971
|
+
*
|
|
7972
|
+
* @summary The directives of a `Cache-Control` header as an object of flags and second counts, as
|
|
7973
|
+
* returned by `parseCacheControl`.
|
|
7649
7974
|
*/
|
|
7650
7975
|
interface CacheControlValue {
|
|
7651
7976
|
/** Indicates the response will never change; parsed but not currently used by this cache policy's expiration logic. */
|
|
@@ -7701,6 +8026,8 @@ interface CacheControlValue {
|
|
|
7701
8026
|
*
|
|
7702
8027
|
* See also {@link CacheControlValue} and [Response Directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#response_directives)
|
|
7703
8028
|
*
|
|
8029
|
+
* @summary Parses a `Cache-Control` header string into a `CacheControlValue` object, caching results
|
|
8030
|
+
* per header string.
|
|
7704
8031
|
* @public
|
|
7705
8032
|
*/
|
|
7706
8033
|
declare function parseCacheControl(header: string): CacheControlValue;
|
|
@@ -7763,6 +8090,9 @@ interface PolicyConfigConstraints {
|
|
|
7763
8090
|
/**
|
|
7764
8091
|
* The configuration options for the {@link DefaultCachePolicy}
|
|
7765
8092
|
*
|
|
8093
|
+
* The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)
|
|
8094
|
+
* guide shows a policy configured with them.
|
|
8095
|
+
*
|
|
7766
8096
|
* ```ts [app/services/store.ts]
|
|
7767
8097
|
* import { Store } from '@warp-drive-mirror/core';
|
|
7768
8098
|
* import { DefaultCachePolicy } from '@warp-drive-mirror/core/store'; // [!code focus]
|
|
@@ -7774,6 +8104,8 @@ interface PolicyConfigConstraints {
|
|
|
7774
8104
|
* }
|
|
7775
8105
|
* ```
|
|
7776
8106
|
*
|
|
8107
|
+
* @summary Options for `DefaultCachePolicy`: soft and hard expiration times, header-based expiration
|
|
8108
|
+
* constraints, and test-mode behavior.
|
|
7777
8109
|
*/
|
|
7778
8110
|
interface PolicyConfig {
|
|
7779
8111
|
/**
|
|
@@ -7854,6 +8186,9 @@ interface PolicyConfig {
|
|
|
7854
8186
|
/**
|
|
7855
8187
|
* A basic {@link CachePolicy} that can be added to the Store service.
|
|
7856
8188
|
*
|
|
8189
|
+
* The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)
|
|
8190
|
+
* guide shows how to configure it.
|
|
8191
|
+
*
|
|
7857
8192
|
* ```ts [app/services/store.ts]
|
|
7858
8193
|
* import { Store } from '@warp-drive-mirror/core';
|
|
7859
8194
|
* import { DefaultCachePolicy } from '@warp-drive-mirror/core/store'; // [!code focus]
|
|
@@ -7912,6 +8247,7 @@ interface PolicyConfig {
|
|
|
7912
8247
|
* for which {@link CacheOptions.types | cacheOptions.types} was provided
|
|
7913
8248
|
* when a request with an `OpCode` of `"createRecord"` is successful and also includes
|
|
7914
8249
|
* a matching type in its own `cacheOptions.types` array.
|
|
8250
|
+
|
|
7915
8251
|
* :::tip 💡 TIP
|
|
7916
8252
|
* Abstracting this behavior via builders is recommended to ensure consistency.
|
|
7917
8253
|
* :::
|
|
@@ -7931,6 +8267,8 @@ interface PolicyConfig {
|
|
|
7931
8267
|
* This behavior can be opted out of by setting `disableTestOptimization = true`
|
|
7932
8268
|
* in the policy config.
|
|
7933
8269
|
*
|
|
8270
|
+
* @summary The built-in cache policy, which expires cached requests using expiration headers or time
|
|
8271
|
+
* since the response `date`, and invalidates queries after matching creates.
|
|
7934
8272
|
* @public
|
|
7935
8273
|
*/
|
|
7936
8274
|
declare class DefaultCachePolicy implements CachePolicy {
|
|
@@ -8010,14 +8348,16 @@ declare class DefaultCachePolicy implements CachePolicy {
|
|
|
8010
8348
|
*/
|
|
8011
8349
|
isSoftExpired(cacheKey: RequestKey, store: Store): boolean;
|
|
8012
8350
|
}
|
|
8013
|
-
//#endregion
|
|
8014
|
-
//#region src/index.d.ts
|
|
8015
8351
|
/**
|
|
8352
|
+
* @summary Deprecated alias for `ReactiveDocument`, the reactive wrapper around a request's response document.
|
|
8016
8353
|
* @deprecated use {@link ReactiveDocument} instead
|
|
8017
8354
|
*/
|
|
8018
8355
|
type Document<T, M extends Meta | undefined = Meta | undefined, E extends object = object, EM extends Meta | undefined = M> = ReactiveDocument<T, M, E, EM>;
|
|
8019
8356
|
/**
|
|
8020
8357
|
* Options for setting up a Store instance with `useRecommendedStore`.
|
|
8358
|
+
*
|
|
8359
|
+
* @summary Configures the cache, cache policy, request handlers, schemas, and schema extensions that
|
|
8360
|
+
* `useRecommendedStore` wires into a Store class.
|
|
8021
8361
|
*/
|
|
8022
8362
|
interface StoreSetupOptions<T extends Cache = Cache> {
|
|
8023
8363
|
/**
|
|
@@ -8102,6 +8442,9 @@ declare class ConfiguredStore<T extends {
|
|
|
8102
8442
|
* Creates a configured Store class with recommended defaults
|
|
8103
8443
|
* for schema handling, reactivity, caching, and request management.
|
|
8104
8444
|
*
|
|
8445
|
+
* The [Setup](/guides/configuration/#configure-the-store) guide walks through
|
|
8446
|
+
* configuring the store with it.
|
|
8447
|
+
*
|
|
8105
8448
|
* ```ts
|
|
8106
8449
|
* import { useRecommendedStore } from '@warp-drive-mirror/core';
|
|
8107
8450
|
* import { JSONAPICache } from '@warp-drive-mirror/json-api';
|
|
@@ -8204,6 +8547,9 @@ declare class ConfiguredStore<T extends {
|
|
|
8204
8547
|
* {@link RequestManager} won't have it set unless the caller supplies it
|
|
8205
8548
|
* explicitly, so a handler relying on it should treat it as optional (as
|
|
8206
8549
|
* `LoggingHandler` does above).
|
|
8550
|
+
*
|
|
8551
|
+
* @summary Builds a Store subclass preconfigured with the given cache, schemas, and handlers, plus
|
|
8552
|
+
* `Fetch`, `CacheHandler`, and a default cache policy.
|
|
8207
8553
|
*/
|
|
8208
8554
|
declare function useRecommendedStore<T extends Cache, Policy extends CachePolicy>(options: StoreSetupOptions<T> & {
|
|
8209
8555
|
policy: Policy;
|
|
@@ -8218,12 +8564,12 @@ declare function useRecommendedStore<T extends Cache>(options: StoreSetupOptions
|
|
|
8218
8564
|
declare function useRecommendedStore<T extends Cache>(options: StoreSetupOptions<T>, StoreKlass?: typeof Store$1): typeof ConfiguredStore<{
|
|
8219
8565
|
cache: T;
|
|
8220
8566
|
}>;
|
|
8221
|
-
//#endregion
|
|
8222
|
-
//#region src/signals/promise-state.d.ts
|
|
8223
8567
|
/**
|
|
8224
8568
|
* The state of a promise in the "pending"
|
|
8225
8569
|
* state. This is the default initial state.
|
|
8226
8570
|
*
|
|
8571
|
+
* @summary The `getPromiseState` state for a promise that has not yet settled, with `isPending` true and
|
|
8572
|
+
* no value or reason.
|
|
8227
8573
|
*/
|
|
8228
8574
|
interface PendingPromise {
|
|
8229
8575
|
/**
|
|
@@ -8287,6 +8633,8 @@ interface PendingPromise {
|
|
|
8287
8633
|
* This is the state of a promise that has resolved
|
|
8288
8634
|
* successfully.
|
|
8289
8635
|
*
|
|
8636
|
+
* @summary The `getPromiseState` state for a promise that resolved, with `isSuccess` true and the
|
|
8637
|
+
* resolved `value`.
|
|
8290
8638
|
*/
|
|
8291
8639
|
interface ResolvedPromise<T> {
|
|
8292
8640
|
/**
|
|
@@ -8350,6 +8698,8 @@ interface ResolvedPromise<T> {
|
|
|
8350
8698
|
* This is the state of a promise that has rejected
|
|
8351
8699
|
* with an error.
|
|
8352
8700
|
*
|
|
8701
|
+
* @summary The `getPromiseState` state for a promise that rejected, with `isError` true and the
|
|
8702
|
+
* rejection `reason`.
|
|
8353
8703
|
*/
|
|
8354
8704
|
interface RejectedPromise<E> {
|
|
8355
8705
|
/**
|
|
@@ -8417,11 +8767,16 @@ interface RejectedPromise<E> {
|
|
|
8417
8767
|
* - {@link ResolvedPromise}
|
|
8418
8768
|
* - {@link RejectedPromise}
|
|
8419
8769
|
*
|
|
8770
|
+
* @summary The reactive pending, fulfilled, or rejected state of a promise, as returned by
|
|
8771
|
+
* `getPromiseState`.
|
|
8420
8772
|
*/
|
|
8421
8773
|
type PromiseState<T = unknown, E = unknown> = PendingPromise | ResolvedPromise<T> | RejectedPromise<E>;
|
|
8422
8774
|
/**
|
|
8423
8775
|
* Returns a reactive state-machine for the provided promise or awaitable.
|
|
8424
8776
|
*
|
|
8777
|
+
* The [Async as Reactive State](/guides/the-manual/reactivity/derivation) guide shows
|
|
8778
|
+
* how to use it in place of tracked loading and error state.
|
|
8779
|
+
*
|
|
8425
8780
|
* Repeat calls to `getPromiseState` with the same promise will return the same state object
|
|
8426
8781
|
* making is safe and easy to use in templates and JavaScript code to produce reactive
|
|
8427
8782
|
* behaviors around promises.
|
|
@@ -8471,15 +8826,18 @@ type PromiseState<T = unknown, E = unknown> = PendingPromise | ResolvedPromise<T
|
|
|
8471
8826
|
* If looking to use in a template, consider also the `<Await />` component.
|
|
8472
8827
|
*
|
|
8473
8828
|
* See also {@link PromiseState}
|
|
8829
|
+
*
|
|
8830
|
+
* @summary Returns a cached, reactive state object tracking whether a promise is pending, fulfilled, or
|
|
8831
|
+
* rejected, for use in JS or templates.
|
|
8474
8832
|
*/
|
|
8475
8833
|
declare function getPromiseState<T = unknown, E = unknown>(promise: Promise<T> | Awaitable<T, E>): Readonly<PromiseState<T, E>>;
|
|
8476
|
-
//#endregion
|
|
8477
|
-
//#region src/signals/request-state.d.ts
|
|
8478
8834
|
/**
|
|
8479
8835
|
* Lazily consumes the stream of a request, providing a number of
|
|
8480
8836
|
* reactive properties that can be used to build UIs that respond
|
|
8481
8837
|
* to the progress of a request.
|
|
8482
8838
|
*
|
|
8839
|
+
* @summary Reactive download progress for a request, such as bytes loaded and timing, built by lazily
|
|
8840
|
+
* reading its response stream.
|
|
8483
8841
|
* @hideconstructor
|
|
8484
8842
|
*/
|
|
8485
8843
|
declare class RequestLoadingState {
|
|
@@ -8699,9 +9057,11 @@ interface RejectedRequest<RT, E extends StructuredErrorDocument = StructuredErro
|
|
|
8699
9057
|
response: Response | ResponseInfo | null;
|
|
8700
9058
|
}
|
|
8701
9059
|
/**
|
|
8702
|
-
* The state of a request
|
|
8703
|
-
*
|
|
8704
|
-
* cancelled
|
|
9060
|
+
* The state of a request that was aborted before it settled.
|
|
9061
|
+
*
|
|
9062
|
+
* A cancelled request has `status: 'cancelled'` and its `reason` is an
|
|
9063
|
+
* `AbortError`. `isError` is also `true`, as for a {@link RejectedRequest},
|
|
9064
|
+
* so check `status` or `isCancelled` to tell the two apart.
|
|
8705
9065
|
*
|
|
8706
9066
|
*/
|
|
8707
9067
|
interface CancelledRequest<RT, E extends StructuredErrorDocument = StructuredErrorDocument> {
|
|
@@ -8835,11 +9195,33 @@ interface CancelledRequest<RT, E extends StructuredErrorDocument = StructuredErr
|
|
|
8835
9195
|
* - {@link RejectedRequest}
|
|
8836
9196
|
* - {@link CancelledRequest}
|
|
8837
9197
|
*
|
|
9198
|
+
* @summary The reactive pending, fulfilled, rejected, or cancelled state of a request `Future`, as
|
|
9199
|
+
* returned by `getRequestState`.
|
|
8838
9200
|
*/
|
|
8839
9201
|
type RequestState<RT = unknown, E extends StructuredErrorDocument = StructuredErrorDocument> = PendingRequest | ResolvedRequest<RT> | RejectedRequest<RT, E> | CancelledRequest<RT, E>;
|
|
8840
9202
|
/**
|
|
8841
9203
|
* `getRequestState` can be used in both JavaScript and Template contexts.
|
|
8842
9204
|
*
|
|
9205
|
+
* It returns a {@link RequestState}: a reactive object that updates as the
|
|
9206
|
+
* request advances. Calling it again with the same {@link Future} returns the
|
|
9207
|
+
* same object. Check `status` to narrow it to one of four states:
|
|
9208
|
+
*
|
|
9209
|
+
* - {@link PendingRequest} (`'pending'`) is the initial state, before the
|
|
9210
|
+
* request settles.
|
|
9211
|
+
* - {@link ResolvedRequest} (`'fulfilled'`) holds the response content on `value`.
|
|
9212
|
+
* - {@link RejectedRequest} (`'rejected'`) holds the error on `reason`.
|
|
9213
|
+
* - {@link CancelledRequest} (`'cancelled'`) is a request that was aborted.
|
|
9214
|
+
* `isError` is also `true` for a cancelled request, so check `status` or
|
|
9215
|
+
* `isCancelled` rather than `isError` if you handle it differently.
|
|
9216
|
+
*
|
|
9217
|
+
* Every state also exposes a {@link RequestLoadingState} on `loadingState`
|
|
9218
|
+
* for tracking the progress of the response stream.
|
|
9219
|
+
*
|
|
9220
|
+
* The [Reactive Control Flow](/guides/the-manual/reactivity/control-flow) guide shows
|
|
9221
|
+
* how to render request states with it, and
|
|
9222
|
+
* [Using The Response](/guides/the-manual/requests/using-the-response) covers the
|
|
9223
|
+
* `Future` it reads.
|
|
9224
|
+
*
|
|
8843
9225
|
* ```ts
|
|
8844
9226
|
* import { getRequestState } from '@warp-drive-mirror/ember';
|
|
8845
9227
|
*
|
|
@@ -8886,10 +9268,12 @@ type RequestState<RT = unknown, E extends StructuredErrorDocument = StructuredEr
|
|
|
8886
9268
|
* which offers a number of additional capabilities for requests *beyond* what
|
|
8887
9269
|
* `RequestState` provides.
|
|
8888
9270
|
*
|
|
9271
|
+
* @param future - the request {@link Future} to track, as returned by `store.request` or `requestManager.request`
|
|
9272
|
+
* @return the cached {@link RequestState} for `future`
|
|
9273
|
+
* @summary Returns a cached, reactive state object tracking a request `Future` through pending, success,
|
|
9274
|
+
* error, and cancellation.
|
|
8889
9275
|
*/
|
|
8890
9276
|
declare function getRequestState<RT, E>(future: Future<RT>): Readonly<RequestState<RT, StructuredErrorDocument<E>>>;
|
|
8891
|
-
//#endregion
|
|
8892
|
-
//#region src/signals/request-subscription.d.ts
|
|
8893
9277
|
/**
|
|
8894
9278
|
* A symbol used to dispose of a {@link RequestSubscription} when the
|
|
8895
9279
|
* component or context using it is torn down.
|
|
@@ -8898,16 +9282,25 @@ declare const DISPOSE: "(symbol) dispose";
|
|
|
8898
9282
|
/**
|
|
8899
9283
|
* The individual autorefresh strategies a {@link RequestSubscription}
|
|
8900
9284
|
* may combine, see {@link AutorefreshBehaviorCombos}.
|
|
9285
|
+
*
|
|
9286
|
+
* @summary One autorefresh trigger for a request subscription: on reconnecting (`online`), on a timer
|
|
9287
|
+
* (`interval`), or on store invalidation (`invalid`).
|
|
8901
9288
|
*/
|
|
8902
9289
|
type AutorefreshBehaviorType = "online" | "interval" | "invalid";
|
|
8903
9290
|
/**
|
|
8904
9291
|
* The value accepted by {@link SubscriptionArgs.autorefresh}: either a
|
|
8905
9292
|
* boolean, a single {@link AutorefreshBehaviorType}, or a comma-separated
|
|
8906
9293
|
* combination of up to three of them.
|
|
9294
|
+
*
|
|
9295
|
+
* @summary The accepted values for a request subscription's `autorefresh` option: a boolean or a
|
|
9296
|
+
* comma-separated mix of `online`, `interval`, and `invalid`.
|
|
8907
9297
|
*/
|
|
8908
9298
|
type AutorefreshBehaviorCombos = boolean | AutorefreshBehaviorType | `${AutorefreshBehaviorType},${AutorefreshBehaviorType}` | `${AutorefreshBehaviorType},${AutorefreshBehaviorType},${AutorefreshBehaviorType}`;
|
|
8909
9299
|
/**
|
|
8910
9300
|
* Utilities to assist in recovering from the error.
|
|
9301
|
+
*
|
|
9302
|
+
* @summary The online and visibility state plus a `retry` function that a request subscription exposes
|
|
9303
|
+
* for recovering from a failed request.
|
|
8911
9304
|
*/
|
|
8912
9305
|
interface RecoveryFeatures {
|
|
8913
9306
|
/**
|
|
@@ -8925,6 +9318,9 @@ interface RecoveryFeatures {
|
|
|
8925
9318
|
}
|
|
8926
9319
|
/**
|
|
8927
9320
|
* Utilities for keeping the request fresh
|
|
9321
|
+
*
|
|
9322
|
+
* @summary The online, visibility, and refreshing state plus `refresh`, `reload`, and `abort` functions a
|
|
9323
|
+
* request subscription exposes alongside successful content.
|
|
8928
9324
|
*/
|
|
8929
9325
|
interface ContentFeatures<RT> {
|
|
8930
9326
|
/**
|
|
@@ -8958,6 +9354,9 @@ interface ContentFeatures<RT> {
|
|
|
8958
9354
|
}
|
|
8959
9355
|
/**
|
|
8960
9356
|
* The args accepted by the `<Request />` component.
|
|
9357
|
+
*
|
|
9358
|
+
* @summary The arguments of the `<Request />` component: the request or query to run, autorefresh
|
|
9359
|
+
* options, and an optional store or subscription.
|
|
8961
9360
|
*/
|
|
8962
9361
|
interface RequestArgs<RT, E> extends SubscriptionArgs<RT, E> {
|
|
8963
9362
|
/**
|
|
@@ -8976,6 +9375,8 @@ interface RequestArgs<RT, E> extends SubscriptionArgs<RT, E> {
|
|
|
8976
9375
|
}
|
|
8977
9376
|
/**
|
|
8978
9377
|
* The args accepted by a {@link RequestSubscription}.
|
|
9378
|
+
*
|
|
9379
|
+
* @summary Options for a request subscription: the request or query to monitor and its autorefresh settings.
|
|
8979
9380
|
*/
|
|
8980
9381
|
interface SubscriptionArgs<RT, E> {
|
|
8981
9382
|
/**
|
|
@@ -9040,6 +9441,8 @@ interface RequestSubscription<RT, E> {
|
|
|
9040
9441
|
/**
|
|
9041
9442
|
* A reactive class
|
|
9042
9443
|
*
|
|
9444
|
+
* @summary Reactive subscription that monitors a request or query, tracking online, visibility and refresh state and
|
|
9445
|
+
* handling autorefresh, reload and retry.
|
|
9043
9446
|
* @hideconstructor
|
|
9044
9447
|
*/
|
|
9045
9448
|
declare class RequestSubscription<RT, E> {
|
|
@@ -9104,10 +9507,11 @@ declare class RequestSubscription<RT, E> {
|
|
|
9104
9507
|
/**
|
|
9105
9508
|
* Creates a {@link RequestSubscription}, the reactive class powering the
|
|
9106
9509
|
* `<Request />` component's autorefresh, retry, and refresh behaviors.
|
|
9510
|
+
*
|
|
9511
|
+
* @summary Creates a reactive subscription to a request or query that tracks its state and handles
|
|
9512
|
+
* autorefresh, retry, and refresh.
|
|
9107
9513
|
*/
|
|
9108
9514
|
declare function createRequestSubscription<RT, E>(store: Store$1 | RequestManager, args: SubscriptionArgs<RT, E>): RequestSubscription<RT, E>;
|
|
9109
|
-
//#endregion
|
|
9110
|
-
//#region src/signals/reactivity/internal.d.ts
|
|
9111
9515
|
interface Initializer {
|
|
9112
9516
|
value: () => unknown;
|
|
9113
9517
|
}
|
|
@@ -9229,6 +9633,5 @@ declare function peekInternalSignal(signals: SignalStore | undefined, key: strin
|
|
|
9229
9633
|
* signal, scheduling any of its consumers for re-render/re-computation.
|
|
9230
9634
|
*/
|
|
9231
9635
|
declare function notifyInternalSignal(signal: WarpDriveSignal | undefined): void;
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
//# sourceMappingURL=internal-BrqYbG_y.d.ts.map
|
|
9636
|
+
export { PrivateStore as $, STRUCTURED as $n, CacheCapabilitiesManager$1 as $t, Document as A, LegacyResourceQuery as An, CachePolicy as At, PrivateReactiveResource as B, HTTPMethod as Bn, createDeferred as Bt, getRequestState as C, Transformation as Cn, setRecordIdentifier as Ct, ResolvedPromise as D, BaseFinderOptions as Dn, ReactiveDataDocument as Dt, RejectedPromise as E, withDefaults as En, assertPrivateCapabilities as Et, PolicyConfig as F, CreateRequestOptions as Fn, withReactiveResponse as Ft, logGroup as G, ImmutableRequestInfo as Gn, GraphEdge as Gt, checkout as H, ImmutableCreateRequestOptions as Hn, peekGraph as Ht, parseCacheControl as I, DeleteRequestOptions as In, withResponseType as It, normalizeModelName as J, QueryRequestOptions as Jn, CollectionEdge as Jt, LegacyManyArray as K, ImmutableUpdateRequestOptions as Kn, ResourceEdge as Kt, Fetch as L, EnableHydration as Ln, Awaitable as Lt, useRecommendedStore as M, ModelSchema as Mn, StoreRequestContext as Mt, CacheControlValue as N, CacheOptions as Nn, StoreRequestInput as Nt, getPromiseState as O, FindAllOptions as On, ReactiveDocument as Ot, DefaultCachePolicy as P, ConstrainedRequestOptions as Pn, withBrand as Pt, CreateRecordProperties as Q, ResponseInfo as Qn, RelationshipDiff as Qt, instantiateRecord as R, FindRecordOptions$2 as Rn, getPromiseResult as Rt, ResolvedRequest as S, SchemaService$1 as Sn, recordIdentifierFor as St, PromiseState as T, registerDerivations as Tn, PrivateCacheCapabilitiesManager as Tt, commit as U, ImmutableDeleteRequestOptions as Un, isBelongsTo as Ut, ReactiveResource as V, IS_FUTURE as Vn, graphFor as Vt, log as W, ImmutableHeaders as Wn, Graph as Wt, ensureStringId as X, RequestContext as Xn, Cache as Xt, coerceId as Y, RemotelyAccessibleIdentifier as Yn, UpgradedMeta as Yt, constructResource as Z, RequestInfo as Zn, ChangedAttributesHash as Zt, CancelledRequest as _, SchemaService as _n, Context as _t, notifyInternalSignal as a, NotifyKeys as an, FetchError as ar, Request$1 as at, RequestLoadingState as b, ExtensionDef as bn, StoreMap as bt, AutorefreshBehaviorCombos as c, isRequestKey as cn, Deferred as cr, SaveRecordMutation as ct, DISPOSE as d, setIdentifierGenerationMethod as dn, ManagedRequestPriority as dr, LegacyQueryArray as dt, CacheOperation$1 as en, SkipCache as er, Store$1 as et, RecoveryFeatures as f, setIdentifierResetMethod as fn, NextFn as fr, LegacyLiveArray as ft, createRequestSubscription as g, RelationshipsSchema as gn, Checkout as gt, SubscriptionArgs as h, AttributesSchema as hn, ManagedArray as ht, makeInitializer as i, NotificationType as in, UpdateRequestOptions as ir, PrivateRequestStateService as it, StoreSetupOptions as j, QueryOptions as jn, CacheHandler as jt, ConfiguredStore as k, FindRecordOptions as kn, ReactiveErrorDocument as kt, AutorefreshBehaviorType as l, isResourceKey as ln, Future as lr, RecordArrayManager as lt, RequestSubscription as m, setKeyInfoForResource as mn, ReactiveResourceArray as mt, WarpDriveSignal as n, NotificationChannel as nn, StructuredDocument as nr, isPrivateStore as nt, peekInternalSignal as o, FieldValueIdentity as on, Context$1 as or, RequestCacheRequestState as ot, RequestArgs as p, setIdentifierUpdateMethod as pn, RequestManager as pr, PrivateReactiveResourceArray as pt, createLegacyManyArray as q, PostQueryRequestOptions as qn, ImplicitEdge as qt, getOrCreateInternalSignal as r, NotificationManager$1 as rn, StructuredErrorDocument as rr, FindRecordQuery as rt, withSignalStore as s, fieldValueIdentity as sn, CacheHandler$1 as sr, RequestStateService as st, SignalStore as t, DocumentCacheOperation$1 as tn, StructuredDataDocument as tr, assertPrivateStore as tt, ContentFeatures as u, setIdentifierForgetMethod as un, Handler as ur, fastPush as ut, PendingRequest as v, CAUTION_MEGA_DANGER_ZONE_Extension as vn, NativeProxy as vt, PendingPromise as w, fromIdentity as wn, storeFor as wt, RequestState as x, ProcessedExtension as xn, _clearCaches as xt, RejectedRequest as y, ExtensibleField as yn, InstanceCache as yt, teardownRecord as z, FindRecordRequestOptions as zn, setPromiseResult as zt };
|
|
9637
|
+
//# sourceMappingURL=internal-D_WIXC4r.d.ts.map
|