@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
package/dist/store/-private.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { CacheHandler, type CachePolicy, type LegacyQueryArray as CollectionRecordArray, type LegacyQueryArray, type CreateRecordProperties, type FindRecordQuery, type InstanceCache, type LegacyLiveArray, type LegacyLiveArray as LiveArray, type LegacyManyArray, type LegacyManyArray as RelatedCollection, type NativeProxy, type PrivateCacheCapabilitiesManager, type PrivateReactiveResourceArray, type PrivateRequestStateService, type PrivateStore, type ReactiveResourceArray, RecordArrayManager, type Request, type RequestCacheRequestState, type RequestStateService, type SaveRecordMutation, Store, StoreMap, type StoreRequestContext, type StoreRequestInput, _clearCaches, normalizeModelName as _deprecatingNormalize, assertPrivateCapabilities, assertPrivateStore, coerceId, constructResource, createLegacyManyArray, ensureStringId, fastPush, isPrivateStore, isRequestKey, isResourceKey, log, logGroup, recordIdentifierFor, setRecordIdentifier, storeFor };
|
|
1
|
+
import { $ as PrivateStore, At as CachePolicy, Ct as setRecordIdentifier, Et as assertPrivateCapabilities, G as logGroup, J as normalizeModelName, K as LegacyManyArray, Mt as StoreRequestContext, Nt as StoreRequestInput, Q as CreateRecordProperties, St as recordIdentifierFor, Tt as PrivateCacheCapabilitiesManager, W as log, X as ensureStringId, Y as coerceId, Z as constructResource, at as Request, bt as StoreMap, cn as isRequestKey, ct as SaveRecordMutation, dt as LegacyQueryArray, et as Store, ft as LegacyLiveArray, it as PrivateRequestStateService, jt as CacheHandler, ln as isResourceKey, lt as RecordArrayManager, mt as ReactiveResourceArray, nt as isPrivateStore, on as FieldValueIdentity, ot as RequestCacheRequestState, pt as PrivateReactiveResourceArray, q as createLegacyManyArray, rt as FindRecordQuery, sn as fieldValueIdentity, st as RequestStateService, tt as assertPrivateStore, ut as fastPush, vt as NativeProxy, wt as storeFor, xt as _clearCaches, yt as InstanceCache } from "../internal-D_WIXC4r.js";
|
|
2
|
+
export { CacheHandler, type CachePolicy, type LegacyQueryArray as CollectionRecordArray, type LegacyQueryArray, type CreateRecordProperties, type FieldValueIdentity, type FindRecordQuery, type InstanceCache, type LegacyLiveArray, type LegacyLiveArray as LiveArray, type LegacyManyArray, type LegacyManyArray as RelatedCollection, type NativeProxy, type PrivateCacheCapabilitiesManager, type PrivateReactiveResourceArray, type PrivateRequestStateService, type PrivateStore, type ReactiveResourceArray, RecordArrayManager, type Request, type RequestCacheRequestState, type RequestStateService, type SaveRecordMutation, Store, StoreMap, type StoreRequestContext, type StoreRequestInput, _clearCaches, normalizeModelName as _deprecatingNormalize, assertPrivateCapabilities, assertPrivateStore, coerceId, constructResource, createLegacyManyArray, ensureStringId, fastPush, fieldValueIdentity, isPrivateStore, isRequestKey, isResourceKey, log, logGroup, recordIdentifierFor, setRecordIdentifier, storeFor };
|
package/dist/store/-private.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as setRecordIdentifier, D as
|
|
1
|
+
import { C as setRecordIdentifier, D as isRequestKey, E as fieldValueIdentity, F as coerceId, I as ensureStringId, L as log, O as isResourceKey, P as normalizeModelName, R as logGroup, S as recordIdentifierFor, T as assertPrivateCapabilities, _ as isPrivateStore, b as StoreMap, f as createLegacyManyArray, g as assertPrivateStore, h as Store, m as CacheHandler, p as constructResource, v as RecordArrayManager, w as storeFor, x as _clearCaches, y as fastPush } from "../src-ccp1WKyt.js";
|
|
2
2
|
|
|
3
|
-
export { CacheHandler, RecordArrayManager, Store, StoreMap, _clearCaches, normalizeModelName as _deprecatingNormalize, assertPrivateCapabilities, assertPrivateStore, coerceId, constructResource, createLegacyManyArray, ensureStringId, fastPush, isPrivateStore, isRequestKey, isResourceKey, log, logGroup, recordIdentifierFor, setRecordIdentifier, storeFor };
|
|
3
|
+
export { CacheHandler, RecordArrayManager, Store, StoreMap, _clearCaches, normalizeModelName as _deprecatingNormalize, assertPrivateCapabilities, assertPrivateStore, coerceId, constructResource, createLegacyManyArray, ensureStringId, fastPush, fieldValueIdentity, isPrivateStore, isRequestKey, isResourceKey, log, logGroup, recordIdentifierFor, setRecordIdentifier, storeFor };
|
|
@@ -2,11 +2,14 @@ import { LRUCache } from "./utils/string.js";
|
|
|
2
2
|
import { getGlobalConfig, macroCondition } from "@embroider/macros";
|
|
3
3
|
import { deprecate } from "@ember/debug";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/store/-private/default-cache-policy.ts
|
|
6
6
|
/**
|
|
7
7
|
* Interface of a parsed Cache-Control header value.
|
|
8
8
|
*
|
|
9
9
|
* - [MDN Cache-Control Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)
|
|
10
|
+
*
|
|
11
|
+
* @summary The directives of a `Cache-Control` header as an object of flags and second counts, as
|
|
12
|
+
* returned by `parseCacheControl`.
|
|
10
13
|
*/
|
|
11
14
|
const NUMERIC_KEYS = /* @__PURE__ */ new Set([
|
|
12
15
|
"max-age",
|
|
@@ -38,6 +41,8 @@ const NUMERIC_KEYS = /* @__PURE__ */ new Set([
|
|
|
38
41
|
*
|
|
39
42
|
* See also {@link CacheControlValue} and [Response Directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#response_directives)
|
|
40
43
|
*
|
|
44
|
+
* @summary Parses a `Cache-Control` header string into a `CacheControlValue` object, caching results
|
|
45
|
+
* per header string.
|
|
41
46
|
* @public
|
|
42
47
|
*/
|
|
43
48
|
function parseCacheControl(header) {
|
|
@@ -173,6 +178,9 @@ function isExpired(cacheKey, request, config) {
|
|
|
173
178
|
/**
|
|
174
179
|
* The configuration options for the {@link DefaultCachePolicy}
|
|
175
180
|
*
|
|
181
|
+
* The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)
|
|
182
|
+
* guide shows a policy configured with them.
|
|
183
|
+
*
|
|
176
184
|
* ```ts [app/services/store.ts]
|
|
177
185
|
* import { Store } from '@warp-drive-mirror/core';
|
|
178
186
|
* import { DefaultCachePolicy } from '@warp-drive-mirror/core/store'; // [!code focus]
|
|
@@ -184,10 +192,15 @@ function isExpired(cacheKey, request, config) {
|
|
|
184
192
|
* }
|
|
185
193
|
* ```
|
|
186
194
|
*
|
|
195
|
+
* @summary Options for `DefaultCachePolicy`: soft and hard expiration times, header-based expiration
|
|
196
|
+
* constraints, and test-mode behavior.
|
|
187
197
|
*/
|
|
188
198
|
/**
|
|
189
199
|
* A basic {@link CachePolicy} that can be added to the Store service.
|
|
190
200
|
*
|
|
201
|
+
* The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)
|
|
202
|
+
* guide shows how to configure it.
|
|
203
|
+
*
|
|
191
204
|
* ```ts [app/services/store.ts]
|
|
192
205
|
* import { Store } from '@warp-drive-mirror/core';
|
|
193
206
|
* import { DefaultCachePolicy } from '@warp-drive-mirror/core/store'; // [!code focus]
|
|
@@ -266,6 +279,8 @@ function isExpired(cacheKey, request, config) {
|
|
|
266
279
|
* This behavior can be opted out of by setting `disableTestOptimization = true`
|
|
267
280
|
* in the policy config.
|
|
268
281
|
*
|
|
282
|
+
* @summary The built-in cache policy, which expires cached requests using expiration headers or time
|
|
283
|
+
* since the response `date`, and invalidates queries after matching creates.
|
|
269
284
|
* @public
|
|
270
285
|
*/
|
|
271
286
|
var DefaultCachePolicy = class {
|
|
@@ -457,6 +472,5 @@ var DefaultCachePolicy = class {
|
|
|
457
472
|
}
|
|
458
473
|
};
|
|
459
474
|
|
|
460
|
-
//#endregion
|
|
461
475
|
export { parseCacheControl as n, DefaultCachePolicy as t };
|
|
462
|
-
//# sourceMappingURL=store-
|
|
476
|
+
//# sourceMappingURL=store-C8iKKtQK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-C8iKKtQK.js","names":["deprecate","LRUCache","getGlobalConfig","macroCondition","NUMERIC_KEYS","Set","parseCacheControl","header","CACHE_CONTROL_CACHE","get","key","value","isParsingKey","cacheControlValue","i","length","char","charAt","WarpDrive","env","DEBUG","test","Error","has","parseCacheControlValue","stringToParse","parsedValue","Number","parseInt","isNaN","isExpired","cacheKey","request","config","constraints","result","activeLogging","LOG_CACHE_POLICY","debug","globalThis","getWarpDriveRuntimeConfig","console","log","lid","headers","response","now","Date","date","xWarpDriveExpires","expirationTime","getTime","cacheControl","age","maxAge","ageValue","dateValue","Expires","expires","apiCacheHardExpires","TESTING","disableTestOptimization","apiCacheSoftExpires","time","deadline","DefaultCachePolicy","_getStore","store","set","_stores","invalidated","types","Map","constructor","WeakMap","_config","arguments","id","since","enabled","available","for","until","invalidateRequest","add","invalidateRequestsForType","type","storeCache","notifications","forEach","notify","didRequest","op","statusNumber","status","records","map","r","additionalTypes","cacheOptions","delete","isHardExpired","cache","cached","peekRequest","isSoftExpired"],"sources":["../src/store/-private/default-cache-policy.ts"],"sourcesContent":["import { deprecate } from '@ember/debug';\n\nimport { LOG_CACHE_POLICY } from '@warp-drive-mirror/core/build-config/debugging';\nimport { TESTING } from '@warp-drive-mirror/core/build-config/env';\nimport { assert } from '@warp-drive-mirror/core/build-config/macros';\n\n// oxlint-disable-next-line no-unused-vars\nimport type { CacheHandler, CachePolicy } from '../-private';\n// oxlint-disable-next-line no-unused-vars\nimport type { Fetch } from '../../request/-private/fetch';\nimport type { Cache } from '../../types/cache';\nimport type { RequestKey, ResourceKey } from '../../types/identifier';\nimport type {\n // oxlint-disable-next-line no-unused-vars\n CacheOptions,\n ImmutableRequestInfo,\n // oxlint-disable-next-line no-unused-vars\n RequestInfo,\n ResponseInfo,\n StructuredDocument,\n} from '../../types/request';\nimport type { ResourceDocument } from '../../types/spec/document';\nimport { LRUCache } from '../../utils/string';\n\ntype UnsubscribeToken = object;\ntype CacheOperation = 'added' | 'removed' | 'updated' | 'state';\ntype DocumentCacheOperation = 'invalidated' | 'added' | 'removed' | 'updated' | 'state';\n\nexport interface NotificationCallback {\n (resourceKey: ResourceKey, notificationType: 'attributes' | 'relationships', key?: string): void;\n (resourceKey: ResourceKey, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;\n // (resourceKey: ResourceKey, notificationType: NotificationType, key?: string): void;\n}\n\ninterface ResourceOperationCallback {\n // resource updates\n (resourceKey: ResourceKey, notificationType: CacheOperation): void;\n}\n\ninterface DocumentOperationCallback {\n // document updates\n (cacheKey: RequestKey, notificationType: DocumentCacheOperation): void;\n}\n\ntype NotificationManager = {\n subscribe(resourceKey: ResourceKey, callback: NotificationCallback): UnsubscribeToken;\n subscribe(cacheKey: 'resource', callback: ResourceOperationCallback): UnsubscribeToken;\n subscribe(cacheKey: 'document' | RequestKey, callback: DocumentOperationCallback): UnsubscribeToken;\n\n notify(cacheKey: ResourceKey, value: 'attributes' | 'relationships', key?: string): boolean;\n notify(cacheKey: ResourceKey, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;\n notify(cacheKey: ResourceKey, value: CacheOperation): boolean;\n notify(cacheKey: RequestKey, value: DocumentCacheOperation): boolean;\n};\n\ntype Store = {\n cache: Cache;\n notifications: NotificationManager;\n};\n\n/**\n * Interface of a parsed Cache-Control header value.\n *\n * - [MDN Cache-Control Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)\n *\n * @summary The directives of a `Cache-Control` header as an object of flags and second counts, as\n * returned by `parseCacheControl`.\n */\nexport interface CacheControlValue {\n /** Indicates the response will never change; parsed but not currently used by this cache policy's expiration logic. */\n immutable?: boolean;\n /** Seconds since the response's `Date` that it is considered fresh; combined with the `Age` header to determine expiration. */\n 'max-age'?: number;\n /** Indicates a stale response must be revalidated before use; parsed but not currently used by this cache policy's expiration logic. */\n 'must-revalidate'?: boolean;\n /** Indicates the client must understand the response's status code semantics before caching; parsed but not currently used by this cache policy's expiration logic. */\n 'must-understand'?: boolean;\n /** Indicates the response must be revalidated before being reused from cache; parsed but not currently used by this cache policy's expiration logic. */\n 'no-cache'?: boolean;\n /** Indicates the response must not be stored in any cache; parsed but not currently used by this cache policy's expiration logic. */\n 'no-store'?: boolean;\n /** Indicates the response must not be transformed by intermediaries; parsed but not currently used by this cache policy's expiration logic. */\n 'no-transform'?: boolean;\n /** Indicates only an already-cached response should be used; parsed but not currently used by this cache policy's expiration logic. */\n 'only-if-cached'?: boolean;\n /** Indicates the response is intended for a single user and should not be stored by shared caches; parsed but not currently used by this cache policy's expiration logic. */\n private?: boolean;\n /** Like `must-revalidate` but only for shared caches; parsed but not currently used by this cache policy's expiration logic. */\n 'proxy-revalidate'?: boolean;\n /** Indicates the response may be stored by any cache; parsed but not currently used by this cache policy's expiration logic. */\n public?: boolean;\n /** Seconds since the response's `Date` that it is considered fresh for shared caches; used as a fallback for `max-age` when determining expiration. */\n 's-maxage'?: number;\n /** Seconds a stale response may be reused if an error occurs while revalidating; parsed but not currently used by this cache policy's expiration logic. */\n 'stale-if-error'?: number;\n /** Seconds a stale response may be reused while a revalidation happens in the background; parsed but not currently used by this cache policy's expiration logic. */\n 'stale-while-revalidate'?: number;\n}\n\ntype CacheControlKey = keyof CacheControlValue;\n\nconst NUMERIC_KEYS = new Set(['max-age', 's-maxage', 'stale-if-error', 'stale-while-revalidate']);\n\n/**\n * Parses a string Cache-Control header value into an object with the following structure:\n *\n * ```ts\n * interface CacheControlValue {\n * immutable?: boolean;\n * 'max-age'?: number;\n * 'must-revalidate'?: boolean;\n * 'must-understand'?: boolean;\n * 'no-cache'?: boolean;\n * 'no-store'?: boolean;\n * 'no-transform'?: boolean;\n * 'only-if-cached'?: boolean;\n * private?: boolean;\n * 'proxy-revalidate'?: boolean;\n * public?: boolean;\n * 's-maxage'?: number;\n * 'stale-if-error'?: number;\n * 'stale-while-revalidate'?: number;\n * }\n * ```\n *\n * See also {@link CacheControlValue} and [Response Directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#response_directives)\n *\n * @summary Parses a `Cache-Control` header string into a `CacheControlValue` object, caching results\n * per header string.\n * @public\n */\nexport function parseCacheControl(header: string): CacheControlValue {\n return CACHE_CONTROL_CACHE.get(header);\n}\n\nconst CACHE_CONTROL_CACHE = new LRUCache((header: string) => {\n let key: CacheControlKey = '' as CacheControlKey;\n let value = '';\n let isParsingKey = true;\n const cacheControlValue: CacheControlValue = {};\n\n for (let i = 0; i < header.length; i++) {\n const char = header.charAt(i);\n if (char === ',') {\n assert(`Invalid Cache-Control value, expected a value`, !isParsingKey || !NUMERIC_KEYS.has(key));\n assert(\n `Invalid Cache-Control value, expected a value after \"=\" but got \",\"`,\n i === 0 || header.charAt(i - 1) !== '='\n );\n isParsingKey = true;\n // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n key = '' as CacheControlKey;\n value = '';\n continue;\n } else if (char === '=') {\n assert(`Invalid Cache-Control value, expected a value after \"=\"`, i + 1 !== header.length);\n isParsingKey = false;\n } else if (char === ' ' || char === `\\t` || char === `\\n`) {\n continue;\n } else if (isParsingKey) {\n key += char;\n } else {\n value += char;\n }\n\n if (i === header.length - 1) {\n // @ts-expect-error TS incorrectly thinks that optional keys must have a type that includes undefined\n cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;\n }\n }\n\n return cacheControlValue;\n}, 200);\n\nfunction parseCacheControlValue(stringToParse: string): number {\n const parsedValue = Number.parseInt(stringToParse);\n assert(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`, !Number.isNaN(parsedValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${stringToParse}`, parsedValue >= 0);\n if (Number.isNaN(parsedValue) || parsedValue < 0) {\n return 0;\n }\n\n return parsedValue;\n}\n\nfunction isExpired(cacheKey: RequestKey, request: StructuredDocument<ResourceDocument>, config: PolicyConfig): boolean {\n const { constraints } = config;\n\n if (constraints?.isExpired) {\n const result = constraints.isExpired(request);\n if (result !== null) {\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because constraints.isExpired returned ${result}`\n );\n }\n return result;\n }\n }\n\n const { headers } = request.response!;\n\n if (!headers) {\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no headers were provided`);\n }\n\n // if we have no headers then both the headers based expiration\n // and the time based expiration will be considered expired\n return true;\n }\n\n // check for X-WarpDrive-Expires\n const now = Date.now();\n const date = headers.get('Date');\n\n if (constraints?.headers) {\n if (constraints.headers['X-WarpDrive-Expires']) {\n const xWarpDriveExpires = headers.get('X-WarpDrive-Expires');\n if (xWarpDriveExpires) {\n const expirationTime = new Date(xWarpDriveExpires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by X-WarpDrive-Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n\n // check for Cache-Control\n if (constraints.headers['Cache-Control']) {\n const cacheControl = headers.get('Cache-Control');\n const age = headers.get('Age');\n\n if (cacheControl && age && date) {\n const cacheControlValue = parseCacheControl(cacheControl);\n\n // max-age and s-maxage are stored in\n const maxAge = cacheControlValue['max-age'] || cacheControlValue['s-maxage'];\n\n if (maxAge) {\n // age is stored in seconds\n const ageValue = parseInt(age, 10);\n assert(`Invalid Cache-Control value, expected a number but got - ${age}`, !Number.isNaN(ageValue));\n assert(`Invalid Cache-Control value, expected a number greater than 0 but got - ${age}`, ageValue >= 0);\n\n if (!Number.isNaN(ageValue) && ageValue >= 0) {\n const dateValue = new Date(date).getTime();\n const expirationTime = dateValue + (maxAge - ageValue) * 1000;\n const result = now >= expirationTime;\n\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Cache-Control header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n }\n }\n }\n }\n\n // check for Expires\n if (constraints.headers.Expires) {\n const expires = headers.get('Expires');\n if (expires) {\n const expirationTime = new Date(expires).getTime();\n const result = now >= expirationTime;\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the time set by Expires header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n return result;\n }\n }\n }\n\n // check for Date\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no Date header was provided`);\n }\n return true;\n }\n\n let expirationTime = config.apiCacheHardExpires;\n if (TESTING) {\n if (!config.disableTestOptimization) {\n expirationTime = config.apiCacheSoftExpires;\n }\n }\n\n const time = new Date(date).getTime();\n const deadline = time + expirationTime;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'EXPIRED' : 'NOT expired'} because the apiCacheHardExpires time since the response's Date header is ${result ? 'in the past' : 'in the future'}`\n );\n }\n\n return result;\n}\n\n/**\n * The constraint options for {@link PolicyConfig.constraints}\n */\nexport interface PolicyConfigConstraints {\n /**\n * Headers that should be checked for expiration.\n *\n */\n headers?: {\n /**\n * Whether the `Cache-Control` header should be checked for expiration.\n * If `true`, then the `max-age` and `s-maxage` directives are used alongside\n * the `Age` and `Date` headers to determine if the expiration time has passed.\n *\n * Other directives are ignored.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present\n * and both configured to be checked.\n *\n */\n 'Cache-Control'?: boolean;\n\n /**\n * Whether the `Expires` header should be checked for expiration.\n *\n * If `true`, then the `Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * 'Cache-Control' will take precedence over 'Expires' if both are present.\n *\n */\n Expires?: boolean;\n\n /**\n * Whether the `X-WarpDrive-Expires` header should be checked for expiration.\n *\n * If `true`, then the `X-WarpDrive-Expires` header is used to caclulate the expiration time\n * and determine if the expiration time has passed.\n *\n * This header will take precedence over 'Cache-Control' and 'Expires' if all three are present.\n *\n * The header's value should be a [UTC date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString).\n *\n */\n 'X-WarpDrive-Expires'?: boolean;\n };\n\n /**\n * A function that should be called to determine if the request is expired.\n *\n * If present, this function will be called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * If the function does not return `null`,\n *\n */\n isExpired?: (request: StructuredDocument<ResourceDocument>) => boolean | null;\n}\n\n/**\n * The configuration options for the {@link DefaultCachePolicy}\n *\n * The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)\n * guide shows a policy configured with them.\n *\n * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive-mirror/core';\n * import { DefaultCachePolicy } from '@warp-drive-mirror/core/store'; // [!code focus]\n *\n * export default class AppStore extends Store {\n * lifetimes = new DefaultCachePolicy({ // [!code focus:3]\n * // ... PolicyConfig Settings ... //\n * });\n * }\n * ```\n *\n * @summary Options for `DefaultCachePolicy`: soft and hard expiration times, header-based expiration\n * constraints, and test-mode behavior.\n */\nexport interface PolicyConfig {\n /**\n * the number of milliseconds after which a request is considered\n * stale. If a request is issued again after this time, the request\n * will respond from cache immediately while a background request\n * is made to update the cache.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the {@link Fetch} handler\n * will automatically add it to responses if it is not present. Responses\n * without a `date` header will be considered stale immediately.\n *\n */\n apiCacheSoftExpires: number;\n /**\n * the number of milliseconds after which a request is considered\n * expired and should be re-fetched. If a request is issued again\n * after this time, the request will disregard the cache and\n * wait for a fresh response from the API.\n *\n * This is calculated against the `date` header of the response.\n *\n * If your API does not provide a `date` header, the {@link Fetch} handler\n * will automatically add it to responses if it is not present. Responses\n * without a `date` header will be considered hard expired immediately.\n *\n */\n apiCacheHardExpires: number;\n /**\n * In Testing environments, the `apiCacheSoftExpires` will always be `false`\n * and `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set {@link RequestInfo.cacheOptions.backgroundReload | cacheOptions.backgroundReload }\n * will still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting this value to `true`.\n *\n */\n disableTestOptimization?: boolean;\n\n /**\n * In addition to the simple time-based expiration strategy, CachePolicy\n * supports various common server-supplied expiration strategies via\n * headers, as well as custom expiration strategies via the {@link PolicyConfigConstraints.isExpired | isExpired}\n * function.\n *\n * Requests will be validated for expiration against these constraints.\n * If any of these constraints are not met, the request will be considered\n * expired. If all constraints are met, the request will be considered\n * valid and the time based expiration strategy will NOT be used.\n *\n * Meeting a constraint means BOTH that the properties the constraint\n * requires are present AND that the expiration time indicated by those\n * properties has not been exceeded.\n *\n * In other words, if the properties for a constraint are not present,\n * this does not count either as meeting or as not meeting the constraint,\n * the constraint simply does not apply.\n *\n * The `isExpired` function is called with the request and should return\n * `true` if the request is expired, `false` if it is not expired, and\n * `null` if the expiration status is unknown.\n *\n * In order constraints are checked:\n *\n * - isExpired function\n * - ↳ (if null) X-WarpDrive-Expires header\n * - ↳ (if null) Cache-Control header\n * - ↳ (if null) Expires header\n *\n * See {@link PolicyConfigConstraints} for configuration options.\n */\n constraints?: PolicyConfigConstraints;\n}\n\n/**\n * A basic {@link CachePolicy} that can be added to the Store service.\n *\n * The [Advanced Store Configuration](/guides/configuration/advanced#decide-how-long-requests-are-valid-for-with-a-cachepolicy)\n * guide shows how to configure it.\n *\n * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive-mirror/core';\n * import { DefaultCachePolicy } from '@warp-drive-mirror/core/store'; // [!code focus]\n *\n * export default class AppStore extends Store {\n * lifetimes = new DefaultCachePolicy({ // [!code focus:5]\n * apiCacheSoftExpires: 30_000,\n * apiCacheHardExpires: 60_000,\n * // ... Other PolicyConfig Settings ... //\n * });\n * }\n * ```\n *\n * :::tip 💡 TIP\n * Date headers do not have millisecond precision, so expiration times should\n * generally be larger than 1000ms.\n * :::\n *\n * See also {@link PolicyConfig} for configuration options.\n *\n * ### The Mechanics\n *\n * This policy determines staleness based on various configurable constraints falling back to a simple\n * check of the time elapsed since the request was last received from the API using the `date` header\n * from the last response.\n *\n * :::tip 💡 TIP\n * The {@link Fetch} handler provided by `@warp-drive-mirror/core` will automatically\n * add the `date` header to responses if it is not present.\n * :::\n *\n * - For manual override of reload see {@link CacheOptions.reload | cacheOptions.reload}\n * - For manual override of background reload see {@link CacheOptions.backgroundReload | cacheOptions.backgroundReload}\n *\n * In order expiration is determined by:\n *\n * ```md\n * Is explicitly invalidated by `cacheOptions.reload`\n * ↳ (if falsey) if the request has been explicitly invalidated\n * since the last request (see Automatic Invalidation below)\n * ↳ (if false) (If Active) isExpired function\n * ↳ (if null) (If Active) X-WarpDrive-Expires header\n * ↳ (if null) (If Active) Cache-Control header\n * ↳ (if null) (If Active) Expires header\n * ↳ (if null) Date header + apiCacheHardExpires < current time\n *\n * -- <if above is false, a background request is issued if> --\n *\n * ↳ is invalidated by `cacheOptions.backgroundReload`\n * ↳ (if falsey) Date header + apiCacheSoftExpires < current time\n * ```\n *\n * ### Automatic Invalidation / Entanglement\n *\n * It also invalidates any request with an {@link RequestInfo.op | OpCode} of `\"query\"`\n * for which {@link CacheOptions.types | cacheOptions.types} was provided\n * when a request with an `OpCode` of `\"createRecord\"` is successful and also includes\n * a matching type in its own `cacheOptions.types` array.\n\n * :::tip 💡 TIP\n * Abstracting this behavior via builders is recommended to ensure consistency.\n * :::\n *\n * ### Testing\n *\n * In Testing environments:\n *\n * - `apiCacheSoftExpires` will always be `false`\n * - `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.\n *\n * This helps reduce flakiness and produce predictably rendered results in test suites.\n *\n * Requests that specifically set `cacheOptions.backgroundReload = true` will\n * still be background reloaded in tests.\n *\n * This behavior can be opted out of by setting `disableTestOptimization = true`\n * in the policy config.\n *\n * @summary The built-in cache policy, which expires cached requests using expiration headers or time\n * since the response `date`, and invalidates queries after matching creates.\n * @public\n */\nexport class DefaultCachePolicy implements CachePolicy {\n /**\n * @internal\n */\n declare private config: PolicyConfig;\n /**\n * @internal\n */\n declare private _stores: WeakMap<Store, { invalidated: Set<RequestKey>; types: Map<string, Set<RequestKey>> }>;\n\n /**\n * @internal\n */\n private _getStore(store: Store): {\n invalidated: Set<RequestKey>;\n types: Map<string, Set<RequestKey>>;\n } {\n let set = this._stores.get(store);\n if (!set) {\n set = { invalidated: new Set(), types: new Map() };\n this._stores.set(store, set);\n }\n return set;\n }\n\n constructor(config: PolicyConfig) {\n this._stores = new WeakMap();\n\n const _config = arguments.length === 1 ? config : (arguments[1] as unknown as PolicyConfig);\n deprecate(\n `Passing a Store to the CachePolicy is deprecated, please pass only a config instead.`,\n arguments.length === 1,\n {\n id: 'ember-data-mirror:request-utils:lifetimes-service-store-arg',\n since: {\n enabled: '5.4',\n available: '4.13',\n },\n for: '@ember-data-mirror/request-utils',\n until: '6.0',\n }\n );\n assert(`You must pass a config to the CachePolicy`, _config);\n assert(`You must pass a apiCacheSoftExpires to the CachePolicy`, typeof _config.apiCacheSoftExpires === 'number');\n assert(`You must pass a apiCacheHardExpires to the CachePolicy`, typeof _config.apiCacheHardExpires === 'number');\n this.config = _config;\n }\n\n /**\n * Invalidate a request by its CacheKey for the given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * ```ts\n * store.lifetimes.invalidateRequest(store, cacheKey);\n * ```\n *\n * @public\n */\n invalidateRequest(cacheKey: RequestKey, store: Store): void {\n this._getStore(store).invalidated.add(cacheKey);\n }\n\n /**\n * Invalidate all requests associated to a specific type\n * for a given store instance.\n *\n * While the store argument may seem redundant, the CachePolicy\n * is designed to be shared across multiple stores / forks\n * of the store.\n *\n * This invalidation is done automatically when using this service\n * for both the {@link CacheHandler} and the [NetworkHandler](/api/@warp-drive-mirror/legacy/compat/variables/LegacyNetworkHandler).\n *\n * ```ts\n * store.lifetimes.invalidateRequestsForType(store, 'person');\n * ```\n *\n * @public\n */\n invalidateRequestsForType(type: string, store: Store): void {\n const storeCache = this._getStore(store);\n const set = storeCache.types.get(type);\n const notifications = store.notifications;\n\n if (set) {\n // TODO batch notifications\n set.forEach((id) => {\n storeCache.invalidated.add(id);\n // @ts-expect-error\n notifications.notify(id, 'invalidated', null);\n });\n }\n }\n\n /**\n * Invoked when a request has been fulfilled from the configured request handlers.\n * This is invoked by the CacheHandler for both foreground and background requests\n * once the cache has been updated.\n *\n * Note, this is invoked by the {@link CacheHandler} regardless of whether\n * the request has a cache-key.\n *\n * This method should not be invoked directly by consumers.\n *\n * @public\n */\n didRequest(\n request: ImmutableRequestInfo,\n response: Response | ResponseInfo | null,\n cacheKey: RequestKey | null,\n store: Store\n ): void {\n // if this is a successful createRecord request, invalidate the cacheKey for the type\n if (request.op === 'createRecord') {\n const statusNumber = response?.status ?? 0;\n if (statusNumber >= 200 && statusNumber < 400) {\n const types = new Set(request.records?.map((r) => r.type));\n const additionalTypes = request.cacheOptions?.types;\n additionalTypes?.forEach((type) => {\n types.add(type);\n });\n\n types.forEach((type) => {\n this.invalidateRequestsForType(type, store);\n });\n }\n\n // add this document's cacheKey to a map for all associated types\n // it is recommended to only use this for queries\n } else if (cacheKey && request.cacheOptions?.types?.length) {\n const storeCache = this._getStore(store);\n request.cacheOptions?.types.forEach((type) => {\n const set = storeCache.types.get(type);\n if (set) {\n set.add(cacheKey);\n storeCache.invalidated.delete(cacheKey);\n } else {\n storeCache.types.set(type, new Set([cacheKey]));\n }\n });\n }\n }\n\n /**\n * Invoked to determine if the request may be fulfilled from cache\n * if possible.\n *\n * Note, this is only invoked by the {@link CacheHandler} if the request has\n * a cache-key.\n *\n * If no cache entry is found or the entry is hard expired,\n * the request will be fulfilled from the configured request handlers\n * and the cache will be updated before returning the response.\n *\n * @public\n * @return true if the request is considered hard expired\n */\n isHardExpired(cacheKey: RequestKey, store: Store): boolean {\n // if we are explicitly invalidated, we are hard expired\n const storeCache = this._getStore(store);\n if (storeCache.invalidated.has(cacheKey)) {\n return true;\n }\n const cache = store.cache;\n const cached = cache.peekRequest(cacheKey);\n\n if (!cached?.response) {\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no cache entry was found`);\n }\n return true;\n }\n\n return isExpired(cacheKey, cached, this.config);\n }\n\n /**\n * Invoked if `isHardExpired` is false to determine if the request\n * should be update behind the scenes if cache data is already available.\n *\n * Note, this is only invoked by the {@link CacheHandler} if the request has\n * a cache-key.\n *\n * If true, the request will be fulfilled from cache while a backgrounded\n * request is made to update the cache via the configured request handlers.\n *\n * @public\n * @return true if the request is considered soft expired\n */\n isSoftExpired(cacheKey: RequestKey, store: Store): boolean {\n if (TESTING) {\n if (!this.config.disableTestOptimization) {\n return false;\n }\n }\n const cache = store.cache;\n const cached = cache.peekRequest(cacheKey);\n\n if (cached?.response) {\n const date = cached.response.headers.get('date');\n\n if (!date) {\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is STALE because no date header was found`);\n }\n return true;\n } else {\n const time = new Date(date).getTime();\n const now = Date.now();\n const deadline = time + this.config.apiCacheSoftExpires;\n const result = now >= deadline;\n\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(\n `CachePolicy: ${cacheKey.lid} is ${result ? 'STALE' : 'NOT stale'}. Expiration time: ${deadline}, now: ${now}`\n );\n }\n\n return result;\n }\n }\n\n if (LOG_CACHE_POLICY) {\n // oxlint-disable-next-line no-console\n console.log(`CachePolicy: ${cacheKey.lid} is STALE because no cache entry was found`);\n }\n\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAqGA,MAAMI,+BAAe,IAAIC,IAAI;CAAC;CAAW;CAAY;CAAkB;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otificationManager } from "./internal-D_WIXC4r.js";
|
|
2
2
|
export { type CacheControlValue, DefaultCachePolicy, type NotificationManager, type PolicyConfig, parseCacheControl };
|
package/dist/store.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
//#region src/types/symbols.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Symbol used internally to stash a reference to the owning
|
|
4
3
|
* {@link Store} on a record instance.
|
|
5
4
|
*
|
|
5
|
+
* @summary Internal symbol key under which a record instance keeps a reference to the store that owns it.
|
|
6
6
|
* @type {Symbol}
|
|
7
7
|
*/
|
|
8
8
|
declare const RecordStore: "___(unique) Symbol(Store)";
|
|
@@ -42,6 +42,8 @@ declare const RecordStore: "___(unique) Symbol(Store)";
|
|
|
42
42
|
* If used, `attr<Transform>('name')` will enforce
|
|
43
43
|
* that the name is the same as the transform name.
|
|
44
44
|
*
|
|
45
|
+
* @summary Symbol key that brands a record with its resource type for TypeScript, and names a derivation or
|
|
46
|
+
* transformation when it is registered.
|
|
45
47
|
* @type {Symbol}
|
|
46
48
|
*/
|
|
47
49
|
declare const Type: "___(unique) Symbol($type)";
|
|
@@ -56,6 +58,8 @@ declare const Type: "___(unique) Symbol($type)";
|
|
|
56
58
|
* take advantage of this to provide better type
|
|
57
59
|
* safety and intellisense.
|
|
58
60
|
*
|
|
61
|
+
* @summary Alias of the `Type` symbol that a record type can declare to tell WarpDrive APIs its resource type for
|
|
62
|
+
* better type inference.
|
|
59
63
|
* @type {Symbol}
|
|
60
64
|
*/
|
|
61
65
|
declare const ResourceType: "___(unique) Symbol($type)";
|
|
@@ -73,6 +77,8 @@ declare const ResourceType: "___(unique) Symbol($type)";
|
|
|
73
77
|
* If used, `attr<Transform>('name')` will enforce
|
|
74
78
|
* that the name is the same as the transform name.
|
|
75
79
|
*
|
|
80
|
+
* @summary Alias of the `Type` symbol that a legacy transform can declare so `attr<Transform>('name')` checks the
|
|
81
|
+
* transform name at the type level.
|
|
76
82
|
* @type {Symbol}
|
|
77
83
|
*/
|
|
78
84
|
declare const TransformName: "___(unique) Symbol($type)";
|
|
@@ -80,9 +86,10 @@ declare const TransformName: "___(unique) Symbol($type)";
|
|
|
80
86
|
* Symbol for use by builders to indicate the return type
|
|
81
87
|
* generic to use for store.request()
|
|
82
88
|
*
|
|
89
|
+
* @summary Type-only symbol key that request builders set on the request they return so `store.request()` can
|
|
90
|
+
* infer the response type.
|
|
83
91
|
* @type {Symbol}
|
|
84
92
|
*/
|
|
85
93
|
declare const RequestSignature: "___(unique) Symbol(RequestSignature)";
|
|
86
|
-
//#endregion
|
|
87
94
|
export { Type as a, TransformName as i, RequestSignature as n, ResourceType as r, RecordStore as t };
|
|
88
|
-
//# sourceMappingURL=symbols-
|
|
95
|
+
//# sourceMappingURL=symbols-DVa1PMFG.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols-DVa1PMFG.d.ts","names":[],"sources":["../src/types/symbols.ts"],"mappings":";;;;;;;cAiBa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0CA;;;;;;;;;;;;;;;;cAiBA;;;;;;;;;;;;;;;;;;;cAoBA;;;;;;;;;cAUA"}
|
package/dist/types/-private.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types/-private.d.ts
|
|
2
1
|
type UniversalTransientKey = "REQ_ID";
|
|
3
2
|
type UniversalKey = `(transient) ${UniversalTransientKey}` | "RequestMap" | "PromiseCache" | "RequestCache" | "SkipCache" | "EnableHydration" | "WarpDriveRuntimeConfig";
|
|
4
3
|
type TransientKey = "transactionRef" | "configuredGenerationMethod" | "configuredUpdateMethod" | "configuredForgetMethod" | "configuredResetMethod" | "configuredKeyInfoMethod" | "signalHooks";
|
|
@@ -71,5 +70,5 @@ export declare function peekUniversalTransient<T>(key: UniversalTransientKey): T
|
|
|
71
70
|
* @private
|
|
72
71
|
*/
|
|
73
72
|
export declare function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T;
|
|
74
|
-
|
|
73
|
+
export {};
|
|
75
74
|
//# sourceMappingURL=-private.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"-private.d.ts","names":[],"sources":["../../src/types/-private.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"-private.d.ts","names":[],"sources":["../../src/types/-private.ts"],"mappings":"A,KAcK;KAIA,8BACc;KAWd;KAWA,2BACc;KA8Gd,aAAa,0CAA0C;KACvD,eAAe,GAAG,oBAAoB,mBAAmB,aAAa,KAAK;;;;;;;;;;;;;;;;;;wBAmBhE,eAAe,GAAG,UAAU,WAAW,KAAK,GAAG,OAAO,IAAI,eAAe,GAAG;;;;;;;;;;;;wBAwB5E,cAAc,GAAG,KAAK,eAAe;;;;;;;;;wBAarC,aAAa,GAAG,KAAK,cAAc,OAAO,IAAI;;;;;;;;;;;wBAe9C,kBAAkB,GAAG,UAAU,cAAc,KAAK,GAAG,OAAO,IAAI,eAAe,GAAG;;;;;;;;wBAoBlF,uBAAuB,GAAG,KAAK,wBAAwB;;;;;;;;wBAYvD,sBAAsB,GAAG,KAAK,uBAAuB,OAAO,IAAI"}
|
package/dist/types/-private.js
CHANGED
|
@@ -1,3 +1,116 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getGlobalConfig, macroCondition } from "@embroider/macros";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/types/-private.ts
|
|
4
|
+
const name = "@warp-drive-mirror/core";
|
|
5
|
+
const version = "5.10.0-alpha.21";
|
|
6
|
+
const GlobalRef = globalThis;
|
|
7
|
+
const UniversalCache = GlobalRef.__warpDrive_universalCache = GlobalRef.__warpDrive_universalCache ?? {};
|
|
8
|
+
GlobalRef[name] = GlobalRef[name] ?? { __version: version };
|
|
9
|
+
const GlobalSink = GlobalRef[name];
|
|
10
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.DEBUG)) {
|
|
11
|
+
if (GlobalSink.__version !== version) throw new Error("Multiple versions of WarpDrive detected, the application will malfunction.");
|
|
12
|
+
}
|
|
13
|
+
const ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? {};
|
|
14
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
15
|
+
if (!GlobalSink.__warpDrive_ModuleScopedCaches) GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;
|
|
16
|
+
else console.warn(`
|
|
17
|
+
Multiple copies of WarpDrive have been detected. This may be due to a bug in ember-auto-import
|
|
18
|
+
in which test assets get their own copy of some v2-addons. This can cause the application to
|
|
19
|
+
malfunction as each copy will maintain its own separate state.`);
|
|
20
|
+
} else {
|
|
21
|
+
if (GlobalSink.__warpDrive_hasOtherCopy) throw new Error("Multiple copies of WarpDrive detected, the application will malfunction.");
|
|
22
|
+
GlobalSink.__warpDrive_hasOtherCopy = true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Coordinates creation of a singleton `value` (e.g. a symbol, WeakMap, or
|
|
26
|
+
* error class) for `key` so that duplicate copies of this package loaded
|
|
27
|
+
* into the same process observe the same instance instead of each creating
|
|
28
|
+
* their own.
|
|
29
|
+
*
|
|
30
|
+
* In `TESTING` builds this stores/reads `value` from a cache namespaced to
|
|
31
|
+
* this package's name on `globalThis` (see the file-level comments above for
|
|
32
|
+
* why this is necessary). Outside of `TESTING`, only one copy of the package
|
|
33
|
+
* is expected to exist, so this is a no-op that always returns `value`
|
|
34
|
+
* unchanged.
|
|
35
|
+
*
|
|
36
|
+
* The return type lies about symbols being unique to work around the d.ts
|
|
37
|
+
* rollup issue described in `reactive/-private/symbols.ts`.
|
|
38
|
+
*
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
function getOrSetGlobal(key, value) {
|
|
42
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
43
|
+
const existing = ModuleScopedCaches[key];
|
|
44
|
+
if (existing === void 0) return ModuleScopedCaches[key] = value;
|
|
45
|
+
else return existing;
|
|
46
|
+
} else return value;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Reads back the current value stored for `key` by {@link setTransient}, or
|
|
50
|
+
* `null` if nothing has been stored yet.
|
|
51
|
+
*
|
|
52
|
+
* Unlike {@link getOrSetGlobal}, this always reads through the same
|
|
53
|
+
* package-namespaced cache regardless of the `TESTING` flag, since this is
|
|
54
|
+
* used for genuinely mutable state (not just singleton values) that must
|
|
55
|
+
* stay in sync across any duplicate copies of this package.
|
|
56
|
+
*
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
function peekTransient(key) {
|
|
60
|
+
const globalKey = `(transient) ${key}`;
|
|
61
|
+
return ModuleScopedCaches[globalKey] ?? null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Stores `value` for `key`, overwriting whatever was previously stored, so
|
|
65
|
+
* that it can later be read back via {@link peekTransient}.
|
|
66
|
+
*
|
|
67
|
+
* See {@link peekTransient} for details on when/why this cache is shared.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
function setTransient(key, value) {
|
|
72
|
+
const globalKey = `(transient) ${key}`;
|
|
73
|
+
return ModuleScopedCaches[globalKey] = value;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Like {@link getOrSetGlobal}, but reads/writes a cache that is shared across
|
|
77
|
+
* *all* copies of WarpDrive on `globalThis`, regardless of package name.
|
|
78
|
+
*
|
|
79
|
+
* This is used for keys (e.g. request/promise caches) that must be
|
|
80
|
+
* coordinated even across "mirror" packages published under different
|
|
81
|
+
* names, rather than only across duplicate copies of the same package name.
|
|
82
|
+
*
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
function getOrSetUniversal(key, value) {
|
|
86
|
+
if (macroCondition(getGlobalConfig().WarpDriveMirror.env.TESTING)) {
|
|
87
|
+
const existing = UniversalCache[key];
|
|
88
|
+
if (existing === void 0) return UniversalCache[key] = value;
|
|
89
|
+
else return existing;
|
|
90
|
+
} else return value;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Like {@link peekTransient}, but reads from the package-name-independent
|
|
94
|
+
* cache used by {@link getOrSetUniversal}. Always reads through this shared
|
|
95
|
+
* cache regardless of the `TESTING` flag.
|
|
96
|
+
*
|
|
97
|
+
* @private
|
|
98
|
+
*/
|
|
99
|
+
function peekUniversalTransient(key) {
|
|
100
|
+
const globalKey = `(transient) ${key}`;
|
|
101
|
+
return UniversalCache[globalKey] ?? null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Like {@link setTransient}, but writes to the package-name-independent
|
|
105
|
+
* cache used by {@link getOrSetUniversal}, so it can later be read via
|
|
106
|
+
* {@link peekUniversalTransient}.
|
|
107
|
+
*
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
function setUniversalTransient(key, value) {
|
|
111
|
+
const globalKey = `(transient) ${key}`;
|
|
112
|
+
return UniversalCache[globalKey] = value;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { getOrSetGlobal, getOrSetUniversal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient };
|
|
116
|
+
//# sourceMappingURL=-private.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"-private.js","names":["getGlobalConfig","macroCondition","name","__WARP_DRIVE_PACKAGE_NAME__","version","__WARP_DRIVE_PACKAGE_VERSION__","GlobalRef","globalThis","UniversalCache","__warpDrive_universalCache","__version","GlobalSink","WarpDrive","env","DEBUG","Error","ModuleScopedCaches","__warpDrive_ModuleScopedCaches","TESTING","console","warn","__warpDrive_hasOtherCopy","getOrSetGlobal","key","value","existing","undefined","peekTransient","globalKey","setTransient","getOrSetUniversal","peekUniversalTransient","setUniversalTransient"],"sources":["../../src/types/-private.ts"],"sourcesContent":["// in testing mode, we utilize globals to ensure only one copy exists of\n// these maps, due to bugs in ember-auto-import\nimport { DEBUG, TESTING } from '@warp-drive-mirror/core/build-config/env';\n\n// Substituted at build time (see `tools/internal-config/tsdown/config.js`)\n// with this package's own `name`/`version` from its `package.json`. Reading\n// it via a static import instead would get inlined by tsdown as a synthetic\n// sourcemap source with empty `sourcesContent`, which points outside the\n// published package once the built chunk is re-bundled by a consumer.\ndeclare const __WARP_DRIVE_PACKAGE_NAME__: string;\ndeclare const __WARP_DRIVE_PACKAGE_VERSION__: string;\nconst name = __WARP_DRIVE_PACKAGE_NAME__;\nconst version = __WARP_DRIVE_PACKAGE_VERSION__;\n\ntype UniversalTransientKey =\n // @warp-drive-mirror/core/request\n 'REQ_ID';\n\ntype UniversalKey =\n | `(transient) ${UniversalTransientKey}`\n // @warp-drive-mirror/core/request\n | 'RequestMap'\n | 'PromiseCache'\n | 'RequestCache'\n // @warp-drive-mirror/core-types/request\n | 'SkipCache'\n | 'EnableHydration'\n // @warp-drive-mirror/core-types/runtime\n | 'WarpDriveRuntimeConfig';\n\ntype TransientKey =\n // @warp-drive-mirror/core/graph\n | 'transactionRef'\n // @warp-drive-mirror/core/store\n | 'configuredGenerationMethod'\n | 'configuredUpdateMethod'\n | 'configuredForgetMethod'\n | 'configuredResetMethod'\n | 'configuredKeyInfoMethod'\n | 'signalHooks';\n\ntype GlobalKey =\n | `(transient) ${TransientKey}`\n // @warp-drive-mirror/legacy/adapter\n | 'AdapterError'\n | 'InvalidError'\n | 'TimeoutError'\n | 'AbortError'\n | 'UnauthorizedError'\n | 'ForbiddenError'\n | 'NotFoundError'\n | 'ConflictError'\n | 'ServerError'\n // @warp-drive-mirror/core/store/reactivity\n | '#{}'\n | '#[]'\n | 'Signals'\n // @warp-drive-mirror/legacy LegacySupport\n | 'AvailableShims'\n // @warp-drive-mirror/core RecordArrayManager\n | 'FAKE_ARR'\n // @warp-drive-mirror/core ReactiveArray\n | '#source'\n | '#update'\n | '#notify'\n | 'IS_COLLECTION'\n // @warp-drive-mirror/core RequestCache\n | 'Touching'\n | 'RequestPromise'\n // @warp-drive-mirror/legacy/compat FetchManager\n | 'SaveOp'\n // @warp-drive-mirror/legacy Model\n | 'LEGACY_SUPPORT'\n | 'LegacySupport'\n // @warp-drive-mirror/core/graph\n | 'Graphs'\n // @warp-drive-mirror/core/request\n | 'IS_FROZEN'\n | 'IS_CACHE_HANDLER'\n // @warp-drive-mirror/utilities\n | 'CONFIG'\n // @warp-drive-mirror/core CacheKeyManager\n | 'DEBUG_MAP'\n | 'IDENTIFIERS'\n | 'DOCUMENTS'\n // @warp-drive-mirror/core InstanceCache\n | 'RecordCache'\n | 'StoreMap'\n // @warp-drive-mirror/core/types/symbols\n | 'Store'\n | '$type'\n | 'TransformName'\n | 'RequestSignature'\n // @warp-drive-mirror/core/types/request\n | 'IS_FUTURE'\n | 'DOC'\n // @warp-drive-mirror/core NotificationManager\n | 'UnscopedChannel'\n // @warp-drive-mirror/core/reactive\n | 'ManagedArrayMap'\n | 'ManagedObjectMap'\n | 'Support'\n | 'SOURCE'\n | 'Destroy'\n | 'Checkout'\n | 'Commit'\n | 'Context';\n\ntype ModuleScopedCaches = Record<GlobalKey, unknown>;\n\nconst GlobalRef = globalThis as unknown as Record<\n string,\n {\n __warpDrive_ModuleScopedCaches?: ModuleScopedCaches;\n __warpDrive_hasOtherCopy?: boolean;\n __version: string;\n }\n> & {\n __warpDrive_universalCache: Record<UniversalKey, unknown>;\n};\nconst UniversalCache = (GlobalRef.__warpDrive_universalCache =\n GlobalRef.__warpDrive_universalCache ?? ({} as Record<UniversalKey, unknown>));\n\n// in order to support mirror packages, we ensure that each\n// unique package name has its own global cache\nGlobalRef[name] = GlobalRef[name] ?? { __version: version };\nconst GlobalSink = GlobalRef[name];\n\nif (DEBUG) {\n if (GlobalSink.__version !== version) {\n throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');\n }\n}\n\nconst ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? ({} as ModuleScopedCaches);\nif (TESTING) {\n if (!GlobalSink.__warpDrive_ModuleScopedCaches) {\n GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;\n } else {\n // oxlint-disable-next-line no-console\n console.warn(`\nMultiple copies of WarpDrive have been detected. This may be due to a bug in ember-auto-import\n in which test assets get their own copy of some v2-addons. This can cause the application to\n malfunction as each copy will maintain its own separate state.`);\n }\n} else {\n if (GlobalSink.__warpDrive_hasOtherCopy) {\n throw new Error('Multiple copies of WarpDrive detected, the application will malfunction.');\n }\n GlobalSink.__warpDrive_hasOtherCopy = true;\n}\n\ntype UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;\ntype UniqueSymbolOr<T, K extends string> = T extends symbol ? UniqueSymbol<K> : T;\n\n/**\n * Coordinates creation of a singleton `value` (e.g. a symbol, WeakMap, or\n * error class) for `key` so that duplicate copies of this package loaded\n * into the same process observe the same instance instead of each creating\n * their own.\n *\n * In `TESTING` builds this stores/reads `value` from a cache namespaced to\n * this package's name on `globalThis` (see the file-level comments above for\n * why this is necessary). Outside of `TESTING`, only one copy of the package\n * is expected to exist, so this is a no-op that always returns `value`\n * unchanged.\n *\n * The return type lies about symbols being unique to work around the d.ts\n * rollup issue described in `reactive/-private/symbols.ts`.\n *\n * @private\n */\nexport function getOrSetGlobal<T, K extends GlobalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = ModuleScopedCaches[key];\n if (existing === undefined) {\n return (ModuleScopedCaches[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\n/**\n * Reads back the current value stored for `key` by {@link setTransient}, or\n * `null` if nothing has been stored yet.\n *\n * Unlike {@link getOrSetGlobal}, this always reads through the same\n * package-namespaced cache regardless of the `TESTING` flag, since this is\n * used for genuinely mutable state (not just singleton values) that must\n * stay in sync across any duplicate copies of this package.\n *\n * @private\n */\nexport function peekTransient<T>(key: TransientKey): T | null {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] as T) ?? null;\n}\n\n/**\n * Stores `value` for `key`, overwriting whatever was previously stored, so\n * that it can later be read back via {@link peekTransient}.\n *\n * See {@link peekTransient} for details on when/why this cache is shared.\n *\n * @private\n */\nexport function setTransient<T>(key: TransientKey, value: T): T {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] = value);\n}\n\n/**\n * Like {@link getOrSetGlobal}, but reads/writes a cache that is shared across\n * *all* copies of WarpDrive on `globalThis`, regardless of package name.\n *\n * This is used for keys (e.g. request/promise caches) that must be\n * coordinated even across \"mirror\" packages published under different\n * names, rather than only across duplicate copies of the same package name.\n *\n * @private\n */\nexport function getOrSetUniversal<T, K extends UniversalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = UniversalCache[key];\n if (existing === undefined) {\n return (UniversalCache[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\n/**\n * Like {@link peekTransient}, but reads from the package-name-independent\n * cache used by {@link getOrSetUniversal}. Always reads through this shared\n * cache regardless of the `TESTING` flag.\n *\n * @private\n */\nexport function peekUniversalTransient<T>(key: UniversalTransientKey): T | null {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] as T) ?? null;\n}\n\n/**\n * Like {@link setTransient}, but writes to the package-name-independent\n * cache used by {@link getOrSetUniversal}, so it can later be read via\n * {@link peekUniversalTransient}.\n *\n * @private\n */\nexport function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] = value);\n}\n"],"mappings":";;;AAWA,MAAME;AACN,MAAME;AAkGN,MAAME,YAAYC;AAUlB,MAAMC,iBAAkBF,UAAUG,6BAChCH,UAAUG,8BAA+B,CAAC;AAI5CH,UAAUJ,QAA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CAC9E,MAAMK,YAAoD,eAAeL;CACzE,OAAQf,eAAeoB,cAAoB;AAC7C;;;;;;;;AASA,SAAgBI,sBAAyBT,KAA4BC,OAAa;CAChF,MAAMI,YAAoD,eAAeL;CACzE,OAAQf,eAAeoB,aAAaJ;AACtC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ResourceBlob } from "../../aliases-
|
|
1
|
+
import { t as ResourceBlob } from "../../aliases-BG5TxALl.js";
|
|
2
2
|
export { ResourceBlob };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Change } from "../../change-
|
|
1
|
+
import { t as Change } from "../../change-INHMiZ2a.js";
|
|
2
2
|
export { Change };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ReplaceRelatedRecordsMutation, i as ReplaceRelatedRecordMutation, n as Mutation, o as SortRelatedRecordsMutation, r as RemoveFromResourceRelationshipMutation, t as AddToResourceRelationshipMutation } from "../../mutations-
|
|
1
|
+
import { a as ReplaceRelatedRecordsMutation, i as ReplaceRelatedRecordMutation, n as Mutation, o as SortRelatedRecordsMutation, r as RemoveFromResourceRelationshipMutation, t as AddToResourceRelationshipMutation } from "../../mutations-CA39mior.js";
|
|
2
2
|
export { AddToResourceRelationshipMutation, Mutation, RemoveFromResourceRelationshipMutation, ReplaceRelatedRecordMutation, ReplaceRelatedRecordsMutation, SortRelatedRecordsMutation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Op, c as RemoveFromDocumentOperation, d as UpdateResourceFieldOperation, f as UpdateResourceOperation, i as MergeOperation, l as RemoveFromResourceRelationshipOperation, n as AddToDocumentOperation, o as Operation, p as UpdateResourceRelationshipOperation, r as AddToResourceRelationshipOperation, s as RemoveDocumentOperation, t as AddResourceOperation, u as RemoveResourceOperation } from "../../operations-
|
|
1
|
+
import { a as Op, c as RemoveFromDocumentOperation, d as UpdateResourceFieldOperation, f as UpdateResourceOperation, i as MergeOperation, l as RemoveFromResourceRelationshipOperation, n as AddToDocumentOperation, o as Operation, p as UpdateResourceRelationshipOperation, r as AddToResourceRelationshipOperation, s as RemoveDocumentOperation, t as AddResourceOperation, u as RemoveResourceOperation } from "../../operations-C1WAEKKq.js";
|
|
2
2
|
export { AddResourceOperation, AddToDocumentOperation, AddToResourceRelationshipOperation, MergeOperation, Op, Operation, RemoveDocumentOperation, RemoveFromDocumentOperation, RemoveFromResourceRelationshipOperation, RemoveResourceOperation, UpdateResourceFieldOperation, UpdateResourceOperation, UpdateResourceRelationshipOperation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Relationship, r as ResourceRelationship, t as CollectionRelationship } from "../../relationship-
|
|
1
|
+
import { n as Relationship, r as ResourceRelationship, t as CollectionRelationship } from "../../relationship-99pc4CaS.js";
|
|
2
2
|
export { CollectionRelationship, Relationship, ResourceRelationship };
|
package/dist/types/cache.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Qt as RelationshipDiff, Xt as Cache, Zt as ChangedAttributesHash } from "../internal-D_WIXC4r.js";
|
|
2
2
|
export { Cache, ChangedAttributesHash, RelationshipDiff };
|
package/dist/types/graph.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ReplaceRelatedRecordOperation, c as UnknownOperation, i as RemoteRelationshipOperation, l as UpdateRelationshipOperation, n as LocalRelationshipOperation, o as ReplaceRelatedRecordsOperation, r as Operation, s as SortRelatedRecords, t as DeleteRecordOperation } from "../graph-
|
|
1
|
+
import { a as ReplaceRelatedRecordOperation, c as UnknownOperation, i as RemoteRelationshipOperation, l as UpdateRelationshipOperation, n as LocalRelationshipOperation, o as ReplaceRelatedRecordsOperation, r as Operation, s as SortRelatedRecords, t as DeleteRecordOperation } from "../graph-BqxaFjEb.js";
|
|
2
2
|
export { DeleteRecordOperation, LocalRelationshipOperation, Operation, RemoteRelationshipOperation, ReplaceRelatedRecordOperation, ReplaceRelatedRecordsOperation, SortRelatedRecords, UnknownOperation, UpdateRelationshipOperation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DEBUG_STALE_CACHE_OWNER, c as RequestKey, d as StableExistingRecordIdentifier, f as StableRecordIdentifier, i as DEBUG_KEY_TYPE, l as ResourceKey, n as CacheKeyType, o as NewResourceKey, r as DEBUG_CLIENT_ORIGINATED, s as PersistedResourceKey, t as CACHE_OWNER, u as StableDocumentIdentifier } from "../identifier-
|
|
1
|
+
import { a as DEBUG_STALE_CACHE_OWNER, c as RequestKey, d as StableExistingRecordIdentifier, f as StableRecordIdentifier, i as DEBUG_KEY_TYPE, l as ResourceKey, n as CacheKeyType, o as NewResourceKey, r as DEBUG_CLIENT_ORIGINATED, s as PersistedResourceKey, t as CACHE_OWNER, u as StableDocumentIdentifier } from "../identifier-DmgDehQK.js";
|
|
2
2
|
export { CACHE_OWNER, CacheKeyType, DEBUG_CLIENT_ORIGINATED, DEBUG_KEY_TYPE, DEBUG_STALE_CACHE_OWNER, NewResourceKey, PersistedResourceKey, RequestKey, ResourceKey, StableDocumentIdentifier, StableExistingRecordIdentifier, StableRecordIdentifier };
|
package/dist/types/identifier.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { getGlobalConfig, macroCondition } from "@embroider/macros";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/types/identifier.ts
|
|
4
|
+
/**
|
|
5
|
+
* @module
|
|
6
|
+
* @summary Types for the stable keys that reference cached data, `ResourceKey` for resources and `RequestKey` for
|
|
7
|
+
* request documents, plus their deprecated identifier aliases.
|
|
8
|
+
*/
|
|
4
9
|
/**
|
|
5
10
|
* @private
|
|
6
11
|
*/
|
|
@@ -24,6 +29,8 @@ const CACHE_OWNER = ProdSymbol("__$co", "CACHE_OWNER");
|
|
|
24
29
|
* Identifies which "bucket" of the cache a key belongs to: resources
|
|
25
30
|
* (`'record'`, see {@link ResourceKey}) or request documents
|
|
26
31
|
* (`'document'`, see {@link RequestKey}).
|
|
32
|
+
*
|
|
33
|
+
* @summary Which cache bucket a key belongs to: `'record'` for resource keys or `'document'` for request keys.
|
|
27
34
|
*/
|
|
28
35
|
/**
|
|
29
36
|
* A referentially stable object with a unique string (lid) that can be used
|
|
@@ -32,9 +39,17 @@ const CACHE_OWNER = ProdSymbol("__$co", "CACHE_OWNER");
|
|
|
32
39
|
* Only requests that are assigned a RequestKey are retrievable/replayable from
|
|
33
40
|
* the cache, though requests without RequestKeys may still update cache state.
|
|
34
41
|
*
|
|
42
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#documents) guide explains
|
|
43
|
+
* the documents it identifies.
|
|
44
|
+
*
|
|
45
|
+
* @summary Stable object with a unique `lid` that references a cached request document, letting that request's
|
|
46
|
+
* result be retrieved or replayed.
|
|
35
47
|
* @public
|
|
36
48
|
*/
|
|
37
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* @summary Deprecated alias for `RequestKey`, the stable cache reference to a request document.
|
|
51
|
+
* @deprecated use {@link RequestKey}
|
|
52
|
+
*/
|
|
38
53
|
/**
|
|
39
54
|
* Used when an ResourceKey is known to be the stable version
|
|
40
55
|
*/
|
|
@@ -45,8 +60,13 @@ const CACHE_OWNER = ProdSymbol("__$co", "CACHE_OWNER");
|
|
|
45
60
|
* Distinguishing between this ResourceKey and one for a client created
|
|
46
61
|
* resource that was created with an ID is generally speaking not possible
|
|
47
62
|
* at runtime, so anything with an ID typically narrows to this.
|
|
63
|
+
*
|
|
64
|
+
* @summary Resource key whose `id` is a known string, the form keys for server-loaded resources take.
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* @summary Deprecated alias for `PersistedResourceKey`, a resource key whose `id` is known.
|
|
68
|
+
* @deprecated use {@link PersistedResourceKey}
|
|
48
69
|
*/
|
|
49
|
-
/** @deprecated use {@link PersistedResourceKey} */
|
|
50
70
|
/**
|
|
51
71
|
* Used when a ResourceKey was created locally
|
|
52
72
|
* (by a call to store.createRecord).
|
|
@@ -55,6 +75,8 @@ const CACHE_OWNER = ProdSymbol("__$co", "CACHE_OWNER");
|
|
|
55
75
|
* that is not for a new record but does not have an ID. This would
|
|
56
76
|
* happen if a user intentionally created one for use with a secondary-index
|
|
57
77
|
* prior to the record having been fully loaded.
|
|
78
|
+
*
|
|
79
|
+
* @summary Resource key for a record created locally with `store.createRecord`, whose `id` may still be `null`.
|
|
58
80
|
*/
|
|
59
81
|
/**
|
|
60
82
|
* A referentially stable object with a unique string (lid) that can be used
|
|
@@ -63,9 +85,16 @@ const CACHE_OWNER = ProdSymbol("__$co", "CACHE_OWNER");
|
|
|
63
85
|
* Every resource has a unique ResourceKey, and ResourceKeys may refer
|
|
64
86
|
* to data that has never been loaded (for instance, in an async relationship).
|
|
65
87
|
*
|
|
88
|
+
* The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains
|
|
89
|
+
* the resources it identifies.
|
|
90
|
+
*
|
|
91
|
+
* @summary Stable object with a unique `lid` plus `type` and `id` that uniquely references one resource's data in
|
|
92
|
+
* the cache, loaded or not.
|
|
66
93
|
* @public
|
|
67
94
|
*/
|
|
68
|
-
/**
|
|
69
|
-
|
|
95
|
+
/**
|
|
96
|
+
* @summary Deprecated alias for `ResourceKey`, the stable cache reference to a single resource.
|
|
97
|
+
* @deprecated use {@link ResourceKey}
|
|
98
|
+
*/
|
|
70
99
|
export { CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_KEY_TYPE, DEBUG_STALE_CACHE_OWNER };
|
|
71
100
|
//# sourceMappingURL=identifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.js","names":["getGlobalConfig","macroCondition","DEBUG_CLIENT_ORIGINATED","Symbol","DEBUG_KEY_TYPE","DEBUG_STALE_CACHE_OWNER","ProdSymbol","str","debugStr","WarpDrive","env","DEBUG","CACHE_OWNER"],"sources":["../../src/types/identifier.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"identifier.js","names":["getGlobalConfig","macroCondition","DEBUG_CLIENT_ORIGINATED","Symbol","DEBUG_KEY_TYPE","DEBUG_STALE_CACHE_OWNER","ProdSymbol","str","debugStr","WarpDrive","env","DEBUG","CACHE_OWNER"],"sources":["../../src/types/identifier.ts"],"sourcesContent":["/**\n * @module\n * @summary Types for the stable keys that reference cached data, `ResourceKey` for resources and `RequestKey` for\n * request documents, plus their deprecated identifier aliases.\n */\n\nimport { DEBUG } from '@warp-drive-mirror/core/build-config/env';\n\n// provided for additional debuggability\n/**\n * @private\n */\nexport const DEBUG_CLIENT_ORIGINATED: unique symbol = Symbol('record-originated-on-client');\n/**\n * @private\n */\nexport const DEBUG_KEY_TYPE: unique symbol = Symbol('key-type');\n/**\n * @private\n */\nexport const DEBUG_STALE_CACHE_OWNER: unique symbol = Symbol('warpDriveStaleCache');\n\nfunction ProdSymbol<T extends string>(str: T, debugStr: string): T {\n return DEBUG ? (Symbol(debugStr) as unknown as T) : str;\n}\n\n// also present in production\n/**\n * @private\n */\nexport const CACHE_OWNER: '__$co' = ProdSymbol('__$co', 'CACHE_OWNER');\n\n/**\n * Identifies which \"bucket\" of the cache a key belongs to: resources\n * (`'record'`, see {@link ResourceKey}) or request documents\n * (`'document'`, see {@link RequestKey}).\n *\n * @summary Which cache bucket a key belongs to: `'record'` for resource keys or `'document'` for request keys.\n */\nexport type CacheKeyType = 'record' | 'document';\n\n/**\n * A referentially stable object with a unique string (lid) that can be used\n * as a reference to request data in the cache.\n *\n * Only requests that are assigned a RequestKey are retrievable/replayable from\n * the cache, though requests without RequestKeys may still update cache state.\n *\n * The [Key Terminology](/guides/the-manual/caching/key-terms#documents) guide explains\n * the documents it identifies.\n *\n * @summary Stable object with a unique `lid` that references a cached request document, letting that request's\n * result be retrieved or replayed.\n * @public\n */\nexport interface RequestKey {\n /**\n * A string representing a unique identity.\n */\n lid: string;\n /**\n * Discriminates a {@link RequestKey} from a {@link ResourceKey}.\n */\n type: '@document';\n /** @internal */\n [CACHE_OWNER]: number | undefined;\n}\n\n/**\n * @summary Deprecated alias for `RequestKey`, the stable cache reference to a request document.\n * @deprecated use {@link RequestKey}\n */\nexport type StableDocumentIdentifier = RequestKey;\n\n/**\n * Used when an ResourceKey is known to be the stable version\n */\ninterface ResourceKeyBase<T extends string = string> {\n /**\n * A string representing a unique identity.\n *\n * @public\n */\n lid: string;\n\n /**\n * the primary `ResourceType` or \"model name\" this ResourceKey belongs to.\n *\n * @public\n */\n type: T;\n\n /** @internal */\n [CACHE_OWNER]: number | undefined;\n\n /** @internal */\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n /** @internal */\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * Used when a ResourceKey was not created locally as part\n * of a call to store.createRecord\n *\n * Distinguishing between this ResourceKey and one for a client created\n * resource that was created with an ID is generally speaking not possible\n * at runtime, so anything with an ID typically narrows to this.\n *\n * @summary Resource key whose `id` is a known string, the form keys for server-loaded resources take.\n */\nexport interface PersistedResourceKey<T extends string = string> extends ResourceKeyBase<T> {\n /**\n * the PrimaryKey for the resource this ResourceKey represents.\n *\n * @public\n */\n id: string;\n}\n\n/**\n * @summary Deprecated alias for `PersistedResourceKey`, a resource key whose `id` is known.\n * @deprecated use {@link PersistedResourceKey}\n */\nexport type StableExistingRecordIdentifier<T extends string = string> = PersistedResourceKey<T>;\n\n/**\n * Used when a ResourceKey was created locally\n * (by a call to store.createRecord).\n *\n * It is possible in rare circumstances to have a ResourceKey\n * that is not for a new record but does not have an ID. This would\n * happen if a user intentionally created one for use with a secondary-index\n * prior to the record having been fully loaded.\n *\n * @summary Resource key for a record created locally with `store.createRecord`, whose `id` may still be `null`.\n */\nexport interface NewResourceKey<T extends string = string> extends ResourceKeyBase<T> {\n /**\n * the PrimaryKey for the resource this ResourceKey represents. `null`\n * if not yet assigned a PrimaryKey value.\n *\n * @public\n */\n id: string | null;\n}\n\n/**\n * A referentially stable object with a unique string (lid) that can be used\n * as a reference to data in the cache.\n *\n * Every resource has a unique ResourceKey, and ResourceKeys may refer\n * to data that has never been loaded (for instance, in an async relationship).\n *\n * The [Key Terminology](/guides/the-manual/caching/key-terms#resources) guide explains\n * the resources it identifies.\n *\n * @summary Stable object with a unique `lid` plus `type` and `id` that uniquely references one resource's data in\n * the cache, loaded or not.\n * @public\n */\nexport type ResourceKey<T extends string = string> = PersistedResourceKey<T> | NewResourceKey<T>;\n\n/**\n * @summary Deprecated alias for `ResourceKey`, the stable cache reference to a single resource.\n * @deprecated use {@link ResourceKey}\n */\nexport type StableRecordIdentifier<T extends string = string> = ResourceKey<T>;\n"],"mappings":";;;;;;;;;;;AAYA,MAAaE,0BAAyCC,OAAO,6BAA6B;;;;AAI1F,MAAaC,iBAAgCD,OAAO,UAAU;;;;AAI9D,MAAaE,0BAAyCF,OAAO,qBAAqB;AAElF,SAASG,WAA6BC,KAAQC,UAAqB;CACjE,OAAOP,eAAAD,gBAAA,CAAA,CAAAS,UAAAC,IAAAC,KAAA,IAASR,OAAOK,QAAQ,IAAqBD;AACtD;;;;AAMA,MAAaK,cAAuBN,WAAW,SAAS,aAAa"}
|
package/dist/types/json/raw.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as Value, n as ObjectValue, r as PrimitiveValue, t as ArrayValue } from "../../raw-
|
|
1
|
+
import { i as Value, n as ObjectValue, r as PrimitiveValue, t as ArrayValue } from "../../raw-adYGuEGM.js";
|
|
2
2
|
export { ArrayValue, ObjectValue, PrimitiveValue, Value };
|
package/dist/types/params.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as SerializablePrimitive, n as QueryParamsSource, r as Serializable, t as QueryParamsSerializationOptions } from "../params-
|
|
1
|
+
import { i as SerializablePrimitive, n as QueryParamsSource, r as Serializable, t as QueryParamsSerializationOptions } from "../params-CNLjCRyH.js";
|
|
2
2
|
export { QueryParamsSerializationOptions, QueryParamsSource, Serializable, SerializablePrimitive };
|
package/dist/types/record.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StringSatisfiesIncludes, c as TypedRecordInstance, i as OpaqueRecordInstance, l as Validate, n as Includes, o as TypeFromInstance, r as Mask, s as TypeFromInstanceOrString, t as ExtractSuggestedCacheTypes, u as createIncludeValidator } from "../record-
|
|
1
|
+
import { a as StringSatisfiesIncludes, c as TypedRecordInstance, i as OpaqueRecordInstance, l as Validate, n as Includes, o as TypeFromInstance, r as Mask, s as TypeFromInstanceOrString, t as ExtractSuggestedCacheTypes, u as createIncludeValidator } from "../record-f5-uOgHt.js";
|
|
2
2
|
export { ExtractSuggestedCacheTypes, Includes, Mask, OpaqueRecordInstance, StringSatisfiesIncludes, TypeFromInstance, TypeFromInstanceOrString, TypedRecordInstance, Validate, createIncludeValidator };
|