@warp-drive/core 5.9.0-beta.0 → 5.9.0-beta.2
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/dist/-private-BYn1Vh-L.js +22 -0
- package/dist/-private-BYn1Vh-L.js.map +1 -0
- package/dist/-private-CyhhcK1a.js +120 -0
- package/dist/-private-CyhhcK1a.js.map +1 -0
- package/dist/-private-zrP4VGAf.js +3530 -0
- package/dist/-private-zrP4VGAf.js.map +1 -0
- package/dist/aliases-BWYW5EhX.d.ts +17 -0
- package/dist/aliases-BWYW5EhX.d.ts.map +1 -0
- package/dist/build-config/babel-macros.d.ts +2 -0
- package/dist/build-config/babel-macros.js +3 -1
- package/dist/build-config/canary-features.d.ts +1 -0
- package/dist/build-config/canary-features.js +1 -1
- package/dist/build-config/debugging.d.ts +1 -0
- package/dist/build-config/debugging.js +1 -1
- package/dist/build-config/deprecations.d.ts +1 -0
- package/dist/build-config/deprecations.js +1 -1
- package/dist/build-config/env.d.ts +2 -0
- package/dist/build-config/env.js +3 -1
- package/dist/build-config/macros.d.ts +2 -0
- package/dist/build-config/macros.js +3 -1
- package/dist/build-config.d.ts +2 -0
- package/dist/build-config.js +3 -1
- package/dist/change-C7kqv2kW.d.ts +41 -0
- package/dist/change-C7kqv2kW.d.ts.map +1 -0
- package/dist/concepts-DFldVwEM.d.ts +77 -0
- package/dist/concepts-DFldVwEM.d.ts.map +1 -0
- package/dist/configure-B_F639tN.d.ts +134 -0
- package/dist/configure-B_F639tN.d.ts.map +1 -0
- package/dist/configure.d.ts +2 -0
- package/dist/configure.js +3 -2
- package/dist/document-BEn91SwT.d.ts +129 -0
- package/dist/document-BEn91SwT.d.ts.map +1 -0
- package/dist/error-50OSEhsF.d.ts +77 -0
- package/dist/error-50OSEhsF.d.ts.map +1 -0
- package/dist/fields-FM7peCiM.d.ts +2327 -0
- package/dist/fields-FM7peCiM.d.ts.map +1 -0
- package/dist/graph/-private.d.ts +2 -0
- package/dist/graph/-private.js +2200 -3196
- package/dist/graph/-private.js.map +1 -0
- package/dist/graph-DLqYXP2z.d.ts +186 -0
- package/dist/graph-DLqYXP2z.d.ts.map +1 -0
- package/dist/identifier-DQnqOSJK.d.ts +112 -0
- package/dist/identifier-DQnqOSJK.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -8
- package/dist/internal-DtWOpxrR.d.ts +9182 -0
- package/dist/internal-DtWOpxrR.d.ts.map +1 -0
- package/dist/json-api-raw-C5APJHHB.d.ts +378 -0
- package/dist/json-api-raw-C5APJHHB.d.ts.map +1 -0
- package/dist/mutations-CqtoGB4t.d.ts +165 -0
- package/dist/mutations-CqtoGB4t.d.ts.map +1 -0
- package/dist/operations-D1qA6r0_.d.ts +244 -0
- package/dist/operations-D1qA6r0_.d.ts.map +1 -0
- package/dist/params-DrEx3bf8.d.ts +41 -0
- package/dist/params-DrEx3bf8.d.ts.map +1 -0
- package/dist/raw-D5hnjiq7.d.ts +31 -0
- package/dist/raw-D5hnjiq7.d.ts.map +1 -0
- package/dist/reactive/-private.d.ts +2 -0
- package/dist/reactive/-private.js +3 -1
- package/dist/reactive.d.ts +2 -0
- package/dist/reactive.js +5 -4
- package/dist/record-D3QQcaIR.d.ts +254 -0
- package/dist/record-D3QQcaIR.d.ts.map +1 -0
- package/dist/relationship-CmHzMPKf.d.ts +65 -0
- package/dist/relationship-CmHzMPKf.d.ts.map +1 -0
- package/dist/request-7BJFgSu_.js +766 -0
- package/dist/request-7BJFgSu_.js.map +1 -0
- package/dist/request.d.ts +2 -0
- package/dist/request.js +2 -48
- package/dist/signals/-leaked.d.ts +1060 -0
- package/dist/signals/-leaked.d.ts.map +1 -0
- package/dist/signals/-leaked.js +3 -1
- package/dist/src-BOAWJH_S.js +9227 -0
- package/dist/src-BOAWJH_S.js.map +1 -0
- package/dist/store/-private.d.ts +2 -0
- package/dist/store/-private.js +3 -1
- package/dist/store-DNF9Rgoh.js +462 -0
- package/dist/store-DNF9Rgoh.js.map +1 -0
- package/dist/store.d.ts +2 -0
- package/dist/store.js +3 -1
- package/dist/symbols-DjRDCeX0.d.ts +88 -0
- package/dist/symbols-DjRDCeX0.d.ts.map +1 -0
- package/dist/types/-private.d.ts +76 -0
- package/dist/types/-private.d.ts.map +1 -0
- package/dist/types/-private.js +1 -77
- package/dist/types/cache/aliases.d.ts +2 -0
- package/dist/types/cache/change.d.ts +2 -0
- package/dist/types/cache/mutations.d.ts +2 -0
- package/dist/types/cache/operations.d.ts +2 -0
- package/dist/types/cache/relationship.d.ts +2 -0
- package/dist/types/cache.d.ts +2 -0
- package/dist/types/graph.d.ts +2 -0
- package/dist/types/identifier.d.ts +2 -0
- package/dist/types/identifier.js +60 -52
- package/dist/types/identifier.js.map +1 -0
- package/dist/types/json/raw.d.ts +2 -0
- package/dist/types/params.d.ts +2 -0
- package/dist/types/record.d.ts +2 -0
- package/dist/types/record.js +211 -181
- package/dist/types/record.js.map +1 -0
- package/dist/types/request.d.ts +2 -0
- package/dist/types/request.js +138 -69
- package/dist/types/request.js.map +1 -0
- package/dist/types/runtime.d.ts +55 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +54 -26
- package/dist/types/runtime.js.map +1 -0
- package/dist/types/schema/concepts.d.ts +2 -0
- package/dist/types/schema/fields.d.ts +2 -0
- package/dist/types/schema/fields.js +501 -495
- package/dist/types/schema/fields.js.map +1 -0
- package/dist/types/schema/fields.type-test.d.ts +1 -0
- package/dist/types/schema/fields.type-test.js +79 -0
- package/dist/types/schema/fields.type-test.js.map +1 -0
- package/dist/types/schema/schema-service.d.ts +2 -0
- package/dist/types/spec/document.d.ts +2 -0
- package/dist/types/spec/error.d.ts +2 -0
- package/dist/types/spec/json-api-raw.d.ts +2 -0
- package/dist/types/symbols.d.ts +2 -0
- package/dist/types/symbols.js +84 -77
- package/dist/types/symbols.js.map +1 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types.d.ts +3 -0
- package/dist/unpkg/dev/-private-BoSTJwp9.js +3519 -0
- package/dist/unpkg/dev/-private-BoSTJwp9.js.map +1 -0
- package/dist/unpkg/dev/-private-CUkeqUhO.js +22 -0
- package/dist/unpkg/dev/-private-CUkeqUhO.js.map +1 -0
- package/dist/unpkg/dev/-private-D6Tw25AD.js +111 -0
- package/dist/unpkg/dev/-private-D6Tw25AD.js.map +1 -0
- package/dist/unpkg/dev/build-config/babel-macros.js +3 -1
- package/dist/unpkg/dev/build-config/canary-features.js +1 -1
- package/dist/unpkg/dev/build-config/debugging.js +1 -1
- package/dist/unpkg/dev/build-config/deprecations.js +1 -1
- package/dist/unpkg/dev/build-config/env.js +3 -1
- package/dist/unpkg/dev/build-config/macros.js +3 -1
- package/dist/unpkg/dev/build-config.js +3 -1
- package/dist/unpkg/dev/configure.js +3 -1
- package/dist/unpkg/dev/graph/-private.js +1958 -2953
- package/dist/unpkg/dev/graph/-private.js.map +1 -0
- package/dist/unpkg/dev/index.js +3 -6
- package/dist/unpkg/dev/reactive/-private.js +3 -1
- package/dist/unpkg/dev/reactive.js +5 -3
- package/dist/unpkg/dev/request-CwjpJB3r.js +756 -0
- package/dist/unpkg/dev/request-CwjpJB3r.js.map +1 -0
- package/dist/unpkg/dev/request.js +2 -48
- package/dist/unpkg/dev/runtime-DoDtzXJb.js +110 -0
- package/dist/unpkg/dev/runtime-DoDtzXJb.js.map +1 -0
- package/dist/unpkg/dev/signals/-leaked.js +3 -1
- package/dist/unpkg/dev/src-CP6e_ozt.js +8331 -0
- package/dist/unpkg/dev/src-CP6e_ozt.js.map +1 -0
- package/dist/unpkg/dev/store/-private.js +3 -55
- package/dist/unpkg/dev/store-DamE3C4y.js +427 -0
- package/dist/unpkg/dev/store-DamE3C4y.js.map +1 -0
- package/dist/unpkg/dev/store.js +1 -556
- package/dist/unpkg/dev/types/-private.js +1 -67
- package/dist/unpkg/dev/types/identifier.js +63 -56
- package/dist/unpkg/dev/types/identifier.js.map +1 -0
- package/dist/unpkg/dev/types/record.js +211 -181
- package/dist/unpkg/dev/types/record.js.map +1 -0
- package/dist/unpkg/dev/types/request.js +138 -69
- package/dist/unpkg/dev/types/request.js.map +1 -0
- package/dist/unpkg/dev/types/runtime.js +54 -26
- package/dist/unpkg/dev/types/runtime.js.map +1 -0
- package/dist/unpkg/dev/types/schema/fields.js +501 -495
- package/dist/unpkg/dev/types/schema/fields.js.map +1 -0
- package/dist/unpkg/dev/types/schema/fields.type-test.js +79 -0
- package/dist/unpkg/dev/types/schema/fields.type-test.js.map +1 -0
- package/dist/unpkg/dev/types/symbols.js +84 -77
- package/dist/unpkg/dev/types/symbols.js.map +1 -0
- package/dist/unpkg/dev/utils/string.js +79 -85
- package/dist/unpkg/dev/utils/string.js.map +1 -0
- package/dist/unpkg/dev-deprecated/-private-BoSTJwp9.js +3519 -0
- package/dist/unpkg/dev-deprecated/-private-BoSTJwp9.js.map +1 -0
- package/dist/unpkg/dev-deprecated/-private-CUkeqUhO.js +22 -0
- package/dist/unpkg/dev-deprecated/-private-CUkeqUhO.js.map +1 -0
- package/dist/unpkg/dev-deprecated/-private-D6Tw25AD.js +111 -0
- package/dist/unpkg/dev-deprecated/-private-D6Tw25AD.js.map +1 -0
- package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +3 -1
- package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -1
- package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -1
- package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -1
- package/dist/unpkg/dev-deprecated/build-config/env.js +3 -1
- package/dist/unpkg/dev-deprecated/build-config/macros.js +3 -1
- package/dist/unpkg/dev-deprecated/build-config.js +3 -1
- package/dist/unpkg/dev-deprecated/configure.js +3 -1
- package/dist/unpkg/dev-deprecated/graph/-private.js +2077 -3147
- package/dist/unpkg/dev-deprecated/graph/-private.js.map +1 -0
- package/dist/unpkg/dev-deprecated/index.js +3 -5
- package/dist/unpkg/dev-deprecated/reactive/-private.js +3 -1
- package/dist/unpkg/dev-deprecated/reactive.js +5 -3
- package/dist/unpkg/dev-deprecated/request-CwjpJB3r.js +756 -0
- package/dist/unpkg/dev-deprecated/request-CwjpJB3r.js.map +1 -0
- package/dist/unpkg/dev-deprecated/request.js +2 -48
- package/dist/unpkg/dev-deprecated/runtime-CPL2BGgT.js +110 -0
- package/dist/unpkg/dev-deprecated/runtime-CPL2BGgT.js.map +1 -0
- package/dist/unpkg/dev-deprecated/signals/-leaked.js +3 -1
- package/dist/unpkg/dev-deprecated/src-De8OV58h.js +8884 -0
- package/dist/unpkg/dev-deprecated/src-De8OV58h.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store/-private.js +3 -1
- package/dist/unpkg/dev-deprecated/store-Bsdz5mRe.js +427 -0
- package/dist/unpkg/dev-deprecated/store-Bsdz5mRe.js.map +1 -0
- package/dist/unpkg/dev-deprecated/store.js +1 -556
- package/dist/unpkg/dev-deprecated/types/-private.js +1 -67
- package/dist/unpkg/dev-deprecated/types/identifier.js +63 -56
- package/dist/unpkg/dev-deprecated/types/identifier.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/record.js +211 -181
- package/dist/unpkg/dev-deprecated/types/record.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/request.js +138 -69
- package/dist/unpkg/dev-deprecated/types/request.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/runtime.js +54 -26
- package/dist/unpkg/dev-deprecated/types/runtime.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.js +501 -495
- package/dist/unpkg/dev-deprecated/types/schema/fields.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +79 -0
- package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js.map +1 -0
- package/dist/unpkg/dev-deprecated/types/symbols.js +84 -77
- package/dist/unpkg/dev-deprecated/types/symbols.js.map +1 -0
- package/dist/unpkg/dev-deprecated/utils/string.js +79 -85
- package/dist/unpkg/dev-deprecated/utils/string.js.map +1 -0
- package/dist/unpkg/prod/-private-B36B1ztP.js +22 -0
- package/dist/unpkg/prod/-private-B36B1ztP.js.map +1 -0
- package/dist/unpkg/prod/-private-DHco-h0q.js +3294 -0
- package/dist/unpkg/prod/-private-DHco-h0q.js.map +1 -0
- package/dist/unpkg/prod/-private-Dhl123OI.js +99 -0
- package/dist/unpkg/prod/-private-Dhl123OI.js.map +1 -0
- package/dist/unpkg/prod/build-config/babel-macros.js +3 -1
- package/dist/unpkg/prod/build-config/canary-features.js +1 -1
- package/dist/unpkg/prod/build-config/debugging.js +1 -1
- package/dist/unpkg/prod/build-config/deprecations.js +1 -1
- package/dist/unpkg/prod/build-config/env.js +3 -1
- package/dist/unpkg/prod/build-config/macros.js +3 -1
- package/dist/unpkg/prod/build-config.js +3 -1
- package/dist/unpkg/prod/configure.js +3 -2
- package/dist/unpkg/prod/graph/-private.js +1494 -2101
- package/dist/unpkg/prod/graph/-private.js.map +1 -0
- package/dist/unpkg/prod/index.js +2 -482
- package/dist/unpkg/prod/reactive/-private.js +3 -1
- package/dist/unpkg/prod/reactive.js +5 -30
- package/dist/unpkg/prod/request-BBdC1Sz7.js +480 -0
- package/dist/unpkg/prod/request-BBdC1Sz7.js.map +1 -0
- package/dist/unpkg/prod/request.js +3 -2
- package/dist/unpkg/prod/signals/-leaked.js +3 -1
- package/dist/unpkg/prod/src-nFHlZgKa.js +6942 -0
- package/dist/unpkg/prod/src-nFHlZgKa.js.map +1 -0
- package/dist/unpkg/prod/store/-private.js +3 -126
- package/dist/unpkg/prod/store-BWhmb7Ob.js +359 -0
- package/dist/unpkg/prod/store-BWhmb7Ob.js.map +1 -0
- package/dist/unpkg/prod/store.js +1 -435
- package/dist/unpkg/prod/types/-private.js +1 -47
- package/dist/unpkg/prod/types/identifier.js +63 -56
- package/dist/unpkg/prod/types/identifier.js.map +1 -0
- package/dist/unpkg/prod/types/record.js +211 -181
- package/dist/unpkg/prod/types/record.js.map +1 -0
- package/dist/unpkg/prod/types/request.js +138 -69
- package/dist/unpkg/prod/types/request.js.map +1 -0
- package/dist/unpkg/prod/types/runtime.js +54 -26
- package/dist/unpkg/prod/types/runtime.js.map +1 -0
- package/dist/unpkg/prod/types/schema/fields.js +501 -495
- package/dist/unpkg/prod/types/schema/fields.js.map +1 -0
- package/dist/unpkg/prod/types/schema/fields.type-test.js +79 -0
- package/dist/unpkg/prod/types/schema/fields.type-test.js.map +1 -0
- package/dist/unpkg/prod/types/symbols.js +84 -77
- package/dist/unpkg/prod/types/symbols.js.map +1 -0
- package/dist/unpkg/prod/utils/string.js +70 -66
- package/dist/unpkg/prod/utils/string.js.map +1 -0
- package/dist/unpkg/prod-deprecated/-private-B36B1ztP.js +22 -0
- package/dist/unpkg/prod-deprecated/-private-B36B1ztP.js.map +1 -0
- package/dist/unpkg/prod-deprecated/-private-DHco-h0q.js +3294 -0
- package/dist/unpkg/prod-deprecated/-private-DHco-h0q.js.map +1 -0
- package/dist/unpkg/prod-deprecated/-private-Dhl123OI.js +99 -0
- package/dist/unpkg/prod-deprecated/-private-Dhl123OI.js.map +1 -0
- package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +3 -1
- package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -1
- package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -1
- package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -1
- package/dist/unpkg/prod-deprecated/build-config/env.js +3 -1
- package/dist/unpkg/prod-deprecated/build-config/macros.js +3 -1
- package/dist/unpkg/prod-deprecated/build-config.js +3 -1
- package/dist/unpkg/prod-deprecated/configure.js +3 -2
- package/dist/unpkg/prod-deprecated/graph/-private.js +1603 -2272
- package/dist/unpkg/prod-deprecated/graph/-private.js.map +1 -0
- package/dist/unpkg/prod-deprecated/index.js +2 -482
- package/dist/unpkg/prod-deprecated/reactive/-private.js +3 -1
- package/dist/unpkg/prod-deprecated/reactive.js +5 -5
- package/dist/unpkg/prod-deprecated/request-BBdC1Sz7.js +480 -0
- package/dist/unpkg/prod-deprecated/request-BBdC1Sz7.js.map +1 -0
- package/dist/unpkg/prod-deprecated/request.js +3 -2
- package/dist/unpkg/prod-deprecated/signals/-leaked.js +3 -1
- package/dist/unpkg/prod-deprecated/src-Cku5ymUJ.js +7375 -0
- package/dist/unpkg/prod-deprecated/src-Cku5ymUJ.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store/-private.js +3 -88
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js +359 -0
- package/dist/unpkg/prod-deprecated/store-BWhmb7Ob.js.map +1 -0
- package/dist/unpkg/prod-deprecated/store.js +1 -435
- package/dist/unpkg/prod-deprecated/types/-private.js +1 -47
- package/dist/unpkg/prod-deprecated/types/identifier.js +63 -56
- package/dist/unpkg/prod-deprecated/types/identifier.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/record.js +211 -181
- package/dist/unpkg/prod-deprecated/types/record.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/request.js +138 -69
- package/dist/unpkg/prod-deprecated/types/request.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/runtime.js +54 -26
- package/dist/unpkg/prod-deprecated/types/runtime.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.js +501 -495
- package/dist/unpkg/prod-deprecated/types/schema/fields.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +79 -0
- package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js.map +1 -0
- package/dist/unpkg/prod-deprecated/types/symbols.js +84 -77
- package/dist/unpkg/prod-deprecated/types/symbols.js.map +1 -0
- package/dist/unpkg/prod-deprecated/utils/string.js +70 -66
- package/dist/unpkg/prod-deprecated/utils/string.js.map +1 -0
- package/dist/utils/string.d.ts +54 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +84 -85
- package/dist/utils/string.js.map +1 -0
- package/dist/utils-BtURiy8l.d.ts +24 -0
- package/dist/utils-BtURiy8l.d.ts.map +1 -0
- package/package.json +17 -21
- package/declarations/build-config/babel-macros.d.ts +0 -1
- package/declarations/build-config/canary-features.d.ts +0 -1
- package/declarations/build-config/debugging.d.ts +0 -1
- package/declarations/build-config/deprecations.d.ts +0 -1
- package/declarations/build-config/env.d.ts +0 -1
- package/declarations/build-config/macros.d.ts +0 -1
- package/declarations/build-config.d.ts +0 -18
- package/declarations/configure.d.ts +0 -7
- package/declarations/graph/-private/-diff.d.ts +0 -19
- package/declarations/graph/-private/-edge-definition.d.ts +0 -149
- package/declarations/graph/-private/-state.d.ts +0 -9
- package/declarations/graph/-private/-utils.d.ts +0 -25
- package/declarations/graph/-private/coerce-id.d.ts +0 -4
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -6
- package/declarations/graph/-private/edges/collection.d.ts +0 -39
- package/declarations/graph/-private/edges/implicit.d.ts +0 -43
- package/declarations/graph/-private/edges/resource.d.ts +0 -23
- package/declarations/graph/-private/graph.d.ts +0 -56
- package/declarations/graph/-private/normalize-link.d.ts +0 -2
- package/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
- package/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
- package/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
- package/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
- package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -7
- package/declarations/graph/-private/operations/update-relationship.d.ts +0 -9
- package/declarations/graph/-private.d.ts +0 -13
- package/declarations/index.d.ts +0 -96
- package/declarations/reactive/-private/default-mode.d.ts +0 -73
- package/declarations/reactive/-private/document.d.ts +0 -142
- package/declarations/reactive/-private/fields/extension.d.ts +0 -8
- package/declarations/reactive/-private/fields/get-field-key.d.ts +0 -8
- package/declarations/reactive/-private/fields/managed-array.d.ts +0 -18
- package/declarations/reactive/-private/fields/managed-object.d.ts +0 -17
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
- package/declarations/reactive/-private/hooks.d.ts +0 -5
- package/declarations/reactive/-private/kind/alias-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/array-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/attribute-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/belongs-to-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/collection-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/derived-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/generic-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/has-many-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/hash-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/identity-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/local-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/object-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/resource-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/schema-array-field.d.ts +0 -4
- package/declarations/reactive/-private/kind/schema-object-field.d.ts +0 -4
- package/declarations/reactive/-private/record.d.ts +0 -83
- package/declarations/reactive/-private/schema.d.ts +0 -326
- package/declarations/reactive/-private/symbols.d.ts +0 -5
- package/declarations/reactive/-private.d.ts +0 -2
- package/declarations/reactive.d.ts +0 -286
- package/declarations/request/-private/context.d.ts +0 -39
- package/declarations/request/-private/debug.d.ts +0 -4
- package/declarations/request/-private/fetch.d.ts +0 -33
- package/declarations/request/-private/future.d.ts +0 -7
- package/declarations/request/-private/manager.d.ts +0 -158
- package/declarations/request/-private/promise-cache.d.ts +0 -28
- package/declarations/request/-private/types.d.ts +0 -234
- package/declarations/request/-private/utils.d.ts +0 -57
- package/declarations/request.d.ts +0 -52
- package/declarations/signals/-leaked.d.ts +0 -2
- package/declarations/signals/-private.d.ts +0 -6
- package/declarations/signals/promise-state.d.ts +0 -264
- package/declarations/signals/reactivity/configure.d.ts +0 -138
- package/declarations/signals/reactivity/internal.d.ts +0 -154
- package/declarations/signals/reactivity/signal.d.ts +0 -56
- package/declarations/signals/request-state.d.ts +0 -372
- package/declarations/signals/request-subscription.d.ts +0 -177
- package/declarations/store/-private/cache-handler/handler.d.ts +0 -56
- package/declarations/store/-private/cache-handler/types.d.ts +0 -84
- package/declarations/store/-private/cache-handler/utils.d.ts +0 -31
- package/declarations/store/-private/caches/instance-cache.d.ts +0 -58
- package/declarations/store/-private/caches/resource-utils.d.ts +0 -9
- package/declarations/store/-private/debug/utils.d.ts +0 -7
- package/declarations/store/-private/default-cache-policy.d.ts +0 -387
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -34
- package/declarations/store/-private/managers/cache-key-manager.d.ts +0 -304
- package/declarations/store/-private/managers/cache-manager.d.ts +0 -367
- package/declarations/store/-private/managers/notification-manager.d.ts +0 -83
- package/declarations/store/-private/managers/record-array-manager.d.ts +0 -100
- package/declarations/store/-private/network/request-cache.d.ts +0 -103
- package/declarations/store/-private/record-arrays/-utils.d.ts +0 -80
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +0 -81
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +0 -133
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +0 -81
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -3
- package/declarations/store/-private/record-arrays/resource-array.d.ts +0 -67
- package/declarations/store/-private/store-service.d.ts +0 -874
- package/declarations/store/-private/utils/coerce-id.d.ts +0 -4
- package/declarations/store/-private/utils/construct-resource.d.ts +0 -6
- package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
- package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
- package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
- package/declarations/store/-private.d.ts +0 -24
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -90
- package/declarations/store/-types/q/identifier.d.ts +0 -23
- package/declarations/store/-types/q/record-instance.d.ts +0 -22
- package/declarations/store/-types/q/store.d.ts +0 -31
- package/declarations/store/deprecated/-private.d.ts +0 -223
- package/declarations/store/deprecated/store.d.ts +0 -784
- package/declarations/store.d.ts +0 -2
- package/declarations/types/-private.d.ts +0 -22
- package/declarations/types/cache/aliases.d.ts +0 -1
- package/declarations/types/cache/change.d.ts +0 -6
- package/declarations/types/cache/mutations.d.ts +0 -38
- package/declarations/types/cache/operations.d.ts +0 -168
- package/declarations/types/cache/relationship.d.ts +0 -13
- package/declarations/types/cache.d.ts +0 -429
- package/declarations/types/graph.d.ts +0 -47
- package/declarations/types/identifier.d.ts +0 -86
- package/declarations/types/json/raw.d.ts +0 -6
- package/declarations/types/params.d.ts +0 -8
- package/declarations/types/record.d.ts +0 -269
- package/declarations/types/request.d.ts +0 -367
- package/declarations/types/runtime.d.ts +0 -14
- package/declarations/types/schema/concepts.d.ts +0 -23
- package/declarations/types/schema/fields.d.ts +0 -2200
- package/declarations/types/schema/fields.type-test.d.ts +0 -1
- package/declarations/types/schema/schema-service.d.ts +0 -380
- package/declarations/types/spec/document.d.ts +0 -67
- package/declarations/types/spec/error.d.ts +0 -18
- package/declarations/types/spec/json-api-raw.d.ts +0 -139
- package/declarations/types/symbols.d.ts +0 -78
- package/declarations/types/utils.d.ts +0 -5
- package/declarations/types.d.ts +0 -11
- package/declarations/utils/string.d.ts +0 -47
- package/dist/configure-DPUFCemT.js +0 -1940
- package/dist/default-cache-policy-D7_u4YRH.js +0 -572
- package/dist/future-BKkJJkj7.js +0 -678
- package/dist/index-CQP2NSqg.js +0 -9982
- package/dist/symbols-3C1OkYtZ.js +0 -39
- package/dist/unpkg/dev/-leaked-Co0EI6Go.js +0 -1939
- package/dist/unpkg/dev/-private-sql1_mdx.js +0 -39
- package/dist/unpkg/dev/future-DFfOzSoe.js +0 -672
- package/dist/unpkg/dev/index-BzcBOnw9.js +0 -9392
- package/dist/unpkg/dev/runtime-E1M51_-O.js +0 -135
- package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +0 -1939
- package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +0 -39
- package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +0 -672
- package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +0 -10007
- package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +0 -135
- package/dist/unpkg/prod/-leaked-DUONXQDB.js +0 -1676
- package/dist/unpkg/prod/-private-sql1_mdx.js +0 -39
- package/dist/unpkg/prod/handler-EU_8ncB2.js +0 -1619
- package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +0 -19
- package/dist/unpkg/prod/request-BrJSCG6r.js +0 -421
- package/dist/unpkg/prod/schema-BSkHyoWz.js +0 -5219
- package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +0 -1676
- package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +0 -39
- package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +0 -334
- package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +0 -26
- package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +0 -19
- package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +0 -421
- package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +0 -6939
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as setRecordIdentifier, D as isResourceKey, E as isRequestKey, F as ensureStringId, I as log, L as logGroup, N as normalizeModelName, P as coerceId, 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-De8OV58h.js";
|
|
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 };
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
import { LRUCache } from "./utils/string.js";
|
|
2
|
+
import { t as getGlobalConfig } from "./runtime-CPL2BGgT.js";
|
|
3
|
+
|
|
4
|
+
//#region src/store/-private/default-cache-policy.ts
|
|
5
|
+
/**
|
|
6
|
+
* Interface of a parsed Cache-Control header value.
|
|
7
|
+
*
|
|
8
|
+
* - [MDN Cache-Control Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control)
|
|
9
|
+
*/
|
|
10
|
+
const NUMERIC_KEYS = /* @__PURE__ */ new Set([
|
|
11
|
+
"max-age",
|
|
12
|
+
"s-maxage",
|
|
13
|
+
"stale-if-error",
|
|
14
|
+
"stale-while-revalidate"
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* Parses a string Cache-Control header value into an object with the following structure:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* interface CacheControlValue {
|
|
21
|
+
* immutable?: boolean;
|
|
22
|
+
* 'max-age'?: number;
|
|
23
|
+
* 'must-revalidate'?: boolean;
|
|
24
|
+
* 'must-understand'?: boolean;
|
|
25
|
+
* 'no-cache'?: boolean;
|
|
26
|
+
* 'no-store'?: boolean;
|
|
27
|
+
* 'no-transform'?: boolean;
|
|
28
|
+
* 'only-if-cached'?: boolean;
|
|
29
|
+
* private?: boolean;
|
|
30
|
+
* 'proxy-revalidate'?: boolean;
|
|
31
|
+
* public?: boolean;
|
|
32
|
+
* 's-maxage'?: number;
|
|
33
|
+
* 'stale-if-error'?: number;
|
|
34
|
+
* 'stale-while-revalidate'?: number;
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* See also {@link CacheControlValue} and [Response Directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control#response_directives)
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
function parseCacheControl(header) {
|
|
43
|
+
return CACHE_CONTROL_CACHE.get(header);
|
|
44
|
+
}
|
|
45
|
+
const CACHE_CONTROL_CACHE = new LRUCache((header) => {
|
|
46
|
+
let key = "";
|
|
47
|
+
let value = "";
|
|
48
|
+
let isParsingKey = true;
|
|
49
|
+
const cacheControlValue = {};
|
|
50
|
+
for (let i = 0; i < header.length; i++) {
|
|
51
|
+
const char = header.charAt(i);
|
|
52
|
+
if (char === ",") {
|
|
53
|
+
((test) => {
|
|
54
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a value`);
|
|
55
|
+
})(!isParsingKey || !NUMERIC_KEYS.has(key));
|
|
56
|
+
((test) => {
|
|
57
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a value after "=" but got ","`);
|
|
58
|
+
})(i === 0 || header.charAt(i - 1) !== "=");
|
|
59
|
+
isParsingKey = true;
|
|
60
|
+
cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;
|
|
61
|
+
key = "";
|
|
62
|
+
value = "";
|
|
63
|
+
continue;
|
|
64
|
+
} else if (char === "=") {
|
|
65
|
+
((test) => {
|
|
66
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a value after "="`);
|
|
67
|
+
})(i + 1 !== header.length);
|
|
68
|
+
isParsingKey = false;
|
|
69
|
+
} else if (char === " " || char === `\t` || char === `\n`) continue;
|
|
70
|
+
else if (isParsingKey) key += char;
|
|
71
|
+
else value += char;
|
|
72
|
+
if (i === header.length - 1) cacheControlValue[key] = NUMERIC_KEYS.has(key) ? parseCacheControlValue(value) : true;
|
|
73
|
+
}
|
|
74
|
+
return cacheControlValue;
|
|
75
|
+
}, 200);
|
|
76
|
+
function parseCacheControlValue(stringToParse) {
|
|
77
|
+
const parsedValue = Number.parseInt(stringToParse);
|
|
78
|
+
((test) => {
|
|
79
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a number but got - ${stringToParse}`);
|
|
80
|
+
})(!Number.isNaN(parsedValue));
|
|
81
|
+
((test) => {
|
|
82
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a number greater than 0 but got - ${stringToParse}`);
|
|
83
|
+
})(parsedValue >= 0);
|
|
84
|
+
if (Number.isNaN(parsedValue) || parsedValue < 0) return 0;
|
|
85
|
+
return parsedValue;
|
|
86
|
+
}
|
|
87
|
+
function isExpired(cacheKey, request, config) {
|
|
88
|
+
const { constraints } = config;
|
|
89
|
+
if (constraints?.isExpired) {
|
|
90
|
+
const result = constraints.isExpired(request);
|
|
91
|
+
if (result !== null) {
|
|
92
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is ${result ? "EXPIRED" : "NOT expired"} because constraints.isExpired returned ${result}`);
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const { headers } = request.response;
|
|
97
|
+
if (!headers) {
|
|
98
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no headers were provided`);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
const now = Date.now();
|
|
102
|
+
const date = headers.get("Date");
|
|
103
|
+
if (constraints?.headers) {
|
|
104
|
+
if (constraints.headers["X-WarpDrive-Expires"]) {
|
|
105
|
+
const xWarpDriveExpires = headers.get("X-WarpDrive-Expires");
|
|
106
|
+
if (xWarpDriveExpires) {
|
|
107
|
+
const result = now >= new Date(xWarpDriveExpires).getTime();
|
|
108
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`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"}`);
|
|
109
|
+
return result;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (constraints.headers["Cache-Control"]) {
|
|
113
|
+
const cacheControl = headers.get("Cache-Control");
|
|
114
|
+
const age = headers.get("Age");
|
|
115
|
+
if (cacheControl && age && date) {
|
|
116
|
+
const cacheControlValue = parseCacheControl(cacheControl);
|
|
117
|
+
const maxAge = cacheControlValue["max-age"] || cacheControlValue["s-maxage"];
|
|
118
|
+
if (maxAge) {
|
|
119
|
+
const ageValue = parseInt(age, 10);
|
|
120
|
+
((test) => {
|
|
121
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a number but got - ${age}`);
|
|
122
|
+
})(!Number.isNaN(ageValue));
|
|
123
|
+
((test) => {
|
|
124
|
+
if (!test) throw new Error(`Invalid Cache-Control value, expected a number greater than 0 but got - ${age}`);
|
|
125
|
+
})(ageValue >= 0);
|
|
126
|
+
if (!Number.isNaN(ageValue) && ageValue >= 0) {
|
|
127
|
+
const result = now >= new Date(date).getTime() + (maxAge - ageValue) * 1e3;
|
|
128
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is ${result ? "EXPIRED" : "NOT expired"} because the time set by Cache-Control header is ${result ? "in the past" : "in the future"}`);
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (constraints.headers.Expires) {
|
|
135
|
+
const expires = headers.get("Expires");
|
|
136
|
+
if (expires) {
|
|
137
|
+
const result = now >= new Date(expires).getTime();
|
|
138
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is ${result ? "EXPIRED" : "NOT expired"} because the time set by Expires header is ${result ? "in the past" : "in the future"}`);
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (!date) {
|
|
144
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no Date header was provided`);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
let expirationTime = config.apiCacheHardExpires;
|
|
148
|
+
if (!config.disableTestOptimization) expirationTime = config.apiCacheSoftExpires;
|
|
149
|
+
const result = now >= new Date(date).getTime() + expirationTime;
|
|
150
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`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"}`);
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The constraint options for {@link PolicyConfig.constraints}
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* The configuration options for the {@link DefaultCachePolicy}
|
|
158
|
+
*
|
|
159
|
+
* ```ts [app/services/store.ts]
|
|
160
|
+
* import { Store } from '@warp-drive/core';
|
|
161
|
+
* import { DefaultCachePolicy } from '@warp-drive/core/store'; // [!code focus]
|
|
162
|
+
*
|
|
163
|
+
* export default class AppStore extends Store {
|
|
164
|
+
* lifetimes = new DefaultCachePolicy({ // [!code focus:3]
|
|
165
|
+
* // ... PolicyConfig Settings ... //
|
|
166
|
+
* });
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
/**
|
|
172
|
+
* A basic {@link CachePolicy} that can be added to the Store service.
|
|
173
|
+
*
|
|
174
|
+
* ```ts [app/services/store.ts]
|
|
175
|
+
* import { Store } from '@warp-drive/core';
|
|
176
|
+
* import { DefaultCachePolicy } from '@warp-drive/core/store'; // [!code focus]
|
|
177
|
+
*
|
|
178
|
+
* export default class AppStore extends Store {
|
|
179
|
+
* lifetimes = new DefaultCachePolicy({ // [!code focus:5]
|
|
180
|
+
* apiCacheSoftExpires: 30_000,
|
|
181
|
+
* apiCacheHardExpires: 60_000,
|
|
182
|
+
* // ... Other PolicyConfig Settings ... //
|
|
183
|
+
* });
|
|
184
|
+
* }
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* :::tip 💡 TIP
|
|
188
|
+
* Date headers do not have millisecond precision, so expiration times should
|
|
189
|
+
* generally be larger than 1000ms.
|
|
190
|
+
* :::
|
|
191
|
+
*
|
|
192
|
+
* See also {@link PolicyConfig} for configuration options.
|
|
193
|
+
*
|
|
194
|
+
* ### The Mechanics
|
|
195
|
+
*
|
|
196
|
+
* This policy determines staleness based on various configurable constraints falling back to a simple
|
|
197
|
+
* check of the time elapsed since the request was last received from the API using the `date` header
|
|
198
|
+
* from the last response.
|
|
199
|
+
*
|
|
200
|
+
* :::tip 💡 TIP
|
|
201
|
+
* The {@link Fetch} handler provided by `@warp-drive/core` will automatically
|
|
202
|
+
* add the `date` header to responses if it is not present.
|
|
203
|
+
* :::
|
|
204
|
+
*
|
|
205
|
+
* - For manual override of reload see {@link CacheOptions.reload | cacheOptions.reload}
|
|
206
|
+
* - For manual override of background reload see {@link CacheOptions.backgroundReload | cacheOptions.backgroundReload}
|
|
207
|
+
*
|
|
208
|
+
* In order expiration is determined by:
|
|
209
|
+
*
|
|
210
|
+
* ```md
|
|
211
|
+
* Is explicitly invalidated by `cacheOptions.reload`
|
|
212
|
+
* ↳ (if falsey) if the request has been explicitly invalidated
|
|
213
|
+
* since the last request (see Automatic Invalidation below)
|
|
214
|
+
* ↳ (if false) (If Active) isExpired function
|
|
215
|
+
* ↳ (if null) (If Active) X-WarpDrive-Expires header
|
|
216
|
+
* ↳ (if null) (If Active) Cache-Control header
|
|
217
|
+
* ↳ (if null) (If Active) Expires header
|
|
218
|
+
* ↳ (if null) Date header + apiCacheHardExpires < current time
|
|
219
|
+
*
|
|
220
|
+
* -- <if above is false, a background request is issued if> --
|
|
221
|
+
*
|
|
222
|
+
* ↳ is invalidated by `cacheOptions.backgroundReload`
|
|
223
|
+
* ↳ (if falsey) Date header + apiCacheSoftExpires < current time
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* ### Automatic Invalidation / Entanglement
|
|
227
|
+
*
|
|
228
|
+
* It also invalidates any request with an {@link RequestInfo.op | OpCode} of `"query"`
|
|
229
|
+
* for which {@link CacheOptions.types | cacheOptions.types} was provided
|
|
230
|
+
* when a request with an `OpCode` of `"createRecord"` is successful and also includes
|
|
231
|
+
* a matching type in its own `cacheOptions.types` array.
|
|
232
|
+
|
|
233
|
+
* :::tip 💡 TIP
|
|
234
|
+
* Abstracting this behavior via builders is recommended to ensure consistency.
|
|
235
|
+
* :::
|
|
236
|
+
*
|
|
237
|
+
* ### Testing
|
|
238
|
+
*
|
|
239
|
+
* In Testing environments:
|
|
240
|
+
*
|
|
241
|
+
* - `apiCacheSoftExpires` will always be `false`
|
|
242
|
+
* - `apiCacheHardExpires` will use the `apiCacheSoftExpires` value.
|
|
243
|
+
*
|
|
244
|
+
* This helps reduce flakiness and produce predictably rendered results in test suites.
|
|
245
|
+
*
|
|
246
|
+
* Requests that specifically set `cacheOptions.backgroundReload = true` will
|
|
247
|
+
* still be background reloaded in tests.
|
|
248
|
+
*
|
|
249
|
+
* This behavior can be opted out of by setting `disableTestOptimization = true`
|
|
250
|
+
* in the policy config.
|
|
251
|
+
*
|
|
252
|
+
* @public
|
|
253
|
+
*/
|
|
254
|
+
var DefaultCachePolicy = class {
|
|
255
|
+
/**
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
258
|
+
/**
|
|
259
|
+
* @internal
|
|
260
|
+
*/
|
|
261
|
+
/**
|
|
262
|
+
* @internal
|
|
263
|
+
*/
|
|
264
|
+
_getStore(store) {
|
|
265
|
+
let set = this._stores.get(store);
|
|
266
|
+
if (!set) {
|
|
267
|
+
set = {
|
|
268
|
+
invalidated: /* @__PURE__ */ new Set(),
|
|
269
|
+
types: /* @__PURE__ */ new Map()
|
|
270
|
+
};
|
|
271
|
+
this._stores.set(store, set);
|
|
272
|
+
}
|
|
273
|
+
return set;
|
|
274
|
+
}
|
|
275
|
+
constructor(config) {
|
|
276
|
+
this._stores = /* @__PURE__ */ new WeakMap();
|
|
277
|
+
const _config = arguments.length === 1 ? config : arguments[1];
|
|
278
|
+
!(arguments.length === 1) && console.warn(`Passing a Store to the CachePolicy is deprecated, please pass only a config instead.`);
|
|
279
|
+
((test) => {
|
|
280
|
+
if (!test) throw new Error(`You must pass a config to the CachePolicy`);
|
|
281
|
+
})(_config);
|
|
282
|
+
((test) => {
|
|
283
|
+
if (!test) throw new Error(`You must pass a apiCacheSoftExpires to the CachePolicy`);
|
|
284
|
+
})(typeof _config.apiCacheSoftExpires === "number");
|
|
285
|
+
((test) => {
|
|
286
|
+
if (!test) throw new Error(`You must pass a apiCacheHardExpires to the CachePolicy`);
|
|
287
|
+
})(typeof _config.apiCacheHardExpires === "number");
|
|
288
|
+
this.config = _config;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Invalidate a request by its CacheKey for the given store instance.
|
|
292
|
+
*
|
|
293
|
+
* While the store argument may seem redundant, the CachePolicy
|
|
294
|
+
* is designed to be shared across multiple stores / forks
|
|
295
|
+
* of the store.
|
|
296
|
+
*
|
|
297
|
+
* ```ts
|
|
298
|
+
* store.lifetimes.invalidateRequest(store, cacheKey);
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @public
|
|
302
|
+
*/
|
|
303
|
+
invalidateRequest(cacheKey, store) {
|
|
304
|
+
this._getStore(store).invalidated.add(cacheKey);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Invalidate all requests associated to a specific type
|
|
308
|
+
* for a given store instance.
|
|
309
|
+
*
|
|
310
|
+
* While the store argument may seem redundant, the CachePolicy
|
|
311
|
+
* is designed to be shared across multiple stores / forks
|
|
312
|
+
* of the store.
|
|
313
|
+
*
|
|
314
|
+
* This invalidation is done automatically when using this service
|
|
315
|
+
* for both the {@link CacheHandler} and the [NetworkHandler](/api/@warp-drive/legacy/compat/variables/LegacyNetworkHandler).
|
|
316
|
+
*
|
|
317
|
+
* ```ts
|
|
318
|
+
* store.lifetimes.invalidateRequestsForType(store, 'person');
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @public
|
|
322
|
+
*/
|
|
323
|
+
invalidateRequestsForType(type, store) {
|
|
324
|
+
const storeCache = this._getStore(store);
|
|
325
|
+
const set = storeCache.types.get(type);
|
|
326
|
+
const notifications = store.notifications;
|
|
327
|
+
if (set) set.forEach((id) => {
|
|
328
|
+
storeCache.invalidated.add(id);
|
|
329
|
+
notifications.notify(id, "invalidated", null);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Invoked when a request has been fulfilled from the configured request handlers.
|
|
334
|
+
* This is invoked by the CacheHandler for both foreground and background requests
|
|
335
|
+
* once the cache has been updated.
|
|
336
|
+
*
|
|
337
|
+
* Note, this is invoked by the {@link CacheHandler} regardless of whether
|
|
338
|
+
* the request has a cache-key.
|
|
339
|
+
*
|
|
340
|
+
* This method should not be invoked directly by consumers.
|
|
341
|
+
*
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
didRequest(request, response, cacheKey, store) {
|
|
345
|
+
if (request.op === "createRecord") {
|
|
346
|
+
const statusNumber = response?.status ?? 0;
|
|
347
|
+
if (statusNumber >= 200 && statusNumber < 400) {
|
|
348
|
+
const types = new Set(request.records?.map((r) => r.type));
|
|
349
|
+
(request.cacheOptions?.types)?.forEach((type) => {
|
|
350
|
+
types.add(type);
|
|
351
|
+
});
|
|
352
|
+
types.forEach((type) => {
|
|
353
|
+
this.invalidateRequestsForType(type, store);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
} else if (cacheKey && request.cacheOptions?.types?.length) {
|
|
357
|
+
const storeCache = this._getStore(store);
|
|
358
|
+
request.cacheOptions?.types.forEach((type) => {
|
|
359
|
+
const set = storeCache.types.get(type);
|
|
360
|
+
if (set) {
|
|
361
|
+
set.add(cacheKey);
|
|
362
|
+
storeCache.invalidated.delete(cacheKey);
|
|
363
|
+
} else storeCache.types.set(type, /* @__PURE__ */ new Set([cacheKey]));
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Invoked to determine if the request may be fulfilled from cache
|
|
369
|
+
* if possible.
|
|
370
|
+
*
|
|
371
|
+
* Note, this is only invoked by the {@link CacheHandler} if the request has
|
|
372
|
+
* a cache-key.
|
|
373
|
+
*
|
|
374
|
+
* If no cache entry is found or the entry is hard expired,
|
|
375
|
+
* the request will be fulfilled from the configured request handlers
|
|
376
|
+
* and the cache will be updated before returning the response.
|
|
377
|
+
*
|
|
378
|
+
* @public
|
|
379
|
+
* @return true if the request is considered hard expired
|
|
380
|
+
*/
|
|
381
|
+
isHardExpired(cacheKey, store) {
|
|
382
|
+
if (this._getStore(store).invalidated.has(cacheKey)) return true;
|
|
383
|
+
const cached = store.cache.peekRequest(cacheKey);
|
|
384
|
+
if (!cached?.response) {
|
|
385
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is EXPIRED because no cache entry was found`);
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
return isExpired(cacheKey, cached, this.config);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Invoked if `isHardExpired` is false to determine if the request
|
|
392
|
+
* should be update behind the scenes if cache data is already available.
|
|
393
|
+
*
|
|
394
|
+
* Note, this is only invoked by the {@link CacheHandler} if the request has
|
|
395
|
+
* a cache-key.
|
|
396
|
+
*
|
|
397
|
+
* If true, the request will be fulfilled from cache while a backgrounded
|
|
398
|
+
* request is made to update the cache via the configured request handlers.
|
|
399
|
+
*
|
|
400
|
+
* @public
|
|
401
|
+
* @return true if the request is considered soft expired
|
|
402
|
+
*/
|
|
403
|
+
isSoftExpired(cacheKey, store) {
|
|
404
|
+
if (!this.config.disableTestOptimization) return false;
|
|
405
|
+
const cached = store.cache.peekRequest(cacheKey);
|
|
406
|
+
if (cached?.response) {
|
|
407
|
+
const date = cached.response.headers.get("date");
|
|
408
|
+
if (!date) {
|
|
409
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is STALE because no date header was found`);
|
|
410
|
+
return true;
|
|
411
|
+
} else {
|
|
412
|
+
const time = new Date(date).getTime();
|
|
413
|
+
const now = Date.now();
|
|
414
|
+
const deadline = time + this.config.apiCacheSoftExpires;
|
|
415
|
+
const result = now >= deadline;
|
|
416
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is ${result ? "STALE" : "NOT stale"}. Expiration time: ${deadline}, now: ${now}`);
|
|
417
|
+
return result;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (getGlobalConfig().WarpDrive.debug.LOG_CACHE_POLICY || globalThis.getWarpDriveRuntimeConfig().debug.LOG_CACHE_POLICY) console.log(`CachePolicy: ${cacheKey.lid} is STALE because no cache entry was found`);
|
|
421
|
+
return true;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
//#endregion
|
|
426
|
+
export { parseCacheControl as n, DefaultCachePolicy as t };
|
|
427
|
+
//# sourceMappingURL=store-Bsdz5mRe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-Bsdz5mRe.js","names":["LRUCache","getGlobalConfig","getGlobalConfig0","NUMERIC_KEYS","Set","parseCacheControl","header","CACHE_CONTROL_CACHE","get","key","value","isParsingKey","cacheControlValue","i","length","char","charAt","test","Error","has","parseCacheControlValue","stringToParse","parsedValue","Number","parseInt","isNaN","isExpired","cacheKey","request","config","constraints","result","WarpDrive","debug","LOG_CACHE_POLICY","globalThis","getWarpDriveRuntimeConfig","console","log","lid","headers","response","now","Date","date","xWarpDriveExpires","expirationTime","getTime","cacheControl","age","maxAge","ageValue","dateValue","Expires","expires","apiCacheHardExpires","disableTestOptimization","apiCacheSoftExpires","time","deadline","DefaultCachePolicy","_getStore","store","set","_stores","invalidated","types","Map","constructor","WeakMap","_config","arguments","warn","invalidateRequest","add","invalidateRequestsForType","type","storeCache","notifications","forEach","id","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/core/build-config/debugging';\nimport { TESTING } from '@warp-drive/core/build-config/env';\nimport { assert } from '@warp-drive/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 */\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 * @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 * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive/core';\n * import { DefaultCachePolicy } from '@warp-drive/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 */\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 * ```ts [app/services/store.ts]\n * import { Store } from '@warp-drive/core';\n * import { DefaultCachePolicy } from '@warp-drive/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/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 * @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:request-utils:lifetimes-service-store-arg',\n since: {\n enabled: '5.4',\n available: '4.13',\n },\n for: '@ember-data/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/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":";;;;;;;;;AAkGA,MAAMG,+BAAe,IAAIC,IAAI;CAAC;CAAW;CAAY;CAAkB;AAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BhG,SAAgBC,kBAAkBC,QAAmC;CACnE,OAAOC,oBAAoBC,IAAIF,MAAM;AACvC;AAEA,MAAMC,sBAAsB,IAAIP,UAAUM,WAAmB;CAC3D,IAAIG,MAAuB;CAC3B,IAAIC,QAAQ;CACZ,IAAIC,eAAe;CACnB,MAAMC,oBAAuC,CAAC;CAE9C,KAAK,IAAIC,IAAI,GAAGA,IAAIP,OAAOQ,QAAQD,KAAK;EACtC,MAAME,OAAOT,OAAOU,OAAOH,CAAC;EAC5B,IAAIE,SAAS,KAAK;GAChB,EAAAE,SAAA;IAAA,IAAA,CAAAA,MAAA,MAAA,IAAAC,MAAO,+CAA+C;GAAA,EAAA,CAAE,CAACP,gBAAgB,CAACR,aAAagB,IAAIV,GAAG,CA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